Skip to content

Commit

Permalink
Merge pull request #8787 from dennisadams/rhumb-arc-fix
Browse files Browse the repository at this point in the history
Fix issue in rhumb arc polylines
  • Loading branch information
Hannah authored Jun 15, 2020
2 parents f35b743 + 65aa312 commit 7dc0f84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
##### Fixes :wrench:

- Fixed error with `WallGeoemtry` when there were adjacent positions with very close values [#8952](https://github.com/CesiumGS/cesium/pull/8952)
- Fixed a bug where certain rhumb arc polylines would lead to a crash. [#8787](https://github.com/CesiumGS/cesium/pull/8787)

### 1.70.1 - 2020-06-10

Expand Down
9 changes: 4 additions & 5 deletions Source/Core/PolylinePipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,15 @@ function generateCartesianRhumbArc(
array,
offset
) {
var first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
var last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
var start = ellipsoid.cartesianToCartographic(first, carto1);
var end = ellipsoid.cartesianToCartographic(last, carto2);

var start = ellipsoid.cartesianToCartographic(p0, carto1);
var end = ellipsoid.cartesianToCartographic(p1, carto2);
var numPoints = PolylinePipeline.numberOfPointsRhumbLine(
start,
end,
granularity
);
start.height = 0.0;
end.height = 0.0;
var heights = subdivideHeights(numPoints, h0, h1);

if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
Expand Down
9 changes: 9 additions & 0 deletions Specs/Core/PolylinePipelineSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,13 @@ describe("Core/PolylinePipeline", function () {
expect(newPositions.length).toEqual(3);
expect(newPositions).toEqual([0, 0, 1]);
});

it("generateRhumbArc return values for each position", function () {
var newPositions = PolylinePipeline.generateRhumbArc({
positions: Cartesian3.fromDegreesArray([0, 0, 10, 0, 10, 5]),
});
for (let i = 0; i < newPositions.length; i++) {
expect(newPositions[i]).toBeDefined();
}
});
});

0 comments on commit 7dc0f84

Please sign in to comment.