diff --git a/CHANGES.md b/CHANGES.md index 48fa8ea6888d..bb5f6123717d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/Source/Core/PolylinePipeline.js b/Source/Core/PolylinePipeline.js index f0f9e0c3b491..16660b1c9b75 100644 --- a/Source/Core/PolylinePipeline.js +++ b/Source/Core/PolylinePipeline.js @@ -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)) { diff --git a/Specs/Core/PolylinePipelineSpec.js b/Specs/Core/PolylinePipelineSpec.js index d7d0be388870..1bb7634aa285 100644 --- a/Specs/Core/PolylinePipelineSpec.js +++ b/Specs/Core/PolylinePipelineSpec.js @@ -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(); + } + }); });