CesiumGS / CesiumGS/cesium

PolygonGeometry creates empty polygons with perPositionHeight and extrudedHeight

Open
#3,885 0 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

`PolygonGeometry` can create triangles where two positions are equal for a polygon using `perPositonHeight` and `extrudedHeight`. This happens when the height of one of the top points has a height equal to the extrudedHeight. In this case, the 'wall' on the side of the polygon should only have one triangle, but it still generates two.

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

var pos1 = [new Cesium.Cartesian3(1333465.894653764, -4654487.507295778, 4138588.25016027),
new Cesium.Cartesian3(1333485.211963876, -4654510.505548239, 4138557.5850382405),
new Cesium.Cartesian3(1333385.4137239386, -4654258.530765127, 4138343.625877602)];

var geometry = Cesium.PolygonGeometry.createGeometry(Cesium.PolygonGeometry.fromPositions({
positions: pos1,
vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
perPositionHeight: true,
closeBottom: false
}));

scene.primitives.add(new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : geometry,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
}),
appearance : new Cesium.PerInstanceColorAppearance({
closed : true,
translucent : false
}),
asynchronous: false
}));

scene.camera.setView({
destination: new Cesium.Cartesian3(1333502.4040933265, -4654467.819649983, 4138598.813393836)
});
```

Contributor guide

Open the contributing guide

Research direction

Start with PolygonGeometry.fromPositions and PolygonGeometry.createGeometry using the supplied perPositionHeight and extrudedHeight reproduction. Inspect how the wall triangles are generated when a top point matches extrudedHeight; done means the affected wall produces one triangle instead of two degenerate triangles.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.