@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,945 +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
- EllipsoidRhumbLine_default
28
- } from "./chunk-E6V6SQZW.js";
29
- import {
30
- GeometryAttribute_default,
31
- Geometry_default,
32
- PrimitiveType_default
33
- } from "./chunk-GWCFU2SA.js";
34
- import {
35
- ComponentDatatype_default
36
- } from "./chunk-K4GQUNB5.js";
37
- import {
38
- Cartesian2_default,
39
- Cartesian3_default,
40
- Cartographic_default,
41
- Ellipsoid_default
42
- } from "./chunk-YFXQECWV.js";
43
- import {
44
- Math_default
45
- } from "./chunk-XY4BATBS.js";
46
- import {
47
- WebGLConstants_default
48
- } from "./chunk-MXIZJAPH.js";
49
- import {
50
- defaultValue_default
51
- } from "./chunk-7JO7GPJN.js";
52
- import {
53
- Check_default
54
- } from "./chunk-AD63PIY6.js";
55
- import {
56
- defined_default
57
- } from "./chunk-E63IIM5T.js";
58
-
59
- // packages/engine/Source/Core/WindingOrder.js
60
- var WindingOrder = {
61
- /**
62
- * Vertices are in clockwise order.
63
- *
64
- * @type {number}
65
- * @constant
66
- */
67
- CLOCKWISE: WebGLConstants_default.CW,
68
- /**
69
- * Vertices are in counter-clockwise order.
70
- *
71
- * @type {number}
72
- * @constant
73
- */
74
- COUNTER_CLOCKWISE: WebGLConstants_default.CCW
75
- };
76
- WindingOrder.validate = function(windingOrder) {
77
- return windingOrder === WindingOrder.CLOCKWISE || windingOrder === WindingOrder.COUNTER_CLOCKWISE;
78
- };
79
- var WindingOrder_default = Object.freeze(WindingOrder);
80
-
81
- // node_modules/earcut/src/earcut.js
82
- function earcut(data, holeIndices, dim = 2) {
83
- const hasHoles = holeIndices && holeIndices.length;
84
- const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
85
- let outerNode = linkedList(data, 0, outerLen, dim, true);
86
- const triangles = [];
87
- if (!outerNode || outerNode.next === outerNode.prev) return triangles;
88
- let minX, minY, invSize;
89
- if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
90
- if (data.length > 80 * dim) {
91
- minX = Infinity;
92
- minY = Infinity;
93
- let maxX = -Infinity;
94
- let maxY = -Infinity;
95
- for (let i = dim; i < outerLen; i += dim) {
96
- const x = data[i];
97
- const y = data[i + 1];
98
- if (x < minX) minX = x;
99
- if (y < minY) minY = y;
100
- if (x > maxX) maxX = x;
101
- if (y > maxY) maxY = y;
102
- }
103
- invSize = Math.max(maxX - minX, maxY - minY);
104
- invSize = invSize !== 0 ? 32767 / invSize : 0;
105
- }
106
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
107
- return triangles;
108
- }
109
- function linkedList(data, start, end, dim, clockwise) {
110
- let last;
111
- if (clockwise === signedArea(data, start, end, dim) > 0) {
112
- for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
113
- } else {
114
- for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
115
- }
116
- if (last && equals(last, last.next)) {
117
- removeNode(last);
118
- last = last.next;
119
- }
120
- return last;
121
- }
122
- function filterPoints(start, end) {
123
- if (!start) return start;
124
- if (!end) end = start;
125
- let p = start, again;
126
- do {
127
- again = false;
128
- if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
129
- removeNode(p);
130
- p = end = p.prev;
131
- if (p === p.next) break;
132
- again = true;
133
- } else {
134
- p = p.next;
135
- }
136
- } while (again || p !== end);
137
- return end;
138
- }
139
- function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
140
- if (!ear) return;
141
- if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
142
- let stop = ear;
143
- while (ear.prev !== ear.next) {
144
- const prev = ear.prev;
145
- const next = ear.next;
146
- if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
147
- triangles.push(prev.i, ear.i, next.i);
148
- removeNode(ear);
149
- ear = next.next;
150
- stop = next.next;
151
- continue;
152
- }
153
- ear = next;
154
- if (ear === stop) {
155
- if (!pass) {
156
- earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
157
- } else if (pass === 1) {
158
- ear = cureLocalIntersections(filterPoints(ear), triangles);
159
- earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
160
- } else if (pass === 2) {
161
- splitEarcut(ear, triangles, dim, minX, minY, invSize);
162
- }
163
- break;
164
- }
165
- }
166
- }
167
- function isEar(ear) {
168
- const a = ear.prev, b = ear, c = ear.next;
169
- if (area(a, b, c) >= 0) return false;
170
- const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
171
- const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
172
- let p = c.next;
173
- while (p !== a) {
174
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
175
- p = p.next;
176
- }
177
- return true;
178
- }
179
- function isEarHashed(ear, minX, minY, invSize) {
180
- const a = ear.prev, b = ear, c = ear.next;
181
- if (area(a, b, c) >= 0) return false;
182
- const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
183
- const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
184
- const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
185
- let p = ear.prevZ, n = ear.nextZ;
186
- while (p && p.z >= minZ && n && n.z <= maxZ) {
187
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
188
- p = p.prevZ;
189
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
190
- n = n.nextZ;
191
- }
192
- while (p && p.z >= minZ) {
193
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
194
- p = p.prevZ;
195
- }
196
- while (n && n.z <= maxZ) {
197
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
198
- n = n.nextZ;
199
- }
200
- return true;
201
- }
202
- function cureLocalIntersections(start, triangles) {
203
- let p = start;
204
- do {
205
- const a = p.prev, b = p.next.next;
206
- if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
207
- triangles.push(a.i, p.i, b.i);
208
- removeNode(p);
209
- removeNode(p.next);
210
- p = start = b;
211
- }
212
- p = p.next;
213
- } while (p !== start);
214
- return filterPoints(p);
215
- }
216
- function splitEarcut(start, triangles, dim, minX, minY, invSize) {
217
- let a = start;
218
- do {
219
- let b = a.next.next;
220
- while (b !== a.prev) {
221
- if (a.i !== b.i && isValidDiagonal(a, b)) {
222
- let c = splitPolygon(a, b);
223
- a = filterPoints(a, a.next);
224
- c = filterPoints(c, c.next);
225
- earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
226
- earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
227
- return;
228
- }
229
- b = b.next;
230
- }
231
- a = a.next;
232
- } while (a !== start);
233
- }
234
- function eliminateHoles(data, holeIndices, outerNode, dim) {
235
- const queue = [];
236
- for (let i = 0, len = holeIndices.length; i < len; i++) {
237
- const start = holeIndices[i] * dim;
238
- const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
239
- const list = linkedList(data, start, end, dim, false);
240
- if (list === list.next) list.steiner = true;
241
- queue.push(getLeftmost(list));
242
- }
243
- queue.sort(compareX);
244
- for (let i = 0; i < queue.length; i++) {
245
- outerNode = eliminateHole(queue[i], outerNode);
246
- }
247
- return outerNode;
248
- }
249
- function compareX(a, b) {
250
- return a.x - b.x;
251
- }
252
- function eliminateHole(hole, outerNode) {
253
- const bridge = findHoleBridge(hole, outerNode);
254
- if (!bridge) {
255
- return outerNode;
256
- }
257
- const bridgeReverse = splitPolygon(bridge, hole);
258
- filterPoints(bridgeReverse, bridgeReverse.next);
259
- return filterPoints(bridge, bridge.next);
260
- }
261
- function findHoleBridge(hole, outerNode) {
262
- let p = outerNode;
263
- const hx = hole.x;
264
- const hy = hole.y;
265
- let qx = -Infinity;
266
- let m;
267
- do {
268
- if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
269
- const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
270
- if (x <= hx && x > qx) {
271
- qx = x;
272
- m = p.x < p.next.x ? p : p.next;
273
- if (x === hx) return m;
274
- }
275
- }
276
- p = p.next;
277
- } while (p !== outerNode);
278
- if (!m) return null;
279
- const stop = m;
280
- const mx = m.x;
281
- const my = m.y;
282
- let tanMin = Infinity;
283
- p = m;
284
- do {
285
- if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
286
- const tan = Math.abs(hy - p.y) / (hx - p.x);
287
- if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
288
- m = p;
289
- tanMin = tan;
290
- }
291
- }
292
- p = p.next;
293
- } while (p !== stop);
294
- return m;
295
- }
296
- function sectorContainsSector(m, p) {
297
- return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
298
- }
299
- function indexCurve(start, minX, minY, invSize) {
300
- let p = start;
301
- do {
302
- if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
303
- p.prevZ = p.prev;
304
- p.nextZ = p.next;
305
- p = p.next;
306
- } while (p !== start);
307
- p.prevZ.nextZ = null;
308
- p.prevZ = null;
309
- sortLinked(p);
310
- }
311
- function sortLinked(list) {
312
- let numMerges;
313
- let inSize = 1;
314
- do {
315
- let p = list;
316
- let e;
317
- list = null;
318
- let tail = null;
319
- numMerges = 0;
320
- while (p) {
321
- numMerges++;
322
- let q = p;
323
- let pSize = 0;
324
- for (let i = 0; i < inSize; i++) {
325
- pSize++;
326
- q = q.nextZ;
327
- if (!q) break;
328
- }
329
- let qSize = inSize;
330
- while (pSize > 0 || qSize > 0 && q) {
331
- if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
332
- e = p;
333
- p = p.nextZ;
334
- pSize--;
335
- } else {
336
- e = q;
337
- q = q.nextZ;
338
- qSize--;
339
- }
340
- if (tail) tail.nextZ = e;
341
- else list = e;
342
- e.prevZ = tail;
343
- tail = e;
344
- }
345
- p = q;
346
- }
347
- tail.nextZ = null;
348
- inSize *= 2;
349
- } while (numMerges > 1);
350
- return list;
351
- }
352
- function zOrder(x, y, minX, minY, invSize) {
353
- x = (x - minX) * invSize | 0;
354
- y = (y - minY) * invSize | 0;
355
- x = (x | x << 8) & 16711935;
356
- x = (x | x << 4) & 252645135;
357
- x = (x | x << 2) & 858993459;
358
- x = (x | x << 1) & 1431655765;
359
- y = (y | y << 8) & 16711935;
360
- y = (y | y << 4) & 252645135;
361
- y = (y | y << 2) & 858993459;
362
- y = (y | y << 1) & 1431655765;
363
- return x | y << 1;
364
- }
365
- function getLeftmost(start) {
366
- let p = start, leftmost = start;
367
- do {
368
- if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
369
- p = p.next;
370
- } while (p !== start);
371
- return leftmost;
372
- }
373
- function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
374
- return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
375
- }
376
- function isValidDiagonal(a, b) {
377
- return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
378
- (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
379
- (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
380
- equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
381
- }
382
- function area(p, q, r) {
383
- return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
384
- }
385
- function equals(p1, p2) {
386
- return p1.x === p2.x && p1.y === p2.y;
387
- }
388
- function intersects(p1, q1, p2, q2) {
389
- const o1 = sign(area(p1, q1, p2));
390
- const o2 = sign(area(p1, q1, q2));
391
- const o3 = sign(area(p2, q2, p1));
392
- const o4 = sign(area(p2, q2, q1));
393
- if (o1 !== o2 && o3 !== o4) return true;
394
- if (o1 === 0 && onSegment(p1, p2, q1)) return true;
395
- if (o2 === 0 && onSegment(p1, q2, q1)) return true;
396
- if (o3 === 0 && onSegment(p2, p1, q2)) return true;
397
- if (o4 === 0 && onSegment(p2, q1, q2)) return true;
398
- return false;
399
- }
400
- function onSegment(p, q, r) {
401
- return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
402
- }
403
- function sign(num) {
404
- return num > 0 ? 1 : num < 0 ? -1 : 0;
405
- }
406
- function intersectsPolygon(a, b) {
407
- let p = a;
408
- do {
409
- if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
410
- p = p.next;
411
- } while (p !== a);
412
- return false;
413
- }
414
- function locallyInside(a, b) {
415
- return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
416
- }
417
- function middleInside(a, b) {
418
- let p = a;
419
- let inside = false;
420
- const px = (a.x + b.x) / 2;
421
- const py = (a.y + b.y) / 2;
422
- do {
423
- if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
424
- inside = !inside;
425
- p = p.next;
426
- } while (p !== a);
427
- return inside;
428
- }
429
- function splitPolygon(a, b) {
430
- const a2 = createNode(a.i, a.x, a.y), b2 = createNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
431
- a.next = b;
432
- b.prev = a;
433
- a2.next = an;
434
- an.prev = a2;
435
- b2.next = a2;
436
- a2.prev = b2;
437
- bp.next = b2;
438
- b2.prev = bp;
439
- return b2;
440
- }
441
- function insertNode(i, x, y, last) {
442
- const p = createNode(i, x, y);
443
- if (!last) {
444
- p.prev = p;
445
- p.next = p;
446
- } else {
447
- p.next = last.next;
448
- p.prev = last;
449
- last.next.prev = p;
450
- last.next = p;
451
- }
452
- return p;
453
- }
454
- function removeNode(p) {
455
- p.next.prev = p.prev;
456
- p.prev.next = p.next;
457
- if (p.prevZ) p.prevZ.nextZ = p.nextZ;
458
- if (p.nextZ) p.nextZ.prevZ = p.prevZ;
459
- }
460
- function createNode(i, x, y) {
461
- return {
462
- i,
463
- // vertex index in coordinates array
464
- x,
465
- y,
466
- // vertex coordinates
467
- prev: null,
468
- // previous and next vertex nodes in a polygon ring
469
- next: null,
470
- z: 0,
471
- // z-order curve value
472
- prevZ: null,
473
- // previous and next nodes in z-order
474
- nextZ: null,
475
- steiner: false
476
- // indicates whether this is a steiner point
477
- };
478
- }
479
- function signedArea(data, start, end, dim) {
480
- let sum = 0;
481
- for (let i = start, j = end - dim; i < end; i += dim) {
482
- sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
483
- j = i;
484
- }
485
- return sum;
486
- }
487
-
488
- // packages/engine/Source/Core/PolygonPipeline.js
489
- var scaleToGeodeticHeightN = new Cartesian3_default();
490
- var scaleToGeodeticHeightP = new Cartesian3_default();
491
- var PolygonPipeline = {};
492
- PolygonPipeline.computeArea2D = function(positions) {
493
- Check_default.defined("positions", positions);
494
- Check_default.typeOf.number.greaterThanOrEquals(
495
- "positions.length",
496
- positions.length,
497
- 3
498
- );
499
- const length = positions.length;
500
- let area2 = 0;
501
- for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
502
- const v0 = positions[i0];
503
- const v1 = positions[i1];
504
- area2 += v0.x * v1.y - v1.x * v0.y;
505
- }
506
- return area2 * 0.5;
507
- };
508
- PolygonPipeline.computeWindingOrder2D = function(positions) {
509
- const area2 = PolygonPipeline.computeArea2D(positions);
510
- return area2 > 0 ? WindingOrder_default.COUNTER_CLOCKWISE : WindingOrder_default.CLOCKWISE;
511
- };
512
- PolygonPipeline.triangulate = function(positions, holes) {
513
- Check_default.defined("positions", positions);
514
- const flattenedPositions = Cartesian2_default.packArray(positions);
515
- return earcut(flattenedPositions, holes, 2);
516
- };
517
- var subdivisionV0Scratch = new Cartesian3_default();
518
- var subdivisionV1Scratch = new Cartesian3_default();
519
- var subdivisionV2Scratch = new Cartesian3_default();
520
- var subdivisionS0Scratch = new Cartesian3_default();
521
- var subdivisionS1Scratch = new Cartesian3_default();
522
- var subdivisionS2Scratch = new Cartesian3_default();
523
- var subdivisionMidScratch = new Cartesian3_default();
524
- var subdivisionT0Scratch = new Cartesian2_default();
525
- var subdivisionT1Scratch = new Cartesian2_default();
526
- var subdivisionT2Scratch = new Cartesian2_default();
527
- var subdivisionTexcoordMidScratch = new Cartesian2_default();
528
- PolygonPipeline.computeSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
529
- granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
530
- const hasTexcoords = defined_default(texcoords);
531
- Check_default.typeOf.object("ellipsoid", ellipsoid);
532
- Check_default.defined("positions", positions);
533
- Check_default.defined("indices", indices);
534
- Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
535
- Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
536
- Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
537
- const triangles = indices.slice(0);
538
- let i;
539
- const length = positions.length;
540
- const subdividedPositions = new Array(length * 3);
541
- const subdividedTexcoords = new Array(length * 2);
542
- let q = 0;
543
- let p = 0;
544
- for (i = 0; i < length; i++) {
545
- const item = positions[i];
546
- subdividedPositions[q++] = item.x;
547
- subdividedPositions[q++] = item.y;
548
- subdividedPositions[q++] = item.z;
549
- if (hasTexcoords) {
550
- const texcoordItem = texcoords[i];
551
- subdividedTexcoords[p++] = texcoordItem.x;
552
- subdividedTexcoords[p++] = texcoordItem.y;
553
- }
554
- }
555
- const subdividedIndices = [];
556
- const edges = {};
557
- const radius = ellipsoid.maximumRadius;
558
- const minDistance = Math_default.chordLength(granularity, radius);
559
- const minDistanceSqrd = minDistance * minDistance;
560
- while (triangles.length > 0) {
561
- const i2 = triangles.pop();
562
- const i1 = triangles.pop();
563
- const i0 = triangles.pop();
564
- const v0 = Cartesian3_default.fromArray(
565
- subdividedPositions,
566
- i0 * 3,
567
- subdivisionV0Scratch
568
- );
569
- const v1 = Cartesian3_default.fromArray(
570
- subdividedPositions,
571
- i1 * 3,
572
- subdivisionV1Scratch
573
- );
574
- const v2 = Cartesian3_default.fromArray(
575
- subdividedPositions,
576
- i2 * 3,
577
- subdivisionV2Scratch
578
- );
579
- let t0, t1, t2;
580
- if (hasTexcoords) {
581
- t0 = Cartesian2_default.fromArray(
582
- subdividedTexcoords,
583
- i0 * 2,
584
- subdivisionT0Scratch
585
- );
586
- t1 = Cartesian2_default.fromArray(
587
- subdividedTexcoords,
588
- i1 * 2,
589
- subdivisionT1Scratch
590
- );
591
- t2 = Cartesian2_default.fromArray(
592
- subdividedTexcoords,
593
- i2 * 2,
594
- subdivisionT2Scratch
595
- );
596
- }
597
- const s0 = Cartesian3_default.multiplyByScalar(
598
- Cartesian3_default.normalize(v0, subdivisionS0Scratch),
599
- radius,
600
- subdivisionS0Scratch
601
- );
602
- const s1 = Cartesian3_default.multiplyByScalar(
603
- Cartesian3_default.normalize(v1, subdivisionS1Scratch),
604
- radius,
605
- subdivisionS1Scratch
606
- );
607
- const s2 = Cartesian3_default.multiplyByScalar(
608
- Cartesian3_default.normalize(v2, subdivisionS2Scratch),
609
- radius,
610
- subdivisionS2Scratch
611
- );
612
- const g0 = Cartesian3_default.magnitudeSquared(
613
- Cartesian3_default.subtract(s0, s1, subdivisionMidScratch)
614
- );
615
- const g1 = Cartesian3_default.magnitudeSquared(
616
- Cartesian3_default.subtract(s1, s2, subdivisionMidScratch)
617
- );
618
- const g2 = Cartesian3_default.magnitudeSquared(
619
- Cartesian3_default.subtract(s2, s0, subdivisionMidScratch)
620
- );
621
- const max = Math.max(g0, g1, g2);
622
- let edge;
623
- let mid;
624
- let midTexcoord;
625
- if (max > minDistanceSqrd) {
626
- if (g0 === max) {
627
- edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
628
- i = edges[edge];
629
- if (!defined_default(i)) {
630
- mid = Cartesian3_default.add(v0, v1, subdivisionMidScratch);
631
- Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
632
- subdividedPositions.push(mid.x, mid.y, mid.z);
633
- i = subdividedPositions.length / 3 - 1;
634
- edges[edge] = i;
635
- if (hasTexcoords) {
636
- midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
637
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
638
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
639
- }
640
- }
641
- triangles.push(i0, i, i2);
642
- triangles.push(i, i1, i2);
643
- } else if (g1 === max) {
644
- edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
645
- i = edges[edge];
646
- if (!defined_default(i)) {
647
- mid = Cartesian3_default.add(v1, v2, subdivisionMidScratch);
648
- Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
649
- subdividedPositions.push(mid.x, mid.y, mid.z);
650
- i = subdividedPositions.length / 3 - 1;
651
- edges[edge] = i;
652
- if (hasTexcoords) {
653
- midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
654
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
655
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
656
- }
657
- }
658
- triangles.push(i1, i, i0);
659
- triangles.push(i, i2, i0);
660
- } else if (g2 === max) {
661
- edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
662
- i = edges[edge];
663
- if (!defined_default(i)) {
664
- mid = Cartesian3_default.add(v2, v0, subdivisionMidScratch);
665
- Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
666
- subdividedPositions.push(mid.x, mid.y, mid.z);
667
- i = subdividedPositions.length / 3 - 1;
668
- edges[edge] = i;
669
- if (hasTexcoords) {
670
- midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
671
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
672
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
673
- }
674
- }
675
- triangles.push(i2, i, i1);
676
- triangles.push(i, i0, i1);
677
- }
678
- } else {
679
- subdividedIndices.push(i0);
680
- subdividedIndices.push(i1);
681
- subdividedIndices.push(i2);
682
- }
683
- }
684
- const geometryOptions = {
685
- attributes: {
686
- position: new GeometryAttribute_default({
687
- componentDatatype: ComponentDatatype_default.DOUBLE,
688
- componentsPerAttribute: 3,
689
- values: subdividedPositions
690
- })
691
- },
692
- indices: subdividedIndices,
693
- primitiveType: PrimitiveType_default.TRIANGLES
694
- };
695
- if (hasTexcoords) {
696
- geometryOptions.attributes.st = new GeometryAttribute_default({
697
- componentDatatype: ComponentDatatype_default.FLOAT,
698
- componentsPerAttribute: 2,
699
- values: subdividedTexcoords
700
- });
701
- }
702
- return new Geometry_default(geometryOptions);
703
- };
704
- var subdivisionC0Scratch = new Cartographic_default();
705
- var subdivisionC1Scratch = new Cartographic_default();
706
- var subdivisionC2Scratch = new Cartographic_default();
707
- var subdivisionCartographicScratch = new Cartographic_default();
708
- PolygonPipeline.computeRhumbLineSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
709
- granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
710
- const hasTexcoords = defined_default(texcoords);
711
- Check_default.typeOf.object("ellipsoid", ellipsoid);
712
- Check_default.defined("positions", positions);
713
- Check_default.defined("indices", indices);
714
- Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
715
- Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
716
- Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
717
- const triangles = indices.slice(0);
718
- let i;
719
- const length = positions.length;
720
- const subdividedPositions = new Array(length * 3);
721
- const subdividedTexcoords = new Array(length * 2);
722
- let q = 0;
723
- let p = 0;
724
- for (i = 0; i < length; i++) {
725
- const item = positions[i];
726
- subdividedPositions[q++] = item.x;
727
- subdividedPositions[q++] = item.y;
728
- subdividedPositions[q++] = item.z;
729
- if (hasTexcoords) {
730
- const texcoordItem = texcoords[i];
731
- subdividedTexcoords[p++] = texcoordItem.x;
732
- subdividedTexcoords[p++] = texcoordItem.y;
733
- }
734
- }
735
- const subdividedIndices = [];
736
- const edges = {};
737
- const radius = ellipsoid.maximumRadius;
738
- const minDistance = Math_default.chordLength(granularity, radius);
739
- const rhumb0 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
740
- const rhumb1 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
741
- const rhumb2 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
742
- while (triangles.length > 0) {
743
- const i2 = triangles.pop();
744
- const i1 = triangles.pop();
745
- const i0 = triangles.pop();
746
- const v0 = Cartesian3_default.fromArray(
747
- subdividedPositions,
748
- i0 * 3,
749
- subdivisionV0Scratch
750
- );
751
- const v1 = Cartesian3_default.fromArray(
752
- subdividedPositions,
753
- i1 * 3,
754
- subdivisionV1Scratch
755
- );
756
- const v2 = Cartesian3_default.fromArray(
757
- subdividedPositions,
758
- i2 * 3,
759
- subdivisionV2Scratch
760
- );
761
- let t0, t1, t2;
762
- if (hasTexcoords) {
763
- t0 = Cartesian2_default.fromArray(
764
- subdividedTexcoords,
765
- i0 * 2,
766
- subdivisionT0Scratch
767
- );
768
- t1 = Cartesian2_default.fromArray(
769
- subdividedTexcoords,
770
- i1 * 2,
771
- subdivisionT1Scratch
772
- );
773
- t2 = Cartesian2_default.fromArray(
774
- subdividedTexcoords,
775
- i2 * 2,
776
- subdivisionT2Scratch
777
- );
778
- }
779
- const c0 = ellipsoid.cartesianToCartographic(v0, subdivisionC0Scratch);
780
- const c1 = ellipsoid.cartesianToCartographic(v1, subdivisionC1Scratch);
781
- const c2 = ellipsoid.cartesianToCartographic(v2, subdivisionC2Scratch);
782
- rhumb0.setEndPoints(c0, c1);
783
- const g0 = rhumb0.surfaceDistance;
784
- rhumb1.setEndPoints(c1, c2);
785
- const g1 = rhumb1.surfaceDistance;
786
- rhumb2.setEndPoints(c2, c0);
787
- const g2 = rhumb2.surfaceDistance;
788
- const max = Math.max(g0, g1, g2);
789
- let edge;
790
- let mid;
791
- let midHeight;
792
- let midCartesian3;
793
- let midTexcoord;
794
- if (max > minDistance) {
795
- if (g0 === max) {
796
- edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
797
- i = edges[edge];
798
- if (!defined_default(i)) {
799
- mid = rhumb0.interpolateUsingFraction(
800
- 0.5,
801
- subdivisionCartographicScratch
802
- );
803
- midHeight = (c0.height + c1.height) * 0.5;
804
- midCartesian3 = Cartesian3_default.fromRadians(
805
- mid.longitude,
806
- mid.latitude,
807
- midHeight,
808
- ellipsoid,
809
- subdivisionMidScratch
810
- );
811
- subdividedPositions.push(
812
- midCartesian3.x,
813
- midCartesian3.y,
814
- midCartesian3.z
815
- );
816
- i = subdividedPositions.length / 3 - 1;
817
- edges[edge] = i;
818
- if (hasTexcoords) {
819
- midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
820
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
821
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
822
- }
823
- }
824
- triangles.push(i0, i, i2);
825
- triangles.push(i, i1, i2);
826
- } else if (g1 === max) {
827
- edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
828
- i = edges[edge];
829
- if (!defined_default(i)) {
830
- mid = rhumb1.interpolateUsingFraction(
831
- 0.5,
832
- subdivisionCartographicScratch
833
- );
834
- midHeight = (c1.height + c2.height) * 0.5;
835
- midCartesian3 = Cartesian3_default.fromRadians(
836
- mid.longitude,
837
- mid.latitude,
838
- midHeight,
839
- ellipsoid,
840
- subdivisionMidScratch
841
- );
842
- subdividedPositions.push(
843
- midCartesian3.x,
844
- midCartesian3.y,
845
- midCartesian3.z
846
- );
847
- i = subdividedPositions.length / 3 - 1;
848
- edges[edge] = i;
849
- if (hasTexcoords) {
850
- midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
851
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
852
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
853
- }
854
- }
855
- triangles.push(i1, i, i0);
856
- triangles.push(i, i2, i0);
857
- } else if (g2 === max) {
858
- edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
859
- i = edges[edge];
860
- if (!defined_default(i)) {
861
- mid = rhumb2.interpolateUsingFraction(
862
- 0.5,
863
- subdivisionCartographicScratch
864
- );
865
- midHeight = (c2.height + c0.height) * 0.5;
866
- midCartesian3 = Cartesian3_default.fromRadians(
867
- mid.longitude,
868
- mid.latitude,
869
- midHeight,
870
- ellipsoid,
871
- subdivisionMidScratch
872
- );
873
- subdividedPositions.push(
874
- midCartesian3.x,
875
- midCartesian3.y,
876
- midCartesian3.z
877
- );
878
- i = subdividedPositions.length / 3 - 1;
879
- edges[edge] = i;
880
- if (hasTexcoords) {
881
- midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
882
- Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
883
- subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
884
- }
885
- }
886
- triangles.push(i2, i, i1);
887
- triangles.push(i, i0, i1);
888
- }
889
- } else {
890
- subdividedIndices.push(i0);
891
- subdividedIndices.push(i1);
892
- subdividedIndices.push(i2);
893
- }
894
- }
895
- const geometryOptions = {
896
- attributes: {
897
- position: new GeometryAttribute_default({
898
- componentDatatype: ComponentDatatype_default.DOUBLE,
899
- componentsPerAttribute: 3,
900
- values: subdividedPositions
901
- })
902
- },
903
- indices: subdividedIndices,
904
- primitiveType: PrimitiveType_default.TRIANGLES
905
- };
906
- if (hasTexcoords) {
907
- geometryOptions.attributes.st = new GeometryAttribute_default({
908
- componentDatatype: ComponentDatatype_default.FLOAT,
909
- componentsPerAttribute: 2,
910
- values: subdividedTexcoords
911
- });
912
- }
913
- return new Geometry_default(geometryOptions);
914
- };
915
- PolygonPipeline.scaleToGeodeticHeight = function(positions, height, ellipsoid, scaleToSurface) {
916
- ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
917
- let n = scaleToGeodeticHeightN;
918
- let p = scaleToGeodeticHeightP;
919
- height = defaultValue_default(height, 0);
920
- scaleToSurface = defaultValue_default(scaleToSurface, true);
921
- if (defined_default(positions)) {
922
- const length = positions.length;
923
- for (let i = 0; i < length; i += 3) {
924
- Cartesian3_default.fromArray(positions, i, p);
925
- if (scaleToSurface) {
926
- p = ellipsoid.scaleToGeodeticSurface(p, p);
927
- }
928
- if (height !== 0) {
929
- n = ellipsoid.geodeticSurfaceNormal(p, n);
930
- Cartesian3_default.multiplyByScalar(n, height, n);
931
- Cartesian3_default.add(p, n, p);
932
- }
933
- positions[i] = p.x;
934
- positions[i + 1] = p.y;
935
- positions[i + 2] = p.z;
936
- }
937
- }
938
- return positions;
939
- };
940
- var PolygonPipeline_default = PolygonPipeline;
941
-
942
- export {
943
- WindingOrder_default,
944
- PolygonPipeline_default
945
- };