CesiumGS / CesiumGS/cesium

Geometry.splitLongitude crashing for polygon that crosses the poles

Open
#4,801 3 comments 0 reactions 0 assignees View on GitHub
category - polygons/geometry type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/O_LaBx1_1wg

[ne_10m_admin_0_countries2.json.txt](https://github.com/AnalyticalGraphicsInc/cesium/files/682638/ne_10m_admin_0_countries2.json.txt)

For some reason this crashes in Sandcastle but not in the CesiumViewer. It also doesn't crash when `scene3DOnly = true`

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

viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_admin_0_countries2.json'));
```

```
DeveloperError: normalized result is not a number
Error
at new DeveloperError (http://localhost:8080/Source/Core/DeveloperError.js:44:19)
at Function.Cartesian3.normalize (http://localhost:8080/Source/Core/Cartesian3.js:422:19)
at computeTriangleAttributes (http://localhost:8080/Source/Core/GeometryPipeline.js:1901:24)
at splitLongitudeTriangles (http://localhost:8080/Source/Core/GeometryPipeline.js:2058:17)
at Object.GeometryPipeline.splitLongitude (http://localhost:8080/Source/Core/GeometryPipeline.js:2482:17)
at geometryPipeline (http://localhost:8080/Source/Scene/PrimitivePipeline.js:135:38)
at Object.PrimitivePipeline.combineGeometry (http://localhost:8080/Source/Scene/PrimitivePipeline.js:278:26)
at combineGeometry (http://localhost:8080/Source/Workers/combineGeometry.js:12:41)
at http://localhost:8080/Source/Workers/createTaskProcessorWorker.js:56:42
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash in Sandcastle using the linked ne_10m_admin_0_countries2.json.txt data with scene3DOnly left unset. Start at Source/Core/GeometryPipeline.js, especially splitLongitude and splitLongitudeTriangles, then follow the stack through Source/Scene/PrimitivePipeline.js. Done means the polygon loads without the DeveloperError while preserving the scene3DOnly behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.