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 mitering bug with ground polylines over long distances #7885

Merged
merged 4 commits into from
Jun 6, 2019

Conversation

likangning93
Copy link
Contributor

Fixes #7855.

GroundPolylineGeometry miters between line segments, but only if their endpoints aren't coplanar.
This used to be a literal coplanar check, but this would fail sometimes for very long-distance line segments due to the tiny epsilon used for coplanarity. The computed miter vector would then also have problems due to the curvature of the Earth, since it was a naive average of the directions from point-to-point.

This PR moves the check for whether miters are needed or not to a check using vectors pointing towards the segments' end points but tangent to the surface of the ellipsoid.

The spec for miter breaking was also incorrect, the first test case wasn't even encountering a miter break.

@cesium-concierge
Copy link

Thanks for the pull request @likangning93!

  • ✔️ Signed CLA found.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@wallw-teal
Copy link
Contributor

That fixes our issue. Thanks!

var vertexUpScratch = new Cartesian3();
var cosine90 = 0.0;
var cosine180 = -1.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lilleyse for context, computeVertexMiterNormal is meant to compute a normal pointing to the "right" side of a join between two line segments defined by 3 points, eventually this is used to compute normals on the start and end faces of the volumes around polyline segments.

@lilleyse
Copy link
Contributor

lilleyse commented Jun 6, 2019

Looks good!

@lilleyse lilleyse merged commit 90b130e into master Jun 6, 2019
@lilleyse lilleyse deleted the fixGroundPolylinesCoplanar branch June 6, 2019 13:17
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.

GroundPolylineGeometry missing/occluded segment
4 participants