Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return first position when interpolating rhumblines at surface distance 0.0 #9430

Merged
merged 2 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
##### Fixes :wrench:

- Fixed a regression in 1.79 that broke terrain exaggeration. [#9397](https://github.com/CesiumGS/cesium/pull/9397)
- Fixed an issue where interpolating certain small rhumblines with surface distance 0.0 would not return the expected result. [#9430](https://github.com/CesiumGS/cesium/pull/9430)

### 1.79 - 2021-03-01

Expand Down
4 changes: 4 additions & 0 deletions Source/Core/EllipsoidRhumbLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ function interpolateUsingSurfaceDistance(
ellipticity,
result
) {
if (distance === 0.0) {
return Cartographic.clone(start, result);
}

var ellipticitySquared = ellipticity * ellipticity;

var longitude;
Expand Down
24 changes: 24 additions & 0 deletions Specs/Core/EllipsoidRhumbLineSpec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Cartesian3 } from "../../Source/Cesium.js";
import { Cartographic } from "../../Source/Cesium.js";
import { Ellipsoid } from "../../Source/Cesium.js";
import { EllipsoidGeodesic } from "../../Source/Cesium.js";
Expand Down Expand Up @@ -1023,4 +1024,27 @@ describe("Core/EllipsoidRhumbLine", function () {
)
).toBe(true);
});

it("returns the start point when interpolating at surface distance 0.0", function () {
var p0 = new Cartesian3(
899411.2767873341,
-5079219.747324299,
3738850.924729517
);
var p1 = new Cartesian3(
899411.0994891181,
-5079219.778719673,
3738850.9247295167
);

var ellipsoid = Ellipsoid.WGS84;
var c0 = ellipsoid.cartesianToCartographic(p0, new Cartographic());
var c1 = ellipsoid.cartesianToCartographic(p1, new Cartographic());
var rhumb = new EllipsoidRhumbLine(c0, c1, ellipsoid);

var c = rhumb.interpolateUsingSurfaceDistance(0.0, new Cartographic());
var p = ellipsoid.cartographicToCartesian(c, new Cartesian3());

expect(p).toEqualEpsilon(p0, CesiumMath.EPSILON7);
});
});