@rtzh/engine 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/Build/Workers/chunk-2J26NSQJ.js +57 -0
  2. package/Build/Workers/chunk-2ZWJOYYZ.js +497 -0
  3. package/Build/Workers/chunk-3ENHMKKX.js +1800 -0
  4. package/Build/Workers/chunk-47CWFJX6.js +124 -0
  5. package/Build/Workers/chunk-4VAD4BJM.js +55 -0
  6. package/Build/Workers/chunk-5DTY5JIA.js +256 -0
  7. package/Build/Workers/chunk-623LOZW5.js +511 -0
  8. package/Build/Workers/chunk-6WNAMM2J.js +368 -0
  9. package/Build/Workers/chunk-7IJ6YJDR.js +439 -0
  10. package/Build/Workers/chunk-A44RSIOC.js +138 -0
  11. package/Build/Workers/chunk-ALHM5LNB.js +163 -0
  12. package/Build/Workers/chunk-ASKKSAO2.js +114 -0
  13. package/Build/Workers/chunk-AUOSJ7RD.js +1483 -0
  14. package/Build/Workers/chunk-BLMLQN3N.js +288 -0
  15. package/Build/Workers/chunk-BLPBGSIN.js +778 -0
  16. package/Build/Workers/chunk-BVMMZTO2.js +73 -0
  17. package/Build/Workers/chunk-DQLCJMOH.js +692 -0
  18. package/Build/Workers/chunk-DU24KQOE.js +352 -0
  19. package/Build/Workers/chunk-EAXGQLHV.js +102 -0
  20. package/Build/Workers/chunk-EPAJ4UIR.js +75 -0
  21. package/Build/Workers/chunk-F2MK22SO.js +198 -0
  22. package/Build/Workers/chunk-F4XSN4LN.js +642 -0
  23. package/Build/Workers/chunk-FAVFRMK5.js +1317 -0
  24. package/Build/Workers/chunk-FKKXVIQS.js +58 -0
  25. package/Build/Workers/chunk-FQBOVVHM.js +2719 -0
  26. package/Build/Workers/chunk-HTTTEW64.js +305 -0
  27. package/Build/Workers/chunk-HZQONEX2.js +241 -0
  28. package/Build/Workers/chunk-ILNFTW5Z.js +788 -0
  29. package/Build/Workers/chunk-J6DW5QIM.js +55 -0
  30. package/Build/Workers/chunk-JCJRAI2M.js +8366 -0
  31. package/Build/Workers/chunk-JEFN4ZPU.js +44 -0
  32. package/Build/Workers/chunk-KWI3TOQ3.js +1460 -0
  33. package/Build/Workers/chunk-L63MA7DS.js +299 -0
  34. package/Build/Workers/chunk-LKCPP73L.js +139 -0
  35. package/Build/Workers/chunk-MBKDVX63.js +1067 -0
  36. package/Build/Workers/chunk-ODIGZZ3R.js +682 -0
  37. package/Build/Workers/chunk-Q2GNXOAO.js +414 -0
  38. package/Build/Workers/chunk-QCRUW3OJ.js +387 -0
  39. package/Build/Workers/chunk-QG2AN7NK.js +2058 -0
  40. package/Build/Workers/chunk-RGAJSVVU.js +1045 -0
  41. package/Build/Workers/chunk-RJJMDQTR.js +455 -0
  42. package/Build/Workers/chunk-RMYM65KX.js +629 -0
  43. package/Build/Workers/chunk-S3QVNBQ2.js +837 -0
  44. package/Build/Workers/chunk-SL6RUOEJ.js +1443 -0
  45. package/Build/Workers/chunk-TDP5NGTP.js +171 -0
  46. package/Build/Workers/chunk-TDQUDFAH.js +940 -0
  47. package/Build/Workers/chunk-TVCOYHIQ.js +1054 -0
  48. package/Build/Workers/chunk-TVVFCSTW.js +162 -0
  49. package/Build/Workers/chunk-UCLPK6WA.js +101 -0
  50. package/Build/Workers/chunk-UR5UUI2S.js +280 -0
  51. package/Build/Workers/chunk-VH6ZXWXV.js +398 -0
  52. package/Build/Workers/chunk-VU5DFAMV.js +97 -0
  53. package/Build/Workers/chunk-WMSJG24O.js +352 -0
  54. package/Build/Workers/chunk-X7RJMQRF.js +476 -0
  55. package/Build/Workers/chunk-XOKZRQNH.js +219 -0
  56. package/Build/Workers/chunk-YF767F7T.js +37 -0
  57. package/Build/Workers/chunk-YLNURUBI.js +3514 -0
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Scene/Model/CPUStylingPipelineStage.js +4 -1
  112. package/Source/Scene/Model/CustomShader.js +21 -0
  113. package/Source/Scene/Model/CustomShaderPipelineStage.js +9 -0
  114. package/Source/Scene/Model/ModelDrawCommand.js +52 -3
  115. package/Source/Shaders/Model/CPUStylingStageFS.glsl +4 -1
  116. package/Source/Shaders/Model/CPUStylingStageFS.js +4 -1
  117. package/Source/Shaders/Model/CPUStylingStageVS.glsl +4 -1
  118. package/Source/Shaders/Model/CPUStylingStageVS.js +4 -1
  119. package/Source/Shaders/Model/ModelFS.glsl +11 -9
  120. package/Source/Shaders/Model/ModelFS.js +11 -9
  121. package/index.d.ts +8 -0
  122. package/index.js +64 -64
  123. package/package.json +1 -1
@@ -0,0 +1,305 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.14
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ Quaternion_default
28
+ } from "./chunk-JCJRAI2M.js";
29
+ import {
30
+ Cartesian3_default,
31
+ Matrix3_default
32
+ } from "./chunk-SL6RUOEJ.js";
33
+ import {
34
+ Math_default
35
+ } from "./chunk-2ZWJOYYZ.js";
36
+
37
+ // packages/engine/Source/Core/EllipseGeometryLibrary.js
38
+ var EllipseGeometryLibrary = {};
39
+ var rotAxis = new Cartesian3_default();
40
+ var tempVec = new Cartesian3_default();
41
+ var unitQuat = new Quaternion_default();
42
+ var rotMtx = new Matrix3_default();
43
+ function pointOnEllipsoid(theta, rotation, northVec, eastVec, aSqr, ab, bSqr, mag, unitPos, result) {
44
+ const azimuth = theta + rotation;
45
+ Cartesian3_default.multiplyByScalar(eastVec, Math.cos(azimuth), rotAxis);
46
+ Cartesian3_default.multiplyByScalar(northVec, Math.sin(azimuth), tempVec);
47
+ Cartesian3_default.add(rotAxis, tempVec, rotAxis);
48
+ let cosThetaSquared = Math.cos(theta);
49
+ cosThetaSquared = cosThetaSquared * cosThetaSquared;
50
+ let sinThetaSquared = Math.sin(theta);
51
+ sinThetaSquared = sinThetaSquared * sinThetaSquared;
52
+ const radius = ab / Math.sqrt(bSqr * cosThetaSquared + aSqr * sinThetaSquared);
53
+ const angle = radius / mag;
54
+ Quaternion_default.fromAxisAngle(rotAxis, angle, unitQuat);
55
+ Matrix3_default.fromQuaternion(unitQuat, rotMtx);
56
+ Matrix3_default.multiplyByVector(rotMtx, unitPos, result);
57
+ Cartesian3_default.normalize(result, result);
58
+ Cartesian3_default.multiplyByScalar(result, mag, result);
59
+ return result;
60
+ }
61
+ var scratchCartesian1 = new Cartesian3_default();
62
+ var scratchCartesian2 = new Cartesian3_default();
63
+ var scratchCartesian3 = new Cartesian3_default();
64
+ var scratchNormal = new Cartesian3_default();
65
+ EllipseGeometryLibrary.raisePositionsToHeight = function(positions, options, extrude) {
66
+ const ellipsoid = options.ellipsoid;
67
+ const height = options.height;
68
+ const extrudedHeight = options.extrudedHeight;
69
+ const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
70
+ const finalPositions = new Float64Array(size * 3);
71
+ const length = positions.length;
72
+ const bottomOffset = extrude ? length : 0;
73
+ for (let i = 0; i < length; i += 3) {
74
+ const i1 = i + 1;
75
+ const i2 = i + 2;
76
+ const position = Cartesian3_default.fromArray(positions, i, scratchCartesian1);
77
+ ellipsoid.scaleToGeodeticSurface(position, position);
78
+ const extrudedPosition = Cartesian3_default.clone(position, scratchCartesian2);
79
+ const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
80
+ const scaledNormal = Cartesian3_default.multiplyByScalar(
81
+ normal,
82
+ height,
83
+ scratchCartesian3
84
+ );
85
+ Cartesian3_default.add(position, scaledNormal, position);
86
+ if (extrude) {
87
+ Cartesian3_default.multiplyByScalar(normal, extrudedHeight, scaledNormal);
88
+ Cartesian3_default.add(extrudedPosition, scaledNormal, extrudedPosition);
89
+ finalPositions[i + bottomOffset] = extrudedPosition.x;
90
+ finalPositions[i1 + bottomOffset] = extrudedPosition.y;
91
+ finalPositions[i2 + bottomOffset] = extrudedPosition.z;
92
+ }
93
+ finalPositions[i] = position.x;
94
+ finalPositions[i1] = position.y;
95
+ finalPositions[i2] = position.z;
96
+ }
97
+ return finalPositions;
98
+ };
99
+ var unitPosScratch = new Cartesian3_default();
100
+ var eastVecScratch = new Cartesian3_default();
101
+ var northVecScratch = new Cartesian3_default();
102
+ EllipseGeometryLibrary.computeEllipsePositions = function(options, addFillPositions, addEdgePositions) {
103
+ const semiMinorAxis = options.semiMinorAxis;
104
+ const semiMajorAxis = options.semiMajorAxis;
105
+ const rotation = options.rotation;
106
+ const center = options.center;
107
+ const granularity = options.granularity * 8;
108
+ const aSqr = semiMinorAxis * semiMinorAxis;
109
+ const bSqr = semiMajorAxis * semiMajorAxis;
110
+ const ab = semiMajorAxis * semiMinorAxis;
111
+ const mag = Cartesian3_default.magnitude(center);
112
+ const unitPos = Cartesian3_default.normalize(center, unitPosScratch);
113
+ let eastVec = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, center, eastVecScratch);
114
+ eastVec = Cartesian3_default.normalize(eastVec, eastVec);
115
+ const northVec = Cartesian3_default.cross(unitPos, eastVec, northVecScratch);
116
+ let numPts = 1 + Math.ceil(Math_default.PI_OVER_TWO / granularity);
117
+ const deltaTheta = Math_default.PI_OVER_TWO / (numPts - 1);
118
+ let theta = Math_default.PI_OVER_TWO - numPts * deltaTheta;
119
+ if (theta < 0) {
120
+ numPts -= Math.ceil(Math.abs(theta) / deltaTheta);
121
+ }
122
+ const size = 2 * (numPts * (numPts + 2));
123
+ const positions = addFillPositions ? new Array(size * 3) : void 0;
124
+ let positionIndex = 0;
125
+ let position = scratchCartesian1;
126
+ let reflectedPosition = scratchCartesian2;
127
+ const outerPositionsLength = numPts * 4 * 3;
128
+ let outerRightIndex = outerPositionsLength - 1;
129
+ let outerLeftIndex = 0;
130
+ const outerPositions = addEdgePositions ? new Array(outerPositionsLength) : void 0;
131
+ let i;
132
+ let j;
133
+ let numInterior;
134
+ let t;
135
+ let interiorPosition;
136
+ theta = Math_default.PI_OVER_TWO;
137
+ position = pointOnEllipsoid(
138
+ theta,
139
+ rotation,
140
+ northVec,
141
+ eastVec,
142
+ aSqr,
143
+ ab,
144
+ bSqr,
145
+ mag,
146
+ unitPos,
147
+ position
148
+ );
149
+ if (addFillPositions) {
150
+ positions[positionIndex++] = position.x;
151
+ positions[positionIndex++] = position.y;
152
+ positions[positionIndex++] = position.z;
153
+ }
154
+ if (addEdgePositions) {
155
+ outerPositions[outerRightIndex--] = position.z;
156
+ outerPositions[outerRightIndex--] = position.y;
157
+ outerPositions[outerRightIndex--] = position.x;
158
+ }
159
+ theta = Math_default.PI_OVER_TWO - deltaTheta;
160
+ for (i = 1; i < numPts + 1; ++i) {
161
+ position = pointOnEllipsoid(
162
+ theta,
163
+ rotation,
164
+ northVec,
165
+ eastVec,
166
+ aSqr,
167
+ ab,
168
+ bSqr,
169
+ mag,
170
+ unitPos,
171
+ position
172
+ );
173
+ reflectedPosition = pointOnEllipsoid(
174
+ Math.PI - theta,
175
+ rotation,
176
+ northVec,
177
+ eastVec,
178
+ aSqr,
179
+ ab,
180
+ bSqr,
181
+ mag,
182
+ unitPos,
183
+ reflectedPosition
184
+ );
185
+ if (addFillPositions) {
186
+ positions[positionIndex++] = position.x;
187
+ positions[positionIndex++] = position.y;
188
+ positions[positionIndex++] = position.z;
189
+ numInterior = 2 * i + 2;
190
+ for (j = 1; j < numInterior - 1; ++j) {
191
+ t = j / (numInterior - 1);
192
+ interiorPosition = Cartesian3_default.lerp(
193
+ position,
194
+ reflectedPosition,
195
+ t,
196
+ scratchCartesian3
197
+ );
198
+ positions[positionIndex++] = interiorPosition.x;
199
+ positions[positionIndex++] = interiorPosition.y;
200
+ positions[positionIndex++] = interiorPosition.z;
201
+ }
202
+ positions[positionIndex++] = reflectedPosition.x;
203
+ positions[positionIndex++] = reflectedPosition.y;
204
+ positions[positionIndex++] = reflectedPosition.z;
205
+ }
206
+ if (addEdgePositions) {
207
+ outerPositions[outerRightIndex--] = position.z;
208
+ outerPositions[outerRightIndex--] = position.y;
209
+ outerPositions[outerRightIndex--] = position.x;
210
+ outerPositions[outerLeftIndex++] = reflectedPosition.x;
211
+ outerPositions[outerLeftIndex++] = reflectedPosition.y;
212
+ outerPositions[outerLeftIndex++] = reflectedPosition.z;
213
+ }
214
+ theta = Math_default.PI_OVER_TWO - (i + 1) * deltaTheta;
215
+ }
216
+ for (i = numPts; i > 1; --i) {
217
+ theta = Math_default.PI_OVER_TWO - (i - 1) * deltaTheta;
218
+ position = pointOnEllipsoid(
219
+ -theta,
220
+ rotation,
221
+ northVec,
222
+ eastVec,
223
+ aSqr,
224
+ ab,
225
+ bSqr,
226
+ mag,
227
+ unitPos,
228
+ position
229
+ );
230
+ reflectedPosition = pointOnEllipsoid(
231
+ theta + Math.PI,
232
+ rotation,
233
+ northVec,
234
+ eastVec,
235
+ aSqr,
236
+ ab,
237
+ bSqr,
238
+ mag,
239
+ unitPos,
240
+ reflectedPosition
241
+ );
242
+ if (addFillPositions) {
243
+ positions[positionIndex++] = position.x;
244
+ positions[positionIndex++] = position.y;
245
+ positions[positionIndex++] = position.z;
246
+ numInterior = 2 * (i - 1) + 2;
247
+ for (j = 1; j < numInterior - 1; ++j) {
248
+ t = j / (numInterior - 1);
249
+ interiorPosition = Cartesian3_default.lerp(
250
+ position,
251
+ reflectedPosition,
252
+ t,
253
+ scratchCartesian3
254
+ );
255
+ positions[positionIndex++] = interiorPosition.x;
256
+ positions[positionIndex++] = interiorPosition.y;
257
+ positions[positionIndex++] = interiorPosition.z;
258
+ }
259
+ positions[positionIndex++] = reflectedPosition.x;
260
+ positions[positionIndex++] = reflectedPosition.y;
261
+ positions[positionIndex++] = reflectedPosition.z;
262
+ }
263
+ if (addEdgePositions) {
264
+ outerPositions[outerRightIndex--] = position.z;
265
+ outerPositions[outerRightIndex--] = position.y;
266
+ outerPositions[outerRightIndex--] = position.x;
267
+ outerPositions[outerLeftIndex++] = reflectedPosition.x;
268
+ outerPositions[outerLeftIndex++] = reflectedPosition.y;
269
+ outerPositions[outerLeftIndex++] = reflectedPosition.z;
270
+ }
271
+ }
272
+ theta = Math_default.PI_OVER_TWO;
273
+ position = pointOnEllipsoid(
274
+ -theta,
275
+ rotation,
276
+ northVec,
277
+ eastVec,
278
+ aSqr,
279
+ ab,
280
+ bSqr,
281
+ mag,
282
+ unitPos,
283
+ position
284
+ );
285
+ const r = {};
286
+ if (addFillPositions) {
287
+ positions[positionIndex++] = position.x;
288
+ positions[positionIndex++] = position.y;
289
+ positions[positionIndex++] = position.z;
290
+ r.positions = positions;
291
+ r.numPts = numPts;
292
+ }
293
+ if (addEdgePositions) {
294
+ outerPositions[outerRightIndex--] = position.z;
295
+ outerPositions[outerRightIndex--] = position.y;
296
+ outerPositions[outerRightIndex--] = position.x;
297
+ r.outerPositions = outerPositions;
298
+ }
299
+ return r;
300
+ };
301
+ var EllipseGeometryLibrary_default = EllipseGeometryLibrary;
302
+
303
+ export {
304
+ EllipseGeometryLibrary_default
305
+ };
@@ -0,0 +1,241 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.14
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ GeographicProjection_default
28
+ } from "./chunk-TDQUDFAH.js";
29
+ import {
30
+ Matrix2_default,
31
+ Rectangle_default
32
+ } from "./chunk-JCJRAI2M.js";
33
+ import {
34
+ Cartographic_default,
35
+ Ellipsoid_default
36
+ } from "./chunk-KWI3TOQ3.js";
37
+ import {
38
+ Cartesian3_default
39
+ } from "./chunk-SL6RUOEJ.js";
40
+ import {
41
+ Math_default
42
+ } from "./chunk-2ZWJOYYZ.js";
43
+ import {
44
+ DeveloperError_default
45
+ } from "./chunk-ALHM5LNB.js";
46
+ import {
47
+ defined_default
48
+ } from "./chunk-EPAJ4UIR.js";
49
+
50
+ // packages/engine/Source/Core/RectangleGeometryLibrary.js
51
+ var cos = Math.cos;
52
+ var sin = Math.sin;
53
+ var sqrt = Math.sqrt;
54
+ var RectangleGeometryLibrary = {};
55
+ RectangleGeometryLibrary.computePosition = function(computedOptions, ellipsoid, computeST, row, col, position, st) {
56
+ const radiiSquared = ellipsoid.radiiSquared;
57
+ const nwCorner = computedOptions.nwCorner;
58
+ const rectangle = computedOptions.boundingRectangle;
59
+ let stLatitude = nwCorner.latitude - computedOptions.granYCos * row + col * computedOptions.granXSin;
60
+ const cosLatitude = cos(stLatitude);
61
+ const nZ = sin(stLatitude);
62
+ const kZ = radiiSquared.z * nZ;
63
+ let stLongitude = nwCorner.longitude + row * computedOptions.granYSin + col * computedOptions.granXCos;
64
+ const nX = cosLatitude * cos(stLongitude);
65
+ const nY = cosLatitude * sin(stLongitude);
66
+ const kX = radiiSquared.x * nX;
67
+ const kY = radiiSquared.y * nY;
68
+ const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);
69
+ position.x = kX / gamma;
70
+ position.y = kY / gamma;
71
+ position.z = kZ / gamma;
72
+ if (computeST) {
73
+ const stNwCorner = computedOptions.stNwCorner;
74
+ if (defined_default(stNwCorner)) {
75
+ stLatitude = stNwCorner.latitude - computedOptions.stGranYCos * row + col * computedOptions.stGranXSin;
76
+ stLongitude = stNwCorner.longitude + row * computedOptions.stGranYSin + col * computedOptions.stGranXCos;
77
+ st.x = (stLongitude - computedOptions.stWest) * computedOptions.lonScalar;
78
+ st.y = (stLatitude - computedOptions.stSouth) * computedOptions.latScalar;
79
+ } else {
80
+ st.x = (stLongitude - rectangle.west) * computedOptions.lonScalar;
81
+ st.y = (stLatitude - rectangle.south) * computedOptions.latScalar;
82
+ }
83
+ }
84
+ };
85
+ var rotationMatrixScratch = new Matrix2_default();
86
+ var nwCartesian = new Cartesian3_default();
87
+ var centerScratch = new Cartographic_default();
88
+ var centerCartesian = new Cartesian3_default();
89
+ var proj = new GeographicProjection_default();
90
+ function getRotationOptions(nwCorner, rotation, granularityX, granularityY, center, width, height) {
91
+ const cosRotation = Math.cos(rotation);
92
+ const granYCos = granularityY * cosRotation;
93
+ const granXCos = granularityX * cosRotation;
94
+ const sinRotation = Math.sin(rotation);
95
+ const granYSin = granularityY * sinRotation;
96
+ const granXSin = granularityX * sinRotation;
97
+ proj._ellipsoid = Ellipsoid_default.default;
98
+ nwCartesian = proj.project(nwCorner, nwCartesian);
99
+ nwCartesian = Cartesian3_default.subtract(nwCartesian, centerCartesian, nwCartesian);
100
+ const rotationMatrix = Matrix2_default.fromRotation(rotation, rotationMatrixScratch);
101
+ nwCartesian = Matrix2_default.multiplyByVector(
102
+ rotationMatrix,
103
+ nwCartesian,
104
+ nwCartesian
105
+ );
106
+ nwCartesian = Cartesian3_default.add(nwCartesian, centerCartesian, nwCartesian);
107
+ nwCorner = proj.unproject(nwCartesian, nwCorner);
108
+ width -= 1;
109
+ height -= 1;
110
+ const latitude = nwCorner.latitude;
111
+ const latitude0 = latitude + width * granXSin;
112
+ const latitude1 = latitude - granYCos * height;
113
+ const latitude2 = latitude - granYCos * height + width * granXSin;
114
+ const north = Math.max(latitude, latitude0, latitude1, latitude2);
115
+ const south = Math.min(latitude, latitude0, latitude1, latitude2);
116
+ const longitude = nwCorner.longitude;
117
+ const longitude0 = longitude + width * granXCos;
118
+ const longitude1 = longitude + height * granYSin;
119
+ const longitude2 = longitude + height * granYSin + width * granXCos;
120
+ const east = Math.max(longitude, longitude0, longitude1, longitude2);
121
+ const west = Math.min(longitude, longitude0, longitude1, longitude2);
122
+ return {
123
+ north,
124
+ south,
125
+ east,
126
+ west,
127
+ granYCos,
128
+ granYSin,
129
+ granXCos,
130
+ granXSin,
131
+ nwCorner
132
+ };
133
+ }
134
+ RectangleGeometryLibrary.computeOptions = function(rectangle, granularity, rotation, stRotation, boundingRectangleScratch, nwCornerResult, stNwCornerResult) {
135
+ let east = rectangle.east;
136
+ let west = rectangle.west;
137
+ let north = rectangle.north;
138
+ let south = rectangle.south;
139
+ let northCap = false;
140
+ let southCap = false;
141
+ if (north === Math_default.PI_OVER_TWO) {
142
+ northCap = true;
143
+ }
144
+ if (south === -Math_default.PI_OVER_TWO) {
145
+ southCap = true;
146
+ }
147
+ let dx;
148
+ const dy = north - south;
149
+ if (west > east) {
150
+ dx = Math_default.TWO_PI - west + east;
151
+ } else {
152
+ dx = east - west;
153
+ }
154
+ const width = Math.ceil(dx / granularity) + 1;
155
+ const height = Math.ceil(dy / granularity) + 1;
156
+ const granularityX = dx / (width - 1);
157
+ const granularityY = dy / (height - 1);
158
+ const nwCorner = Rectangle_default.northwest(rectangle, nwCornerResult);
159
+ const center = Rectangle_default.center(rectangle, centerScratch);
160
+ if (rotation !== 0 || stRotation !== 0) {
161
+ if (center.longitude < nwCorner.longitude) {
162
+ center.longitude += Math_default.TWO_PI;
163
+ }
164
+ proj._ellipsoid = Ellipsoid_default.default;
165
+ centerCartesian = proj.project(center, centerCartesian);
166
+ }
167
+ const granYCos = granularityY;
168
+ const granXCos = granularityX;
169
+ const granYSin = 0;
170
+ const granXSin = 0;
171
+ const boundingRectangle = Rectangle_default.clone(
172
+ rectangle,
173
+ boundingRectangleScratch
174
+ );
175
+ const computedOptions = {
176
+ granYCos,
177
+ granYSin,
178
+ granXCos,
179
+ granXSin,
180
+ nwCorner,
181
+ boundingRectangle,
182
+ width,
183
+ height,
184
+ northCap,
185
+ southCap
186
+ };
187
+ if (rotation !== 0) {
188
+ const rotationOptions = getRotationOptions(
189
+ nwCorner,
190
+ rotation,
191
+ granularityX,
192
+ granularityY,
193
+ center,
194
+ width,
195
+ height
196
+ );
197
+ north = rotationOptions.north;
198
+ south = rotationOptions.south;
199
+ east = rotationOptions.east;
200
+ west = rotationOptions.west;
201
+ if (north < -Math_default.PI_OVER_TWO || north > Math_default.PI_OVER_TWO || south < -Math_default.PI_OVER_TWO || south > Math_default.PI_OVER_TWO) {
202
+ throw new DeveloperError_default(
203
+ "Rotated rectangle is invalid. It crosses over either the north or south pole."
204
+ );
205
+ }
206
+ computedOptions.granYCos = rotationOptions.granYCos;
207
+ computedOptions.granYSin = rotationOptions.granYSin;
208
+ computedOptions.granXCos = rotationOptions.granXCos;
209
+ computedOptions.granXSin = rotationOptions.granXSin;
210
+ boundingRectangle.north = north;
211
+ boundingRectangle.south = south;
212
+ boundingRectangle.east = east;
213
+ boundingRectangle.west = west;
214
+ }
215
+ if (stRotation !== 0) {
216
+ rotation = rotation - stRotation;
217
+ const stNwCorner = Rectangle_default.northwest(boundingRectangle, stNwCornerResult);
218
+ const stRotationOptions = getRotationOptions(
219
+ stNwCorner,
220
+ rotation,
221
+ granularityX,
222
+ granularityY,
223
+ center,
224
+ width,
225
+ height
226
+ );
227
+ computedOptions.stGranYCos = stRotationOptions.granYCos;
228
+ computedOptions.stGranXCos = stRotationOptions.granXCos;
229
+ computedOptions.stGranYSin = stRotationOptions.granYSin;
230
+ computedOptions.stGranXSin = stRotationOptions.granXSin;
231
+ computedOptions.stNwCorner = stNwCorner;
232
+ computedOptions.stWest = stRotationOptions.west;
233
+ computedOptions.stSouth = stRotationOptions.south;
234
+ }
235
+ return computedOptions;
236
+ };
237
+ var RectangleGeometryLibrary_default = RectangleGeometryLibrary;
238
+
239
+ export {
240
+ RectangleGeometryLibrary_default
241
+ };