deeptwins-cesium-engine 0.0.39 → 0.0.40

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 (104) hide show
  1. package/Build/Workers/chunk-22YARAUJ.js +629 -0
  2. package/Build/Workers/chunk-2HVM4MOI.js +220 -0
  3. package/Build/Workers/chunk-2PWEYBYR.js +75 -0
  4. package/Build/Workers/chunk-2ZI2BRKI.js +37 -0
  5. package/Build/Workers/chunk-3Q6HPHTH.js +684 -0
  6. package/Build/Workers/chunk-4LE3SGQH.js +634 -0
  7. package/Build/Workers/chunk-5IBSBFAA.js +287 -0
  8. package/Build/Workers/chunk-5ZELPLWF.js +58 -0
  9. package/Build/Workers/chunk-73EDFMPB.js +1073 -0
  10. package/Build/Workers/chunk-ALIDMMNJ.js +10357 -0
  11. package/Build/Workers/chunk-AXTXYHVG.js +59 -0
  12. package/Build/Workers/chunk-B3DSUDQQ.js +101 -0
  13. package/Build/Workers/chunk-B7R4KLQV.js +959 -0
  14. package/Build/Workers/chunk-CET7MMFD.js +1055 -0
  15. package/Build/Workers/chunk-DGWWFN6L.js +102 -0
  16. package/Build/Workers/chunk-DPZEBUVY.js +122 -0
  17. package/Build/Workers/chunk-EKUYACAZ.js +163 -0
  18. package/Build/Workers/chunk-ETQJFLBY.js +435 -0
  19. package/Build/Workers/chunk-HDJDQBU6.js +758 -0
  20. package/Build/Workers/chunk-HOO3H5M5.js +171 -0
  21. package/Build/Workers/chunk-JRFRSSGD.js +1800 -0
  22. package/Build/Workers/chunk-KMDXAR34.js +1481 -0
  23. package/Build/Workers/chunk-KZDZFG2L.js +157 -0
  24. package/Build/Workers/chunk-LDXSEGOX.js +2857 -0
  25. package/Build/Workers/chunk-LYJFG66W.js +196 -0
  26. package/Build/Workers/chunk-N2UJHZ4W.js +368 -0
  27. package/Build/Workers/chunk-NZU4VBYI.js +834 -0
  28. package/Build/Workers/chunk-OY2Z6SFD.js +100 -0
  29. package/Build/Workers/chunk-PA4JZFFM.js +353 -0
  30. package/Build/Workers/chunk-QUJ6BNQF.js +39 -0
  31. package/Build/Workers/chunk-ROPEB47Y.js +300 -0
  32. package/Build/Workers/chunk-S3RIIJID.js +781 -0
  33. package/Build/Workers/chunk-SPS2I45W.js +73 -0
  34. package/Build/Workers/chunk-TBJBVKDE.js +262 -0
  35. package/Build/Workers/chunk-TJAONFQM.js +44 -0
  36. package/Build/Workers/chunk-TJNJ6CLS.js +239 -0
  37. package/Build/Workers/chunk-U4SUBL6L.js +390 -0
  38. package/Build/Workers/chunk-U6RITS73.js +456 -0
  39. package/Build/Workers/chunk-UHPBZJQF.js +2717 -0
  40. package/Build/Workers/chunk-UHS2YM44.js +115 -0
  41. package/Build/Workers/chunk-UN3RMNI2.js +500 -0
  42. package/Build/Workers/chunk-UYS2HZVM.js +421 -0
  43. package/Build/Workers/chunk-VSEDVQN7.js +305 -0
  44. package/Build/Workers/chunk-W7KOAHR2.js +691 -0
  45. package/Build/Workers/chunk-WGHS4HMU.js +55 -0
  46. package/Build/Workers/chunk-XV4SYFDP.js +138 -0
  47. package/Build/Workers/chunk-XX7RETEX.js +1258 -0
  48. package/Build/Workers/chunk-XYMJZUFF.js +476 -0
  49. package/Build/Workers/chunk-YCU6WHSN.js +963 -0
  50. package/Build/Workers/chunk-YWEX5QFW.js +398 -0
  51. package/Build/Workers/chunk-Z2WOKKJM.js +511 -0
  52. package/Build/Workers/chunk-ZYUOPFWQ.js +139 -0
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Scene/Billboard.js +22 -0
  102. package/Source/Scene/BillboardTexture.js +92 -2
  103. package/index.js +97 -97
  104. package/package.json +1 -1
@@ -0,0 +1,1055 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.39
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
+ ArcType_default
28
+ } from "./chunk-WGHS4HMU.js";
29
+ import {
30
+ GeometryPipeline_default
31
+ } from "./chunk-UHPBZJQF.js";
32
+ import {
33
+ PolygonPipeline_default,
34
+ WindingOrder_default
35
+ } from "./chunk-B7R4KLQV.js";
36
+ import {
37
+ arrayRemoveDuplicates_default
38
+ } from "./chunk-OY2Z6SFD.js";
39
+ import {
40
+ EllipsoidRhumbLine_default
41
+ } from "./chunk-U6RITS73.js";
42
+ import {
43
+ IntersectionTests_default
44
+ } from "./chunk-XX7RETEX.js";
45
+ import {
46
+ Plane_default
47
+ } from "./chunk-HOO3H5M5.js";
48
+ import {
49
+ IndexDatatype_default
50
+ } from "./chunk-ZYUOPFWQ.js";
51
+ import {
52
+ GeometryAttributes_default
53
+ } from "./chunk-TJAONFQM.js";
54
+ import {
55
+ GeometryAttribute_default,
56
+ Geometry_default,
57
+ PrimitiveType_default
58
+ } from "./chunk-ROPEB47Y.js";
59
+ import {
60
+ Quaternion_default
61
+ } from "./chunk-ALIDMMNJ.js";
62
+ import {
63
+ ComponentDatatype_default
64
+ } from "./chunk-TBJBVKDE.js";
65
+ import {
66
+ Cartesian2_default,
67
+ Cartesian3_default,
68
+ Cartographic_default,
69
+ Ellipsoid_default,
70
+ Matrix3_default
71
+ } from "./chunk-LDXSEGOX.js";
72
+ import {
73
+ Math_default
74
+ } from "./chunk-UN3RMNI2.js";
75
+ import {
76
+ defaultValue_default
77
+ } from "./chunk-QUJ6BNQF.js";
78
+ import {
79
+ defined_default
80
+ } from "./chunk-2PWEYBYR.js";
81
+
82
+ // packages/engine/Source/Core/PolygonHierarchy.js
83
+ function PolygonHierarchy(positions, holes) {
84
+ this.positions = defined_default(positions) ? positions : [];
85
+ this.holes = defined_default(holes) ? holes : [];
86
+ }
87
+ var PolygonHierarchy_default = PolygonHierarchy;
88
+
89
+ // packages/engine/Source/Core/Queue.js
90
+ function Queue() {
91
+ this._array = [];
92
+ this._offset = 0;
93
+ this._length = 0;
94
+ }
95
+ Object.defineProperties(Queue.prototype, {
96
+ /**
97
+ * The length of the queue.
98
+ *
99
+ * @memberof Queue.prototype
100
+ *
101
+ * @type {number}
102
+ * @readonly
103
+ */
104
+ length: {
105
+ get: function() {
106
+ return this._length;
107
+ }
108
+ }
109
+ });
110
+ Queue.prototype.enqueue = function(item) {
111
+ this._array.push(item);
112
+ this._length++;
113
+ };
114
+ Queue.prototype.dequeue = function() {
115
+ if (this._length === 0) {
116
+ return void 0;
117
+ }
118
+ const array = this._array;
119
+ let offset = this._offset;
120
+ const item = array[offset];
121
+ array[offset] = void 0;
122
+ offset++;
123
+ if (offset > 10 && offset * 2 > array.length) {
124
+ this._array = array.slice(offset);
125
+ offset = 0;
126
+ }
127
+ this._offset = offset;
128
+ this._length--;
129
+ return item;
130
+ };
131
+ Queue.prototype.peek = function() {
132
+ if (this._length === 0) {
133
+ return void 0;
134
+ }
135
+ return this._array[this._offset];
136
+ };
137
+ Queue.prototype.contains = function(item) {
138
+ return this._array.indexOf(item) !== -1;
139
+ };
140
+ Queue.prototype.clear = function() {
141
+ this._array.length = this._offset = this._length = 0;
142
+ };
143
+ Queue.prototype.sort = function(compareFunction) {
144
+ if (this._offset > 0) {
145
+ this._array = this._array.slice(this._offset);
146
+ this._offset = 0;
147
+ }
148
+ this._array.sort(compareFunction);
149
+ };
150
+ var Queue_default = Queue;
151
+
152
+ // packages/engine/Source/Core/PolygonGeometryLibrary.js
153
+ var PolygonGeometryLibrary = {};
154
+ PolygonGeometryLibrary.computeHierarchyPackedLength = function(polygonHierarchy, CartesianX) {
155
+ let numComponents = 0;
156
+ const stack = [polygonHierarchy];
157
+ while (stack.length > 0) {
158
+ const hierarchy = stack.pop();
159
+ if (!defined_default(hierarchy)) {
160
+ continue;
161
+ }
162
+ numComponents += 2;
163
+ const positions = hierarchy.positions;
164
+ const holes = hierarchy.holes;
165
+ if (defined_default(positions) && positions.length > 0) {
166
+ numComponents += positions.length * CartesianX.packedLength;
167
+ }
168
+ if (defined_default(holes)) {
169
+ const length = holes.length;
170
+ for (let i = 0; i < length; ++i) {
171
+ stack.push(holes[i]);
172
+ }
173
+ }
174
+ }
175
+ return numComponents;
176
+ };
177
+ PolygonGeometryLibrary.packPolygonHierarchy = function(polygonHierarchy, array, startingIndex, CartesianX) {
178
+ const stack = [polygonHierarchy];
179
+ while (stack.length > 0) {
180
+ const hierarchy = stack.pop();
181
+ if (!defined_default(hierarchy)) {
182
+ continue;
183
+ }
184
+ const positions = hierarchy.positions;
185
+ const holes = hierarchy.holes;
186
+ array[startingIndex++] = defined_default(positions) ? positions.length : 0;
187
+ array[startingIndex++] = defined_default(holes) ? holes.length : 0;
188
+ if (defined_default(positions)) {
189
+ const positionsLength = positions.length;
190
+ for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
191
+ CartesianX.pack(positions[i], array, startingIndex);
192
+ }
193
+ }
194
+ if (defined_default(holes)) {
195
+ const holesLength = holes.length;
196
+ for (let j = 0; j < holesLength; ++j) {
197
+ stack.push(holes[j]);
198
+ }
199
+ }
200
+ }
201
+ return startingIndex;
202
+ };
203
+ PolygonGeometryLibrary.unpackPolygonHierarchy = function(array, startingIndex, CartesianX) {
204
+ const positionsLength = array[startingIndex++];
205
+ const holesLength = array[startingIndex++];
206
+ const positions = new Array(positionsLength);
207
+ const holes = holesLength > 0 ? new Array(holesLength) : void 0;
208
+ for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
209
+ positions[i] = CartesianX.unpack(array, startingIndex);
210
+ }
211
+ for (let j = 0; j < holesLength; ++j) {
212
+ holes[j] = PolygonGeometryLibrary.unpackPolygonHierarchy(
213
+ array,
214
+ startingIndex,
215
+ CartesianX
216
+ );
217
+ startingIndex = holes[j].startingIndex;
218
+ delete holes[j].startingIndex;
219
+ }
220
+ return {
221
+ positions,
222
+ holes,
223
+ startingIndex
224
+ };
225
+ };
226
+ var distance2DScratch = new Cartesian2_default();
227
+ function getPointAtDistance2D(p0, p1, distance, length) {
228
+ Cartesian2_default.subtract(p1, p0, distance2DScratch);
229
+ Cartesian2_default.multiplyByScalar(
230
+ distance2DScratch,
231
+ distance / length,
232
+ distance2DScratch
233
+ );
234
+ Cartesian2_default.add(p0, distance2DScratch, distance2DScratch);
235
+ return [distance2DScratch.x, distance2DScratch.y];
236
+ }
237
+ var distanceScratch = new Cartesian3_default();
238
+ function getPointAtDistance(p0, p1, distance, length) {
239
+ Cartesian3_default.subtract(p1, p0, distanceScratch);
240
+ Cartesian3_default.multiplyByScalar(
241
+ distanceScratch,
242
+ distance / length,
243
+ distanceScratch
244
+ );
245
+ Cartesian3_default.add(p0, distanceScratch, distanceScratch);
246
+ return [distanceScratch.x, distanceScratch.y, distanceScratch.z];
247
+ }
248
+ PolygonGeometryLibrary.subdivideLineCount = function(p0, p1, minDistance) {
249
+ const distance = Cartesian3_default.distance(p0, p1);
250
+ const n = distance / minDistance;
251
+ const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
252
+ return Math.pow(2, countDivide);
253
+ };
254
+ var scratchCartographic0 = new Cartographic_default();
255
+ var scratchCartographic1 = new Cartographic_default();
256
+ var scratchCartographic2 = new Cartographic_default();
257
+ var scratchCartesian0 = new Cartesian3_default();
258
+ var scratchRhumbLine = new EllipsoidRhumbLine_default();
259
+ PolygonGeometryLibrary.subdivideRhumbLineCount = function(ellipsoid, p0, p1, minDistance) {
260
+ const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
261
+ const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
262
+ const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
263
+ const n = rhumb.surfaceDistance / minDistance;
264
+ const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
265
+ return Math.pow(2, countDivide);
266
+ };
267
+ PolygonGeometryLibrary.subdivideTexcoordLine = function(t0, t1, p0, p1, minDistance, result) {
268
+ const subdivisions = PolygonGeometryLibrary.subdivideLineCount(
269
+ p0,
270
+ p1,
271
+ minDistance
272
+ );
273
+ const length2D = Cartesian2_default.distance(t0, t1);
274
+ const distanceBetweenCoords = length2D / subdivisions;
275
+ const texcoords = result;
276
+ texcoords.length = subdivisions * 2;
277
+ let index = 0;
278
+ for (let i = 0; i < subdivisions; i++) {
279
+ const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
280
+ texcoords[index++] = t[0];
281
+ texcoords[index++] = t[1];
282
+ }
283
+ return texcoords;
284
+ };
285
+ PolygonGeometryLibrary.subdivideLine = function(p0, p1, minDistance, result) {
286
+ const numVertices = PolygonGeometryLibrary.subdivideLineCount(
287
+ p0,
288
+ p1,
289
+ minDistance
290
+ );
291
+ const length = Cartesian3_default.distance(p0, p1);
292
+ const distanceBetweenVertices = length / numVertices;
293
+ if (!defined_default(result)) {
294
+ result = [];
295
+ }
296
+ const positions = result;
297
+ positions.length = numVertices * 3;
298
+ let index = 0;
299
+ for (let i = 0; i < numVertices; i++) {
300
+ const p = getPointAtDistance(p0, p1, i * distanceBetweenVertices, length);
301
+ positions[index++] = p[0];
302
+ positions[index++] = p[1];
303
+ positions[index++] = p[2];
304
+ }
305
+ return positions;
306
+ };
307
+ PolygonGeometryLibrary.subdivideTexcoordRhumbLine = function(t0, t1, ellipsoid, p0, p1, minDistance, result) {
308
+ const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
309
+ const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
310
+ scratchRhumbLine.setEndPoints(c0, c1);
311
+ const n = scratchRhumbLine.surfaceDistance / minDistance;
312
+ const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
313
+ const subdivisions = Math.pow(2, countDivide);
314
+ const length2D = Cartesian2_default.distance(t0, t1);
315
+ const distanceBetweenCoords = length2D / subdivisions;
316
+ const texcoords = result;
317
+ texcoords.length = subdivisions * 2;
318
+ let index = 0;
319
+ for (let i = 0; i < subdivisions; i++) {
320
+ const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
321
+ texcoords[index++] = t[0];
322
+ texcoords[index++] = t[1];
323
+ }
324
+ return texcoords;
325
+ };
326
+ PolygonGeometryLibrary.subdivideRhumbLine = function(ellipsoid, p0, p1, minDistance, result) {
327
+ const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
328
+ const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
329
+ const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
330
+ if (!defined_default(result)) {
331
+ result = [];
332
+ }
333
+ if (rhumb.surfaceDistance <= minDistance) {
334
+ result.length = 3;
335
+ result[0] = p0.x;
336
+ result[1] = p0.y;
337
+ result[2] = p0.z;
338
+ return result;
339
+ }
340
+ const n = rhumb.surfaceDistance / minDistance;
341
+ const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
342
+ const numVertices = Math.pow(2, countDivide);
343
+ const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
344
+ const positions = result;
345
+ positions.length = numVertices * 3;
346
+ let index = 0;
347
+ for (let i = 0; i < numVertices; i++) {
348
+ const c = rhumb.interpolateUsingSurfaceDistance(
349
+ i * distanceBetweenVertices,
350
+ scratchCartographic2
351
+ );
352
+ const p = ellipsoid.cartographicToCartesian(c, scratchCartesian0);
353
+ positions[index++] = p.x;
354
+ positions[index++] = p.y;
355
+ positions[index++] = p.z;
356
+ }
357
+ return positions;
358
+ };
359
+ var scaleToGeodeticHeightN1 = new Cartesian3_default();
360
+ var scaleToGeodeticHeightN2 = new Cartesian3_default();
361
+ var scaleToGeodeticHeightP1 = new Cartesian3_default();
362
+ var scaleToGeodeticHeightP2 = new Cartesian3_default();
363
+ PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
364
+ ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
365
+ const n1 = scaleToGeodeticHeightN1;
366
+ let n2 = scaleToGeodeticHeightN2;
367
+ const p = scaleToGeodeticHeightP1;
368
+ let p2 = scaleToGeodeticHeightP2;
369
+ if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
370
+ const positions = geometry.attributes.position.values;
371
+ const length = positions.length / 2;
372
+ for (let i = 0; i < length; i += 3) {
373
+ Cartesian3_default.fromArray(positions, i, p);
374
+ ellipsoid.geodeticSurfaceNormal(p, n1);
375
+ p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
376
+ n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
377
+ n2 = Cartesian3_default.add(p2, n2, n2);
378
+ positions[i + length] = n2.x;
379
+ positions[i + 1 + length] = n2.y;
380
+ positions[i + 2 + length] = n2.z;
381
+ if (perPositionHeight) {
382
+ p2 = Cartesian3_default.clone(p, p2);
383
+ }
384
+ n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
385
+ n2 = Cartesian3_default.add(p2, n2, n2);
386
+ positions[i] = n2.x;
387
+ positions[i + 1] = n2.y;
388
+ positions[i + 2] = n2.z;
389
+ }
390
+ }
391
+ return geometry;
392
+ };
393
+ PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
394
+ const polygons = [];
395
+ const queue = new Queue_default();
396
+ queue.enqueue(polygonHierarchy);
397
+ let i;
398
+ let j;
399
+ let length;
400
+ while (queue.length !== 0) {
401
+ const outerNode = queue.dequeue();
402
+ let outerRing = outerNode.positions;
403
+ if (scaleToEllipsoidSurface) {
404
+ length = outerRing.length;
405
+ for (i = 0; i < length; i++) {
406
+ ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
407
+ }
408
+ }
409
+ outerRing = arrayRemoveDuplicates_default(
410
+ outerRing,
411
+ Cartesian3_default.equalsEpsilon,
412
+ true
413
+ );
414
+ if (outerRing.length < 3) {
415
+ continue;
416
+ }
417
+ const numChildren = outerNode.holes ? outerNode.holes.length : 0;
418
+ for (i = 0; i < numChildren; i++) {
419
+ const hole = outerNode.holes[i];
420
+ let holePositions = hole.positions;
421
+ if (scaleToEllipsoidSurface) {
422
+ length = holePositions.length;
423
+ for (j = 0; j < length; ++j) {
424
+ ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
425
+ }
426
+ }
427
+ holePositions = arrayRemoveDuplicates_default(
428
+ holePositions,
429
+ Cartesian3_default.equalsEpsilon,
430
+ true
431
+ );
432
+ if (holePositions.length < 3) {
433
+ continue;
434
+ }
435
+ polygons.push(holePositions);
436
+ let numGrandchildren = 0;
437
+ if (defined_default(hole.holes)) {
438
+ numGrandchildren = hole.holes.length;
439
+ }
440
+ for (j = 0; j < numGrandchildren; j++) {
441
+ queue.enqueue(hole.holes[j]);
442
+ }
443
+ }
444
+ polygons.push(outerRing);
445
+ }
446
+ return polygons;
447
+ };
448
+ var scratchRhumbIntersection = new Cartographic_default();
449
+ function computeEquatorIntersectionRhumb(start, end, ellipsoid) {
450
+ const c0 = ellipsoid.cartesianToCartographic(start, scratchCartographic0);
451
+ const c1 = ellipsoid.cartesianToCartographic(end, scratchCartographic1);
452
+ if (Math.sign(c0.latitude) === Math.sign(c1.latitude)) {
453
+ return;
454
+ }
455
+ scratchRhumbLine.setEndPoints(c0, c1);
456
+ const intersection = scratchRhumbLine.findIntersectionWithLatitude(
457
+ 0,
458
+ scratchRhumbIntersection
459
+ );
460
+ if (!defined_default(intersection)) {
461
+ return;
462
+ }
463
+ let minLongitude = Math.min(c0.longitude, c1.longitude);
464
+ let maxLongitude = Math.max(c0.longitude, c1.longitude);
465
+ if (Math.abs(maxLongitude - minLongitude) > Math_default.PI) {
466
+ const swap = minLongitude;
467
+ minLongitude = maxLongitude;
468
+ maxLongitude = swap;
469
+ }
470
+ if (intersection.longitude < minLongitude || intersection.longitude > maxLongitude) {
471
+ return;
472
+ }
473
+ return ellipsoid.cartographicToCartesian(intersection);
474
+ }
475
+ function computeEquatorIntersection(start, end, ellipsoid, arcType) {
476
+ if (arcType === ArcType_default.RHUMB) {
477
+ return computeEquatorIntersectionRhumb(start, end, ellipsoid);
478
+ }
479
+ const intersection = IntersectionTests_default.lineSegmentPlane(
480
+ start,
481
+ end,
482
+ Plane_default.ORIGIN_XY_PLANE
483
+ );
484
+ if (!defined_default(intersection)) {
485
+ return;
486
+ }
487
+ return ellipsoid.scaleToGeodeticSurface(intersection, intersection);
488
+ }
489
+ var scratchCartographic = new Cartographic_default();
490
+ function computeEdgesOnPlane(positions, ellipsoid, arcType) {
491
+ const edgesOnPlane = [];
492
+ let startPoint, endPoint, type, next, intersection, i = 0;
493
+ while (i < positions.length) {
494
+ startPoint = positions[i];
495
+ endPoint = positions[(i + 1) % positions.length];
496
+ type = Math_default.sign(startPoint.z);
497
+ next = Math_default.sign(endPoint.z);
498
+ const getLongitude = (position) => {
499
+ const cartographic = ellipsoid.cartesianToCartographic(
500
+ position,
501
+ scratchCartographic
502
+ );
503
+ return cartographic.longitude;
504
+ };
505
+ if (type === 0) {
506
+ edgesOnPlane.push({
507
+ position: i,
508
+ type,
509
+ visited: false,
510
+ next,
511
+ theta: getLongitude(startPoint)
512
+ });
513
+ } else if (next !== 0) {
514
+ intersection = computeEquatorIntersection(
515
+ startPoint,
516
+ endPoint,
517
+ ellipsoid,
518
+ arcType
519
+ );
520
+ ++i;
521
+ if (!defined_default(intersection)) {
522
+ continue;
523
+ }
524
+ positions.splice(i, 0, intersection);
525
+ edgesOnPlane.push({
526
+ position: i,
527
+ type,
528
+ visited: false,
529
+ next,
530
+ theta: getLongitude(intersection)
531
+ });
532
+ }
533
+ ++i;
534
+ }
535
+ return edgesOnPlane;
536
+ }
537
+ function wirePolygon(polygons, polygonIndex, positions, edgesOnPlane, toDelete, startIndex, abovePlane) {
538
+ const polygon = [];
539
+ let i = startIndex;
540
+ const getMatchingEdge = (i2) => (edge) => edge.position === i2;
541
+ const polygonsToWire = [];
542
+ do {
543
+ const position = positions[i];
544
+ polygon.push(position);
545
+ const edgeIndex = edgesOnPlane.findIndex(getMatchingEdge(i));
546
+ const edge = edgesOnPlane[edgeIndex];
547
+ if (!defined_default(edge)) {
548
+ ++i;
549
+ continue;
550
+ }
551
+ const { visited: hasBeenVisited, type, next } = edge;
552
+ edge.visited = true;
553
+ if (type === 0) {
554
+ if (next === 0) {
555
+ const previousEdge = edgesOnPlane[edgeIndex - (abovePlane ? 1 : -1)];
556
+ if (previousEdge?.position === i + 1) {
557
+ previousEdge.visited = true;
558
+ } else {
559
+ ++i;
560
+ continue;
561
+ }
562
+ }
563
+ if (!hasBeenVisited && abovePlane && next > 0 || startIndex === i && !abovePlane && next < 0) {
564
+ ++i;
565
+ continue;
566
+ }
567
+ }
568
+ const followEdge = abovePlane ? type >= 0 : type <= 0;
569
+ if (!followEdge) {
570
+ ++i;
571
+ continue;
572
+ }
573
+ if (!hasBeenVisited) {
574
+ polygonsToWire.push(i);
575
+ }
576
+ const nextEdgeIndex = edgeIndex + (abovePlane ? 1 : -1);
577
+ const nextEdge = edgesOnPlane[nextEdgeIndex];
578
+ if (!defined_default(nextEdge)) {
579
+ ++i;
580
+ continue;
581
+ }
582
+ i = nextEdge.position;
583
+ } while (i < positions.length && i >= 0 && i !== startIndex && polygon.length < positions.length);
584
+ polygons.splice(polygonIndex, toDelete, polygon);
585
+ for (const index of polygonsToWire) {
586
+ polygonIndex = wirePolygon(
587
+ polygons,
588
+ ++polygonIndex,
589
+ positions,
590
+ edgesOnPlane,
591
+ 0,
592
+ index,
593
+ !abovePlane
594
+ );
595
+ }
596
+ return polygonIndex;
597
+ }
598
+ PolygonGeometryLibrary.splitPolygonsOnEquator = function(outerRings, ellipsoid, arcType, result) {
599
+ if (!defined_default(result)) {
600
+ result = [];
601
+ }
602
+ result.splice(0, 0, ...outerRings);
603
+ result.length = outerRings.length;
604
+ let currentPolygon = 0;
605
+ while (currentPolygon < result.length) {
606
+ const outerRing = result[currentPolygon];
607
+ const positions = outerRing.slice();
608
+ if (outerRing.length < 3) {
609
+ result[currentPolygon] = positions;
610
+ ++currentPolygon;
611
+ continue;
612
+ }
613
+ const edgesOnPlane = computeEdgesOnPlane(positions, ellipsoid, arcType);
614
+ if (positions.length === outerRing.length || edgesOnPlane.length <= 1) {
615
+ result[currentPolygon] = positions;
616
+ ++currentPolygon;
617
+ continue;
618
+ }
619
+ edgesOnPlane.sort((a, b) => {
620
+ return a.theta - b.theta;
621
+ });
622
+ const north = positions[0].z >= 0;
623
+ currentPolygon = wirePolygon(
624
+ result,
625
+ currentPolygon,
626
+ positions,
627
+ edgesOnPlane,
628
+ 1,
629
+ 0,
630
+ north
631
+ );
632
+ }
633
+ return result;
634
+ };
635
+ PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, keepDuplicates, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid, splitPolygons) {
636
+ const hierarchy = [];
637
+ const polygons = [];
638
+ const queue = new Queue_default();
639
+ queue.enqueue(polygonHierarchy);
640
+ let split = defined_default(splitPolygons);
641
+ while (queue.length !== 0) {
642
+ const outerNode = queue.dequeue();
643
+ let outerRing = outerNode.positions;
644
+ const holes = outerNode.holes;
645
+ let i;
646
+ let length;
647
+ if (scaleToEllipsoidSurface) {
648
+ length = outerRing.length;
649
+ for (i = 0; i < length; i++) {
650
+ ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
651
+ }
652
+ }
653
+ if (!keepDuplicates) {
654
+ outerRing = arrayRemoveDuplicates_default(
655
+ outerRing,
656
+ Cartesian3_default.equalsEpsilon,
657
+ true
658
+ );
659
+ }
660
+ if (outerRing.length < 3) {
661
+ continue;
662
+ }
663
+ let positions2D = projectPointsTo2D(outerRing);
664
+ if (!defined_default(positions2D)) {
665
+ continue;
666
+ }
667
+ const holeIndices = [];
668
+ let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
669
+ if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
670
+ positions2D.reverse();
671
+ outerRing = outerRing.slice().reverse();
672
+ }
673
+ if (split) {
674
+ split = false;
675
+ let polygons2 = [outerRing];
676
+ polygons2 = splitPolygons(polygons2, polygons2);
677
+ if (polygons2.length > 1) {
678
+ for (const positions2 of polygons2) {
679
+ queue.enqueue(new PolygonHierarchy_default(positions2, holes));
680
+ }
681
+ continue;
682
+ }
683
+ }
684
+ let positions = outerRing.slice();
685
+ const numChildren = defined_default(holes) ? holes.length : 0;
686
+ const polygonHoles = [];
687
+ let j;
688
+ for (i = 0; i < numChildren; i++) {
689
+ const hole = holes[i];
690
+ let holePositions = hole.positions;
691
+ if (scaleToEllipsoidSurface) {
692
+ length = holePositions.length;
693
+ for (j = 0; j < length; ++j) {
694
+ ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
695
+ }
696
+ }
697
+ if (!keepDuplicates) {
698
+ holePositions = arrayRemoveDuplicates_default(
699
+ holePositions,
700
+ Cartesian3_default.equalsEpsilon,
701
+ true
702
+ );
703
+ }
704
+ if (holePositions.length < 3) {
705
+ continue;
706
+ }
707
+ const holePositions2D = projectPointsTo2D(holePositions);
708
+ if (!defined_default(holePositions2D)) {
709
+ continue;
710
+ }
711
+ originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(holePositions2D);
712
+ if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
713
+ holePositions2D.reverse();
714
+ holePositions = holePositions.slice().reverse();
715
+ }
716
+ polygonHoles.push(holePositions);
717
+ holeIndices.push(positions.length);
718
+ positions = positions.concat(holePositions);
719
+ positions2D = positions2D.concat(holePositions2D);
720
+ let numGrandchildren = 0;
721
+ if (defined_default(hole.holes)) {
722
+ numGrandchildren = hole.holes.length;
723
+ }
724
+ for (j = 0; j < numGrandchildren; j++) {
725
+ queue.enqueue(hole.holes[j]);
726
+ }
727
+ }
728
+ hierarchy.push({
729
+ outerRing,
730
+ holes: polygonHoles
731
+ });
732
+ polygons.push({
733
+ positions,
734
+ positions2D,
735
+ holes: holeIndices
736
+ });
737
+ }
738
+ return {
739
+ hierarchy,
740
+ polygons
741
+ };
742
+ };
743
+ var computeBoundingRectangleCartesian2 = new Cartesian2_default();
744
+ var computeBoundingRectangleCartesian3 = new Cartesian3_default();
745
+ var computeBoundingRectangleQuaternion = new Quaternion_default();
746
+ var computeBoundingRectangleMatrix3 = new Matrix3_default();
747
+ PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
748
+ const rotation = Quaternion_default.fromAxisAngle(
749
+ planeNormal,
750
+ angle,
751
+ computeBoundingRectangleQuaternion
752
+ );
753
+ const textureMatrix = Matrix3_default.fromQuaternion(
754
+ rotation,
755
+ computeBoundingRectangleMatrix3
756
+ );
757
+ let minX = Number.POSITIVE_INFINITY;
758
+ let maxX = Number.NEGATIVE_INFINITY;
759
+ let minY = Number.POSITIVE_INFINITY;
760
+ let maxY = Number.NEGATIVE_INFINITY;
761
+ const length = positions.length;
762
+ for (let i = 0; i < length; ++i) {
763
+ const p = Cartesian3_default.clone(
764
+ positions[i],
765
+ computeBoundingRectangleCartesian3
766
+ );
767
+ Matrix3_default.multiplyByVector(textureMatrix, p, p);
768
+ const st = projectPointTo2D(p, computeBoundingRectangleCartesian2);
769
+ if (defined_default(st)) {
770
+ minX = Math.min(minX, st.x);
771
+ maxX = Math.max(maxX, st.x);
772
+ minY = Math.min(minY, st.y);
773
+ maxY = Math.max(maxY, st.y);
774
+ }
775
+ }
776
+ result.x = minX;
777
+ result.y = minY;
778
+ result.width = maxX - minX;
779
+ result.height = maxY - minY;
780
+ return result;
781
+ };
782
+ PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, textureCoordinates, granularity, perPositionHeight, vertexFormat, arcType) {
783
+ let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
784
+ if (indices.length < 3) {
785
+ indices = [0, 1, 2];
786
+ }
787
+ const positions = polygon.positions;
788
+ const hasTexcoords = defined_default(textureCoordinates);
789
+ const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
790
+ if (perPositionHeight) {
791
+ const length = positions.length;
792
+ const flattenedPositions = new Array(length * 3);
793
+ let index = 0;
794
+ for (let i = 0; i < length; i++) {
795
+ const p = positions[i];
796
+ flattenedPositions[index++] = p.x;
797
+ flattenedPositions[index++] = p.y;
798
+ flattenedPositions[index++] = p.z;
799
+ }
800
+ const geometryOptions = {
801
+ attributes: {
802
+ position: new GeometryAttribute_default({
803
+ componentDatatype: ComponentDatatype_default.DOUBLE,
804
+ componentsPerAttribute: 3,
805
+ values: flattenedPositions
806
+ })
807
+ },
808
+ indices,
809
+ primitiveType: PrimitiveType_default.TRIANGLES
810
+ };
811
+ if (hasTexcoords) {
812
+ geometryOptions.attributes.st = new GeometryAttribute_default({
813
+ componentDatatype: ComponentDatatype_default.FLOAT,
814
+ componentsPerAttribute: 2,
815
+ values: Cartesian2_default.packArray(texcoords)
816
+ });
817
+ }
818
+ const geometry = new Geometry_default(geometryOptions);
819
+ if (vertexFormat.normal) {
820
+ return GeometryPipeline_default.computeNormal(geometry);
821
+ }
822
+ return geometry;
823
+ }
824
+ if (arcType === ArcType_default.GEODESIC) {
825
+ return PolygonPipeline_default.computeSubdivision(
826
+ ellipsoid,
827
+ positions,
828
+ indices,
829
+ texcoords,
830
+ granularity
831
+ );
832
+ } else if (arcType === ArcType_default.RHUMB) {
833
+ return PolygonPipeline_default.computeRhumbLineSubdivision(
834
+ ellipsoid,
835
+ positions,
836
+ indices,
837
+ texcoords,
838
+ granularity
839
+ );
840
+ }
841
+ };
842
+ var computeWallTexcoordsSubdivided = [];
843
+ var computeWallIndicesSubdivided = [];
844
+ var p1Scratch = new Cartesian3_default();
845
+ var p2Scratch = new Cartesian3_default();
846
+ PolygonGeometryLibrary.computeWallGeometry = function(positions, textureCoordinates, ellipsoid, granularity, perPositionHeight, arcType) {
847
+ let edgePositions;
848
+ let topEdgeLength;
849
+ let i;
850
+ let p1;
851
+ let p2;
852
+ let t1;
853
+ let t2;
854
+ let edgeTexcoords;
855
+ let topEdgeTexcoordLength;
856
+ let length = positions.length;
857
+ let index = 0;
858
+ let textureIndex = 0;
859
+ const hasTexcoords = defined_default(textureCoordinates);
860
+ const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
861
+ if (!perPositionHeight) {
862
+ const minDistance = Math_default.chordLength(
863
+ granularity,
864
+ ellipsoid.maximumRadius
865
+ );
866
+ let numVertices = 0;
867
+ if (arcType === ArcType_default.GEODESIC) {
868
+ for (i = 0; i < length; i++) {
869
+ numVertices += PolygonGeometryLibrary.subdivideLineCount(
870
+ positions[i],
871
+ positions[(i + 1) % length],
872
+ minDistance
873
+ );
874
+ }
875
+ } else if (arcType === ArcType_default.RHUMB) {
876
+ for (i = 0; i < length; i++) {
877
+ numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
878
+ ellipsoid,
879
+ positions[i],
880
+ positions[(i + 1) % length],
881
+ minDistance
882
+ );
883
+ }
884
+ }
885
+ topEdgeLength = (numVertices + length) * 3;
886
+ edgePositions = new Array(topEdgeLength * 2);
887
+ if (hasTexcoords) {
888
+ topEdgeTexcoordLength = (numVertices + length) * 2;
889
+ edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
890
+ }
891
+ for (i = 0; i < length; i++) {
892
+ p1 = positions[i];
893
+ p2 = positions[(i + 1) % length];
894
+ let tempPositions;
895
+ let tempTexcoords;
896
+ if (hasTexcoords) {
897
+ t1 = texcoords[i];
898
+ t2 = texcoords[(i + 1) % length];
899
+ }
900
+ if (arcType === ArcType_default.GEODESIC) {
901
+ tempPositions = PolygonGeometryLibrary.subdivideLine(
902
+ p1,
903
+ p2,
904
+ minDistance,
905
+ computeWallIndicesSubdivided
906
+ );
907
+ if (hasTexcoords) {
908
+ tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordLine(
909
+ t1,
910
+ t2,
911
+ p1,
912
+ p2,
913
+ minDistance,
914
+ computeWallTexcoordsSubdivided
915
+ );
916
+ }
917
+ } else if (arcType === ArcType_default.RHUMB) {
918
+ tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
919
+ ellipsoid,
920
+ p1,
921
+ p2,
922
+ minDistance,
923
+ computeWallIndicesSubdivided
924
+ );
925
+ if (hasTexcoords) {
926
+ tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordRhumbLine(
927
+ t1,
928
+ t2,
929
+ ellipsoid,
930
+ p1,
931
+ p2,
932
+ minDistance,
933
+ computeWallTexcoordsSubdivided
934
+ );
935
+ }
936
+ }
937
+ const tempPositionsLength = tempPositions.length;
938
+ for (let j = 0; j < tempPositionsLength; ++j, ++index) {
939
+ edgePositions[index] = tempPositions[j];
940
+ edgePositions[index + topEdgeLength] = tempPositions[j];
941
+ }
942
+ edgePositions[index] = p2.x;
943
+ edgePositions[index + topEdgeLength] = p2.x;
944
+ ++index;
945
+ edgePositions[index] = p2.y;
946
+ edgePositions[index + topEdgeLength] = p2.y;
947
+ ++index;
948
+ edgePositions[index] = p2.z;
949
+ edgePositions[index + topEdgeLength] = p2.z;
950
+ ++index;
951
+ if (hasTexcoords) {
952
+ const tempTexcoordsLength = tempTexcoords.length;
953
+ for (let k = 0; k < tempTexcoordsLength; ++k, ++textureIndex) {
954
+ edgeTexcoords[textureIndex] = tempTexcoords[k];
955
+ edgeTexcoords[textureIndex + topEdgeTexcoordLength] = tempTexcoords[k];
956
+ }
957
+ edgeTexcoords[textureIndex] = t2.x;
958
+ edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
959
+ ++textureIndex;
960
+ edgeTexcoords[textureIndex] = t2.y;
961
+ edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
962
+ ++textureIndex;
963
+ }
964
+ }
965
+ } else {
966
+ topEdgeLength = length * 3 * 2;
967
+ edgePositions = new Array(topEdgeLength * 2);
968
+ if (hasTexcoords) {
969
+ topEdgeTexcoordLength = length * 2 * 2;
970
+ edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
971
+ }
972
+ for (i = 0; i < length; i++) {
973
+ p1 = positions[i];
974
+ p2 = positions[(i + 1) % length];
975
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p1.x;
976
+ ++index;
977
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p1.y;
978
+ ++index;
979
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p1.z;
980
+ ++index;
981
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p2.x;
982
+ ++index;
983
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p2.y;
984
+ ++index;
985
+ edgePositions[index] = edgePositions[index + topEdgeLength] = p2.z;
986
+ ++index;
987
+ if (hasTexcoords) {
988
+ t1 = texcoords[i];
989
+ t2 = texcoords[(i + 1) % length];
990
+ edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.x;
991
+ ++textureIndex;
992
+ edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.y;
993
+ ++textureIndex;
994
+ edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
995
+ ++textureIndex;
996
+ edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
997
+ ++textureIndex;
998
+ }
999
+ }
1000
+ }
1001
+ length = edgePositions.length;
1002
+ const indices = IndexDatatype_default.createTypedArray(
1003
+ length / 3,
1004
+ length - positions.length * 6
1005
+ );
1006
+ let edgeIndex = 0;
1007
+ length /= 6;
1008
+ for (i = 0; i < length; i++) {
1009
+ const UL = i;
1010
+ const UR = UL + 1;
1011
+ const LL = UL + length;
1012
+ const LR = LL + 1;
1013
+ p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch);
1014
+ p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch);
1015
+ if (Cartesian3_default.equalsEpsilon(
1016
+ p1,
1017
+ p2,
1018
+ Math_default.EPSILON10,
1019
+ Math_default.EPSILON10
1020
+ )) {
1021
+ continue;
1022
+ }
1023
+ indices[edgeIndex++] = UL;
1024
+ indices[edgeIndex++] = LL;
1025
+ indices[edgeIndex++] = UR;
1026
+ indices[edgeIndex++] = UR;
1027
+ indices[edgeIndex++] = LL;
1028
+ indices[edgeIndex++] = LR;
1029
+ }
1030
+ const geometryOptions = {
1031
+ attributes: new GeometryAttributes_default({
1032
+ position: new GeometryAttribute_default({
1033
+ componentDatatype: ComponentDatatype_default.DOUBLE,
1034
+ componentsPerAttribute: 3,
1035
+ values: edgePositions
1036
+ })
1037
+ }),
1038
+ indices,
1039
+ primitiveType: PrimitiveType_default.TRIANGLES
1040
+ };
1041
+ if (hasTexcoords) {
1042
+ geometryOptions.attributes.st = new GeometryAttribute_default({
1043
+ componentDatatype: ComponentDatatype_default.FLOAT,
1044
+ componentsPerAttribute: 2,
1045
+ values: edgeTexcoords
1046
+ });
1047
+ }
1048
+ const geometry = new Geometry_default(geometryOptions);
1049
+ return geometry;
1050
+ };
1051
+ var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
1052
+
1053
+ export {
1054
+ PolygonGeometryLibrary_default
1055
+ };