@@ -72,14 +72,15 @@ export function createTileChildren(
7272 for ( const q of quads ) {
7373 const geometricError = Math . max ( 50 , 2000 / Math . pow ( 2 , childLevel ) ) ;
7474
75- // Natural bounding box calculation - no rotation
75+ // Z-UP COORDINATE SYSTEM (3D Tiles standard):
76+ // X = easting, Y = northing, Z = elevation (up)
7677 const boxCenterX = ( q . minX + q . maxX ) / 2 - centerX ; // X = easting (centered)
77- const boxCenterY = ( minHeight + maxHeight ) / 2 ; // Y = elevation
78- const boxCenterZ = ( q . minY + q . maxY ) / 2 - centerY ; // Z = northing (centered )
78+ const boxCenterY = ( q . minY + q . maxY ) / 2 - centerY ; // Y = northing (centered)
79+ const boxCenterZ = ( minHeight + maxHeight ) / 2 ; // Z = elevation (up )
7980
8081 const boxWidth = q . maxX - q . minX ; // X extent (easting)
81- const boxHeight = maxHeight - minHeight ; // Y extent (elevation )
82- const boxDepth = q . maxY - q . minY ; // Z extent (northing )
82+ const boxHeight = q . maxY - q . minY ; // Y extent (northing )
83+ const boxDepth = maxHeight - minHeight ; // Z extent (elevation )
8384
8485 children . push ( {
8586 boundingVolume : {
@@ -92,10 +93,10 @@ export function createTileChildren(
9293 0 , // X axis half-extents (easting)
9394 0 ,
9495 boxHeight / 2 ,
95- 0 , // Y axis half-extents (elevation )
96+ 0 , // Y axis half-extents (northing )
9697 0 ,
9798 0 ,
98- boxDepth / 2 , // Z axis half-extents (northing )
99+ boxDepth / 2 , // Z axis half-extents (elevation )
99100 ] ,
100101 } ,
101102 refine : 'REPLACE' ,
@@ -131,14 +132,15 @@ export function createRootTile(
131132 maxH : number ,
132133 maxLevel : number ,
133134) {
134- // Natural root bounding box calculation
135+ // Z-UP COORDINATE SYSTEM (3D Tiles standard):
136+ // X = easting, Y = northing, Z = elevation (up)
135137 const rootBoxCenterX = 0 ; // X = easting (centered at origin)
136- const rootBoxCenterY = ( minH + maxH ) / 2 ; // Y = elevation center
137- const rootBoxCenterZ = 0 ; // Z = northing (centered at origin)
138+ const rootBoxCenterY = 0 ; // Y = northing (centered at origin)
139+ const rootBoxCenterZ = ( minH + maxH ) / 2 ; // Z = elevation center
138140
139141 const rootBoxWidth = square [ 2 ] - square [ 0 ] ; // X extent (easting)
140- const rootBoxHeight = maxH - minH ; // Y extent (elevation )
141- const rootBoxDepth = square [ 3 ] - square [ 1 ] ; // Z extent (northing )
142+ const rootBoxHeight = square [ 3 ] - square [ 1 ] ; // Y extent (northing )
143+ const rootBoxDepth = maxH - minH ; // Z extent (elevation )
142144
143145 return {
144146 boundingVolume : {
@@ -151,10 +153,10 @@ export function createRootTile(
151153 0 , // X axis half-extents (easting)
152154 0 ,
153155 rootBoxHeight / 2 ,
154- 0 , // Y axis half-extents (elevation )
156+ 0 , // Y axis half-extents (northing )
155157 0 ,
156158 0 ,
157- rootBoxDepth / 2 , // Z axis half-extents (northing )
159+ rootBoxDepth / 2 , // Z axis half-extents (elevation )
158160 ] ,
159161 } ,
160162 refine : 'REPLACE' ,
0 commit comments