deeptwins-cesium-engine 0.0.3 → 0.0.4

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 (116) hide show
  1. package/Build/Workers/chunk-25U3LB43.js +139 -0
  2. package/Build/Workers/chunk-2GSMCVKA.js +837 -0
  3. package/Build/Workers/chunk-3G3JCTFQ.js +101 -0
  4. package/Build/Workers/chunk-3GRIO7U2.js +162 -0
  5. package/Build/Workers/chunk-3ZQ33WD3.js +455 -0
  6. package/Build/Workers/chunk-4U7LLSJ4.js +288 -0
  7. package/Build/Workers/chunk-4ZMC542T.js +55 -0
  8. package/Build/Workers/chunk-57TENMAK.js +37 -0
  9. package/Build/Workers/chunk-5JCUBAVN.js +387 -0
  10. package/Build/Workers/chunk-5MAQRQUK.js +102 -0
  11. package/Build/Workers/chunk-5XRGC6C7.js +299 -0
  12. package/Build/Workers/chunk-63UAUZT6.js +414 -0
  13. package/Build/Workers/chunk-6BUOGRYV.js +2058 -0
  14. package/Build/Workers/chunk-7D5ZXLGY.js +163 -0
  15. package/Build/Workers/chunk-7N66TCUJ.js +1800 -0
  16. package/Build/Workers/chunk-AG6ARNCB.js +682 -0
  17. package/Build/Workers/chunk-ARXSS5JC.js +788 -0
  18. package/Build/Workers/chunk-BDVACEHF.js +778 -0
  19. package/Build/Workers/chunk-BU67FVEG.js +97 -0
  20. package/Build/Workers/chunk-BYC4YR4M.js +352 -0
  21. package/Build/Workers/chunk-CH66JW7J.js +629 -0
  22. package/Build/Workers/chunk-CV2CR5WA.js +114 -0
  23. package/Build/Workers/chunk-DGMXFRAL.js +1443 -0
  24. package/Build/Workers/chunk-EDP33VH5.js +1054 -0
  25. package/Build/Workers/chunk-F7AOI3UD.js +73 -0
  26. package/Build/Workers/chunk-FKKSB7ZT.js +8366 -0
  27. package/Build/Workers/chunk-FTK6K2HA.js +1483 -0
  28. package/Build/Workers/chunk-IUPJ4QGV.js +476 -0
  29. package/Build/Workers/chunk-K7Z6W3PJ.js +368 -0
  30. package/Build/Workers/chunk-KBCQ5JGP.js +57 -0
  31. package/Build/Workers/chunk-KKTCNH5B.js +398 -0
  32. package/Build/Workers/chunk-LCSOUDEK.js +58 -0
  33. package/Build/Workers/chunk-LE5B7M4M.js +642 -0
  34. package/Build/Workers/chunk-LPPTJ7CE.js +511 -0
  35. package/Build/Workers/chunk-M3CFFEB7.js +280 -0
  36. package/Build/Workers/chunk-NN52QO5J.js +497 -0
  37. package/Build/Workers/chunk-NO3BDHBF.js +241 -0
  38. package/Build/Workers/chunk-O2H3UW6F.js +256 -0
  39. package/Build/Workers/chunk-OLJ7MBC7.js +439 -0
  40. package/Build/Workers/chunk-OZMVAGFQ.js +2719 -0
  41. package/Build/Workers/chunk-P3S5BWX6.js +219 -0
  42. package/Build/Workers/chunk-PLQPDE4E.js +171 -0
  43. package/Build/Workers/chunk-PYMMZCF6.js +3514 -0
  44. package/Build/Workers/chunk-QIK67M72.js +692 -0
  45. package/Build/Workers/chunk-RDQU66WA.js +124 -0
  46. package/Build/Workers/chunk-S6YC56IM.js +940 -0
  47. package/Build/Workers/chunk-S7CL5IXE.js +138 -0
  48. package/Build/Workers/chunk-SCVFHATG.js +1317 -0
  49. package/Build/Workers/chunk-V3IFABPY.js +44 -0
  50. package/Build/Workers/chunk-VKRSYA3C.js +1067 -0
  51. package/Build/Workers/chunk-VXIA6U3E.js +75 -0
  52. package/Build/Workers/chunk-WKTTAMO3.js +305 -0
  53. package/Build/Workers/chunk-WMMHNRGJ.js +198 -0
  54. package/Build/Workers/chunk-WY6ZUQRU.js +55 -0
  55. package/Build/Workers/chunk-X33W4QLH.js +958 -0
  56. package/Build/Workers/chunk-ZB5XJVWP.js +1460 -0
  57. package/Build/Workers/chunk-ZNQU6MNK.js +352 -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/README.md +1 -1
  112. package/Source/Scene/DerivedCommand.js +1 -1
  113. package/Source/Scene/VoxelContent.js +1 -1
  114. package/index.d.ts +1 -1
  115. package/index.js +9 -9
  116. package/package.json +7 -11
@@ -0,0 +1,299 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.29
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
+ Matrix2_default,
28
+ Quaternion_default,
29
+ Rectangle_default,
30
+ Transforms_default
31
+ } from "./chunk-FKKSB7ZT.js";
32
+ import {
33
+ Matrix4_default
34
+ } from "./chunk-6BUOGRYV.js";
35
+ import {
36
+ WebGLConstants_default
37
+ } from "./chunk-CH66JW7J.js";
38
+ import {
39
+ Cartesian2_default,
40
+ Cartographic_default
41
+ } from "./chunk-ZB5XJVWP.js";
42
+ import {
43
+ Cartesian3_default,
44
+ Frozen_default,
45
+ Matrix3_default
46
+ } from "./chunk-DGMXFRAL.js";
47
+ import {
48
+ Check_default,
49
+ DeveloperError_default
50
+ } from "./chunk-7D5ZXLGY.js";
51
+ import {
52
+ defined_default
53
+ } from "./chunk-VXIA6U3E.js";
54
+
55
+ // packages/engine/Source/Core/GeometryType.js
56
+ var GeometryType = {
57
+ NONE: 0,
58
+ TRIANGLES: 1,
59
+ LINES: 2,
60
+ POLYLINES: 3
61
+ };
62
+ var GeometryType_default = Object.freeze(GeometryType);
63
+
64
+ // packages/engine/Source/Core/PrimitiveType.js
65
+ var PrimitiveType = {
66
+ /**
67
+ * Points primitive where each vertex (or index) is a separate point.
68
+ *
69
+ * @type {number}
70
+ * @constant
71
+ */
72
+ POINTS: WebGLConstants_default.POINTS,
73
+ /**
74
+ * Lines primitive where each two vertices (or indices) is a line segment. Line segments are not necessarily connected.
75
+ *
76
+ * @type {number}
77
+ * @constant
78
+ */
79
+ LINES: WebGLConstants_default.LINES,
80
+ /**
81
+ * Line loop primitive where each vertex (or index) after the first connects a line to
82
+ * the previous vertex, and the last vertex implicitly connects to the first.
83
+ *
84
+ * @type {number}
85
+ * @constant
86
+ */
87
+ LINE_LOOP: WebGLConstants_default.LINE_LOOP,
88
+ /**
89
+ * Line strip primitive where each vertex (or index) after the first connects a line to the previous vertex.
90
+ *
91
+ * @type {number}
92
+ * @constant
93
+ */
94
+ LINE_STRIP: WebGLConstants_default.LINE_STRIP,
95
+ /**
96
+ * Triangles primitive where each three vertices (or indices) is a triangle. Triangles do not necessarily share edges.
97
+ *
98
+ * @type {number}
99
+ * @constant
100
+ */
101
+ TRIANGLES: WebGLConstants_default.TRIANGLES,
102
+ /**
103
+ * Triangle strip primitive where each vertex (or index) after the first two connect to
104
+ * the previous two vertices forming a triangle. For example, this can be used to model a wall.
105
+ *
106
+ * @type {number}
107
+ * @constant
108
+ */
109
+ TRIANGLE_STRIP: WebGLConstants_default.TRIANGLE_STRIP,
110
+ /**
111
+ * Triangle fan primitive where each vertex (or index) after the first two connect to
112
+ * the previous vertex and the first vertex forming a triangle. For example, this can be used
113
+ * to model a cone or circle.
114
+ *
115
+ * @type {number}
116
+ * @constant
117
+ */
118
+ TRIANGLE_FAN: WebGLConstants_default.TRIANGLE_FAN
119
+ };
120
+ PrimitiveType.isLines = function(primitiveType) {
121
+ return primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP;
122
+ };
123
+ PrimitiveType.isTriangles = function(primitiveType) {
124
+ return primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
125
+ };
126
+ PrimitiveType.validate = function(primitiveType) {
127
+ return primitiveType === PrimitiveType.POINTS || primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP || primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
128
+ };
129
+ var PrimitiveType_default = Object.freeze(PrimitiveType);
130
+
131
+ // packages/engine/Source/Core/Geometry.js
132
+ function Geometry(options) {
133
+ options = options ?? Frozen_default.EMPTY_OBJECT;
134
+ Check_default.typeOf.object("options.attributes", options.attributes);
135
+ this.attributes = options.attributes;
136
+ this.indices = options.indices;
137
+ this.primitiveType = options.primitiveType ?? PrimitiveType_default.TRIANGLES;
138
+ this.boundingSphere = options.boundingSphere;
139
+ this.geometryType = options.geometryType ?? GeometryType_default.NONE;
140
+ this.boundingSphereCV = options.boundingSphereCV;
141
+ this.offsetAttribute = options.offsetAttribute;
142
+ }
143
+ Geometry.computeNumberOfVertices = function(geometry) {
144
+ Check_default.typeOf.object("geometry", geometry);
145
+ let numberOfVertices = -1;
146
+ for (const property in geometry.attributes) {
147
+ if (geometry.attributes.hasOwnProperty(property) && defined_default(geometry.attributes[property]) && defined_default(geometry.attributes[property].values)) {
148
+ const attribute = geometry.attributes[property];
149
+ const num = attribute.values.length / attribute.componentsPerAttribute;
150
+ if (numberOfVertices !== num && numberOfVertices !== -1) {
151
+ throw new DeveloperError_default(
152
+ "All attribute lists must have the same number of attributes."
153
+ );
154
+ }
155
+ numberOfVertices = num;
156
+ }
157
+ }
158
+ return numberOfVertices;
159
+ };
160
+ var rectangleCenterScratch = new Cartographic_default();
161
+ var enuCenterScratch = new Cartesian3_default();
162
+ var fixedFrameToEnuScratch = new Matrix4_default();
163
+ var boundingRectanglePointsCartographicScratch = [
164
+ new Cartographic_default(),
165
+ new Cartographic_default(),
166
+ new Cartographic_default()
167
+ ];
168
+ var boundingRectanglePointsEnuScratch = [
169
+ new Cartesian2_default(),
170
+ new Cartesian2_default(),
171
+ new Cartesian2_default()
172
+ ];
173
+ var points2DScratch = [new Cartesian2_default(), new Cartesian2_default(), new Cartesian2_default()];
174
+ var pointEnuScratch = new Cartesian3_default();
175
+ var enuRotationScratch = new Quaternion_default();
176
+ var enuRotationMatrixScratch = new Matrix4_default();
177
+ var rotation2DScratch = new Matrix2_default();
178
+ Geometry._textureCoordinateRotationPoints = function(positions, stRotation, ellipsoid, boundingRectangle) {
179
+ let i;
180
+ const rectangleCenter = Rectangle_default.center(
181
+ boundingRectangle,
182
+ rectangleCenterScratch
183
+ );
184
+ const enuCenter = Cartographic_default.toCartesian(
185
+ rectangleCenter,
186
+ ellipsoid,
187
+ enuCenterScratch
188
+ );
189
+ const enuToFixedFrame = Transforms_default.eastNorthUpToFixedFrame(
190
+ enuCenter,
191
+ ellipsoid,
192
+ fixedFrameToEnuScratch
193
+ );
194
+ const fixedFrameToEnu = Matrix4_default.inverse(
195
+ enuToFixedFrame,
196
+ fixedFrameToEnuScratch
197
+ );
198
+ const boundingPointsEnu = boundingRectanglePointsEnuScratch;
199
+ const boundingPointsCarto = boundingRectanglePointsCartographicScratch;
200
+ boundingPointsCarto[0].longitude = boundingRectangle.west;
201
+ boundingPointsCarto[0].latitude = boundingRectangle.south;
202
+ boundingPointsCarto[1].longitude = boundingRectangle.west;
203
+ boundingPointsCarto[1].latitude = boundingRectangle.north;
204
+ boundingPointsCarto[2].longitude = boundingRectangle.east;
205
+ boundingPointsCarto[2].latitude = boundingRectangle.south;
206
+ let posEnu = pointEnuScratch;
207
+ for (i = 0; i < 3; i++) {
208
+ Cartographic_default.toCartesian(boundingPointsCarto[i], ellipsoid, posEnu);
209
+ posEnu = Matrix4_default.multiplyByPointAsVector(fixedFrameToEnu, posEnu, posEnu);
210
+ boundingPointsEnu[i].x = posEnu.x;
211
+ boundingPointsEnu[i].y = posEnu.y;
212
+ }
213
+ const rotation = Quaternion_default.fromAxisAngle(
214
+ Cartesian3_default.UNIT_Z,
215
+ -stRotation,
216
+ enuRotationScratch
217
+ );
218
+ const textureMatrix = Matrix3_default.fromQuaternion(
219
+ rotation,
220
+ enuRotationMatrixScratch
221
+ );
222
+ const positionsLength = positions.length;
223
+ let enuMinX = Number.POSITIVE_INFINITY;
224
+ let enuMinY = Number.POSITIVE_INFINITY;
225
+ let enuMaxX = Number.NEGATIVE_INFINITY;
226
+ let enuMaxY = Number.NEGATIVE_INFINITY;
227
+ for (i = 0; i < positionsLength; i++) {
228
+ posEnu = Matrix4_default.multiplyByPointAsVector(
229
+ fixedFrameToEnu,
230
+ positions[i],
231
+ posEnu
232
+ );
233
+ posEnu = Matrix3_default.multiplyByVector(textureMatrix, posEnu, posEnu);
234
+ enuMinX = Math.min(enuMinX, posEnu.x);
235
+ enuMinY = Math.min(enuMinY, posEnu.y);
236
+ enuMaxX = Math.max(enuMaxX, posEnu.x);
237
+ enuMaxY = Math.max(enuMaxY, posEnu.y);
238
+ }
239
+ const toDesiredInComputed = Matrix2_default.fromRotation(
240
+ stRotation,
241
+ rotation2DScratch
242
+ );
243
+ const points2D = points2DScratch;
244
+ points2D[0].x = enuMinX;
245
+ points2D[0].y = enuMinY;
246
+ points2D[1].x = enuMinX;
247
+ points2D[1].y = enuMaxY;
248
+ points2D[2].x = enuMaxX;
249
+ points2D[2].y = enuMinY;
250
+ const boundingEnuMin = boundingPointsEnu[0];
251
+ const boundingPointsWidth = boundingPointsEnu[2].x - boundingEnuMin.x;
252
+ const boundingPointsHeight = boundingPointsEnu[1].y - boundingEnuMin.y;
253
+ for (i = 0; i < 3; i++) {
254
+ const point2D = points2D[i];
255
+ Matrix2_default.multiplyByVector(toDesiredInComputed, point2D, point2D);
256
+ point2D.x = (point2D.x - boundingEnuMin.x) / boundingPointsWidth;
257
+ point2D.y = (point2D.y - boundingEnuMin.y) / boundingPointsHeight;
258
+ }
259
+ const minXYCorner = points2D[0];
260
+ const maxYCorner = points2D[1];
261
+ const maxXCorner = points2D[2];
262
+ const result = new Array(6);
263
+ Cartesian2_default.pack(minXYCorner, result);
264
+ Cartesian2_default.pack(maxYCorner, result, 2);
265
+ Cartesian2_default.pack(maxXCorner, result, 4);
266
+ return result;
267
+ };
268
+ var Geometry_default = Geometry;
269
+
270
+ // packages/engine/Source/Core/GeometryAttribute.js
271
+ function GeometryAttribute(options) {
272
+ options = options ?? Frozen_default.EMPTY_OBJECT;
273
+ if (!defined_default(options.componentDatatype)) {
274
+ throw new DeveloperError_default("options.componentDatatype is required.");
275
+ }
276
+ if (!defined_default(options.componentsPerAttribute)) {
277
+ throw new DeveloperError_default("options.componentsPerAttribute is required.");
278
+ }
279
+ if (options.componentsPerAttribute < 1 || options.componentsPerAttribute > 4) {
280
+ throw new DeveloperError_default(
281
+ "options.componentsPerAttribute must be between 1 and 4."
282
+ );
283
+ }
284
+ if (!defined_default(options.values)) {
285
+ throw new DeveloperError_default("options.values is required.");
286
+ }
287
+ this.componentDatatype = options.componentDatatype;
288
+ this.componentsPerAttribute = options.componentsPerAttribute;
289
+ this.normalize = options.normalize ?? false;
290
+ this.values = options.values;
291
+ }
292
+ var GeometryAttribute_default = GeometryAttribute;
293
+
294
+ export {
295
+ GeometryType_default,
296
+ PrimitiveType_default,
297
+ Geometry_default,
298
+ GeometryAttribute_default
299
+ };
@@ -0,0 +1,414 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.29
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
+ EllipsoidGeodesic_default
28
+ } from "./chunk-ZNQU6MNK.js";
29
+ import {
30
+ EllipsoidRhumbLine_default
31
+ } from "./chunk-3ZQ33WD3.js";
32
+ import {
33
+ IntersectionTests_default
34
+ } from "./chunk-SCVFHATG.js";
35
+ import {
36
+ Plane_default
37
+ } from "./chunk-PLQPDE4E.js";
38
+ import {
39
+ Matrix4_default
40
+ } from "./chunk-6BUOGRYV.js";
41
+ import {
42
+ Cartographic_default,
43
+ Ellipsoid_default
44
+ } from "./chunk-ZB5XJVWP.js";
45
+ import {
46
+ Cartesian3_default
47
+ } from "./chunk-DGMXFRAL.js";
48
+ import {
49
+ Math_default
50
+ } from "./chunk-NN52QO5J.js";
51
+ import {
52
+ DeveloperError_default
53
+ } from "./chunk-7D5ZXLGY.js";
54
+ import {
55
+ defined_default
56
+ } from "./chunk-VXIA6U3E.js";
57
+
58
+ // packages/engine/Source/Core/PolylinePipeline.js
59
+ var PolylinePipeline = {};
60
+ PolylinePipeline.numberOfPoints = function(p0, p1, minDistance) {
61
+ const distance = Cartesian3_default.distance(p0, p1);
62
+ return Math.ceil(distance / minDistance);
63
+ };
64
+ PolylinePipeline.numberOfPointsRhumbLine = function(p0, p1, granularity) {
65
+ const radiansDistanceSquared = Math.pow(p0.longitude - p1.longitude, 2) + Math.pow(p0.latitude - p1.latitude, 2);
66
+ return Math.max(
67
+ 1,
68
+ Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity)))
69
+ );
70
+ };
71
+ var cartoScratch = new Cartographic_default();
72
+ PolylinePipeline.extractHeights = function(positions, ellipsoid) {
73
+ const length = positions.length;
74
+ const heights = new Array(length);
75
+ for (let i = 0; i < length; i++) {
76
+ const p = positions[i];
77
+ heights[i] = ellipsoid.cartesianToCartographic(p, cartoScratch).height;
78
+ }
79
+ return heights;
80
+ };
81
+ var wrapLongitudeInversMatrix = new Matrix4_default();
82
+ var wrapLongitudeOrigin = new Cartesian3_default();
83
+ var wrapLongitudeXZNormal = new Cartesian3_default();
84
+ var wrapLongitudeXZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
85
+ var wrapLongitudeYZNormal = new Cartesian3_default();
86
+ var wrapLongitudeYZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
87
+ var wrapLongitudeIntersection = new Cartesian3_default();
88
+ var wrapLongitudeOffset = new Cartesian3_default();
89
+ var subdivideHeightsScratchArray = [];
90
+ function subdivideHeights(numPoints, h0, h1) {
91
+ const heights = subdivideHeightsScratchArray;
92
+ heights.length = numPoints;
93
+ let i;
94
+ if (h0 === h1) {
95
+ for (i = 0; i < numPoints; i++) {
96
+ heights[i] = h0;
97
+ }
98
+ return heights;
99
+ }
100
+ const dHeight = h1 - h0;
101
+ const heightPerVertex = dHeight / numPoints;
102
+ for (i = 0; i < numPoints; i++) {
103
+ const h = h0 + i * heightPerVertex;
104
+ heights[i] = h;
105
+ }
106
+ return heights;
107
+ }
108
+ var carto1 = new Cartographic_default();
109
+ var carto2 = new Cartographic_default();
110
+ var cartesian = new Cartesian3_default();
111
+ var scaleFirst = new Cartesian3_default();
112
+ var scaleLast = new Cartesian3_default();
113
+ var ellipsoidGeodesic = new EllipsoidGeodesic_default();
114
+ var ellipsoidRhumb = new EllipsoidRhumbLine_default();
115
+ function generateCartesianArc(p0, p1, minDistance, ellipsoid, h0, h1, array, offset) {
116
+ const first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
117
+ const last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
118
+ const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);
119
+ const start = ellipsoid.cartesianToCartographic(first, carto1);
120
+ const end = ellipsoid.cartesianToCartographic(last, carto2);
121
+ const heights = subdivideHeights(numPoints, h0, h1);
122
+ ellipsoidGeodesic.setEndPoints(start, end);
123
+ const surfaceDistanceBetweenPoints = ellipsoidGeodesic.surfaceDistance / numPoints;
124
+ let index = offset;
125
+ start.height = h0;
126
+ let cart = ellipsoid.cartographicToCartesian(start, cartesian);
127
+ Cartesian3_default.pack(cart, array, index);
128
+ index += 3;
129
+ for (let i = 1; i < numPoints; i++) {
130
+ const carto = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
131
+ i * surfaceDistanceBetweenPoints,
132
+ carto2
133
+ );
134
+ carto.height = heights[i];
135
+ cart = ellipsoid.cartographicToCartesian(carto, cartesian);
136
+ Cartesian3_default.pack(cart, array, index);
137
+ index += 3;
138
+ }
139
+ return index;
140
+ }
141
+ function generateCartesianRhumbArc(p0, p1, granularity, ellipsoid, h0, h1, array, offset) {
142
+ const start = ellipsoid.cartesianToCartographic(p0, carto1);
143
+ const end = ellipsoid.cartesianToCartographic(p1, carto2);
144
+ const numPoints = PolylinePipeline.numberOfPointsRhumbLine(
145
+ start,
146
+ end,
147
+ granularity
148
+ );
149
+ start.height = 0;
150
+ end.height = 0;
151
+ const heights = subdivideHeights(numPoints, h0, h1);
152
+ if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
153
+ ellipsoidRhumb = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
154
+ }
155
+ ellipsoidRhumb.setEndPoints(start, end);
156
+ const surfaceDistanceBetweenPoints = ellipsoidRhumb.surfaceDistance / numPoints;
157
+ let index = offset;
158
+ start.height = h0;
159
+ let cart = ellipsoid.cartographicToCartesian(start, cartesian);
160
+ Cartesian3_default.pack(cart, array, index);
161
+ index += 3;
162
+ for (let i = 1; i < numPoints; i++) {
163
+ const carto = ellipsoidRhumb.interpolateUsingSurfaceDistance(
164
+ i * surfaceDistanceBetweenPoints,
165
+ carto2
166
+ );
167
+ carto.height = heights[i];
168
+ cart = ellipsoid.cartographicToCartesian(carto, cartesian);
169
+ Cartesian3_default.pack(cart, array, index);
170
+ index += 3;
171
+ }
172
+ return index;
173
+ }
174
+ PolylinePipeline.wrapLongitude = function(positions, modelMatrix) {
175
+ const cartesians = [];
176
+ const segments = [];
177
+ if (defined_default(positions) && positions.length > 0) {
178
+ modelMatrix = modelMatrix ?? Matrix4_default.IDENTITY;
179
+ const inverseModelMatrix = Matrix4_default.inverseTransformation(
180
+ modelMatrix,
181
+ wrapLongitudeInversMatrix
182
+ );
183
+ const origin = Matrix4_default.multiplyByPoint(
184
+ inverseModelMatrix,
185
+ Cartesian3_default.ZERO,
186
+ wrapLongitudeOrigin
187
+ );
188
+ const xzNormal = Cartesian3_default.normalize(
189
+ Matrix4_default.multiplyByPointAsVector(
190
+ inverseModelMatrix,
191
+ Cartesian3_default.UNIT_Y,
192
+ wrapLongitudeXZNormal
193
+ ),
194
+ wrapLongitudeXZNormal
195
+ );
196
+ const xzPlane = Plane_default.fromPointNormal(
197
+ origin,
198
+ xzNormal,
199
+ wrapLongitudeXZPlane
200
+ );
201
+ const yzNormal = Cartesian3_default.normalize(
202
+ Matrix4_default.multiplyByPointAsVector(
203
+ inverseModelMatrix,
204
+ Cartesian3_default.UNIT_X,
205
+ wrapLongitudeYZNormal
206
+ ),
207
+ wrapLongitudeYZNormal
208
+ );
209
+ const yzPlane = Plane_default.fromPointNormal(
210
+ origin,
211
+ yzNormal,
212
+ wrapLongitudeYZPlane
213
+ );
214
+ let count = 1;
215
+ cartesians.push(Cartesian3_default.clone(positions[0]));
216
+ let prev = cartesians[0];
217
+ const length = positions.length;
218
+ for (let i = 1; i < length; ++i) {
219
+ const cur = positions[i];
220
+ if (Plane_default.getPointDistance(yzPlane, prev) < 0 || Plane_default.getPointDistance(yzPlane, cur) < 0) {
221
+ const intersection = IntersectionTests_default.lineSegmentPlane(
222
+ prev,
223
+ cur,
224
+ xzPlane,
225
+ wrapLongitudeIntersection
226
+ );
227
+ if (defined_default(intersection)) {
228
+ const offset = Cartesian3_default.multiplyByScalar(
229
+ xzNormal,
230
+ 5e-9,
231
+ wrapLongitudeOffset
232
+ );
233
+ if (Plane_default.getPointDistance(xzPlane, prev) < 0) {
234
+ Cartesian3_default.negate(offset, offset);
235
+ }
236
+ cartesians.push(
237
+ Cartesian3_default.add(intersection, offset, new Cartesian3_default())
238
+ );
239
+ segments.push(count + 1);
240
+ Cartesian3_default.negate(offset, offset);
241
+ cartesians.push(
242
+ Cartesian3_default.add(intersection, offset, new Cartesian3_default())
243
+ );
244
+ count = 1;
245
+ }
246
+ }
247
+ cartesians.push(Cartesian3_default.clone(positions[i]));
248
+ count++;
249
+ prev = cur;
250
+ }
251
+ segments.push(count);
252
+ }
253
+ return {
254
+ positions: cartesians,
255
+ lengths: segments
256
+ };
257
+ };
258
+ PolylinePipeline.generateArc = function(options) {
259
+ if (!defined_default(options)) {
260
+ options = {};
261
+ }
262
+ const positions = options.positions;
263
+ if (!defined_default(positions)) {
264
+ throw new DeveloperError_default("options.positions is required.");
265
+ }
266
+ const length = positions.length;
267
+ const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
268
+ let height = options.height ?? 0;
269
+ const hasHeightArray = Array.isArray(height);
270
+ if (length < 1) {
271
+ return [];
272
+ } else if (length === 1) {
273
+ const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
274
+ height = hasHeightArray ? height[0] : height;
275
+ if (height !== 0) {
276
+ const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
277
+ Cartesian3_default.multiplyByScalar(n, height, n);
278
+ Cartesian3_default.add(p, n, p);
279
+ }
280
+ return [p.x, p.y, p.z];
281
+ }
282
+ let minDistance = options.minDistance;
283
+ if (!defined_default(minDistance)) {
284
+ const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
285
+ minDistance = Math_default.chordLength(granularity, ellipsoid.maximumRadius);
286
+ }
287
+ let numPoints = 0;
288
+ let i;
289
+ for (i = 0; i < length - 1; i++) {
290
+ numPoints += PolylinePipeline.numberOfPoints(
291
+ positions[i],
292
+ positions[i + 1],
293
+ minDistance
294
+ );
295
+ }
296
+ const arrayLength = (numPoints + 1) * 3;
297
+ const newPositions = new Array(arrayLength);
298
+ let offset = 0;
299
+ for (i = 0; i < length - 1; i++) {
300
+ const p0 = positions[i];
301
+ const p1 = positions[i + 1];
302
+ const h0 = hasHeightArray ? height[i] : height;
303
+ const h1 = hasHeightArray ? height[i + 1] : height;
304
+ offset = generateCartesianArc(
305
+ p0,
306
+ p1,
307
+ minDistance,
308
+ ellipsoid,
309
+ h0,
310
+ h1,
311
+ newPositions,
312
+ offset
313
+ );
314
+ }
315
+ subdivideHeightsScratchArray.length = 0;
316
+ const lastPoint = positions[length - 1];
317
+ const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
318
+ carto.height = hasHeightArray ? height[length - 1] : height;
319
+ const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
320
+ Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
321
+ return newPositions;
322
+ };
323
+ var scratchCartographic0 = new Cartographic_default();
324
+ var scratchCartographic1 = new Cartographic_default();
325
+ PolylinePipeline.generateRhumbArc = function(options) {
326
+ if (!defined_default(options)) {
327
+ options = {};
328
+ }
329
+ const positions = options.positions;
330
+ if (!defined_default(positions)) {
331
+ throw new DeveloperError_default("options.positions is required.");
332
+ }
333
+ const length = positions.length;
334
+ const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
335
+ let height = options.height ?? 0;
336
+ const hasHeightArray = Array.isArray(height);
337
+ if (length < 1) {
338
+ return [];
339
+ } else if (length === 1) {
340
+ const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
341
+ height = hasHeightArray ? height[0] : height;
342
+ if (height !== 0) {
343
+ const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
344
+ Cartesian3_default.multiplyByScalar(n, height, n);
345
+ Cartesian3_default.add(p, n, p);
346
+ }
347
+ return [p.x, p.y, p.z];
348
+ }
349
+ const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
350
+ let numPoints = 0;
351
+ let i;
352
+ let c0 = ellipsoid.cartesianToCartographic(
353
+ positions[0],
354
+ scratchCartographic0
355
+ );
356
+ let c1;
357
+ for (i = 0; i < length - 1; i++) {
358
+ c1 = ellipsoid.cartesianToCartographic(
359
+ positions[i + 1],
360
+ scratchCartographic1
361
+ );
362
+ numPoints += PolylinePipeline.numberOfPointsRhumbLine(c0, c1, granularity);
363
+ c0 = Cartographic_default.clone(c1, scratchCartographic0);
364
+ }
365
+ const arrayLength = (numPoints + 1) * 3;
366
+ const newPositions = new Array(arrayLength);
367
+ let offset = 0;
368
+ for (i = 0; i < length - 1; i++) {
369
+ const p0 = positions[i];
370
+ const p1 = positions[i + 1];
371
+ const h0 = hasHeightArray ? height[i] : height;
372
+ const h1 = hasHeightArray ? height[i + 1] : height;
373
+ offset = generateCartesianRhumbArc(
374
+ p0,
375
+ p1,
376
+ granularity,
377
+ ellipsoid,
378
+ h0,
379
+ h1,
380
+ newPositions,
381
+ offset
382
+ );
383
+ }
384
+ subdivideHeightsScratchArray.length = 0;
385
+ const lastPoint = positions[length - 1];
386
+ const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
387
+ carto.height = hasHeightArray ? height[length - 1] : height;
388
+ const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
389
+ Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
390
+ return newPositions;
391
+ };
392
+ PolylinePipeline.generateCartesianArc = function(options) {
393
+ const numberArray = PolylinePipeline.generateArc(options);
394
+ const size = numberArray.length / 3;
395
+ const newPositions = new Array(size);
396
+ for (let i = 0; i < size; i++) {
397
+ newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
398
+ }
399
+ return newPositions;
400
+ };
401
+ PolylinePipeline.generateCartesianRhumbArc = function(options) {
402
+ const numberArray = PolylinePipeline.generateRhumbArc(options);
403
+ const size = numberArray.length / 3;
404
+ const newPositions = new Array(size);
405
+ for (let i = 0; i < size; i++) {
406
+ newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
407
+ }
408
+ return newPositions;
409
+ };
410
+ var PolylinePipeline_default = PolylinePipeline;
411
+
412
+ export {
413
+ PolylinePipeline_default
414
+ };