CesiumGS / CesiumGS/cesium

PolylineVolumeGeometry crashes with large granularity

Open
#5,198 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category - graphics type - bug
Dominant language
JavaScript
Stars
15.8k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

The following code snippet results in an 'Invalid array length' crash in PolylinePipeline.generateArc. This crash does not happen when using granularity: Cesium.Math.PI.

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

function computeCircle(radius) {
    var positions = [];
    for (var i = 0; i < 360; i++) {
        var radians = Cesium.Math.toRadians(i);
        positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
    }
    return positions;
}

viewer.entities.add({
    polylineVolume : {
        positions : Cesium.Cartesian3.fromDegreesArray([-85.0, 32.0,
                                                        -105.0, 32.0]),
        shape : computeCircle(60000.0),
        material : Cesium.Color.RED,
        granularity: Cesium.Math.TWO_PI
    }
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied PolylineVolumeGeometry example with granularity set to Cesium.Math.TWO_PI, then inspect PolylinePipeline.generateArc where the Invalid array length crash occurs. Trace the large-granularity path and verify that the example completes without the crash, ideally with coverage for this case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.