Rectangle.fromCartesianArray and Rectangle.fromCartographicArray don't find the smallest rectangle when positions cross the IDL
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
In this example `Rectangle.FromCartesianArray` finds a rectangle that spans nearly the entire globe. The blue rectangle is actually the smallest rectangle option from the collection of points.
```js
var viewer = new Cesium.Viewer('cesiumContainer');
var positions = Cesium.Cartesian3.fromDegreesArray([
120, 30,
179, 30,
-179, 20,
-10, 30,
0, 0
]);
for (var i = 0; i < positions.length; i++) {
viewer.entities.add({
position : positions[i],
point : {
pixelSize : 10,
color : Cesium.Color.YELLOW
}
});
}
var redRectangle = viewer.entities.add({
rectangle : {
height: 0,
coordinates : Cesium.Rectangle.fromCartesianArray(positions),
material : Cesium.Color.RED.withAlpha(0.5)
}
});
var expectedRectangle = viewer.entities.add({
rectangle : {
height: 0,
coordinates : Cesium.Rectangle.fromDegrees(-10, 0, -179, 30),
material : Cesium.Color.BLUE.withAlpha(0.5)
}
});
```
Contributor guide
Research direction
Start with the Rectangle.fromCartesianArray and Rectangle.fromCartographicArray entry points and reproduce the supplied positions that cross the IDL. Compare the returned rectangle with the expected smallest rectangle in the example; done means both methods choose the smallest spanning rectangle for this case and the behavior is covered by a regression test.
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