diff --git a/CHANGES.md b/CHANGES.md index 72cb6fb29654..95d07f133d0d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ Change Log * Added `PolygonGraphics.hierarchy` for supporting polygons with holes via data sources. * `GeoJsonDataSource` now supports polygons with holes. * `ConstantProperty` can now hold any value; previously it was limited to values that implemented `equals` and `clones` functions, as well as a few special cases. +* Fixed a bug in `EllipsoidGeodesic` that caused it to modify the `height` of the positions passed to the constructor or to to `setEndPoints`. * Instead of throwing an exception when there are not enough unique positions to define a geometry, creating a `Primitive` will succeed, but not render. [#2375](https://github.com/AnalyticalGraphicsInc/cesium/issues/2375) ### 1.5 - 2015-01-05 diff --git a/Source/Core/EllipsoidGeodesic.js b/Source/Core/EllipsoidGeodesic.js index 932432412ad8..d382bd0c296f 100644 --- a/Source/Core/EllipsoidGeodesic.js +++ b/Source/Core/EllipsoidGeodesic.js @@ -185,10 +185,10 @@ define([ vincentyInverseFormula(ellipsoidGeodesic, ellipsoid.maximumRadius, ellipsoid.minimumRadius, start.longitude, start.latitude, end.longitude, end.latitude); - start.height = 0; - end.height = 0; ellipsoidGeodesic._start = Cartographic.clone(start, ellipsoidGeodesic._start); ellipsoidGeodesic._end = Cartographic.clone(end, ellipsoidGeodesic._end); + ellipsoidGeodesic._start.height = 0; + ellipsoidGeodesic._end.height = 0; setConstants(ellipsoidGeodesic); } diff --git a/Specs/Core/EllipsoidGeodesicSpec.js b/Specs/Core/EllipsoidGeodesicSpec.js index 23c73d094d22..18d3899f48f2 100644 --- a/Specs/Core/EllipsoidGeodesicSpec.js +++ b/Specs/Core/EllipsoidGeodesicSpec.js @@ -245,4 +245,12 @@ defineSuite([ expect(expectedMid.longitude).toEqualEpsilon(result.longitude, CesiumMath.EPSILON13); expect(expectedMid.latitude).toEqualEpsilon(result.latitude, CesiumMath.EPSILON13); }); + + it('doesn\'t modify incoming cartographics', function(){ + var start = new Cartographic(1,2,3); + var end = new Cartographic(2,3,4); + var geodesic = new EllipsoidGeodesic(start, end); + expect(start.height).toEqual(3); + expect(end.height).toEqual(4); + }); }); \ No newline at end of file