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 bounding volumes for hemisphere-size GroundPolylineGeometry #7052

Merged
merged 2 commits into from
Sep 20, 2018

Conversation

likangning93
Copy link
Contributor

Fixes #7043

Here's a primitive-based version of what was noted in the issue on the current release Sandcastle.

For comparison, in this branch's Sandcastle.

The problem was in how the bounding sphere was getting computed - the new method is simpler and should work for all cases. The bounding sphere doesn't necessarily cover the shadow volume for very short polylines in some places anymore, but those shadow volumes are extremely conservative, so in practice it shouldn't be a problem, it still covers the lines on terrain and on the ellipsoid.

Here's the spec case, roughly:

var viewer = new Cesium.Viewer('cesiumContainer');

var positions = Cesium.Cartesian3.fromDegreesArray([
    -122.17580380403314, 46.19984918190237,
    -122.17581380403314, 46.19984918190237
]);

var instance = new Cesium.GeometryInstance({
    geometry : new Cesium.GroundPolylineGeometry({
        positions : positions,
        loop : true,
        width : 8.0
    })
});

var polylineOnTerrainPrimitive = new Cesium.GroundPolylinePrimitive({
    geometryInstances : [instance],
    debugShowShadowVolume : false,
    debugShowBoundingVolume : true,
});
viewer.scene.groundPrimitives.add(polylineOnTerrainPrimitive);

viewer.camera.lookAt(positions[1], new Cesium.Cartesian3(100.0, 100.0, 100.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

@cesium-concierge
Copy link

Thanks for the pull request @likangning93!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

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

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@likangning93 likangning93 force-pushed the fixPolylineOnTerrainBoundingVolume branch from 21f898d to 0b12d29 Compare September 20, 2018 02:59
@hpinkos
Copy link
Contributor

hpinkos commented Sep 20, 2018

Looks great @likangning93! This fixes the very large polyline case, and still has roughly the same bounding sphere for very small polylines.

@hpinkos hpinkos merged commit 15eaa73 into master Sep 20, 2018
@hpinkos hpinkos deleted the fixPolylineOnTerrainBoundingVolume branch September 20, 2018 14:44
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.

"scene3DOnly: true" causes Polyline to cull
3 participants