@gmgis/gm-sdk 1.12.5 → 2.0.2

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 (159) hide show
  1. package/dist/dist/index.js +1848 -0
  2. package/dist/gm.min.js +16983 -16483
  3. package/dist/index.js +1436 -1434
  4. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  5. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  7. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  8. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  9. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  10. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  11. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  12. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  13. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  14. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  15. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  16. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  17. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  18. package/dist/resources/Workers/{chunk-I2ITFFPX.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-PRGYLLJT.js → chunk-ARG42DC4.js} +2 -31
  21. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  22. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  23. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  24. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  25. package/dist/resources/Workers/{chunk-DI5NGJUP.js → chunk-D6AA5QVT.js} +2 -20
  26. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  27. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  28. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  29. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  30. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  31. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  32. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  33. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  34. package/dist/resources/Workers/{chunk-7JO7GPJN.js → chunk-GBYLG25F.js} +2 -15
  35. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  36. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  37. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  38. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  39. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  40. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  41. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  42. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  43. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  44. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  45. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  46. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  47. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  48. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  49. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  50. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  51. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  52. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  53. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  54. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  55. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  56. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  57. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  58. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  59. package/dist/resources/Workers/{chunk-6CHGCNMW.js → chunk-WZDE3RYP.js} +4 -34
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -40
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -32
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -209
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -175
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -121
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -481
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -199
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1237
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -542
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -34
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -205
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -45
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -38
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -33
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -35
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -32
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -210
  78. package/dist/resources/Workers/createGeometry.js +2 -144
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1582
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -198
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -98
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1381
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -509
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -470
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -354
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -251
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1246
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -453
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -374
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -92
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -92
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -466
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -361
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -359
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -236
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -539
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2252
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -729
  101. package/dist/resources/Workers/createWallGeometry.js +2 -464
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -312
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2642
  105. package/dist/resources/Workers/decodeI3S.js +2 -1319
  106. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  107. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  108. package/dist/resources/Workers/transcodeKTX2.js +29 -3360
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -793
  111. package/package.json +74 -74
  112. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  113. package/dist/resources/Workers/chunk-26GA3JAM.js +0 -139
  114. package/dist/resources/Workers/chunk-27HUZ7SA.js +0 -305
  115. package/dist/resources/Workers/chunk-2ZGOQXYU.js +0 -171
  116. package/dist/resources/Workers/chunk-3Q2L65QU.js +0 -1258
  117. package/dist/resources/Workers/chunk-472HQ3EH.js +0 -100
  118. package/dist/resources/Workers/chunk-5ODQSF26.js +0 -101
  119. package/dist/resources/Workers/chunk-5OOFQLKF.js +0 -634
  120. package/dist/resources/Workers/chunk-5PTXS2GO.js +0 -10390
  121. package/dist/resources/Workers/chunk-76BYBWHP.js +0 -122
  122. package/dist/resources/Workers/chunk-7BMOHCPM.js +0 -390
  123. package/dist/resources/Workers/chunk-7KTQP4VB.js +0 -59
  124. package/dist/resources/Workers/chunk-7O373FFS.js +0 -665
  125. package/dist/resources/Workers/chunk-AD63PIY6.js +0 -163
  126. package/dist/resources/Workers/chunk-BHQJ2NT7.js +0 -353
  127. package/dist/resources/Workers/chunk-C6YYBQXW.js +0 -102
  128. package/dist/resources/Workers/chunk-CKY7HOHV.js +0 -287
  129. package/dist/resources/Workers/chunk-DHYHSFFJ.js +0 -73
  130. package/dist/resources/Workers/chunk-E27BLMDD.js +0 -115
  131. package/dist/resources/Workers/chunk-E63IIM5T.js +0 -75
  132. package/dist/resources/Workers/chunk-E6V6SQZW.js +0 -456
  133. package/dist/resources/Workers/chunk-EJZTDTUH.js +0 -138
  134. package/dist/resources/Workers/chunk-FDOV2LBJ.js +0 -220
  135. package/dist/resources/Workers/chunk-FIGIZHAQ.js +0 -684
  136. package/dist/resources/Workers/chunk-GESF4OXQ.js +0 -1800
  137. package/dist/resources/Workers/chunk-GGZJN2TI.js +0 -2717
  138. package/dist/resources/Workers/chunk-GNBFYG7F.js +0 -1481
  139. package/dist/resources/Workers/chunk-GWCFU2SA.js +0 -300
  140. package/dist/resources/Workers/chunk-IBLIYJZR.js +0 -196
  141. package/dist/resources/Workers/chunk-JW4FOI6M.js +0 -476
  142. package/dist/resources/Workers/chunk-K4GQUNB5.js +0 -262
  143. package/dist/resources/Workers/chunk-M3GMB5OP.js +0 -834
  144. package/dist/resources/Workers/chunk-MXIZJAPH.js +0 -629
  145. package/dist/resources/Workers/chunk-N5KJGGCM.js +0 -1073
  146. package/dist/resources/Workers/chunk-NGPPMXRM.js +0 -435
  147. package/dist/resources/Workers/chunk-O3E4OAOE.js +0 -511
  148. package/dist/resources/Workers/chunk-PGRPDNHG.js +0 -1048
  149. package/dist/resources/Workers/chunk-S6MRMMQU.js +0 -157
  150. package/dist/resources/Workers/chunk-SMDOP47J.js +0 -945
  151. package/dist/resources/Workers/chunk-TGONEMZO.js +0 -421
  152. package/dist/resources/Workers/chunk-TKVT5GQM.js +0 -781
  153. package/dist/resources/Workers/chunk-U72QNFOJ.js +0 -758
  154. package/dist/resources/Workers/chunk-VJZB3WAV.js +0 -963
  155. package/dist/resources/Workers/chunk-VU2MNO7L.js +0 -239
  156. package/dist/resources/Workers/chunk-XY4BATBS.js +0 -500
  157. package/dist/resources/Workers/chunk-YFXQECWV.js +0 -2857
  158. package/dist/resources/Workers/chunk-YSGTGQQO.js +0 -398
  159. package/dist/resources/Workers/chunk-YZ733KKS.js +0 -368
@@ -1,1048 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
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-PRGYLLJT.js";
29
- import {
30
- GeometryPipeline_default
31
- } from "./chunk-GGZJN2TI.js";
32
- import {
33
- PolygonPipeline_default,
34
- WindingOrder_default
35
- } from "./chunk-SMDOP47J.js";
36
- import {
37
- arrayRemoveDuplicates_default
38
- } from "./chunk-472HQ3EH.js";
39
- import {
40
- EllipsoidRhumbLine_default
41
- } from "./chunk-E6V6SQZW.js";
42
- import {
43
- IntersectionTests_default
44
- } from "./chunk-3Q2L65QU.js";
45
- import {
46
- Plane_default
47
- } from "./chunk-2ZGOQXYU.js";
48
- import {
49
- IndexDatatype_default
50
- } from "./chunk-26GA3JAM.js";
51
- import {
52
- GeometryAttributes_default
53
- } from "./chunk-DI5NGJUP.js";
54
- import {
55
- GeometryAttribute_default,
56
- Geometry_default,
57
- PrimitiveType_default
58
- } from "./chunk-GWCFU2SA.js";
59
- import {
60
- Quaternion_default
61
- } from "./chunk-5PTXS2GO.js";
62
- import {
63
- ComponentDatatype_default
64
- } from "./chunk-K4GQUNB5.js";
65
- import {
66
- Cartesian2_default,
67
- Cartesian3_default,
68
- Cartographic_default,
69
- Ellipsoid_default,
70
- Matrix3_default
71
- } from "./chunk-YFXQECWV.js";
72
- import {
73
- Math_default
74
- } from "./chunk-XY4BATBS.js";
75
- import {
76
- defaultValue_default
77
- } from "./chunk-7JO7GPJN.js";
78
- import {
79
- defined_default
80
- } from "./chunk-E63IIM5T.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
- const n = rhumb.surfaceDistance / minDistance;
331
- const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
332
- const numVertices = Math.pow(2, countDivide);
333
- const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
334
- if (!defined_default(result)) {
335
- result = [];
336
- }
337
- const positions = result;
338
- positions.length = numVertices * 3;
339
- let index = 0;
340
- for (let i = 0; i < numVertices; i++) {
341
- const c = rhumb.interpolateUsingSurfaceDistance(
342
- i * distanceBetweenVertices,
343
- scratchCartographic2
344
- );
345
- const p = ellipsoid.cartographicToCartesian(c, scratchCartesian0);
346
- positions[index++] = p.x;
347
- positions[index++] = p.y;
348
- positions[index++] = p.z;
349
- }
350
- return positions;
351
- };
352
- var scaleToGeodeticHeightN1 = new Cartesian3_default();
353
- var scaleToGeodeticHeightN2 = new Cartesian3_default();
354
- var scaleToGeodeticHeightP1 = new Cartesian3_default();
355
- var scaleToGeodeticHeightP2 = new Cartesian3_default();
356
- PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
357
- ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
358
- const n1 = scaleToGeodeticHeightN1;
359
- let n2 = scaleToGeodeticHeightN2;
360
- const p = scaleToGeodeticHeightP1;
361
- let p2 = scaleToGeodeticHeightP2;
362
- if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
363
- const positions = geometry.attributes.position.values;
364
- const length = positions.length / 2;
365
- for (let i = 0; i < length; i += 3) {
366
- Cartesian3_default.fromArray(positions, i, p);
367
- ellipsoid.geodeticSurfaceNormal(p, n1);
368
- p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
369
- n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
370
- n2 = Cartesian3_default.add(p2, n2, n2);
371
- positions[i + length] = n2.x;
372
- positions[i + 1 + length] = n2.y;
373
- positions[i + 2 + length] = n2.z;
374
- if (perPositionHeight) {
375
- p2 = Cartesian3_default.clone(p, p2);
376
- }
377
- n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
378
- n2 = Cartesian3_default.add(p2, n2, n2);
379
- positions[i] = n2.x;
380
- positions[i + 1] = n2.y;
381
- positions[i + 2] = n2.z;
382
- }
383
- }
384
- return geometry;
385
- };
386
- PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
387
- const polygons = [];
388
- const queue = new Queue_default();
389
- queue.enqueue(polygonHierarchy);
390
- let i;
391
- let j;
392
- let length;
393
- while (queue.length !== 0) {
394
- const outerNode = queue.dequeue();
395
- let outerRing = outerNode.positions;
396
- if (scaleToEllipsoidSurface) {
397
- length = outerRing.length;
398
- for (i = 0; i < length; i++) {
399
- ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
400
- }
401
- }
402
- outerRing = arrayRemoveDuplicates_default(
403
- outerRing,
404
- Cartesian3_default.equalsEpsilon,
405
- true
406
- );
407
- if (outerRing.length < 3) {
408
- continue;
409
- }
410
- const numChildren = outerNode.holes ? outerNode.holes.length : 0;
411
- for (i = 0; i < numChildren; i++) {
412
- const hole = outerNode.holes[i];
413
- let holePositions = hole.positions;
414
- if (scaleToEllipsoidSurface) {
415
- length = holePositions.length;
416
- for (j = 0; j < length; ++j) {
417
- ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
418
- }
419
- }
420
- holePositions = arrayRemoveDuplicates_default(
421
- holePositions,
422
- Cartesian3_default.equalsEpsilon,
423
- true
424
- );
425
- if (holePositions.length < 3) {
426
- continue;
427
- }
428
- polygons.push(holePositions);
429
- let numGrandchildren = 0;
430
- if (defined_default(hole.holes)) {
431
- numGrandchildren = hole.holes.length;
432
- }
433
- for (j = 0; j < numGrandchildren; j++) {
434
- queue.enqueue(hole.holes[j]);
435
- }
436
- }
437
- polygons.push(outerRing);
438
- }
439
- return polygons;
440
- };
441
- var scratchRhumbIntersection = new Cartographic_default();
442
- function computeEquatorIntersectionRhumb(start, end, ellipsoid) {
443
- const c0 = ellipsoid.cartesianToCartographic(start, scratchCartographic0);
444
- const c1 = ellipsoid.cartesianToCartographic(end, scratchCartographic1);
445
- if (Math.sign(c0.latitude) === Math.sign(c1.latitude)) {
446
- return;
447
- }
448
- scratchRhumbLine.setEndPoints(c0, c1);
449
- const intersection = scratchRhumbLine.findIntersectionWithLatitude(
450
- 0,
451
- scratchRhumbIntersection
452
- );
453
- if (!defined_default(intersection)) {
454
- return;
455
- }
456
- let minLongitude = Math.min(c0.longitude, c1.longitude);
457
- let maxLongitude = Math.max(c0.longitude, c1.longitude);
458
- if (Math.abs(maxLongitude - minLongitude) > Math_default.PI) {
459
- const swap = minLongitude;
460
- minLongitude = maxLongitude;
461
- maxLongitude = swap;
462
- }
463
- if (intersection.longitude < minLongitude || intersection.longitude > maxLongitude) {
464
- return;
465
- }
466
- return ellipsoid.cartographicToCartesian(intersection);
467
- }
468
- function computeEquatorIntersection(start, end, ellipsoid, arcType) {
469
- if (arcType === ArcType_default.RHUMB) {
470
- return computeEquatorIntersectionRhumb(start, end, ellipsoid);
471
- }
472
- const intersection = IntersectionTests_default.lineSegmentPlane(
473
- start,
474
- end,
475
- Plane_default.ORIGIN_XY_PLANE
476
- );
477
- if (!defined_default(intersection)) {
478
- return;
479
- }
480
- return ellipsoid.scaleToGeodeticSurface(intersection, intersection);
481
- }
482
- var scratchCartographic = new Cartographic_default();
483
- function computeEdgesOnPlane(positions, ellipsoid, arcType) {
484
- const edgesOnPlane = [];
485
- let startPoint, endPoint, type, next, intersection, i = 0;
486
- while (i < positions.length) {
487
- startPoint = positions[i];
488
- endPoint = positions[(i + 1) % positions.length];
489
- type = Math_default.sign(startPoint.z);
490
- next = Math_default.sign(endPoint.z);
491
- const getLongitude = (position) => {
492
- const cartographic = ellipsoid.cartesianToCartographic(
493
- position,
494
- scratchCartographic
495
- );
496
- return cartographic.longitude;
497
- };
498
- if (type === 0) {
499
- edgesOnPlane.push({
500
- position: i,
501
- type,
502
- visited: false,
503
- next,
504
- theta: getLongitude(startPoint)
505
- });
506
- } else if (next !== 0) {
507
- intersection = computeEquatorIntersection(
508
- startPoint,
509
- endPoint,
510
- ellipsoid,
511
- arcType
512
- );
513
- ++i;
514
- if (!defined_default(intersection)) {
515
- continue;
516
- }
517
- positions.splice(i, 0, intersection);
518
- edgesOnPlane.push({
519
- position: i,
520
- type,
521
- visited: false,
522
- next,
523
- theta: getLongitude(intersection)
524
- });
525
- }
526
- ++i;
527
- }
528
- return edgesOnPlane;
529
- }
530
- function wirePolygon(polygons, polygonIndex, positions, edgesOnPlane, toDelete, startIndex, abovePlane) {
531
- const polygon = [];
532
- let i = startIndex;
533
- const getMatchingEdge = (i2) => (edge) => edge.position === i2;
534
- const polygonsToWire = [];
535
- do {
536
- const position = positions[i];
537
- polygon.push(position);
538
- const edgeIndex = edgesOnPlane.findIndex(getMatchingEdge(i));
539
- const edge = edgesOnPlane[edgeIndex];
540
- if (!defined_default(edge)) {
541
- ++i;
542
- continue;
543
- }
544
- const { visited: hasBeenVisited, type, next } = edge;
545
- edge.visited = true;
546
- if (type === 0) {
547
- if (next === 0) {
548
- const previousEdge = edgesOnPlane[edgeIndex - (abovePlane ? 1 : -1)];
549
- if (previousEdge?.position === i + 1) {
550
- previousEdge.visited = true;
551
- } else {
552
- ++i;
553
- continue;
554
- }
555
- }
556
- if (!hasBeenVisited && abovePlane && next > 0 || startIndex === i && !abovePlane && next < 0) {
557
- ++i;
558
- continue;
559
- }
560
- }
561
- const followEdge = abovePlane ? type >= 0 : type <= 0;
562
- if (!followEdge) {
563
- ++i;
564
- continue;
565
- }
566
- if (!hasBeenVisited) {
567
- polygonsToWire.push(i);
568
- }
569
- const nextEdgeIndex = edgeIndex + (abovePlane ? 1 : -1);
570
- const nextEdge = edgesOnPlane[nextEdgeIndex];
571
- if (!defined_default(nextEdge)) {
572
- ++i;
573
- continue;
574
- }
575
- i = nextEdge.position;
576
- } while (i < positions.length && i >= 0 && i !== startIndex && polygon.length < positions.length);
577
- polygons.splice(polygonIndex, toDelete, polygon);
578
- for (const index of polygonsToWire) {
579
- polygonIndex = wirePolygon(
580
- polygons,
581
- ++polygonIndex,
582
- positions,
583
- edgesOnPlane,
584
- 0,
585
- index,
586
- !abovePlane
587
- );
588
- }
589
- return polygonIndex;
590
- }
591
- PolygonGeometryLibrary.splitPolygonsOnEquator = function(outerRings, ellipsoid, arcType, result) {
592
- if (!defined_default(result)) {
593
- result = [];
594
- }
595
- result.splice(0, 0, ...outerRings);
596
- result.length = outerRings.length;
597
- let currentPolygon = 0;
598
- while (currentPolygon < result.length) {
599
- const outerRing = result[currentPolygon];
600
- const positions = outerRing.slice();
601
- if (outerRing.length < 3) {
602
- result[currentPolygon] = positions;
603
- ++currentPolygon;
604
- continue;
605
- }
606
- const edgesOnPlane = computeEdgesOnPlane(positions, ellipsoid, arcType);
607
- if (positions.length === outerRing.length || edgesOnPlane.length <= 1) {
608
- result[currentPolygon] = positions;
609
- ++currentPolygon;
610
- continue;
611
- }
612
- edgesOnPlane.sort((a, b) => {
613
- return a.theta - b.theta;
614
- });
615
- const north = positions[0].z >= 0;
616
- currentPolygon = wirePolygon(
617
- result,
618
- currentPolygon,
619
- positions,
620
- edgesOnPlane,
621
- 1,
622
- 0,
623
- north
624
- );
625
- }
626
- return result;
627
- };
628
- PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, keepDuplicates, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid, splitPolygons) {
629
- const hierarchy = [];
630
- const polygons = [];
631
- const queue = new Queue_default();
632
- queue.enqueue(polygonHierarchy);
633
- let split = defined_default(splitPolygons);
634
- while (queue.length !== 0) {
635
- const outerNode = queue.dequeue();
636
- let outerRing = outerNode.positions;
637
- const holes = outerNode.holes;
638
- let i;
639
- let length;
640
- if (scaleToEllipsoidSurface) {
641
- length = outerRing.length;
642
- for (i = 0; i < length; i++) {
643
- ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
644
- }
645
- }
646
- if (!keepDuplicates) {
647
- outerRing = arrayRemoveDuplicates_default(
648
- outerRing,
649
- Cartesian3_default.equalsEpsilon,
650
- true
651
- );
652
- }
653
- if (outerRing.length < 3) {
654
- continue;
655
- }
656
- let positions2D = projectPointsTo2D(outerRing);
657
- if (!defined_default(positions2D)) {
658
- continue;
659
- }
660
- const holeIndices = [];
661
- let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
662
- if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
663
- positions2D.reverse();
664
- outerRing = outerRing.slice().reverse();
665
- }
666
- if (split) {
667
- split = false;
668
- let polygons2 = [outerRing];
669
- polygons2 = splitPolygons(polygons2, polygons2);
670
- if (polygons2.length > 1) {
671
- for (const positions2 of polygons2) {
672
- queue.enqueue(new PolygonHierarchy_default(positions2, holes));
673
- }
674
- continue;
675
- }
676
- }
677
- let positions = outerRing.slice();
678
- const numChildren = defined_default(holes) ? holes.length : 0;
679
- const polygonHoles = [];
680
- let j;
681
- for (i = 0; i < numChildren; i++) {
682
- const hole = holes[i];
683
- let holePositions = hole.positions;
684
- if (scaleToEllipsoidSurface) {
685
- length = holePositions.length;
686
- for (j = 0; j < length; ++j) {
687
- ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
688
- }
689
- }
690
- if (!keepDuplicates) {
691
- holePositions = arrayRemoveDuplicates_default(
692
- holePositions,
693
- Cartesian3_default.equalsEpsilon,
694
- true
695
- );
696
- }
697
- if (holePositions.length < 3) {
698
- continue;
699
- }
700
- const holePositions2D = projectPointsTo2D(holePositions);
701
- if (!defined_default(holePositions2D)) {
702
- continue;
703
- }
704
- originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(holePositions2D);
705
- if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
706
- holePositions2D.reverse();
707
- holePositions = holePositions.slice().reverse();
708
- }
709
- polygonHoles.push(holePositions);
710
- holeIndices.push(positions.length);
711
- positions = positions.concat(holePositions);
712
- positions2D = positions2D.concat(holePositions2D);
713
- let numGrandchildren = 0;
714
- if (defined_default(hole.holes)) {
715
- numGrandchildren = hole.holes.length;
716
- }
717
- for (j = 0; j < numGrandchildren; j++) {
718
- queue.enqueue(hole.holes[j]);
719
- }
720
- }
721
- hierarchy.push({
722
- outerRing,
723
- holes: polygonHoles
724
- });
725
- polygons.push({
726
- positions,
727
- positions2D,
728
- holes: holeIndices
729
- });
730
- }
731
- return {
732
- hierarchy,
733
- polygons
734
- };
735
- };
736
- var computeBoundingRectangleCartesian2 = new Cartesian2_default();
737
- var computeBoundingRectangleCartesian3 = new Cartesian3_default();
738
- var computeBoundingRectangleQuaternion = new Quaternion_default();
739
- var computeBoundingRectangleMatrix3 = new Matrix3_default();
740
- PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
741
- const rotation = Quaternion_default.fromAxisAngle(
742
- planeNormal,
743
- angle,
744
- computeBoundingRectangleQuaternion
745
- );
746
- const textureMatrix = Matrix3_default.fromQuaternion(
747
- rotation,
748
- computeBoundingRectangleMatrix3
749
- );
750
- let minX = Number.POSITIVE_INFINITY;
751
- let maxX = Number.NEGATIVE_INFINITY;
752
- let minY = Number.POSITIVE_INFINITY;
753
- let maxY = Number.NEGATIVE_INFINITY;
754
- const length = positions.length;
755
- for (let i = 0; i < length; ++i) {
756
- const p = Cartesian3_default.clone(
757
- positions[i],
758
- computeBoundingRectangleCartesian3
759
- );
760
- Matrix3_default.multiplyByVector(textureMatrix, p, p);
761
- const st = projectPointTo2D(p, computeBoundingRectangleCartesian2);
762
- if (defined_default(st)) {
763
- minX = Math.min(minX, st.x);
764
- maxX = Math.max(maxX, st.x);
765
- minY = Math.min(minY, st.y);
766
- maxY = Math.max(maxY, st.y);
767
- }
768
- }
769
- result.x = minX;
770
- result.y = minY;
771
- result.width = maxX - minX;
772
- result.height = maxY - minY;
773
- return result;
774
- };
775
- PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, textureCoordinates, granularity, perPositionHeight, vertexFormat, arcType) {
776
- let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
777
- if (indices.length < 3) {
778
- indices = [0, 1, 2];
779
- }
780
- const positions = polygon.positions;
781
- const hasTexcoords = defined_default(textureCoordinates);
782
- const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
783
- if (perPositionHeight) {
784
- const length = positions.length;
785
- const flattenedPositions = new Array(length * 3);
786
- let index = 0;
787
- for (let i = 0; i < length; i++) {
788
- const p = positions[i];
789
- flattenedPositions[index++] = p.x;
790
- flattenedPositions[index++] = p.y;
791
- flattenedPositions[index++] = p.z;
792
- }
793
- const geometryOptions = {
794
- attributes: {
795
- position: new GeometryAttribute_default({
796
- componentDatatype: ComponentDatatype_default.DOUBLE,
797
- componentsPerAttribute: 3,
798
- values: flattenedPositions
799
- })
800
- },
801
- indices,
802
- primitiveType: PrimitiveType_default.TRIANGLES
803
- };
804
- if (hasTexcoords) {
805
- geometryOptions.attributes.st = new GeometryAttribute_default({
806
- componentDatatype: ComponentDatatype_default.FLOAT,
807
- componentsPerAttribute: 2,
808
- values: Cartesian2_default.packArray(texcoords)
809
- });
810
- }
811
- const geometry = new Geometry_default(geometryOptions);
812
- if (vertexFormat.normal) {
813
- return GeometryPipeline_default.computeNormal(geometry);
814
- }
815
- return geometry;
816
- }
817
- if (arcType === ArcType_default.GEODESIC) {
818
- return PolygonPipeline_default.computeSubdivision(
819
- ellipsoid,
820
- positions,
821
- indices,
822
- texcoords,
823
- granularity
824
- );
825
- } else if (arcType === ArcType_default.RHUMB) {
826
- return PolygonPipeline_default.computeRhumbLineSubdivision(
827
- ellipsoid,
828
- positions,
829
- indices,
830
- texcoords,
831
- granularity
832
- );
833
- }
834
- };
835
- var computeWallTexcoordsSubdivided = [];
836
- var computeWallIndicesSubdivided = [];
837
- var p1Scratch = new Cartesian3_default();
838
- var p2Scratch = new Cartesian3_default();
839
- PolygonGeometryLibrary.computeWallGeometry = function(positions, textureCoordinates, ellipsoid, granularity, perPositionHeight, arcType) {
840
- let edgePositions;
841
- let topEdgeLength;
842
- let i;
843
- let p1;
844
- let p2;
845
- let t1;
846
- let t2;
847
- let edgeTexcoords;
848
- let topEdgeTexcoordLength;
849
- let length = positions.length;
850
- let index = 0;
851
- let textureIndex = 0;
852
- const hasTexcoords = defined_default(textureCoordinates);
853
- const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
854
- if (!perPositionHeight) {
855
- const minDistance = Math_default.chordLength(
856
- granularity,
857
- ellipsoid.maximumRadius
858
- );
859
- let numVertices = 0;
860
- if (arcType === ArcType_default.GEODESIC) {
861
- for (i = 0; i < length; i++) {
862
- numVertices += PolygonGeometryLibrary.subdivideLineCount(
863
- positions[i],
864
- positions[(i + 1) % length],
865
- minDistance
866
- );
867
- }
868
- } else if (arcType === ArcType_default.RHUMB) {
869
- for (i = 0; i < length; i++) {
870
- numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
871
- ellipsoid,
872
- positions[i],
873
- positions[(i + 1) % length],
874
- minDistance
875
- );
876
- }
877
- }
878
- topEdgeLength = (numVertices + length) * 3;
879
- edgePositions = new Array(topEdgeLength * 2);
880
- if (hasTexcoords) {
881
- topEdgeTexcoordLength = (numVertices + length) * 2;
882
- edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
883
- }
884
- for (i = 0; i < length; i++) {
885
- p1 = positions[i];
886
- p2 = positions[(i + 1) % length];
887
- let tempPositions;
888
- let tempTexcoords;
889
- if (hasTexcoords) {
890
- t1 = texcoords[i];
891
- t2 = texcoords[(i + 1) % length];
892
- }
893
- if (arcType === ArcType_default.GEODESIC) {
894
- tempPositions = PolygonGeometryLibrary.subdivideLine(
895
- p1,
896
- p2,
897
- minDistance,
898
- computeWallIndicesSubdivided
899
- );
900
- if (hasTexcoords) {
901
- tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordLine(
902
- t1,
903
- t2,
904
- p1,
905
- p2,
906
- minDistance,
907
- computeWallTexcoordsSubdivided
908
- );
909
- }
910
- } else if (arcType === ArcType_default.RHUMB) {
911
- tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
912
- ellipsoid,
913
- p1,
914
- p2,
915
- minDistance,
916
- computeWallIndicesSubdivided
917
- );
918
- if (hasTexcoords) {
919
- tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordRhumbLine(
920
- t1,
921
- t2,
922
- ellipsoid,
923
- p1,
924
- p2,
925
- minDistance,
926
- computeWallTexcoordsSubdivided
927
- );
928
- }
929
- }
930
- const tempPositionsLength = tempPositions.length;
931
- for (let j = 0; j < tempPositionsLength; ++j, ++index) {
932
- edgePositions[index] = tempPositions[j];
933
- edgePositions[index + topEdgeLength] = tempPositions[j];
934
- }
935
- edgePositions[index] = p2.x;
936
- edgePositions[index + topEdgeLength] = p2.x;
937
- ++index;
938
- edgePositions[index] = p2.y;
939
- edgePositions[index + topEdgeLength] = p2.y;
940
- ++index;
941
- edgePositions[index] = p2.z;
942
- edgePositions[index + topEdgeLength] = p2.z;
943
- ++index;
944
- if (hasTexcoords) {
945
- const tempTexcoordsLength = tempTexcoords.length;
946
- for (let k = 0; k < tempTexcoordsLength; ++k, ++textureIndex) {
947
- edgeTexcoords[textureIndex] = tempTexcoords[k];
948
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = tempTexcoords[k];
949
- }
950
- edgeTexcoords[textureIndex] = t2.x;
951
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
952
- ++textureIndex;
953
- edgeTexcoords[textureIndex] = t2.y;
954
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
955
- ++textureIndex;
956
- }
957
- }
958
- } else {
959
- topEdgeLength = length * 3 * 2;
960
- edgePositions = new Array(topEdgeLength * 2);
961
- if (hasTexcoords) {
962
- topEdgeTexcoordLength = length * 2 * 2;
963
- edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
964
- }
965
- for (i = 0; i < length; i++) {
966
- p1 = positions[i];
967
- p2 = positions[(i + 1) % length];
968
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.x;
969
- ++index;
970
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.y;
971
- ++index;
972
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.z;
973
- ++index;
974
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.x;
975
- ++index;
976
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.y;
977
- ++index;
978
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.z;
979
- ++index;
980
- if (hasTexcoords) {
981
- t1 = texcoords[i];
982
- t2 = texcoords[(i + 1) % length];
983
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.x;
984
- ++textureIndex;
985
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.y;
986
- ++textureIndex;
987
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
988
- ++textureIndex;
989
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
990
- ++textureIndex;
991
- }
992
- }
993
- }
994
- length = edgePositions.length;
995
- const indices = IndexDatatype_default.createTypedArray(
996
- length / 3,
997
- length - positions.length * 6
998
- );
999
- let edgeIndex = 0;
1000
- length /= 6;
1001
- for (i = 0; i < length; i++) {
1002
- const UL = i;
1003
- const UR = UL + 1;
1004
- const LL = UL + length;
1005
- const LR = LL + 1;
1006
- p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch);
1007
- p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch);
1008
- if (Cartesian3_default.equalsEpsilon(
1009
- p1,
1010
- p2,
1011
- Math_default.EPSILON10,
1012
- Math_default.EPSILON10
1013
- )) {
1014
- continue;
1015
- }
1016
- indices[edgeIndex++] = UL;
1017
- indices[edgeIndex++] = LL;
1018
- indices[edgeIndex++] = UR;
1019
- indices[edgeIndex++] = UR;
1020
- indices[edgeIndex++] = LL;
1021
- indices[edgeIndex++] = LR;
1022
- }
1023
- const geometryOptions = {
1024
- attributes: new GeometryAttributes_default({
1025
- position: new GeometryAttribute_default({
1026
- componentDatatype: ComponentDatatype_default.DOUBLE,
1027
- componentsPerAttribute: 3,
1028
- values: edgePositions
1029
- })
1030
- }),
1031
- indices,
1032
- primitiveType: PrimitiveType_default.TRIANGLES
1033
- };
1034
- if (hasTexcoords) {
1035
- geometryOptions.attributes.st = new GeometryAttribute_default({
1036
- componentDatatype: ComponentDatatype_default.FLOAT,
1037
- componentsPerAttribute: 2,
1038
- values: edgeTexcoords
1039
- });
1040
- }
1041
- const geometry = new Geometry_default(geometryOptions);
1042
- return geometry;
1043
- };
1044
- var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
1045
-
1046
- export {
1047
- PolygonGeometryLibrary_default
1048
- };