CesiumGS / CesiumGS/cesium

Add epsilon when checking if a rectangle crosses the IDL

Open
#4,113 1 comment 0 reactions 0 assignees View on GitHub
category - math type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Both `Rectangle.fromCartesianArray` and `Rectangle.fromCartographicArray` have a block to check if it crosses over the IDL.

``` javascript
if (east - west > eastOverIDL - westOverIDL) {
// adjust values
}
```

This block would get executed incorrectly if you call `fromCartesianArray` with

``` javascript
var positions = [
Cartesian3.fromRadians(-2.132233295161041, 0.8062986516323901),
Cartesian3.fromRadians(-2.132425042759527, 0.8061069040339044)
];
```

Here, the difference is `4.440892098500626e-16`. Perhaps add an epsilon check.

Contributor guide

Open the contributing guide

Research direction

Locate Rectangle.fromCartesianArray and Rectangle.fromCartographicArray and read the IDL-crossing checks shown in the issue. Reproduce the reported case with the provided Cartesian3 positions, then verify that an epsilon-aware check prevents the incorrect adjustment in both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.