-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Improve CoplanarPolygonGeometry normal calculation #7188
Conversation
Thanks for the pull request @hpinkos!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
@OmarShehata can you review? |
If using winding order to compute normal is going to cause problems, I think this could work. Can we add a flag that says something like That way it resolves the use case Scott brought up here #7185 (comment) , and still gives the user explicit control over this without either them or us having to worry about winding order. What do you think @hpinkos ? I definitely think it makes more sense for the polygon to have a consistent direction (facing away from the ellipsoid) as opposed to the behavior in master where it depends on where it's defined. Something I just thought of: Does it still work if the globe is turned off the polygon is around the center of the earth? |
I don't think a |
@mramato isn't this the only flat geometry that won't always be on the surface? That's why I thought this would make sense. If not, then I agree doing this as a separate issue for all relevant geometry types is better. |
@OmarShehata yeah, we can consider adding something like that in the future if people ask for it. It's just not really necessary for this PR. |
This is ready for review |
No, rectangle, polygon, ellipse, etc... all have height properties and can be in the air. @OmarShehata please bump for @bagnell to give a final lookover and merge once you're happy. |
Code looks good! It resolves the original issue as well as the issue here https://groups.google.com/d/msg/cesium-dev/aTbKq5Kn8Tc/R3RDMvd_BwAJ. For
This links to the wrong PR. Shouldn't it be more like "Fixed inconsistent normal calculation for polygon entities with |
@OmarShehata the normal was the underlying problem, but the incorrect texture was the bug that someone saw and reported. |
I'm fine with that description, but just wanted to clarify that the link still goes to a different PR than this one. |
Thanks @OmarShehata! @bagnell please review and merge |
Congratulations on closing the issue! I found these Cesium forum links in the comments above: https://groups.google.com/d/msg/cesium-dev/aTbKq5Kn8Tc/R3RDMvd_BwAJ If this issue affects any of these threads, please post a comment like the following:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Fixes #7185
Flips the normal of the polygon if it is pointing roughly towards the center of the earth instead of away from it. (Also flip the tangent so it points towards the right instead of the left). This then fixes the texture coordinate calculation so images don't appear mirrored in some cases.