Skip to content

Commit 8a3bc86

Browse files
committed
Merge branch 'master' of github.com:NASA-AMMOS/3DTilesRendererJS
2 parents 0d8c957 + 15d4722 commit 8a3bc86

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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".

src/three/renderer/math/Ellipsoid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

test/three/Ellipsoid.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)