Height affecting ground primitive polygon rendering
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
### What happened?
I'm currently creating a GroundPolylinePrimitive using GroundPolylineGeometry, as well as a GroundPrimitive that uses a PolygonGeometry to "fill" the polyline. I'm giving both the GroundPolylineGeometry and GroundPrimitive the same positions, however the polygon shape does not seem to match the polyline. See the attached screenshot:
I've previously worked from a fork of cesium at version 1.99.0 in which the positions of the polygon do correctly "fill" the polyline. For example here is a screenshot running locally of the same scenario as the linked sandbox but with cesium version 1.99:
Here's the code for this example running at cesium v1.99.0:
```
var Cesium = require('cesium/Cesium');
var viewer = new Cesium.Viewer('cesiumContainer');
const cartographics = [
{
"longitude": -1.8402495415863134,
"latitude": 0.7033934337801941,
"height": 2177.974000000284
},
{
"longitude": -1.8402506824369915,
"latitude": 0.7033901872332414,
"height": 2177.9740000000156
},
{
"longitude": -1.840249836934684,
"latitude": 0.703388112597783,
"height": 2177.9739999988838
},
{
"longitude": -1.8402478059109948,
"latitude": 0.7033903665805613,
"height": 2177.9739999987028
},
{
"longitude": -1.840246112964614,
"latitude": 0.7033920799454119,
"height": 2177.9739999996555
},
{
"longitude": -1.8402467855800173,
"latitude": 0.7033933442953648,
"height": 2177.9740000006414
},
{
"longitude": -1.8402495415863134,
"latitude": 0.7033934337801941,
"height": 2177.974000000284
}
];
const { WGS84 } = Cesium.Ellipsoid;
const positions = WGS84.cartographicArrayToCartesianArray(cartographics);
const c = Cesium.Color.fromCssColorString('#ffe566');
const polygonGeometryInstance = new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: {
positions,
},
}),
attributes: {
color: new Cesium.ColorGeometryInstanceAttribute(
c.red,
c.green,
c.blue,
),
},
});
const polygonPrimitive = new Cesium.GroundPrimitive({
geometryInstances: polygonGeometryInstance,
appearance: new Cesium.PerInstanceColorAppearance({
closed: true,
translucent: true,
}),
});
const lineGeometryInstance = new Cesium.GeometryInstance({
geometry: new Cesium.GroundPolylineGeometry({
positions,
loop: false,
width: 3.0,
}),
});
const linePrimitive = new Cesium.GroundPolylinePrimitive({
geometryInstances: [lineGeometryInstance],
appearance: new Cesium.PolylineMaterialAppearance({
material: Cesium.Material.fromType('Color', {
color: c,
}),
}),
});
viewer.scene.primitives.add(polygonPrimitive);
viewer.scene.primitives.add(linePrimitive);
viewer.scene.camera.flyTo({destination: positions[0]});
```
Interestingly when using cartographics with zeroed height they seem to match up (note [this](https://sandcastle.cesium.com/#c=rVZbj5pAFP4rxD6IiR3BAQTrbroxTdukTTfZTfuw7sMII046MGRmcGM3/vceERTQ6qbRF5xzvnP5zmUgFKnSxorRFyqNGyOlL8aUKpYn6GchM2edsDhPRaoJS6mcdXofZuksDQvLkEgtYkmyJQsVOHiapQb8XncPw5h1uEhjpvOIzjpj472NfMcaOoHr2K7vYRs7/RqU6D3SQiML4wA7GI98yw4cuwZcUhYvdQHbCTf9N8V1Lc8fOtgLAts9H9ey/dEQ46FjO1eI6wQ+BMWO55+n6/u2PXSD0cjH14gKhXMD2woCx7/AFnueC2DPvkpcD1gEHjwuNHdojSA3GAU7uErYke8CC8se4QtDhR1nGLjYa9Tl/5t77WHePp5rS/Zq/Pr84DvGBhas3M5PnLNMCRbVYJlQTDP4C7DCANW3805Ksn4UUxCBC5IWZ7Oxv4fFFpwiLmJz77Kx84c0poILiRZSJFOlisODliyNze67xYK6ntftNRLk61ikn6lIqJbrryAjaUib905ba5blj0v5uA6+b3o0960yqmBfGJVEhkuwqyl3gJJb/yCvWr7p9YvmFAeigdM8h7I1fIRbuo1sigK087+rrM1m+BBJGvXbslhSmh5J5zynNWGvfxjQzYkC30uWALVVu7JS5Gm0V7YLWyUMLP/RqDIsyTJK5FbQ7AWVFbAoxN0eVm9LyIWi0djQskFJA1DxPKSpbug2vTZHDi+hK05QWRQgXHfcHKTjOeFCZGNjQbiqk3hhkV6ODYyss9mfb0+ZyVva9HSqFs8XulT6/040lYzw011KSu24Mqvgxa4/rjNqdosmd/vttSrXIqxvVe9EPXbfHEhByynKKrYKkSgy23O8tTiHbxTs+BZrmIYkgRvhRA47BVpwuCXN14gqzVKybfz4MAJP1nOZfqffmSi95vS24vmRJZmQ2sglNxEaaJpk8A6gajDPw99Uo1AVt+gWOhnUTScRWxksujnxqQXrQpQCzSLn/IH9gbfJ7WQA+CNTLkgEF++PFZWcrLewpX37bSdECE0GcDxtqYXgcyJbnv8C) sandbox).
How is height intended to affect a ground primitive? Is this a regression, or expected behaviour?
### Reproduction steps
1. Create a ground primitive using polygon geometry, and a ground polyline primitive using ground polyline geometry using the same positions in example sandbox/code snippet
2. Note that they don't quite match up
3.
...
### Sandcastle example
https://sandcastle.cesium.com/#c=tVZbb5tIFP4ryPsQLLljYLgMrhNtZK26lbpqpVS7D3EeJjC2Rx0zaGZI5Eb+73vAYANx7FhqeYE55zuH71whkZk21hNnz0xZ11bGnq0Z07xYo38rmT0fJNV5JjNDecbUfDD8OM/mWVJZJlQZuVQ0X/FEg4P7eWbB9bK7WdZ8IGS25KZI2XwwsT64iPiO58eB7wYkxC72Ry0oNXukgyIH4xj7GEfEcWPfbQFXjC9XpoR5bhShOPKd6vKIvwNtR+/iETgh8XwcxrEbnObhuCTyMPZ8138HD8cNwouI+DEBFtgPyel8EOK6XhBHEcGnaOC4vAghmFxGA1IdxK4Txz45kw8chgGAQ/c9RCKozGVEQogzDuF2pj88JwKy0E1ufJ5HHAZBcCGPiAQQp+NG+EyjYt/34gCHncy91SAh9NGFDfK7J6a8PbQm+8X679Md8a0tTHW9Ev4Sguda8rQFy6XmhsMjwCoD1F4Jt0rRzXc5AxG4oFl1tjtL47BNpGBIyKW9d9lZNAcaMymkQgsl1zOtq8OdUTxb2ld/LBYsCMOrYYeg2Cxl9onJNTNq8xlkNEtYd9n1tXZdjmUtn7TB37oe7X3prOZlf3OmqEpWYNdS7gB1bKODvGmB7XBUFas6UAMxPRaQto6PpAy3w6ZKQJ//bWNtd1+fIMXSUV+2VIxlr6SPomAt4XB0aNjtkQR/U3wNoT31M6tkkaV7ZT+xDWGI8o1C1a+lec6oKgXdWjDVAKtE3O5h7bIkQmqWTiyjOiEZAGpRJCwzHd122I9RwJfvF3ZQnRQIuO2420iv+0RImU+sBRW6HcQzT81qYmHknGR/ujw1k/eU6f5YLh7OVKn2/w81THEqjldpXWsnjVkDr2b9+yZn9lVV5KtRf6zqsUjaUzU8ko/djw7SUHKG8iZajWia2v0+Li1O4TsJe73FOqYJXcNGOMJhp0ALAVvSfkmZNjyjZeEnhxa4dx5q+oPRYKrNRrCbJs4/+TqXyliFEjZCY8PWOXwTmB4/FskPZlCiqy1aQqfjtuk05U8WT6+P/N/BuFCtQbMohLjjP+HrcjMdA/6VqZA0hcX79YkpQTclbOXefNkJEULTMRyPWxopxSNVPc//Aw
### Environment
Browser: Chrome 121.0.6167.160
CesiumJS Version: 1.115
Operating System: Mac OS 13.5
Contributor guide
Research direction
Start by running the linked Sandcastle example with the shared positions at their original heights and with heights set to zero. Read the GroundPolylineGeometry, GroundPolylinePrimitive, GroundPrimitive, and PolygonGeometry entry points to trace how each projects or clamps positions. Done means determining whether the mismatch is expected or a regression and adding the relevant regression coverage or documentation.
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