File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88### Changed
99- EnvironmentControls: PivotMesh is now added to the scene before the "start" event is fired.
1010
11+ ### Fixed
12+ - Ellipsoid.getPositionToCartographic: fixed incorrect calculation of cartographic point.
13+
1114## [ 0.4.23] - 2026-03-18
1215### Added
1316- DebugTilesPlugin: Added support for "boundsColorMode".
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ export class Ellipsoid {
353353 // From Cesium function Ellipsoid.cartesianToCartographic
354354 // https://github.com/CesiumGS/cesium/blob/665ec32e813d5d6fe906ec3e87187f6c38ed5e49/packages/engine/Source/core/renderer/Ellipsoid.js#L463
355355 this . getPositionToSurfacePoint ( pos , _vec ) ;
356- this . getPositionToNormal ( pos , _norm ) ;
356+ this . getPositionToNormal ( _vec , _norm ) ;
357357
358358 const heightDelta = _vec2 . subVectors ( pos , _vec ) ;
359359
Original file line number Diff line number Diff line change @@ -178,6 +178,30 @@ describe( 'Ellipsoid', () => {
178178
179179 } ) ;
180180
181+ it ( 'should match Cesium Cartesian to Cartographic results.' , ( ) => {
182+
183+ const HEIGHT_EPSILON = 1e-5 ;
184+ const LAT_LON_EPSILON = 1e-7 ;
185+ const LAT = 40 ;
186+ const LON = - 75 ;
187+ const HEIGHT = 5000 ;
188+ const cart = new Cesium . Cartographic ( LON , LAT , HEIGHT ) ;
189+
190+ c_wgsEllipse . cartographicToCartesian ( cart , c ) ;
191+ v . set ( c . x , c . y , c . z ) ;
192+
193+ const cesiumResult = new Cesium . Cartographic ( ) ;
194+ c_wgsEllipse . cartesianToCartographic ( c , cesiumResult ) ;
195+
196+ const result = { } ;
197+ wgsEllipse . getPositionToCartographic ( v , result ) ;
198+
199+ compareCoord ( result . lon , cesiumResult . longitude , LAT_LON_EPSILON ) ;
200+ compareCoord ( result . lat , cesiumResult . latitude , LAT_LON_EPSILON ) ;
201+ compareCoord ( result . height , cesiumResult . height , HEIGHT_EPSILON ) ;
202+
203+ } ) ;
204+
181205 it ( 'should match the expected elevation.' , ( ) => {
182206
183207 //ellipsoid rotation
You can’t perform that action at this time.
0 commit comments