Skip to content

Commit

Permalink
Merge pull request #9316 from littlemurph/EllipsoidGeodsic_SurfaceDis…
Browse files Browse the repository at this point in the history
…tance_NaN

Ellipsoid geodsic surface distance nan
  • Loading branch information
IanLilleyT authored Feb 3, 2021
2 parents ca8b918 + 2b786f6 commit 4c7fb7c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### 1.79 - 2021-03-01

##### Fixes :wrench:

- Fixed an issue where certain inputs to EllipsoidGeodesic would result in a surfaceDistance of NaN. [#9316](https://github.com/CesiumGS/cesium/pull/9316)

### 1.78 - 2021-02-01

##### Additions :tada:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Victor Turansky](https://github.com/turansky)
- [Will Jadkowski](https://github.com/willjad)
- [Mac Clayton](https://github.com/mclayton7)
- [Ben Murphy](https://github.com/littlemurph)
2 changes: 1 addition & 1 deletion Source/Core/EllipsoidGeodesic.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function vincentyInverseFormula(

cosineTwiceSigmaMidpoint = cosineSigma - (2.0 * ss) / cosineSquaredAlpha;

if (isNaN(cosineTwiceSigmaMidpoint)) {
if (!isFinite(cosineTwiceSigmaMidpoint)) {
cosineTwiceSigmaMidpoint = 0.0;
}

Expand Down
13 changes: 13 additions & 0 deletions Specs/Core/EllipsoidGeodesicSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ describe("Core/EllipsoidGeodesic", function () {
);
});

it("computes distance very close to equator", function () {
// See https://github.com/CesiumGS/cesium/issues/9248

var ellipsoid = new Ellipsoid(6, 6, 3);

var start = new Cartographic(-CesiumMath.EPSILON10, CesiumMath.EPSILON10);

var end = new Cartographic(+CesiumMath.EPSILON10, CesiumMath.EPSILON10);

var geodesic = new EllipsoidGeodesic(start, end, ellipsoid);
expect(geodesic.surfaceDistance).not.toBeNaN();
});

it("computes distance at meridian", function () {
var ellipsoid = new Ellipsoid(6, 6, 6);
var fifteenDegrees = Math.PI / 12;
Expand Down

0 comments on commit 4c7fb7c

Please sign in to comment.