Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix polygon normals in meter offset mode #1244

Merged
merged 3 commits into from
Dec 18, 2017
Merged

Fix polygon normals in meter offset mode #1244

merged 3 commits into from
Dec 18, 2017

Conversation

Pessimistress
Copy link
Collaborator

@Pessimistress Pessimistress commented Dec 16, 2017

Polygon layer needs to project normals (either lng_lat delta or meters delta depending on the coordinate system) into the world space. The existing code assumes that the layer is always in LNG_LAT mode.

@@ -48,6 +49,9 @@ float project_scale(float meters) {
}

vec2 project_scale(vec2 meters) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_scale is documented for projecting offset to pixels. vec2 project_scale(vec2 meters) is exclusively used for xy offsets. In LNG_LAT mode, this offset is in degrees rather than meters.

Maybe meters is not a good name for the argument?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't done a deep enough review to suggest alternatives but some initial comments

Maybe meters is not a good name for the argument?

This could be a quite big change compared to my current way of thinking. All distances are supposed to be provided as meters in geospatial modes. I have tried to clearly state this in the docs e.g. the article about coordinate systems. The scale for distances does not change withcoordinateSystem, i.e. any line widths or distances are still provided in meters even when in LNGLAT mode.

If there is a need for dealing with degree deltas for normals, we may want to add a different method to the project package.

projecting offset to pixels

The project to "pixels" part is a little bit less firm. Most pixel work is now done after projection to clip space, so we may not have to worry too much about fixing the scale of the intermediate coordinate system.

@@ -48,6 +49,9 @@ float project_scale(float meters) {
}

vec2 project_scale(vec2 meters) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meters => spatialUnit or just unit?
same for project_scale()

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to land once docs, what's new etc are updated.

@Pessimistress Pessimistress merged commit 6202438 into master Dec 18, 2017
@Pessimistress Pessimistress deleted the normals branch December 18, 2017 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants