PolylineVolumeGeometry binormals are incorrect
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
It uses GeometryPipeline.computeBinormalandTangent.
At some point, `r = Infinity`, causing `NaN` later down the line
https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/GeometryPipeline.js#L1282
Demo:
```
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var shape = [new Cesium.Cartesian2(-10000, -10000), new Cesium.Cartesian2(10000, -10000), new Cesium.Cartesian2(10000, 10000), new Cesium.Cartesian2(-10000, 10000)];
var redTube = new Cesium.GeometryInstance({
geometry : Cesium.PolylineVolumeGeometry.createGeometry(new Cesium.PolylineVolumeGeometry({
vertexFormat : Cesium.VertexFormat.ALL,
polylinePositions : Cesium.Cartesian3.fromDegreesArray([
90.0, -30.0,
90.0, -35.0
]),
cornerType: Cesium.CornerType.MITERED,
shapePositions: shape
})),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
});
scene.primitives.add(new Cesium.Primitive({
geometryInstances : redTube,
asynchronous: false,
appearance : new Cesium.DebugAppearance({
attributeName : 'st'
})
}));
var g = Cesium.PolylineVolumeGeometry.createGeometry(new Cesium.PolylineVolumeGeometry({
vertexFormat : new Cesium.VertexFormat({position: true, normal: true, binormal: true}),
polylinePositions : Cesium.Cartesian3.fromDegreesArray([
90.0, -30.0,
90.0, -35.0
]),
cornerType: Cesium.CornerType.MITERED,
shapePositions: shape
}));
g.attributes.normal = undefined;
scene.primitives.add(Cesium.createTangentSpaceDebugPrimitive({
geometry : g,
length : 100000.0,
}));
```
Contributor guide
Research direction
Start at Source/Core/GeometryPipeline.js around line 1282 and trace the PolylineVolumeGeometry path that calls computeBinormalandTangent. Reproduce the supplied PolylineVolumeGeometry example, then verify that the generated binormals no longer become NaN when the calculation reaches r = Infinity.
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