var viewer = new Cesium.Viewer('cesiumContainer');
var radius = 1;
var outlineSphere = viewer.entities.add({
position: new Cesium.Cartesian3(0.0, 0.0, 0.0),
ellipsoid : {
radii : new Cesium.Cartesian3(radius, radius, radius),
fill : false,
outline : true,
outlineColor : Cesium.Color.YELLOW,
slicePartitions : 10,
stackPartitions : 10
}
});
This crashes because while it tries to project the bounding sphere center to 2D for the batch table.
An error occurred while rendering. Rendering has stopped.
TypeError: Cannot read property 'longitude' of undefined
TypeError: Cannot read property 'longitude' of undefined
at GeographicProjection.project (http://localhost:8080/Source/Core/GeographicProjection.js:69:30)
at updateBatchTableBoundingSpheres (http://localhost:8080/Source/Scene/Primitive.js:1285:39)
at Primitive.update (http://localhost:8080/Source/Scene/Primitive.js:1776:13)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:365:27)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:365:27)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:365:27)
at updateAndRenderPrimitives (http://localhost:8080/Source/Scene/Scene.js:2749:27)
at executeCommandsInViewport (http://localhost:8080/Source/Scene/Scene.js:2610:13)
at updateAndExecuteCommands (http://localhost:8080/Source/Scene/Scene.js:2473:13)
at render (http://localhost:8080/Source/Scene/Scene.js:3009:9)
Also, setting scene3Donly: true does not fix the issue. Should we be skipping this step if scene3D only?
Unless I'm remembering incorrectly, Cesium has always had issues drawing data at the WGS84 origin because of the discontinuity there.
That being said, we can probably skip some of the work in updateBatchTableBoundingSpheres when in 3d only mode, but I'm not positive you won't immediately hit another issue related to the discontinuity.
The only reason it's a problem is because it's trying to convert (0,0,0) into a cartographic and doesn't know how to do it
Yes, I know that, but there are lots of other areas of the code that would end up trying to do the same calculation, so skipping it here might still cause a conversion failure elsewhere.
Just adding my :+1: to this issue: We're developing an app with Cesium that requires drawing rectangles that may be globally symmetrical, resulting in a center of (0,0,0) to updateBatchTableBoundingSpheres. I created an SSCCE (sscce.org) using the sandcastle app that shows this error from drawing a rectangle. Comment scene3DOnly: true, line to fix it, but we'd prefer to keep our memory usage low!
https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=bVJNT9wwEP0rVi4EKTjZoooqDauK5VAkKioqcSF7cJzZMKozXtlOIK347zgJuyRNL9b4zed7M60wrEV4BsMuGcEz24DFpuYPAxaeyOG70eQEEpiTiP3NiTErgeD8+o5UlzJnGoh6VBDWwqGmlO2EsiNYCAu3ogPzE+VvMFPXrlHKSgNAV41z87QKtNTlPP5J17CMRNrpK/0yhUi0WA2TfAe1X6Z8+G/I+vFlb9obQodCqe4BLRYKphkD4R9+oCULCwrkWKtEKZyeeR3WoLx0H9jr6decWq97UegXr/rj2epLErGzC/8M1kWyfY8wvrCgSsG9KFGQne/o/uDlO6Pra6i8kjbsm7Kh9mOyjUZjdTA+HYzzbU79HL7PsGkO5Dx7sFyUZTjsGMuU5cFxhDx4l66G/+HHfzpeCGNSa1MiCQc2XTCJxhh/LmC85umU10YrbcKE93ocn4R/Ph2SXkcJgyjIrOsUrMdK37Dea+NYY1TIeeyg3qu+dVw0fmGOS2t7vll8SMpKbD3Hyzz458bzgEklrPWe/kB/4R/PcZ3FPn6WprSnQtVdC0aJrg95Wq1vR5BznsX+u8xyWqtCmEnFNw
Thanks for reporting this @MattF-NSIDC! I'm surprised setting scene3DOnly: false fixes this issue, usually setting that to true fixes weird issues like this.
It looks like it's working because center is _almost_ zero when scene3DOnly: false.
(2.335901028160947e-9, 1.6665547830641003e-9, 0.0)
Here's the problem code: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Primitive.js#L1395-L1400
Firstly, we should skip computing the 2D bounding sphere when scene3DOnly: true if possible. And there has to be some way to project a bounding sphere centered at (0,0,0) to 2D. Can we pick something like longitude: 0, latitude: 0, height: -Ellipsoid.WGS84.x as the Cartographic to project?
@hpinkos Thanks for your ongoing research in to this issue!
I don't think you can do much else than picking an arbitrary lon/lat when converting from "the center of the Earth" to lons and lats :man_shrugging:
@hpinkos thanks so much for getting a partial fix merged! :bowing_man: I noticed Cesium is doing monthly-ish releases -- do you think this will make it in the July release? :crossed_fingers: :)
@MattF-NSIDC yes, we release Cesium the first business day of every month. We're working on putting together the 1.47 release now. It does include this partial fix and it will be available later today =)
Thanks again for your help -- I'm able to use scene3DOnly true again with 1.47 :)
Great @MattF-NSIDC! Glad that worked for you =)
Forum post with related problem when Viewer.zoomTo() target's bounding sphere is centered at (0, 0, 0).
No longer crashes
Congratulations on closing the issue! I found these Cesium forum links in the comments above:
https://groups.google.com/forum/#!msg/cesium-dev/771Z16fIOJQ/pP3yMfbNAgAJ
If this issue affects any of these threads, please post a comment like the following:
The issue at https://github.com/AnalyticalGraphicsInc/cesium/issues/6365 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.
Most helpful comment
@MattF-NSIDC yes, we release Cesium the first business day of every month. We're working on putting together the 1.47 release now. It does include this partial fix and it will be available later today =)