@cesium/engine 3.0.2 → 5.0.0

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 (246) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-2U6EBIRX.js +757 -0
  5. package/Build/Workers/chunk-2ZI7FZ3Q.js +58 -0
  6. package/Build/Workers/chunk-3TSHZWOZ.js +1860 -0
  7. package/Build/Workers/chunk-44B6FQSJ.js +684 -0
  8. package/Build/Workers/chunk-4AJR66C5.js +368 -0
  9. package/Build/Workers/chunk-4HN3N5SE.js +501 -0
  10. package/Build/Workers/chunk-4QGPYV3W.js +102 -0
  11. package/Build/Workers/chunk-4RKE4B3G.js +476 -0
  12. package/Build/Workers/chunk-5E3V7Y4R.js +196 -0
  13. package/Build/Workers/chunk-6EHT6GS3.js +163 -0
  14. package/Build/Workers/chunk-6I22NWKQ.js +171 -0
  15. package/Build/Workers/chunk-7N67FBLW.js +1054 -0
  16. package/Build/Workers/chunk-AQQGAFKX.js +124 -0
  17. package/Build/Workers/chunk-CROU4RHL.js +138 -0
  18. package/Build/Workers/chunk-CTJCECTX.js +258 -0
  19. package/Build/Workers/chunk-DWJZFZ67.js +781 -0
  20. package/Build/Workers/chunk-EHJQEARC.js +59 -0
  21. package/Build/Workers/chunk-EVLKHUAE.js +1477 -0
  22. package/Build/Workers/chunk-FOOYJER7.js +834 -0
  23. package/Build/Workers/chunk-GLCRFDOB.js +73 -0
  24. package/Build/Workers/chunk-GPO47TW4.js +39 -0
  25. package/Build/Workers/chunk-H5Q2JKIA.js +1075 -0
  26. package/Build/Workers/chunk-HIDSEUWS.js +2041 -0
  27. package/Build/Workers/chunk-HV67ARO7.js +302 -0
  28. package/Build/Workers/chunk-IC7G4BX2.js +421 -0
  29. package/Build/Workers/chunk-IQN2LMGD.js +55 -0
  30. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  31. package/Build/Workers/chunk-K3VEWONC.js +289 -0
  32. package/Build/Workers/chunk-KZFXE35V.js +117 -0
  33. package/Build/Workers/chunk-MG2TXIO5.js +400 -0
  34. package/Build/Workers/chunk-MRCFDEKH.js +138 -0
  35. package/Build/Workers/chunk-MYDS6HBL.js +3273 -0
  36. package/Build/Workers/chunk-OCIX2CQ7.js +305 -0
  37. package/Build/Workers/chunk-P32XMW4I.js +2716 -0
  38. package/Build/Workers/chunk-PEVZYZBQ.js +157 -0
  39. package/Build/Workers/chunk-PMDLIBEQ.js +218 -0
  40. package/Build/Workers/chunk-QDUOGCCO.js +1009 -0
  41. package/Build/Workers/chunk-QUCJGBCK.js +430 -0
  42. package/Build/Workers/chunk-RCI7BSOM.js +452 -0
  43. package/Build/Workers/chunk-SVTSC7FX.js +390 -0
  44. package/Build/Workers/chunk-TXOGSFHZ.js +77 -0
  45. package/Build/Workers/chunk-TXYJOVQK.js +629 -0
  46. package/Build/Workers/chunk-UFIT5XDI.js +1258 -0
  47. package/Build/Workers/chunk-ULLMQNFQ.js +73 -0
  48. package/Build/Workers/chunk-UM7FIUQW.js +101 -0
  49. package/Build/Workers/{package.js → chunk-UMLTOPAE.js} +13 -2
  50. package/Build/Workers/chunk-V5S5N2IS.js +8644 -0
  51. package/Build/Workers/chunk-VN2IHJKM.js +513 -0
  52. package/Build/Workers/chunk-VWSD2XV5.js +669 -0
  53. package/Build/Workers/chunk-X2KIWBTW.js +100 -0
  54. package/Build/Workers/chunk-Y24CDOJC.js +353 -0
  55. package/Build/Workers/chunk-YLMDWSXO.js +44 -0
  56. package/Build/Workers/chunk-YNZ4DMR7.js +634 -0
  57. package/Build/Workers/chunk-Z2MP3UBE.js +236 -0
  58. package/Build/Workers/combineGeometry.js +65 -15
  59. package/Build/Workers/createBoxGeometry.js +55 -10
  60. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  61. package/Build/Workers/createCircleGeometry.js +185 -202
  62. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  65. package/Build/Workers/createCorridorGeometry.js +1163 -1307
  66. package/Build/Workers/createCorridorOutlineGeometry.js +534 -569
  67. package/Build/Workers/createCylinderGeometry.js +57 -10
  68. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  69. package/Build/Workers/createEllipseGeometry.js +68 -12
  70. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  71. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  73. package/Build/Workers/createFrustumGeometry.js +55 -10
  74. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  75. package/Build/Workers/createGeometry.js +143 -48
  76. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2012
  77. package/Build/Workers/createPlaneGeometry.js +216 -243
  78. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  79. package/Build/Workers/createPolygonGeometry.js +1437 -1314
  80. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  81. package/Build/Workers/createPolylineGeometry.js +471 -547
  82. package/Build/Workers/createPolylineVolumeGeometry.js +354 -384
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -295
  84. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  85. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  86. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  87. package/Build/Workers/createSphereGeometry.js +112 -118
  88. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  89. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  90. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  91. package/Build/Workers/createVectorTileGeometries.js +377 -436
  92. package/Build/Workers/createVectorTilePoints.js +110 -77
  93. package/Build/Workers/createVectorTilePolygons.js +369 -391
  94. package/Build/Workers/createVectorTilePolylines.js +252 -244
  95. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  96. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  97. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  98. package/Build/Workers/createWallGeometry.js +459 -593
  99. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  100. package/Build/Workers/decodeDraco.js +327 -347
  101. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  102. package/Build/Workers/decodeI3S.js +765 -970
  103. package/Build/Workers/transcodeKTX2.js +3351 -1473
  104. package/Build/Workers/transferTypedArrayTest.js +3 -4
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  106. package/LICENSE.md +0 -12
  107. package/Source/Core/CesiumTerrainProvider.js +1 -2
  108. package/Source/Core/Credit.js +7 -1
  109. package/Source/Core/FeatureDetection.js +9 -0
  110. package/Source/Core/GoogleMaps.js +1 -2
  111. package/Source/Core/Ion.js +1 -2
  112. package/Source/Core/KTX2Transcoder.js +7 -3
  113. package/Source/Core/PolygonGeometry.js +340 -27
  114. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  115. package/Source/Core/Stereographic.js +247 -0
  116. package/Source/Core/TaskProcessor.js +185 -168
  117. package/Source/Core/Transforms.js +2 -2
  118. package/Source/Core/buildModuleUrl.js +6 -5
  119. package/Source/Core/sampleTerrain.js +43 -10
  120. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  121. package/Source/Scene/ArcGisMapService.js +1 -2
  122. package/Source/Scene/Billboard.js +7 -0
  123. package/Source/Scene/Cesium3DTilePass.js +1 -1
  124. package/Source/Scene/Cesium3DTileset.js +38 -81
  125. package/Source/Scene/CreditDisplay.js +2 -2
  126. package/Source/Scene/DracoLoader.js +26 -3
  127. package/Source/Scene/I3SDataProvider.js +0 -27
  128. package/Source/Scene/I3SDecoder.js +127 -0
  129. package/Source/Scene/I3SNode.js +32 -110
  130. package/Source/Scene/Implicit3DTileContent.js +13 -0
  131. package/Source/Scene/ImplicitTileset.js +5 -0
  132. package/Source/Scene/LabelCollection.js +3 -1
  133. package/Source/Scene/Model/I3dmLoader.js +5 -1
  134. package/Source/Scene/Model/Model.js +20 -23
  135. package/Source/Scene/OpenStreetMapImageryProvider.js +4 -1
  136. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  137. package/Source/Scene/PrimitiveCollection.js +39 -0
  138. package/Source/Scene/Scene.js +3 -0
  139. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  140. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  141. package/Source/Widget/CesiumWidget.js +2 -1
  142. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  143. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  144. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  145. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  146. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  147. package/Source/Workers/transferTypedArrayTest.js +0 -6
  148. package/index.d.ts +69 -35
  149. package/index.js +189 -187
  150. package/package.json +2 -1
  151. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  152. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  153. package/Build/Workers/AxisAlignedBoundingBox-a03420b1.js +0 -258
  154. package/Build/Workers/BoundingRectangle-32fa8a4a.js +0 -369
  155. package/Build/Workers/BoxGeometry-cd550612.js +0 -884
  156. package/Build/Workers/Check-6ede7e26.js +0 -290
  157. package/Build/Workers/Color-571a6085.js +0 -2262
  158. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  159. package/Build/Workers/CoplanarPolygonGeometryLibrary-488b1a9f.js +0 -132
  160. package/Build/Workers/CorridorGeometryLibrary-fc4ff147.js +0 -498
  161. package/Build/Workers/CylinderGeometry-bc26926d.js +0 -467
  162. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  163. package/Build/Workers/EllipseGeometry-89533a10.js +0 -1304
  164. package/Build/Workers/EllipseGeometryLibrary-b0d7df17.js +0 -366
  165. package/Build/Workers/EllipseOutlineGeometry-63ff7a87.js +0 -443
  166. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  167. package/Build/Workers/EllipsoidGeometry-07e99d2d.js +0 -637
  168. package/Build/Workers/EllipsoidOutlineGeometry-ba5c7ee2.js +0 -454
  169. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  170. package/Build/Workers/EllipsoidTangentPlane-65d41b3e.js +0 -373
  171. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  172. package/Build/Workers/FrustumGeometry-4a7589ed.js +0 -2540
  173. package/Build/Workers/GeometryAttribute-a5b6275b.js +0 -619
  174. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  175. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  176. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  177. package/Build/Workers/GeometryPipeline-fa9e6ffc.js +0 -3690
  178. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  179. package/Build/Workers/IntersectionTests-feace3da.js +0 -1836
  180. package/Build/Workers/Math-0a2ac845.js +0 -1340
  181. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  182. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  183. package/Build/Workers/OrientedBoundingBox-6b94d955.js +0 -1259
  184. package/Build/Workers/Plane-4c3d403b.js +0 -309
  185. package/Build/Workers/PolygonGeometryLibrary-4ffc457d.js +0 -1074
  186. package/Build/Workers/PolygonPipeline-d5e66350.js +0 -1344
  187. package/Build/Workers/PolylinePipeline-83410f0c.js +0 -573
  188. package/Build/Workers/PolylineVolumeGeometryLibrary-290e7aec.js +0 -781
  189. package/Build/Workers/PrimitivePipeline-6081d138.js +0 -966
  190. package/Build/Workers/RectangleGeometryLibrary-986710d8.js +0 -280
  191. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  192. package/Build/Workers/TerrainEncoding-528e1d68.js +0 -1227
  193. package/Build/Workers/Transforms-b527bb09.js +0 -14714
  194. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  195. package/Build/Workers/WallGeometryLibrary-faf583f8.js +0 -211
  196. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  197. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  198. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  199. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  200. package/Build/Workers/combine-d9581036.js +0 -82
  201. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  202. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  203. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  204. package/Source/Workers/package.json +0 -1
  205. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  235. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  236. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  237. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  238. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  239. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  240. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  241. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  242. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  243. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  244. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  245. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  246. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,462 +1,665 @@
1
- define(['./defaultValue-fe22d8c0', './Matrix3-41c58dde', './ArcType-2d9abbbc', './BoundingRectangle-32fa8a4a', './Transforms-b527bb09', './Matrix2-e1298525', './Check-6ede7e26', './ComponentDatatype-cf1fa08e', './EllipsoidGeodesic-5b3623dc', './EllipsoidTangentPlane-65d41b3e', './GeometryAttribute-a5b6275b', './GeometryInstance-34d9e21e', './GeometryOffsetAttribute-9ad0019c', './GeometryPipeline-fa9e6ffc', './IndexDatatype-2643aa47', './Math-0a2ac845', './PolygonGeometryLibrary-4ffc457d', './PolygonPipeline-d5e66350', './VertexFormat-030f11ff', './combine-d9581036', './RuntimeError-ef395448', './WebGLConstants-0b1ce7ba', './AxisAlignedBoundingBox-a03420b1', './IntersectionTests-feace3da', './Plane-4c3d403b', './AttributeCompression-f9f6c717', './EncodedCartesian3-57415c8a', './arrayRemoveDuplicates-d2061e85', './EllipsoidRhumbLine-ef872433', './GeometryAttributes-ad136444'], (function (defaultValue, Matrix3, ArcType, BoundingRectangle, Transforms, Matrix2, Check, ComponentDatatype, EllipsoidGeodesic, EllipsoidTangentPlane, GeometryAttribute, GeometryInstance, GeometryOffsetAttribute, GeometryPipeline, IndexDatatype, Math$1, PolygonGeometryLibrary, PolygonPipeline, VertexFormat, combine, RuntimeError, WebGLConstants, AxisAlignedBoundingBox, IntersectionTests, Plane, AttributeCompression, EncodedCartesian3, arrayRemoveDuplicates, EllipsoidRhumbLine, GeometryAttributes) { 'use strict';
2
-
3
- const scratchCarto1 = new Matrix3.Cartographic();
4
- const scratchCarto2 = new Matrix3.Cartographic();
5
- function adjustPosHeightsForNormal(position, p1, p2, ellipsoid) {
6
- const carto1 = ellipsoid.cartesianToCartographic(position, scratchCarto1);
7
- const height = carto1.height;
8
- const p1Carto = ellipsoid.cartesianToCartographic(p1, scratchCarto2);
9
- p1Carto.height = height;
10
- ellipsoid.cartographicToCartesian(p1Carto, p1);
11
-
12
- const p2Carto = ellipsoid.cartesianToCartographic(p2, scratchCarto2);
13
- p2Carto.height = height - 100;
14
- ellipsoid.cartographicToCartesian(p2Carto, p2);
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.110
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
+ BoundingRectangle_default
28
+ } from "./chunk-PMDLIBEQ.js";
29
+ import {
30
+ PolygonGeometryLibrary_default
31
+ } from "./chunk-7N67FBLW.js";
32
+ import {
33
+ ArcType_default
34
+ } from "./chunk-IQN2LMGD.js";
35
+ import {
36
+ GeometryInstance_default
37
+ } from "./chunk-EHJQEARC.js";
38
+ import {
39
+ GeometryPipeline_default
40
+ } from "./chunk-P32XMW4I.js";
41
+ import "./chunk-QUCJGBCK.js";
42
+ import "./chunk-4QGPYV3W.js";
43
+ import {
44
+ oneTimeWarning_default
45
+ } from "./chunk-J2FHYK2Z.js";
46
+ import {
47
+ EllipsoidGeodesic_default
48
+ } from "./chunk-Y24CDOJC.js";
49
+ import {
50
+ GeometryOffsetAttribute_default
51
+ } from "./chunk-UMLTOPAE.js";
52
+ import {
53
+ VertexFormat_default
54
+ } from "./chunk-MRCFDEKH.js";
55
+ import {
56
+ EllipsoidTangentPlane_default
57
+ } from "./chunk-K3VEWONC.js";
58
+ import "./chunk-PEVZYZBQ.js";
59
+ import {
60
+ PolygonPipeline_default,
61
+ WindingOrder_default
62
+ } from "./chunk-QDUOGCCO.js";
63
+ import "./chunk-X2KIWBTW.js";
64
+ import "./chunk-RCI7BSOM.js";
65
+ import {
66
+ IntersectionTests_default,
67
+ Ray_default
68
+ } from "./chunk-UFIT5XDI.js";
69
+ import "./chunk-6I22NWKQ.js";
70
+ import {
71
+ IndexDatatype_default
72
+ } from "./chunk-CROU4RHL.js";
73
+ import "./chunk-YLMDWSXO.js";
74
+ import {
75
+ GeometryAttribute_default,
76
+ Geometry_default
77
+ } from "./chunk-HV67ARO7.js";
78
+ import {
79
+ BoundingSphere_default,
80
+ Quaternion_default
81
+ } from "./chunk-V5S5N2IS.js";
82
+ import "./chunk-ULLMQNFQ.js";
83
+ import {
84
+ Cartesian2_default,
85
+ Rectangle_default
86
+ } from "./chunk-MYDS6HBL.js";
87
+ import {
88
+ ComponentDatatype_default
89
+ } from "./chunk-CTJCECTX.js";
90
+ import {
91
+ Cartesian3_default,
92
+ Cartographic_default,
93
+ Ellipsoid_default,
94
+ Matrix3_default
95
+ } from "./chunk-HIDSEUWS.js";
96
+ import {
97
+ Math_default
98
+ } from "./chunk-4HN3N5SE.js";
99
+ import "./chunk-TXYJOVQK.js";
100
+ import "./chunk-2ZI7FZ3Q.js";
101
+ import {
102
+ defaultValue_default
103
+ } from "./chunk-GPO47TW4.js";
104
+ import {
105
+ Check_default,
106
+ DeveloperError_default
107
+ } from "./chunk-6EHT6GS3.js";
108
+ import {
109
+ defined_default
110
+ } from "./chunk-TXOGSFHZ.js";
111
+
112
+ // packages/engine/Source/Core/deprecationWarning.js
113
+ function deprecationWarning(identifier, message) {
114
+ if (!defined_default(identifier) || !defined_default(message)) {
115
+ throw new DeveloperError_default("identifier and message are required.");
15
116
  }
16
-
17
- const scratchBoundingRectangle = new BoundingRectangle.BoundingRectangle();
18
- const scratchPosition = new Matrix3.Cartesian3();
19
- const scratchNormal = new Matrix3.Cartesian3();
20
- const scratchTangent = new Matrix3.Cartesian3();
21
- const scratchBitangent = new Matrix3.Cartesian3();
22
- const p1Scratch = new Matrix3.Cartesian3();
23
- const p2Scratch = new Matrix3.Cartesian3();
24
- let scratchPerPosNormal = new Matrix3.Cartesian3();
25
- let scratchPerPosTangent = new Matrix3.Cartesian3();
26
- let scratchPerPosBitangent = new Matrix3.Cartesian3();
27
-
28
- const appendTextureCoordinatesOrigin = new Matrix2.Cartesian2();
29
- const appendTextureCoordinatesCartesian2 = new Matrix2.Cartesian2();
30
- const appendTextureCoordinatesCartesian3 = new Matrix3.Cartesian3();
31
- const appendTextureCoordinatesQuaternion = new Transforms.Quaternion();
32
- const appendTextureCoordinatesMatrix3 = new Matrix3.Matrix3();
33
- const tangentMatrixScratch = new Matrix3.Matrix3();
34
-
35
- function computeAttributes(options) {
36
- const vertexFormat = options.vertexFormat;
37
- const geometry = options.geometry;
38
- const shadowVolume = options.shadowVolume;
39
- const flatPositions = geometry.attributes.position.values;
40
- const flatTexcoords = defaultValue.defined(geometry.attributes.st)
41
- ? geometry.attributes.st.values
42
- : undefined;
43
-
44
- let length = flatPositions.length;
45
- const wall = options.wall;
46
- const top = options.top || wall;
47
- const bottom = options.bottom || wall;
48
- if (
49
- vertexFormat.st ||
50
- vertexFormat.normal ||
51
- vertexFormat.tangent ||
52
- vertexFormat.bitangent ||
53
- shadowVolume
54
- ) {
55
- // PERFORMANCE_IDEA: Compute before subdivision, then just interpolate during subdivision.
56
- // PERFORMANCE_IDEA: Compute with createGeometryFromPositions() for fast path when there's no holes.
57
- const boundingRectangle = options.boundingRectangle;
58
- const tangentPlane = options.tangentPlane;
59
- const ellipsoid = options.ellipsoid;
60
- const stRotation = options.stRotation;
61
- const perPositionHeight = options.perPositionHeight;
62
-
63
- const origin = appendTextureCoordinatesOrigin;
64
- origin.x = boundingRectangle.x;
65
- origin.y = boundingRectangle.y;
66
-
67
- const textureCoordinates = vertexFormat.st
68
- ? new Float32Array(2 * (length / 3))
69
- : undefined;
70
- let normals;
71
- if (vertexFormat.normal) {
72
- if (perPositionHeight && top && !wall) {
73
- normals = geometry.attributes.normal.values;
74
- } else {
75
- normals = new Float32Array(length);
76
- }
117
+ oneTimeWarning_default(identifier, message);
118
+ }
119
+ var deprecationWarning_default = deprecationWarning;
120
+
121
+ // packages/engine/Source/Core/Stereographic.js
122
+ function Stereographic(position, tangentPlane) {
123
+ this.position = position;
124
+ if (!defined_default(this.position)) {
125
+ this.position = new Cartesian2_default();
126
+ }
127
+ this.tangentPlane = tangentPlane;
128
+ if (!defined_default(this.tangentPlane)) {
129
+ this.tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
130
+ }
131
+ }
132
+ Object.defineProperties(Stereographic.prototype, {
133
+ /**
134
+ * Gets the ellipsoid.
135
+ * @memberof Stereographic.prototype
136
+ * @type {Ellipsoid}
137
+ */
138
+ ellipsoid: {
139
+ get: function() {
140
+ return this.tangentPlane.ellipsoid;
141
+ }
142
+ },
143
+ /**
144
+ * Gets the x coordinate
145
+ * @memberof Stereographic.prototype
146
+ * @type {number}
147
+ */
148
+ x: {
149
+ get: function() {
150
+ return this.position.x;
151
+ }
152
+ },
153
+ /**
154
+ * Gets the y coordinate
155
+ * @memberof Stereographic.prototype
156
+ * @type {number}
157
+ */
158
+ y: {
159
+ get: function() {
160
+ return this.position.y;
161
+ }
162
+ },
163
+ /**
164
+ * Computes the conformal latitude, or the ellipsoidal latitude projected onto an arbitrary sphere.
165
+ * @memberof Stereographic.prototype
166
+ * @type {number}
167
+ */
168
+ conformalLatitude: {
169
+ get: function() {
170
+ const r = Cartesian2_default.magnitude(this.position);
171
+ const d = 2 * this.ellipsoid.maximumRadius;
172
+ const sign = this.tangentPlane.plane.normal.z;
173
+ return sign * (Math_default.PI_OVER_TWO - 2 * Math.atan2(r, d));
174
+ }
175
+ },
176
+ /**
177
+ * Computes the longitude
178
+ * @memberof Stereographic.prototype
179
+ * @type {number}
180
+ */
181
+ longitude: {
182
+ get: function() {
183
+ let longitude = Math_default.PI_OVER_TWO + Math.atan2(this.y, this.x);
184
+ if (longitude > Math.PI) {
185
+ longitude -= Math_default.TWO_PI;
77
186
  }
78
- const tangents = vertexFormat.tangent
79
- ? new Float32Array(length)
80
- : undefined;
81
- const bitangents = vertexFormat.bitangent
82
- ? new Float32Array(length)
83
- : undefined;
84
- const extrudeNormals = shadowVolume ? new Float32Array(length) : undefined;
85
-
86
- let textureCoordIndex = 0;
87
- let attrIndex = 0;
88
-
89
- let normal = scratchNormal;
90
- let tangent = scratchTangent;
91
- let bitangent = scratchBitangent;
92
- let recomputeNormal = true;
93
-
94
- let textureMatrix = appendTextureCoordinatesMatrix3;
95
- let tangentRotationMatrix = tangentMatrixScratch;
96
- if (stRotation !== 0.0) {
97
- let rotation = Transforms.Quaternion.fromAxisAngle(
98
- tangentPlane._plane.normal,
99
- stRotation,
100
- appendTextureCoordinatesQuaternion
101
- );
102
- textureMatrix = Matrix3.Matrix3.fromQuaternion(rotation, textureMatrix);
103
-
104
- rotation = Transforms.Quaternion.fromAxisAngle(
105
- tangentPlane._plane.normal,
106
- -stRotation,
107
- appendTextureCoordinatesQuaternion
108
- );
109
- tangentRotationMatrix = Matrix3.Matrix3.fromQuaternion(
110
- rotation,
111
- tangentRotationMatrix
112
- );
187
+ return longitude;
188
+ }
189
+ }
190
+ });
191
+ var scratchCartographic = new Cartographic_default();
192
+ var scratchCartesian = new Cartesian3_default();
193
+ Stereographic.prototype.getLatitude = function(ellipsoid) {
194
+ if (!defined_default(ellipsoid)) {
195
+ ellipsoid = Ellipsoid_default.WGS84;
196
+ }
197
+ scratchCartographic.latitude = this.conformalLatitude;
198
+ scratchCartographic.longitude = this.longitude;
199
+ scratchCartographic.height = 0;
200
+ const cartesian = this.ellipsoid.cartographicToCartesian(
201
+ scratchCartographic,
202
+ scratchCartesian
203
+ );
204
+ ellipsoid.cartesianToCartographic(cartesian, scratchCartographic);
205
+ return scratchCartographic.latitude;
206
+ };
207
+ var scratchProjectPointOntoPlaneRay = new Ray_default();
208
+ var scratchProjectPointOntoPlaneRayDirection = new Cartesian3_default();
209
+ var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
210
+ Stereographic.fromCartesian = function(cartesian, result) {
211
+ Check_default.defined("cartesian", cartesian);
212
+ const sign = Math_default.signNotZero(cartesian.z);
213
+ let tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
214
+ let origin = Stereographic.SOUTH_POLE;
215
+ if (sign < 0) {
216
+ tangentPlane = Stereographic.SOUTH_POLE_TANGENT_PLANE;
217
+ origin = Stereographic.NORTH_POLE;
218
+ }
219
+ const ray = scratchProjectPointOntoPlaneRay;
220
+ ray.origin = tangentPlane.ellipsoid.scaleToGeocentricSurface(
221
+ cartesian,
222
+ ray.origin
223
+ );
224
+ ray.direction = Cartesian3_default.subtract(
225
+ ray.origin,
226
+ origin,
227
+ scratchProjectPointOntoPlaneRayDirection
228
+ );
229
+ Cartesian3_default.normalize(ray.direction, ray.direction);
230
+ const intersectionPoint = IntersectionTests_default.rayPlane(
231
+ ray,
232
+ tangentPlane.plane,
233
+ scratchProjectPointOntoPlaneCartesian3
234
+ );
235
+ const v = Cartesian3_default.subtract(intersectionPoint, origin, intersectionPoint);
236
+ const x = Cartesian3_default.dot(tangentPlane.xAxis, v);
237
+ const y = sign * Cartesian3_default.dot(tangentPlane.yAxis, v);
238
+ if (!defined_default(result)) {
239
+ return new Stereographic(new Cartesian2_default(x, y), tangentPlane);
240
+ }
241
+ result.position = new Cartesian2_default(x, y);
242
+ result.tangentPlane = tangentPlane;
243
+ return result;
244
+ };
245
+ Stereographic.fromCartesianArray = function(cartesians, result) {
246
+ Check_default.defined("cartesians", cartesians);
247
+ const length = cartesians.length;
248
+ if (!defined_default(result)) {
249
+ result = new Array(length);
250
+ } else {
251
+ result.length = length;
252
+ }
253
+ for (let i = 0; i < length; i++) {
254
+ result[i] = Stereographic.fromCartesian(cartesians[i], result[i]);
255
+ }
256
+ return result;
257
+ };
258
+ Stereographic.clone = function(stereographic, result) {
259
+ if (!defined_default(stereographic)) {
260
+ return void 0;
261
+ }
262
+ if (!defined_default(result)) {
263
+ return new Stereographic(
264
+ stereographic.position,
265
+ stereographic.tangentPlane
266
+ );
267
+ }
268
+ result.position = stereographic.position;
269
+ result.tangentPlane = stereographic.tangentPlane;
270
+ return result;
271
+ };
272
+ Stereographic.HALF_UNIT_SPHERE = Object.freeze(new Ellipsoid_default(0.5, 0.5, 0.5));
273
+ Stereographic.NORTH_POLE = Object.freeze(new Cartesian3_default(0, 0, 0.5));
274
+ Stereographic.SOUTH_POLE = Object.freeze(new Cartesian3_default(0, 0, -0.5));
275
+ Stereographic.NORTH_POLE_TANGENT_PLANE = Object.freeze(
276
+ new EllipsoidTangentPlane_default(
277
+ Stereographic.NORTH_POLE,
278
+ Stereographic.HALF_UNIT_SPHERE
279
+ )
280
+ );
281
+ Stereographic.SOUTH_POLE_TANGENT_PLANE = Object.freeze(
282
+ new EllipsoidTangentPlane_default(
283
+ Stereographic.SOUTH_POLE,
284
+ Stereographic.HALF_UNIT_SPHERE
285
+ )
286
+ );
287
+ var Stereographic_default = Stereographic;
288
+
289
+ // packages/engine/Source/Core/PolygonGeometry.js
290
+ var scratchCarto1 = new Cartographic_default();
291
+ var scratchCarto2 = new Cartographic_default();
292
+ function adjustPosHeightsForNormal(position, p1, p2, ellipsoid) {
293
+ const carto1 = ellipsoid.cartesianToCartographic(position, scratchCarto1);
294
+ const height = carto1.height;
295
+ const p1Carto = ellipsoid.cartesianToCartographic(p1, scratchCarto2);
296
+ p1Carto.height = height;
297
+ ellipsoid.cartographicToCartesian(p1Carto, p1);
298
+ const p2Carto = ellipsoid.cartesianToCartographic(p2, scratchCarto2);
299
+ p2Carto.height = height - 100;
300
+ ellipsoid.cartographicToCartesian(p2Carto, p2);
301
+ }
302
+ var scratchBoundingRectangle = new BoundingRectangle_default();
303
+ var scratchPosition = new Cartesian3_default();
304
+ var scratchNormal = new Cartesian3_default();
305
+ var scratchTangent = new Cartesian3_default();
306
+ var scratchBitangent = new Cartesian3_default();
307
+ var p1Scratch = new Cartesian3_default();
308
+ var p2Scratch = new Cartesian3_default();
309
+ var scratchPerPosNormal = new Cartesian3_default();
310
+ var scratchPerPosTangent = new Cartesian3_default();
311
+ var scratchPerPosBitangent = new Cartesian3_default();
312
+ var appendTextureCoordinatesOrigin = new Cartesian2_default();
313
+ var appendTextureCoordinatesCartesian2 = new Cartesian2_default();
314
+ var appendTextureCoordinatesCartesian3 = new Cartesian3_default();
315
+ var appendTextureCoordinatesQuaternion = new Quaternion_default();
316
+ var appendTextureCoordinatesMatrix3 = new Matrix3_default();
317
+ var tangentMatrixScratch = new Matrix3_default();
318
+ function computeAttributes(options) {
319
+ const vertexFormat = options.vertexFormat;
320
+ const geometry = options.geometry;
321
+ const shadowVolume = options.shadowVolume;
322
+ const flatPositions = geometry.attributes.position.values;
323
+ const flatTexcoords = defined_default(geometry.attributes.st) ? geometry.attributes.st.values : void 0;
324
+ let length = flatPositions.length;
325
+ const wall = options.wall;
326
+ const top = options.top || wall;
327
+ const bottom = options.bottom || wall;
328
+ if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
329
+ const boundingRectangle = options.boundingRectangle;
330
+ const rotationAxis = options.rotationAxis;
331
+ const projectTo2d = options.projectTo2d;
332
+ const ellipsoid = options.ellipsoid;
333
+ const stRotation = options.stRotation;
334
+ const perPositionHeight = options.perPositionHeight;
335
+ const origin = appendTextureCoordinatesOrigin;
336
+ origin.x = boundingRectangle.x;
337
+ origin.y = boundingRectangle.y;
338
+ const textureCoordinates = vertexFormat.st ? new Float32Array(2 * (length / 3)) : void 0;
339
+ let normals;
340
+ if (vertexFormat.normal) {
341
+ if (perPositionHeight && top && !wall) {
342
+ normals = geometry.attributes.normal.values;
113
343
  } else {
114
- textureMatrix = Matrix3.Matrix3.clone(Matrix3.Matrix3.IDENTITY, textureMatrix);
115
- tangentRotationMatrix = Matrix3.Matrix3.clone(
116
- Matrix3.Matrix3.IDENTITY,
117
- tangentRotationMatrix
118
- );
119
- }
120
-
121
- let bottomOffset = 0;
122
- let bottomOffset2 = 0;
123
-
124
- if (top && bottom) {
125
- bottomOffset = length / 2;
126
- bottomOffset2 = length / 3;
127
-
128
- length /= 2;
344
+ normals = new Float32Array(length);
129
345
  }
130
-
131
- for (let i = 0; i < length; i += 3) {
132
- const position = Matrix3.Cartesian3.fromArray(
133
- flatPositions,
134
- i,
135
- appendTextureCoordinatesCartesian3
136
- );
137
-
138
- if (vertexFormat.st) {
139
- if (!defaultValue.defined(flatTexcoords)) {
140
- let p = Matrix3.Matrix3.multiplyByVector(
141
- textureMatrix,
142
- position,
143
- scratchPosition
144
- );
145
- p = ellipsoid.scaleToGeodeticSurface(p, p);
146
- const st = tangentPlane.projectPointOntoPlane(
147
- p,
148
- appendTextureCoordinatesCartesian2
149
- );
150
- Matrix2.Cartesian2.subtract(st, origin, st);
151
-
152
- const stx = Math$1.CesiumMath.clamp(st.x / boundingRectangle.width, 0, 1);
153
- const sty = Math$1.CesiumMath.clamp(st.y / boundingRectangle.height, 0, 1);
154
- if (bottom) {
155
- textureCoordinates[textureCoordIndex + bottomOffset2] = stx;
156
- textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = sty;
157
- }
158
- if (top) {
159
- textureCoordinates[textureCoordIndex] = stx;
160
- textureCoordinates[textureCoordIndex + 1] = sty;
161
- }
162
-
163
- textureCoordIndex += 2;
346
+ }
347
+ const tangents = vertexFormat.tangent ? new Float32Array(length) : void 0;
348
+ const bitangents = vertexFormat.bitangent ? new Float32Array(length) : void 0;
349
+ const extrudeNormals = shadowVolume ? new Float32Array(length) : void 0;
350
+ let textureCoordIndex = 0;
351
+ let attrIndex = 0;
352
+ let normal = scratchNormal;
353
+ let tangent = scratchTangent;
354
+ let bitangent = scratchBitangent;
355
+ let recomputeNormal = true;
356
+ let textureMatrix = appendTextureCoordinatesMatrix3;
357
+ let tangentRotationMatrix = tangentMatrixScratch;
358
+ if (stRotation !== 0) {
359
+ let rotation = Quaternion_default.fromAxisAngle(
360
+ rotationAxis,
361
+ stRotation,
362
+ appendTextureCoordinatesQuaternion
363
+ );
364
+ textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
365
+ rotation = Quaternion_default.fromAxisAngle(
366
+ rotationAxis,
367
+ -stRotation,
368
+ appendTextureCoordinatesQuaternion
369
+ );
370
+ tangentRotationMatrix = Matrix3_default.fromQuaternion(
371
+ rotation,
372
+ tangentRotationMatrix
373
+ );
374
+ } else {
375
+ textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
376
+ tangentRotationMatrix = Matrix3_default.clone(
377
+ Matrix3_default.IDENTITY,
378
+ tangentRotationMatrix
379
+ );
380
+ }
381
+ let bottomOffset = 0;
382
+ let bottomOffset2 = 0;
383
+ if (top && bottom) {
384
+ bottomOffset = length / 2;
385
+ bottomOffset2 = length / 3;
386
+ length /= 2;
387
+ }
388
+ for (let i = 0; i < length; i += 3) {
389
+ const position = Cartesian3_default.fromArray(
390
+ flatPositions,
391
+ i,
392
+ appendTextureCoordinatesCartesian3
393
+ );
394
+ if (vertexFormat.st) {
395
+ if (!defined_default(flatTexcoords)) {
396
+ let p = Matrix3_default.multiplyByVector(
397
+ textureMatrix,
398
+ position,
399
+ scratchPosition
400
+ );
401
+ p = ellipsoid.scaleToGeodeticSurface(p, p);
402
+ const st = projectTo2d(p, appendTextureCoordinatesCartesian2);
403
+ Cartesian2_default.subtract(st, origin, st);
404
+ const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
405
+ const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
406
+ if (bottom) {
407
+ textureCoordinates[textureCoordIndex + bottomOffset2] = stx;
408
+ textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = sty;
164
409
  }
410
+ if (top) {
411
+ textureCoordinates[textureCoordIndex] = stx;
412
+ textureCoordinates[textureCoordIndex + 1] = sty;
413
+ }
414
+ textureCoordIndex += 2;
165
415
  }
166
-
167
- if (
168
- vertexFormat.normal ||
169
- vertexFormat.tangent ||
170
- vertexFormat.bitangent ||
171
- shadowVolume
172
- ) {
173
- const attrIndex1 = attrIndex + 1;
174
- const attrIndex2 = attrIndex + 2;
175
-
176
- if (wall) {
177
- if (i + 3 < length) {
178
- const p1 = Matrix3.Cartesian3.fromArray(flatPositions, i + 3, p1Scratch);
179
-
180
- if (recomputeNormal) {
181
- const p2 = Matrix3.Cartesian3.fromArray(
182
- flatPositions,
183
- i + length,
184
- p2Scratch
185
- );
186
- if (perPositionHeight) {
187
- adjustPosHeightsForNormal(position, p1, p2, ellipsoid);
188
- }
189
- Matrix3.Cartesian3.subtract(p1, position, p1);
190
- Matrix3.Cartesian3.subtract(p2, position, p2);
191
- normal = Matrix3.Cartesian3.normalize(
192
- Matrix3.Cartesian3.cross(p2, p1, normal),
193
- normal
194
- );
195
- recomputeNormal = false;
196
- }
197
-
198
- if (Matrix3.Cartesian3.equalsEpsilon(p1, position, Math$1.CesiumMath.EPSILON10)) {
199
- // if we've reached a corner
200
- recomputeNormal = true;
416
+ }
417
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
418
+ const attrIndex1 = attrIndex + 1;
419
+ const attrIndex2 = attrIndex + 2;
420
+ if (wall) {
421
+ if (i + 3 < length) {
422
+ const p1 = Cartesian3_default.fromArray(flatPositions, i + 3, p1Scratch);
423
+ if (recomputeNormal) {
424
+ const p2 = Cartesian3_default.fromArray(
425
+ flatPositions,
426
+ i + length,
427
+ p2Scratch
428
+ );
429
+ if (perPositionHeight) {
430
+ adjustPosHeightsForNormal(position, p1, p2, ellipsoid);
201
431
  }
432
+ Cartesian3_default.subtract(p1, position, p1);
433
+ Cartesian3_default.subtract(p2, position, p2);
434
+ normal = Cartesian3_default.normalize(
435
+ Cartesian3_default.cross(p2, p1, normal),
436
+ normal
437
+ );
438
+ recomputeNormal = false;
202
439
  }
203
-
204
- if (vertexFormat.tangent || vertexFormat.bitangent) {
205
- bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
206
- if (vertexFormat.tangent) {
207
- tangent = Matrix3.Cartesian3.normalize(
208
- Matrix3.Cartesian3.cross(bitangent, normal, tangent),
209
- tangent
210
- );
211
- }
440
+ if (Cartesian3_default.equalsEpsilon(p1, position, Math_default.EPSILON10)) {
441
+ recomputeNormal = true;
212
442
  }
213
- } else {
214
- normal = ellipsoid.geodeticSurfaceNormal(position, normal);
215
- if (vertexFormat.tangent || vertexFormat.bitangent) {
216
- if (perPositionHeight) {
217
- scratchPerPosNormal = Matrix3.Cartesian3.fromArray(
218
- normals,
219
- attrIndex,
220
- scratchPerPosNormal
221
- );
222
- scratchPerPosTangent = Matrix3.Cartesian3.cross(
223
- Matrix3.Cartesian3.UNIT_Z,
224
- scratchPerPosNormal,
443
+ }
444
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
445
+ bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
446
+ if (vertexFormat.tangent) {
447
+ tangent = Cartesian3_default.normalize(
448
+ Cartesian3_default.cross(bitangent, normal, tangent),
449
+ tangent
450
+ );
451
+ }
452
+ }
453
+ } else {
454
+ normal = ellipsoid.geodeticSurfaceNormal(position, normal);
455
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
456
+ if (perPositionHeight) {
457
+ scratchPerPosNormal = Cartesian3_default.fromArray(
458
+ normals,
459
+ attrIndex,
460
+ scratchPerPosNormal
461
+ );
462
+ scratchPerPosTangent = Cartesian3_default.cross(
463
+ Cartesian3_default.UNIT_Z,
464
+ scratchPerPosNormal,
465
+ scratchPerPosTangent
466
+ );
467
+ scratchPerPosTangent = Cartesian3_default.normalize(
468
+ Matrix3_default.multiplyByVector(
469
+ tangentRotationMatrix,
470
+ scratchPerPosTangent,
225
471
  scratchPerPosTangent
226
- );
227
- scratchPerPosTangent = Matrix3.Cartesian3.normalize(
228
- Matrix3.Matrix3.multiplyByVector(
229
- tangentRotationMatrix,
472
+ ),
473
+ scratchPerPosTangent
474
+ );
475
+ if (vertexFormat.bitangent) {
476
+ scratchPerPosBitangent = Cartesian3_default.normalize(
477
+ Cartesian3_default.cross(
478
+ scratchPerPosNormal,
230
479
  scratchPerPosTangent,
231
- scratchPerPosTangent
480
+ scratchPerPosBitangent
232
481
  ),
233
- scratchPerPosTangent
482
+ scratchPerPosBitangent
234
483
  );
235
- if (vertexFormat.bitangent) {
236
- scratchPerPosBitangent = Matrix3.Cartesian3.normalize(
237
- Matrix3.Cartesian3.cross(
238
- scratchPerPosNormal,
239
- scratchPerPosTangent,
240
- scratchPerPosBitangent
241
- ),
242
- scratchPerPosBitangent
243
- );
244
- }
245
484
  }
246
-
247
- tangent = Matrix3.Cartesian3.cross(Matrix3.Cartesian3.UNIT_Z, normal, tangent);
248
- tangent = Matrix3.Cartesian3.normalize(
249
- Matrix3.Matrix3.multiplyByVector(tangentRotationMatrix, tangent, tangent),
250
- tangent
485
+ }
486
+ tangent = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent);
487
+ tangent = Cartesian3_default.normalize(
488
+ Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent),
489
+ tangent
490
+ );
491
+ if (vertexFormat.bitangent) {
492
+ bitangent = Cartesian3_default.normalize(
493
+ Cartesian3_default.cross(normal, tangent, bitangent),
494
+ bitangent
251
495
  );
252
- if (vertexFormat.bitangent) {
253
- bitangent = Matrix3.Cartesian3.normalize(
254
- Matrix3.Cartesian3.cross(normal, tangent, bitangent),
255
- bitangent
256
- );
257
- }
258
496
  }
259
497
  }
260
-
261
- if (vertexFormat.normal) {
262
- if (options.wall) {
263
- normals[attrIndex + bottomOffset] = normal.x;
264
- normals[attrIndex1 + bottomOffset] = normal.y;
265
- normals[attrIndex2 + bottomOffset] = normal.z;
266
- } else if (bottom) {
267
- normals[attrIndex + bottomOffset] = -normal.x;
268
- normals[attrIndex1 + bottomOffset] = -normal.y;
269
- normals[attrIndex2 + bottomOffset] = -normal.z;
270
- }
271
-
272
- if ((top && !perPositionHeight) || wall) {
273
- normals[attrIndex] = normal.x;
274
- normals[attrIndex1] = normal.y;
275
- normals[attrIndex2] = normal.z;
276
- }
498
+ }
499
+ if (vertexFormat.normal) {
500
+ if (options.wall) {
501
+ normals[attrIndex + bottomOffset] = normal.x;
502
+ normals[attrIndex1 + bottomOffset] = normal.y;
503
+ normals[attrIndex2 + bottomOffset] = normal.z;
504
+ } else if (bottom) {
505
+ normals[attrIndex + bottomOffset] = -normal.x;
506
+ normals[attrIndex1 + bottomOffset] = -normal.y;
507
+ normals[attrIndex2 + bottomOffset] = -normal.z;
277
508
  }
278
-
279
- if (shadowVolume) {
280
- if (wall) {
281
- normal = ellipsoid.geodeticSurfaceNormal(position, normal);
282
- }
283
- extrudeNormals[attrIndex + bottomOffset] = -normal.x;
284
- extrudeNormals[attrIndex1 + bottomOffset] = -normal.y;
285
- extrudeNormals[attrIndex2 + bottomOffset] = -normal.z;
509
+ if (top && !perPositionHeight || wall) {
510
+ normals[attrIndex] = normal.x;
511
+ normals[attrIndex1] = normal.y;
512
+ normals[attrIndex2] = normal.z;
286
513
  }
287
-
288
- if (vertexFormat.tangent) {
289
- if (options.wall) {
290
- tangents[attrIndex + bottomOffset] = tangent.x;
291
- tangents[attrIndex1 + bottomOffset] = tangent.y;
292
- tangents[attrIndex2 + bottomOffset] = tangent.z;
293
- } else if (bottom) {
294
- tangents[attrIndex + bottomOffset] = -tangent.x;
295
- tangents[attrIndex1 + bottomOffset] = -tangent.y;
296
- tangents[attrIndex2 + bottomOffset] = -tangent.z;
297
- }
298
-
299
- if (top) {
300
- if (perPositionHeight) {
301
- tangents[attrIndex] = scratchPerPosTangent.x;
302
- tangents[attrIndex1] = scratchPerPosTangent.y;
303
- tangents[attrIndex2] = scratchPerPosTangent.z;
304
- } else {
305
- tangents[attrIndex] = tangent.x;
306
- tangents[attrIndex1] = tangent.y;
307
- tangents[attrIndex2] = tangent.z;
308
- }
309
- }
514
+ }
515
+ if (shadowVolume) {
516
+ if (wall) {
517
+ normal = ellipsoid.geodeticSurfaceNormal(position, normal);
310
518
  }
311
-
312
- if (vertexFormat.bitangent) {
313
- if (bottom) {
314
- bitangents[attrIndex + bottomOffset] = bitangent.x;
315
- bitangents[attrIndex1 + bottomOffset] = bitangent.y;
316
- bitangents[attrIndex2 + bottomOffset] = bitangent.z;
519
+ extrudeNormals[attrIndex + bottomOffset] = -normal.x;
520
+ extrudeNormals[attrIndex1 + bottomOffset] = -normal.y;
521
+ extrudeNormals[attrIndex2 + bottomOffset] = -normal.z;
522
+ }
523
+ if (vertexFormat.tangent) {
524
+ if (options.wall) {
525
+ tangents[attrIndex + bottomOffset] = tangent.x;
526
+ tangents[attrIndex1 + bottomOffset] = tangent.y;
527
+ tangents[attrIndex2 + bottomOffset] = tangent.z;
528
+ } else if (bottom) {
529
+ tangents[attrIndex + bottomOffset] = -tangent.x;
530
+ tangents[attrIndex1 + bottomOffset] = -tangent.y;
531
+ tangents[attrIndex2 + bottomOffset] = -tangent.z;
532
+ }
533
+ if (top) {
534
+ if (perPositionHeight) {
535
+ tangents[attrIndex] = scratchPerPosTangent.x;
536
+ tangents[attrIndex1] = scratchPerPosTangent.y;
537
+ tangents[attrIndex2] = scratchPerPosTangent.z;
538
+ } else {
539
+ tangents[attrIndex] = tangent.x;
540
+ tangents[attrIndex1] = tangent.y;
541
+ tangents[attrIndex2] = tangent.z;
317
542
  }
318
- if (top) {
319
- if (perPositionHeight) {
320
- bitangents[attrIndex] = scratchPerPosBitangent.x;
321
- bitangents[attrIndex1] = scratchPerPosBitangent.y;
322
- bitangents[attrIndex2] = scratchPerPosBitangent.z;
323
- } else {
324
- bitangents[attrIndex] = bitangent.x;
325
- bitangents[attrIndex1] = bitangent.y;
326
- bitangents[attrIndex2] = bitangent.z;
327
- }
543
+ }
544
+ }
545
+ if (vertexFormat.bitangent) {
546
+ if (bottom) {
547
+ bitangents[attrIndex + bottomOffset] = bitangent.x;
548
+ bitangents[attrIndex1 + bottomOffset] = bitangent.y;
549
+ bitangents[attrIndex2 + bottomOffset] = bitangent.z;
550
+ }
551
+ if (top) {
552
+ if (perPositionHeight) {
553
+ bitangents[attrIndex] = scratchPerPosBitangent.x;
554
+ bitangents[attrIndex1] = scratchPerPosBitangent.y;
555
+ bitangents[attrIndex2] = scratchPerPosBitangent.z;
556
+ } else {
557
+ bitangents[attrIndex] = bitangent.x;
558
+ bitangents[attrIndex1] = bitangent.y;
559
+ bitangents[attrIndex2] = bitangent.z;
328
560
  }
329
561
  }
330
- attrIndex += 3;
331
562
  }
332
- }
333
-
334
- if (vertexFormat.st && !defaultValue.defined(flatTexcoords)) {
335
- geometry.attributes.st = new GeometryAttribute.GeometryAttribute({
336
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
337
- componentsPerAttribute: 2,
338
- values: textureCoordinates,
339
- });
340
- }
341
-
342
- if (vertexFormat.normal) {
343
- geometry.attributes.normal = new GeometryAttribute.GeometryAttribute({
344
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
345
- componentsPerAttribute: 3,
346
- values: normals,
347
- });
348
- }
349
-
350
- if (vertexFormat.tangent) {
351
- geometry.attributes.tangent = new GeometryAttribute.GeometryAttribute({
352
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
353
- componentsPerAttribute: 3,
354
- values: tangents,
355
- });
356
- }
357
-
358
- if (vertexFormat.bitangent) {
359
- geometry.attributes.bitangent = new GeometryAttribute.GeometryAttribute({
360
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
361
- componentsPerAttribute: 3,
362
- values: bitangents,
363
- });
364
- }
365
-
366
- if (shadowVolume) {
367
- geometry.attributes.extrudeDirection = new GeometryAttribute.GeometryAttribute({
368
- componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
369
- componentsPerAttribute: 3,
370
- values: extrudeNormals,
371
- });
563
+ attrIndex += 3;
372
564
  }
373
565
  }
374
-
375
- if (options.extrude && defaultValue.defined(options.offsetAttribute)) {
376
- const size = flatPositions.length / 3;
377
- let offsetAttribute = new Uint8Array(size);
378
-
379
- if (options.offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.TOP) {
380
- if ((top && bottom) || wall) {
381
- offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
382
- } else if (top) {
383
- offsetAttribute = offsetAttribute.fill(1);
384
- }
385
- } else {
386
- const offsetValue =
387
- options.offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE ? 0 : 1;
388
- offsetAttribute = offsetAttribute.fill(offsetValue);
389
- }
390
-
391
- geometry.attributes.applyOffset = new GeometryAttribute.GeometryAttribute({
392
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
393
- componentsPerAttribute: 1,
394
- values: offsetAttribute,
566
+ if (vertexFormat.st && !defined_default(flatTexcoords)) {
567
+ geometry.attributes.st = new GeometryAttribute_default({
568
+ componentDatatype: ComponentDatatype_default.FLOAT,
569
+ componentsPerAttribute: 2,
570
+ values: textureCoordinates
395
571
  });
396
572
  }
397
-
398
- return geometry;
399
- }
400
-
401
- const startCartographicScratch = new Matrix3.Cartographic();
402
- const endCartographicScratch = new Matrix3.Cartographic();
403
- const idlCross = {
404
- westOverIDL: 0.0,
405
- eastOverIDL: 0.0,
406
- };
407
- let ellipsoidGeodesic = new EllipsoidGeodesic.EllipsoidGeodesic();
408
- function computeRectangle(positions, ellipsoid, arcType, granularity, result) {
409
- result = defaultValue.defaultValue(result, new Matrix2.Rectangle());
410
- if (!defaultValue.defined(positions) || positions.length < 3) {
411
- result.west = 0.0;
412
- result.north = 0.0;
413
- result.south = 0.0;
414
- result.east = 0.0;
415
- return result;
573
+ if (vertexFormat.normal) {
574
+ geometry.attributes.normal = new GeometryAttribute_default({
575
+ componentDatatype: ComponentDatatype_default.FLOAT,
576
+ componentsPerAttribute: 3,
577
+ values: normals
578
+ });
416
579
  }
417
-
418
- if (arcType === ArcType.ArcType.RHUMB) {
419
- return Matrix2.Rectangle.fromCartesianArray(positions, ellipsoid, result);
580
+ if (vertexFormat.tangent) {
581
+ geometry.attributes.tangent = new GeometryAttribute_default({
582
+ componentDatatype: ComponentDatatype_default.FLOAT,
583
+ componentsPerAttribute: 3,
584
+ values: tangents
585
+ });
420
586
  }
421
-
422
- if (!ellipsoidGeodesic.ellipsoid.equals(ellipsoid)) {
423
- ellipsoidGeodesic = new EllipsoidGeodesic.EllipsoidGeodesic(undefined, undefined, ellipsoid);
587
+ if (vertexFormat.bitangent) {
588
+ geometry.attributes.bitangent = new GeometryAttribute_default({
589
+ componentDatatype: ComponentDatatype_default.FLOAT,
590
+ componentsPerAttribute: 3,
591
+ values: bitangents
592
+ });
424
593
  }
425
-
426
- result.west = Number.POSITIVE_INFINITY;
427
- result.east = Number.NEGATIVE_INFINITY;
428
- result.south = Number.POSITIVE_INFINITY;
429
- result.north = Number.NEGATIVE_INFINITY;
430
-
431
- idlCross.westOverIDL = Number.POSITIVE_INFINITY;
432
- idlCross.eastOverIDL = Number.NEGATIVE_INFINITY;
433
-
434
- const inverseChordLength =
435
- 1.0 / Math$1.CesiumMath.chordLength(granularity, ellipsoid.maximumRadius);
436
- const positionsLength = positions.length;
437
- let endCartographic = ellipsoid.cartesianToCartographic(
438
- positions[0],
439
- endCartographicScratch
440
- );
441
- let startCartographic = startCartographicScratch;
442
- let swap;
443
-
444
- for (let i = 1; i < positionsLength; i++) {
445
- swap = startCartographic;
446
- startCartographic = endCartographic;
447
- endCartographic = ellipsoid.cartesianToCartographic(positions[i], swap);
448
- ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
449
- interpolateAndGrowRectangle(
450
- ellipsoidGeodesic,
451
- inverseChordLength,
452
- result,
453
- idlCross
454
- );
594
+ if (shadowVolume) {
595
+ geometry.attributes.extrudeDirection = new GeometryAttribute_default({
596
+ componentDatatype: ComponentDatatype_default.FLOAT,
597
+ componentsPerAttribute: 3,
598
+ values: extrudeNormals
599
+ });
455
600
  }
456
-
601
+ }
602
+ if (options.extrude && defined_default(options.offsetAttribute)) {
603
+ const size = flatPositions.length / 3;
604
+ let offsetAttribute = new Uint8Array(size);
605
+ if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
606
+ if (top && bottom || wall) {
607
+ offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
608
+ } else if (top) {
609
+ offsetAttribute = offsetAttribute.fill(1);
610
+ }
611
+ } else {
612
+ const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
613
+ offsetAttribute = offsetAttribute.fill(offsetValue);
614
+ }
615
+ geometry.attributes.applyOffset = new GeometryAttribute_default({
616
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
617
+ componentsPerAttribute: 1,
618
+ values: offsetAttribute
619
+ });
620
+ }
621
+ return geometry;
622
+ }
623
+ var startCartographicScratch = new Cartographic_default();
624
+ var endCartographicScratch = new Cartographic_default();
625
+ var idlCross = {
626
+ westOverIDL: 0,
627
+ eastOverIDL: 0
628
+ };
629
+ var ellipsoidGeodesic = new EllipsoidGeodesic_default();
630
+ function computeRectangle(positions, ellipsoid, arcType, granularity, result) {
631
+ result = defaultValue_default(result, new Rectangle_default());
632
+ if (!defined_default(positions) || positions.length < 3) {
633
+ result.west = 0;
634
+ result.north = 0;
635
+ result.south = 0;
636
+ result.east = 0;
637
+ return result;
638
+ }
639
+ if (arcType === ArcType_default.RHUMB) {
640
+ return Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
641
+ }
642
+ if (!ellipsoidGeodesic.ellipsoid.equals(ellipsoid)) {
643
+ ellipsoidGeodesic = new EllipsoidGeodesic_default(void 0, void 0, ellipsoid);
644
+ }
645
+ result.west = Number.POSITIVE_INFINITY;
646
+ result.east = Number.NEGATIVE_INFINITY;
647
+ result.south = Number.POSITIVE_INFINITY;
648
+ result.north = Number.NEGATIVE_INFINITY;
649
+ idlCross.westOverIDL = Number.POSITIVE_INFINITY;
650
+ idlCross.eastOverIDL = Number.NEGATIVE_INFINITY;
651
+ const inverseChordLength = 1 / Math_default.chordLength(granularity, ellipsoid.maximumRadius);
652
+ const positionsLength = positions.length;
653
+ let endCartographic = ellipsoid.cartesianToCartographic(
654
+ positions[0],
655
+ endCartographicScratch
656
+ );
657
+ let startCartographic = startCartographicScratch;
658
+ let swap;
659
+ for (let i = 1; i < positionsLength; i++) {
457
660
  swap = startCartographic;
458
661
  startCartographic = endCartographic;
459
- endCartographic = ellipsoid.cartesianToCartographic(positions[0], swap);
662
+ endCartographic = ellipsoid.cartesianToCartographic(positions[i], swap);
460
663
  ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
461
664
  interpolateAndGrowRectangle(
462
665
  ellipsoidGeodesic,
@@ -464,164 +667,155 @@ define(['./defaultValue-fe22d8c0', './Matrix3-41c58dde', './ArcType-2d9abbbc', '
464
667
  result,
465
668
  idlCross
466
669
  );
467
-
468
- if (result.east - result.west > idlCross.eastOverIDL - idlCross.westOverIDL) {
469
- result.west = idlCross.westOverIDL;
470
- result.east = idlCross.eastOverIDL;
471
-
472
- if (result.east > Math$1.CesiumMath.PI) {
473
- result.east = result.east - Math$1.CesiumMath.TWO_PI;
474
- }
475
- if (result.west > Math$1.CesiumMath.PI) {
476
- result.west = result.west - Math$1.CesiumMath.TWO_PI;
477
- }
478
- }
479
-
480
- return result;
481
670
  }
482
-
483
- const interpolatedCartographicScratch = new Matrix3.Cartographic();
484
- function interpolateAndGrowRectangle(
671
+ swap = startCartographic;
672
+ startCartographic = endCartographic;
673
+ endCartographic = ellipsoid.cartesianToCartographic(positions[0], swap);
674
+ ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
675
+ interpolateAndGrowRectangle(
485
676
  ellipsoidGeodesic,
486
677
  inverseChordLength,
487
678
  result,
488
679
  idlCross
489
- ) {
490
- const segmentLength = ellipsoidGeodesic.surfaceDistance;
491
-
492
- const numPoints = Math.ceil(segmentLength * inverseChordLength);
493
- const subsegmentDistance =
494
- numPoints > 0 ? segmentLength / (numPoints - 1) : Number.POSITIVE_INFINITY;
495
- let interpolationDistance = 0.0;
496
-
497
- for (let i = 0; i < numPoints; i++) {
498
- const interpolatedCartographic = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
499
- interpolationDistance,
500
- interpolatedCartographicScratch
680
+ );
681
+ if (result.east - result.west > idlCross.eastOverIDL - idlCross.westOverIDL) {
682
+ result.west = idlCross.westOverIDL;
683
+ result.east = idlCross.eastOverIDL;
684
+ if (result.east > Math_default.PI) {
685
+ result.east = result.east - Math_default.TWO_PI;
686
+ }
687
+ if (result.west > Math_default.PI) {
688
+ result.west = result.west - Math_default.TWO_PI;
689
+ }
690
+ }
691
+ return result;
692
+ }
693
+ var interpolatedCartographicScratch = new Cartographic_default();
694
+ function interpolateAndGrowRectangle(ellipsoidGeodesic2, inverseChordLength, result, idlCross2) {
695
+ const segmentLength = ellipsoidGeodesic2.surfaceDistance;
696
+ const numPoints = Math.ceil(segmentLength * inverseChordLength);
697
+ const subsegmentDistance = numPoints > 0 ? segmentLength / (numPoints - 1) : Number.POSITIVE_INFINITY;
698
+ let interpolationDistance = 0;
699
+ for (let i = 0; i < numPoints; i++) {
700
+ const interpolatedCartographic = ellipsoidGeodesic2.interpolateUsingSurfaceDistance(
701
+ interpolationDistance,
702
+ interpolatedCartographicScratch
703
+ );
704
+ interpolationDistance += subsegmentDistance;
705
+ const longitude = interpolatedCartographic.longitude;
706
+ const latitude = interpolatedCartographic.latitude;
707
+ result.west = Math.min(result.west, longitude);
708
+ result.east = Math.max(result.east, longitude);
709
+ result.south = Math.min(result.south, latitude);
710
+ result.north = Math.max(result.north, latitude);
711
+ const lonAdjusted = longitude >= 0 ? longitude : longitude + Math_default.TWO_PI;
712
+ idlCross2.westOverIDL = Math.min(idlCross2.westOverIDL, lonAdjusted);
713
+ idlCross2.eastOverIDL = Math.max(idlCross2.eastOverIDL, lonAdjusted);
714
+ }
715
+ }
716
+ var createGeometryFromPositionsExtrudedPositions = [];
717
+ function createGeometryFromPositionsExtruded(ellipsoid, polygon2, textureCoordinates, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
718
+ const geos = {
719
+ walls: []
720
+ };
721
+ let i;
722
+ if (closeTop || closeBottom) {
723
+ const topGeo = PolygonGeometryLibrary_default.createGeometryFromPositions(
724
+ ellipsoid,
725
+ polygon2,
726
+ textureCoordinates,
727
+ granularity,
728
+ perPositionHeight,
729
+ vertexFormat,
730
+ arcType
731
+ );
732
+ const edgePoints = topGeo.attributes.position.values;
733
+ const indices = topGeo.indices;
734
+ let numPositions;
735
+ let newIndices;
736
+ if (closeTop && closeBottom) {
737
+ const topBottomPositions = edgePoints.concat(edgePoints);
738
+ numPositions = topBottomPositions.length / 3;
739
+ newIndices = IndexDatatype_default.createTypedArray(
740
+ numPositions,
741
+ indices.length * 2
501
742
  );
502
- interpolationDistance += subsegmentDistance;
503
- const longitude = interpolatedCartographic.longitude;
504
- const latitude = interpolatedCartographic.latitude;
505
-
506
- result.west = Math.min(result.west, longitude);
507
- result.east = Math.max(result.east, longitude);
508
- result.south = Math.min(result.south, latitude);
509
- result.north = Math.max(result.north, latitude);
510
-
511
- const lonAdjusted =
512
- longitude >= 0 ? longitude : longitude + Math$1.CesiumMath.TWO_PI;
513
- idlCross.westOverIDL = Math.min(idlCross.westOverIDL, lonAdjusted);
514
- idlCross.eastOverIDL = Math.max(idlCross.eastOverIDL, lonAdjusted);
743
+ newIndices.set(indices);
744
+ const ilength = indices.length;
745
+ const length = numPositions / 2;
746
+ for (i = 0; i < ilength; i += 3) {
747
+ const i0 = newIndices[i] + length;
748
+ const i1 = newIndices[i + 1] + length;
749
+ const i2 = newIndices[i + 2] + length;
750
+ newIndices[i + ilength] = i2;
751
+ newIndices[i + 1 + ilength] = i1;
752
+ newIndices[i + 2 + ilength] = i0;
753
+ }
754
+ topGeo.attributes.position.values = topBottomPositions;
755
+ if (perPositionHeight && vertexFormat.normal) {
756
+ const normals = topGeo.attributes.normal.values;
757
+ topGeo.attributes.normal.values = new Float32Array(
758
+ topBottomPositions.length
759
+ );
760
+ topGeo.attributes.normal.values.set(normals);
761
+ }
762
+ if (vertexFormat.st && defined_default(textureCoordinates)) {
763
+ const texcoords = topGeo.attributes.st.values;
764
+ topGeo.attributes.st.values = new Float32Array(numPositions * 2);
765
+ topGeo.attributes.st.values = texcoords.concat(texcoords);
766
+ }
767
+ topGeo.indices = newIndices;
768
+ } else if (closeBottom) {
769
+ numPositions = edgePoints.length / 3;
770
+ newIndices = IndexDatatype_default.createTypedArray(numPositions, indices.length);
771
+ for (i = 0; i < indices.length; i += 3) {
772
+ newIndices[i] = indices[i + 2];
773
+ newIndices[i + 1] = indices[i + 1];
774
+ newIndices[i + 2] = indices[i];
775
+ }
776
+ topGeo.indices = newIndices;
515
777
  }
778
+ geos.topAndBottom = new GeometryInstance_default({
779
+ geometry: topGeo
780
+ });
516
781
  }
517
-
518
- const createGeometryFromPositionsExtrudedPositions = [];
519
-
520
- function createGeometryFromPositionsExtruded(
521
- ellipsoid,
522
- polygon,
782
+ let outerRing = hierarchy.outerRing;
783
+ let tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
784
+ let positions2D = tangentPlane.projectPointsOntoPlane(
785
+ outerRing,
786
+ createGeometryFromPositionsExtrudedPositions
787
+ );
788
+ let windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
789
+ if (windingOrder === WindingOrder_default.CLOCKWISE) {
790
+ outerRing = outerRing.slice().reverse();
791
+ }
792
+ let wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
793
+ outerRing,
523
794
  textureCoordinates,
795
+ ellipsoid,
524
796
  granularity,
525
- hierarchy,
526
797
  perPositionHeight,
527
- closeTop,
528
- closeBottom,
529
- vertexFormat,
530
798
  arcType
531
- ) {
532
- const geos = {
533
- walls: [],
534
- };
535
- let i;
536
-
537
- if (closeTop || closeBottom) {
538
- const topGeo = PolygonGeometryLibrary.PolygonGeometryLibrary.createGeometryFromPositions(
539
- ellipsoid,
540
- polygon,
541
- textureCoordinates,
542
- granularity,
543
- perPositionHeight,
544
- vertexFormat,
545
- arcType
546
- );
547
-
548
- const edgePoints = topGeo.attributes.position.values;
549
- const indices = topGeo.indices;
550
- let numPositions;
551
- let newIndices;
552
-
553
- if (closeTop && closeBottom) {
554
- const topBottomPositions = edgePoints.concat(edgePoints);
555
-
556
- numPositions = topBottomPositions.length / 3;
557
-
558
- newIndices = IndexDatatype.IndexDatatype.createTypedArray(
559
- numPositions,
560
- indices.length * 2
561
- );
562
- newIndices.set(indices);
563
- const ilength = indices.length;
564
-
565
- const length = numPositions / 2;
566
-
567
- for (i = 0; i < ilength; i += 3) {
568
- const i0 = newIndices[i] + length;
569
- const i1 = newIndices[i + 1] + length;
570
- const i2 = newIndices[i + 2] + length;
571
-
572
- newIndices[i + ilength] = i2;
573
- newIndices[i + 1 + ilength] = i1;
574
- newIndices[i + 2 + ilength] = i0;
575
- }
576
-
577
- topGeo.attributes.position.values = topBottomPositions;
578
- if (perPositionHeight && vertexFormat.normal) {
579
- const normals = topGeo.attributes.normal.values;
580
- topGeo.attributes.normal.values = new Float32Array(
581
- topBottomPositions.length
582
- );
583
- topGeo.attributes.normal.values.set(normals);
584
- }
585
-
586
- if (vertexFormat.st && defaultValue.defined(textureCoordinates)) {
587
- const texcoords = topGeo.attributes.st.values;
588
- topGeo.attributes.st.values = new Float32Array(numPositions * 2);
589
- topGeo.attributes.st.values = texcoords.concat(texcoords);
590
- }
591
-
592
- topGeo.indices = newIndices;
593
- } else if (closeBottom) {
594
- numPositions = edgePoints.length / 3;
595
- newIndices = IndexDatatype.IndexDatatype.createTypedArray(numPositions, indices.length);
596
-
597
- for (i = 0; i < indices.length; i += 3) {
598
- newIndices[i] = indices[i + 2];
599
- newIndices[i + 1] = indices[i + 1];
600
- newIndices[i + 2] = indices[i];
601
- }
602
-
603
- topGeo.indices = newIndices;
604
- }
605
-
606
- geos.topAndBottom = new GeometryInstance.GeometryInstance({
607
- geometry: topGeo,
608
- });
609
- }
610
-
611
- let outerRing = hierarchy.outerRing;
612
- let tangentPlane = EllipsoidTangentPlane.EllipsoidTangentPlane.fromPoints(outerRing, ellipsoid);
613
- let positions2D = tangentPlane.projectPointsOntoPlane(
614
- outerRing,
799
+ );
800
+ geos.walls.push(
801
+ new GeometryInstance_default({
802
+ geometry: wallGeo
803
+ })
804
+ );
805
+ const holes = hierarchy.holes;
806
+ for (i = 0; i < holes.length; i++) {
807
+ let hole = holes[i];
808
+ tangentPlane = EllipsoidTangentPlane_default.fromPoints(hole, ellipsoid);
809
+ positions2D = tangentPlane.projectPointsOntoPlane(
810
+ hole,
615
811
  createGeometryFromPositionsExtrudedPositions
616
812
  );
617
-
618
- let windingOrder = PolygonPipeline.PolygonPipeline.computeWindingOrder2D(positions2D);
619
- if (windingOrder === PolygonPipeline.WindingOrder.CLOCKWISE) {
620
- outerRing = outerRing.slice().reverse();
813
+ windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
814
+ if (windingOrder === WindingOrder_default.COUNTER_CLOCKWISE) {
815
+ hole = hole.slice().reverse();
621
816
  }
622
-
623
- let wallGeo = PolygonGeometryLibrary.PolygonGeometryLibrary.computeWallGeometry(
624
- outerRing,
817
+ wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
818
+ hole,
625
819
  textureCoordinates,
626
820
  ellipsoid,
627
821
  granularity,
@@ -629,792 +823,721 @@ define(['./defaultValue-fe22d8c0', './Matrix3-41c58dde', './ArcType-2d9abbbc', '
629
823
  arcType
630
824
  );
631
825
  geos.walls.push(
632
- new GeometryInstance.GeometryInstance({
633
- geometry: wallGeo,
826
+ new GeometryInstance_default({
827
+ geometry: wallGeo
634
828
  })
635
829
  );
636
-
637
- const holes = hierarchy.holes;
638
- for (i = 0; i < holes.length; i++) {
639
- let hole = holes[i];
640
-
641
- tangentPlane = EllipsoidTangentPlane.EllipsoidTangentPlane.fromPoints(hole, ellipsoid);
642
- positions2D = tangentPlane.projectPointsOntoPlane(
643
- hole,
644
- createGeometryFromPositionsExtrudedPositions
645
- );
646
-
647
- windingOrder = PolygonPipeline.PolygonPipeline.computeWindingOrder2D(positions2D);
648
- if (windingOrder === PolygonPipeline.WindingOrder.COUNTER_CLOCKWISE) {
649
- hole = hole.slice().reverse();
650
- }
651
-
652
- wallGeo = PolygonGeometryLibrary.PolygonGeometryLibrary.computeWallGeometry(
653
- hole,
654
- textureCoordinates,
655
- ellipsoid,
656
- granularity,
657
- perPositionHeight,
658
- arcType
659
- );
660
- geos.walls.push(
661
- new GeometryInstance.GeometryInstance({
662
- geometry: wallGeo,
663
- })
664
- );
665
- }
666
-
667
- return geos;
668
830
  }
669
-
670
- /**
671
- * A description of a polygon on the ellipsoid. The polygon is defined by a polygon hierarchy. Polygon geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
672
- *
673
- * @alias PolygonGeometry
674
- * @constructor
675
- *
676
- * @param {object} options Object with the following properties:
677
- * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
678
- * @param {number} [options.height=0.0] The distance in meters between the polygon and the ellipsoid surface.
679
- * @param {number} [options.extrudedHeight] The distance in meters between the polygon's extruded face and the ellipsoid surface.
680
- * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
681
- * @param {number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
682
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
683
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
684
- * @param {boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
685
- * @param {boolean} [options.closeTop=true] When false, leaves off the top of an extruded polygon open.
686
- * @param {boolean} [options.closeBottom=true] When false, leaves off the bottom of an extruded polygon open.
687
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
688
- * @param {PolygonHierarchy} [options.textureCoordinates] Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points. Has no effect for ground primitives.
689
- *
690
- * @see PolygonGeometry#createGeometry
691
- * @see PolygonGeometry#fromPositions
692
- *
693
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Polygon.html|Cesium Sandcastle Polygon Demo}
694
- *
695
- * @example
696
- * // 1. create a polygon from points
697
- * const polygon = new Cesium.PolygonGeometry({
698
- * polygonHierarchy : new Cesium.PolygonHierarchy(
699
- * Cesium.Cartesian3.fromDegreesArray([
700
- * -72.0, 40.0,
701
- * -70.0, 35.0,
702
- * -75.0, 30.0,
703
- * -70.0, 30.0,
704
- * -68.0, 40.0
705
- * ])
706
- * )
707
- * });
708
- * const geometry = Cesium.PolygonGeometry.createGeometry(polygon);
709
- *
710
- * // 2. create a nested polygon with holes
711
- * const polygonWithHole = new Cesium.PolygonGeometry({
712
- * polygonHierarchy : new Cesium.PolygonHierarchy(
713
- * Cesium.Cartesian3.fromDegreesArray([
714
- * -109.0, 30.0,
715
- * -95.0, 30.0,
716
- * -95.0, 40.0,
717
- * -109.0, 40.0
718
- * ]),
719
- * [new Cesium.PolygonHierarchy(
720
- * Cesium.Cartesian3.fromDegreesArray([
721
- * -107.0, 31.0,
722
- * -107.0, 39.0,
723
- * -97.0, 39.0,
724
- * -97.0, 31.0
725
- * ]),
726
- * [new Cesium.PolygonHierarchy(
727
- * Cesium.Cartesian3.fromDegreesArray([
728
- * -105.0, 33.0,
729
- * -99.0, 33.0,
730
- * -99.0, 37.0,
731
- * -105.0, 37.0
732
- * ]),
733
- * [new Cesium.PolygonHierarchy(
734
- * Cesium.Cartesian3.fromDegreesArray([
735
- * -103.0, 34.0,
736
- * -101.0, 34.0,
737
- * -101.0, 36.0,
738
- * -103.0, 36.0
739
- * ])
740
- * )]
741
- * )]
742
- * )]
743
- * )
744
- * });
745
- * const geometry = Cesium.PolygonGeometry.createGeometry(polygonWithHole);
746
- *
747
- * // 3. create extruded polygon
748
- * const extrudedPolygon = new Cesium.PolygonGeometry({
749
- * polygonHierarchy : new Cesium.PolygonHierarchy(
750
- * Cesium.Cartesian3.fromDegreesArray([
751
- * -72.0, 40.0,
752
- * -70.0, 35.0,
753
- * -75.0, 30.0,
754
- * -70.0, 30.0,
755
- * -68.0, 40.0
756
- * ])
757
- * ),
758
- * extrudedHeight: 300000
759
- * });
760
- * const geometry = Cesium.PolygonGeometry.createGeometry(extrudedPolygon);
761
- */
762
- function PolygonGeometry(options) {
763
- //>>includeStart('debug', pragmas.debug);
764
- Check.Check.typeOf.object("options", options);
765
- Check.Check.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
766
- if (
767
- defaultValue.defined(options.perPositionHeight) &&
768
- options.perPositionHeight &&
769
- defaultValue.defined(options.height)
770
- ) {
771
- throw new Check.DeveloperError(
772
- "Cannot use both options.perPositionHeight and options.height"
773
- );
774
- }
775
- if (
776
- defaultValue.defined(options.arcType) &&
777
- options.arcType !== ArcType.ArcType.GEODESIC &&
778
- options.arcType !== ArcType.ArcType.RHUMB
779
- ) {
780
- throw new Check.DeveloperError(
781
- "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
782
- );
783
- }
784
- //>>includeEnd('debug');
785
-
786
- const polygonHierarchy = options.polygonHierarchy;
787
- const vertexFormat = defaultValue.defaultValue(options.vertexFormat, VertexFormat.VertexFormat.DEFAULT);
788
- const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
789
- const granularity = defaultValue.defaultValue(
790
- options.granularity,
791
- Math$1.CesiumMath.RADIANS_PER_DEGREE
831
+ return geos;
832
+ }
833
+ function PolygonGeometry(options) {
834
+ Check_default.typeOf.object("options", options);
835
+ Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
836
+ if (defined_default(options.perPositionHeight) && options.perPositionHeight && defined_default(options.height)) {
837
+ throw new DeveloperError_default(
838
+ "Cannot use both options.perPositionHeight and options.height"
792
839
  );
793
- const stRotation = defaultValue.defaultValue(options.stRotation, 0.0);
794
- const textureCoordinates = options.textureCoordinates;
795
- const perPositionHeight = defaultValue.defaultValue(options.perPositionHeight, false);
796
- const perPositionHeightExtrude =
797
- perPositionHeight && defaultValue.defined(options.extrudedHeight);
798
- let height = defaultValue.defaultValue(options.height, 0.0);
799
- let extrudedHeight = defaultValue.defaultValue(options.extrudedHeight, height);
800
-
801
- if (!perPositionHeightExtrude) {
802
- const h = Math.max(height, extrudedHeight);
803
- extrudedHeight = Math.min(height, extrudedHeight);
804
- height = h;
805
- }
806
-
807
- this._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat);
808
- this._ellipsoid = Matrix3.Ellipsoid.clone(ellipsoid);
809
- this._granularity = granularity;
810
- this._stRotation = stRotation;
811
- this._height = height;
812
- this._extrudedHeight = extrudedHeight;
813
- this._closeTop = defaultValue.defaultValue(options.closeTop, true);
814
- this._closeBottom = defaultValue.defaultValue(options.closeBottom, true);
815
- this._polygonHierarchy = polygonHierarchy;
816
- this._perPositionHeight = perPositionHeight;
817
- this._perPositionHeightExtrude = perPositionHeightExtrude;
818
- this._shadowVolume = defaultValue.defaultValue(options.shadowVolume, false);
819
- this._workerName = "createPolygonGeometry";
820
- this._offsetAttribute = options.offsetAttribute;
821
- this._arcType = defaultValue.defaultValue(options.arcType, ArcType.ArcType.GEODESIC);
822
-
823
- this._rectangle = undefined;
824
- this._textureCoordinateRotationPoints = undefined;
825
- this._textureCoordinates = textureCoordinates;
826
-
827
- /**
828
- * The number of elements used to pack the object into an array.
829
- * @type {number}
830
- */
831
- this.packedLength =
832
- PolygonGeometryLibrary.PolygonGeometryLibrary.computeHierarchyPackedLength(
833
- polygonHierarchy,
834
- Matrix3.Cartesian3
835
- ) +
836
- Matrix3.Ellipsoid.packedLength +
837
- VertexFormat.VertexFormat.packedLength +
838
- (textureCoordinates
839
- ? PolygonGeometryLibrary.PolygonGeometryLibrary.computeHierarchyPackedLength(
840
- textureCoordinates,
841
- Matrix2.Cartesian2
842
- )
843
- : 1) +
844
- 12;
845
840
  }
846
-
847
- /**
848
- * A description of a polygon from an array of positions. Polygon geometry can be rendered with both {@link Primitive} and {@link GroundPrimitive}.
849
- *
850
- * @param {object} options Object with the following properties:
851
- * @param {Cartesian3[]} options.positions An array of positions that defined the corner points of the polygon.
852
- * @param {number} [options.height=0.0] The height of the polygon.
853
- * @param {number} [options.extrudedHeight] The height of the polygon extrusion.
854
- * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
855
- * @param {number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
856
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
857
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
858
- * @param {boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
859
- * @param {boolean} [options.closeTop=true] When false, leaves off the top of an extruded polygon open.
860
- * @param {boolean} [options.closeBottom=true] When false, leaves off the bottom of an extruded polygon open.
861
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
862
- * @param {PolygonHierarchy} [options.textureCoordinates] Texture coordinates as a {@link PolygonHierarchy} of {@link Cartesian2} points. Has no effect for ground primitives.
863
- * @returns {PolygonGeometry}
864
- *
865
- * @example
866
- * // create a polygon from points
867
- * const polygon = Cesium.PolygonGeometry.fromPositions({
868
- * positions : Cesium.Cartesian3.fromDegreesArray([
869
- * -72.0, 40.0,
870
- * -70.0, 35.0,
871
- * -75.0, 30.0,
872
- * -70.0, 30.0,
873
- * -68.0, 40.0
874
- * ])
875
- * });
876
- * const geometry = Cesium.PolygonGeometry.createGeometry(polygon);
877
- *
878
- * @see PolygonGeometry#createGeometry
879
- */
880
- PolygonGeometry.fromPositions = function (options) {
881
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
882
-
883
- //>>includeStart('debug', pragmas.debug);
884
- Check.Check.defined("options.positions", options.positions);
885
- //>>includeEnd('debug');
886
-
887
- const newOptions = {
888
- polygonHierarchy: {
889
- positions: options.positions,
890
- },
891
- height: options.height,
892
- extrudedHeight: options.extrudedHeight,
893
- vertexFormat: options.vertexFormat,
894
- stRotation: options.stRotation,
895
- ellipsoid: options.ellipsoid,
896
- granularity: options.granularity,
897
- perPositionHeight: options.perPositionHeight,
898
- closeTop: options.closeTop,
899
- closeBottom: options.closeBottom,
900
- offsetAttribute: options.offsetAttribute,
901
- arcType: options.arcType,
902
- textureCoordinates: options.textureCoordinates,
903
- };
904
- return new PolygonGeometry(newOptions);
905
- };
906
-
907
- /**
908
- * Stores the provided instance into the provided array.
909
- *
910
- * @param {PolygonGeometry} value The value to pack.
911
- * @param {number[]} array The array to pack into.
912
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
913
- *
914
- * @returns {number[]} The array that was packed into
915
- */
916
- PolygonGeometry.pack = function (value, array, startingIndex) {
917
- //>>includeStart('debug', pragmas.debug);
918
- Check.Check.typeOf.object("value", value);
919
- Check.Check.defined("array", array);
920
- //>>includeEnd('debug');
921
-
922
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
923
-
924
- startingIndex = PolygonGeometryLibrary.PolygonGeometryLibrary.packPolygonHierarchy(
925
- value._polygonHierarchy,
926
- array,
927
- startingIndex,
928
- Matrix3.Cartesian3
841
+ if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
842
+ throw new DeveloperError_default(
843
+ "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
929
844
  );
930
-
931
- Matrix3.Ellipsoid.pack(value._ellipsoid, array, startingIndex);
932
- startingIndex += Matrix3.Ellipsoid.packedLength;
933
-
934
- VertexFormat.VertexFormat.pack(value._vertexFormat, array, startingIndex);
935
- startingIndex += VertexFormat.VertexFormat.packedLength;
936
-
937
- array[startingIndex++] = value._height;
938
- array[startingIndex++] = value._extrudedHeight;
939
- array[startingIndex++] = value._granularity;
940
- array[startingIndex++] = value._stRotation;
941
- array[startingIndex++] = value._perPositionHeightExtrude ? 1.0 : 0.0;
942
- array[startingIndex++] = value._perPositionHeight ? 1.0 : 0.0;
943
- array[startingIndex++] = value._closeTop ? 1.0 : 0.0;
944
- array[startingIndex++] = value._closeBottom ? 1.0 : 0.0;
945
- array[startingIndex++] = value._shadowVolume ? 1.0 : 0.0;
946
- array[startingIndex++] = defaultValue.defaultValue(value._offsetAttribute, -1);
947
- array[startingIndex++] = value._arcType;
948
- if (defaultValue.defined(value._textureCoordinates)) {
949
- startingIndex = PolygonGeometryLibrary.PolygonGeometryLibrary.packPolygonHierarchy(
950
- value._textureCoordinates,
951
- array,
952
- startingIndex,
953
- Matrix2.Cartesian2
954
- );
955
- } else {
956
- array[startingIndex++] = -1.0;
957
- }
958
- array[startingIndex++] = value.packedLength;
959
- return array;
960
- };
961
-
962
- const scratchEllipsoid = Matrix3.Ellipsoid.clone(Matrix3.Ellipsoid.UNIT_SPHERE);
963
- const scratchVertexFormat = new VertexFormat.VertexFormat();
964
-
965
- //Only used to avoid inability to default construct.
966
- const dummyOptions = {
967
- polygonHierarchy: {},
845
+ }
846
+ const polygonHierarchy = options.polygonHierarchy;
847
+ const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
848
+ const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
849
+ const granularity = defaultValue_default(
850
+ options.granularity,
851
+ Math_default.RADIANS_PER_DEGREE
852
+ );
853
+ const stRotation = defaultValue_default(options.stRotation, 0);
854
+ const textureCoordinates = options.textureCoordinates;
855
+ const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
856
+ const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
857
+ let height = defaultValue_default(options.height, 0);
858
+ let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
859
+ if (!perPositionHeightExtrude) {
860
+ const h = Math.max(height, extrudedHeight);
861
+ extrudedHeight = Math.min(height, extrudedHeight);
862
+ height = h;
863
+ }
864
+ this._vertexFormat = VertexFormat_default.clone(vertexFormat);
865
+ this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
866
+ this._granularity = granularity;
867
+ this._stRotation = stRotation;
868
+ this._height = height;
869
+ this._extrudedHeight = extrudedHeight;
870
+ this._closeTop = defaultValue_default(options.closeTop, true);
871
+ this._closeBottom = defaultValue_default(options.closeBottom, true);
872
+ this._polygonHierarchy = polygonHierarchy;
873
+ this._perPositionHeight = perPositionHeight;
874
+ this._perPositionHeightExtrude = perPositionHeightExtrude;
875
+ this._shadowVolume = defaultValue_default(options.shadowVolume, false);
876
+ this._workerName = "createPolygonGeometry";
877
+ this._offsetAttribute = options.offsetAttribute;
878
+ this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
879
+ this._rectangle = void 0;
880
+ this._textureCoordinateRotationPoints = void 0;
881
+ this._textureCoordinates = textureCoordinates;
882
+ this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
883
+ polygonHierarchy,
884
+ Cartesian3_default
885
+ ) + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + (textureCoordinates ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
886
+ textureCoordinates,
887
+ Cartesian2_default
888
+ ) : 1) + 12;
889
+ }
890
+ PolygonGeometry.fromPositions = function(options) {
891
+ options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
892
+ Check_default.defined("options.positions", options.positions);
893
+ const newOptions = {
894
+ polygonHierarchy: {
895
+ positions: options.positions
896
+ },
897
+ height: options.height,
898
+ extrudedHeight: options.extrudedHeight,
899
+ vertexFormat: options.vertexFormat,
900
+ stRotation: options.stRotation,
901
+ ellipsoid: options.ellipsoid,
902
+ granularity: options.granularity,
903
+ perPositionHeight: options.perPositionHeight,
904
+ closeTop: options.closeTop,
905
+ closeBottom: options.closeBottom,
906
+ offsetAttribute: options.offsetAttribute,
907
+ arcType: options.arcType,
908
+ textureCoordinates: options.textureCoordinates
968
909
  };
969
-
970
- /**
971
- * Retrieves an instance from a packed array.
972
- *
973
- * @param {number[]} array The packed array.
974
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
975
- * @param {PolygonGeometry} [result] The object into which to store the result.
976
- */
977
- PolygonGeometry.unpack = function (array, startingIndex, result) {
978
- //>>includeStart('debug', pragmas.debug);
979
- Check.Check.defined("array", array);
980
- //>>includeEnd('debug');
981
-
982
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
983
-
984
- const polygonHierarchy = PolygonGeometryLibrary.PolygonGeometryLibrary.unpackPolygonHierarchy(
910
+ return new PolygonGeometry(newOptions);
911
+ };
912
+ PolygonGeometry.pack = function(value, array, startingIndex) {
913
+ Check_default.typeOf.object("value", value);
914
+ Check_default.defined("array", array);
915
+ startingIndex = defaultValue_default(startingIndex, 0);
916
+ startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
917
+ value._polygonHierarchy,
918
+ array,
919
+ startingIndex,
920
+ Cartesian3_default
921
+ );
922
+ Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
923
+ startingIndex += Ellipsoid_default.packedLength;
924
+ VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
925
+ startingIndex += VertexFormat_default.packedLength;
926
+ array[startingIndex++] = value._height;
927
+ array[startingIndex++] = value._extrudedHeight;
928
+ array[startingIndex++] = value._granularity;
929
+ array[startingIndex++] = value._stRotation;
930
+ array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
931
+ array[startingIndex++] = value._perPositionHeight ? 1 : 0;
932
+ array[startingIndex++] = value._closeTop ? 1 : 0;
933
+ array[startingIndex++] = value._closeBottom ? 1 : 0;
934
+ array[startingIndex++] = value._shadowVolume ? 1 : 0;
935
+ array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
936
+ array[startingIndex++] = value._arcType;
937
+ if (defined_default(value._textureCoordinates)) {
938
+ startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
939
+ value._textureCoordinates,
985
940
  array,
986
941
  startingIndex,
987
- Matrix3.Cartesian3
942
+ Cartesian2_default
988
943
  );
989
- startingIndex = polygonHierarchy.startingIndex;
990
- delete polygonHierarchy.startingIndex;
991
-
992
- const ellipsoid = Matrix3.Ellipsoid.unpack(array, startingIndex, scratchEllipsoid);
993
- startingIndex += Matrix3.Ellipsoid.packedLength;
994
-
995
- const vertexFormat = VertexFormat.VertexFormat.unpack(
996
- array,
997
- startingIndex,
998
- scratchVertexFormat
944
+ } else {
945
+ array[startingIndex++] = -1;
946
+ }
947
+ array[startingIndex++] = value.packedLength;
948
+ return array;
949
+ };
950
+ var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
951
+ var scratchVertexFormat = new VertexFormat_default();
952
+ var dummyOptions = {
953
+ polygonHierarchy: {}
954
+ };
955
+ PolygonGeometry.unpack = function(array, startingIndex, result) {
956
+ Check_default.defined("array", array);
957
+ startingIndex = defaultValue_default(startingIndex, 0);
958
+ const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
959
+ array,
960
+ startingIndex,
961
+ Cartesian3_default
962
+ );
963
+ startingIndex = polygonHierarchy.startingIndex;
964
+ delete polygonHierarchy.startingIndex;
965
+ const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
966
+ startingIndex += Ellipsoid_default.packedLength;
967
+ const vertexFormat = VertexFormat_default.unpack(
968
+ array,
969
+ startingIndex,
970
+ scratchVertexFormat
971
+ );
972
+ startingIndex += VertexFormat_default.packedLength;
973
+ const height = array[startingIndex++];
974
+ const extrudedHeight = array[startingIndex++];
975
+ const granularity = array[startingIndex++];
976
+ const stRotation = array[startingIndex++];
977
+ const perPositionHeightExtrude = array[startingIndex++] === 1;
978
+ const perPositionHeight = array[startingIndex++] === 1;
979
+ const closeTop = array[startingIndex++] === 1;
980
+ const closeBottom = array[startingIndex++] === 1;
981
+ const shadowVolume = array[startingIndex++] === 1;
982
+ const offsetAttribute = array[startingIndex++];
983
+ const arcType = array[startingIndex++];
984
+ const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
985
+ array,
986
+ startingIndex,
987
+ Cartesian2_default
988
+ );
989
+ if (defined_default(textureCoordinates)) {
990
+ startingIndex = textureCoordinates.startingIndex;
991
+ delete textureCoordinates.startingIndex;
992
+ } else {
993
+ startingIndex++;
994
+ }
995
+ const packedLength = array[startingIndex++];
996
+ if (!defined_default(result)) {
997
+ result = new PolygonGeometry(dummyOptions);
998
+ }
999
+ result._polygonHierarchy = polygonHierarchy;
1000
+ result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
1001
+ result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
1002
+ result._height = height;
1003
+ result._extrudedHeight = extrudedHeight;
1004
+ result._granularity = granularity;
1005
+ result._stRotation = stRotation;
1006
+ result._perPositionHeightExtrude = perPositionHeightExtrude;
1007
+ result._perPositionHeight = perPositionHeight;
1008
+ result._closeTop = closeTop;
1009
+ result._closeBottom = closeBottom;
1010
+ result._shadowVolume = shadowVolume;
1011
+ result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
1012
+ result._arcType = arcType;
1013
+ result._textureCoordinates = textureCoordinates;
1014
+ result.packedLength = packedLength;
1015
+ return result;
1016
+ };
1017
+ var scratchCartesian0 = new Cartesian2_default();
1018
+ var scratchCartesian1 = new Cartesian2_default();
1019
+ var scratchPolarClosest = new Stereographic_default();
1020
+ function expandRectangle(polar, lastPolar, ellipsoid, arcType, polygon2, result) {
1021
+ const longitude = polar.longitude;
1022
+ const lonAdjusted = longitude >= 0 ? longitude : longitude + Math_default.TWO_PI;
1023
+ polygon2.westOverIdl = Math.min(polygon2.westOverIdl, lonAdjusted);
1024
+ polygon2.eastOverIdl = Math.max(polygon2.eastOverIdl, lonAdjusted);
1025
+ result.west = Math.min(result.west, longitude);
1026
+ result.east = Math.max(result.east, longitude);
1027
+ const latitude = polar.getLatitude(ellipsoid);
1028
+ let segmentLatitude = latitude;
1029
+ result.south = Math.min(result.south, latitude);
1030
+ result.north = Math.max(result.north, latitude);
1031
+ if (arcType !== ArcType_default.RHUMB) {
1032
+ const segment = Cartesian2_default.subtract(
1033
+ lastPolar.position,
1034
+ polar.position,
1035
+ scratchCartesian0
999
1036
  );
1000
- startingIndex += VertexFormat.VertexFormat.packedLength;
1001
-
1002
- const height = array[startingIndex++];
1003
- const extrudedHeight = array[startingIndex++];
1004
- const granularity = array[startingIndex++];
1005
- const stRotation = array[startingIndex++];
1006
- const perPositionHeightExtrude = array[startingIndex++] === 1.0;
1007
- const perPositionHeight = array[startingIndex++] === 1.0;
1008
- const closeTop = array[startingIndex++] === 1.0;
1009
- const closeBottom = array[startingIndex++] === 1.0;
1010
- const shadowVolume = array[startingIndex++] === 1.0;
1011
- const offsetAttribute = array[startingIndex++];
1012
- const arcType = array[startingIndex++];
1013
- const textureCoordinates =
1014
- array[startingIndex] === -1.0
1015
- ? undefined
1016
- : PolygonGeometryLibrary.PolygonGeometryLibrary.unpackPolygonHierarchy(
1017
- array,
1018
- startingIndex,
1019
- Matrix2.Cartesian2
1020
- );
1021
- if (defaultValue.defined(textureCoordinates)) {
1022
- startingIndex = textureCoordinates.startingIndex;
1023
- delete textureCoordinates.startingIndex;
1024
- } else {
1025
- startingIndex++;
1026
- }
1027
- const packedLength = array[startingIndex++];
1028
-
1029
- if (!defaultValue.defined(result)) {
1030
- result = new PolygonGeometry(dummyOptions);
1037
+ const t = Cartesian2_default.dot(lastPolar.position, segment) / Cartesian2_default.dot(segment, segment);
1038
+ if (t > 0 && t < 1) {
1039
+ const projected = Cartesian2_default.add(
1040
+ lastPolar.position,
1041
+ Cartesian2_default.multiplyByScalar(segment, -t, segment),
1042
+ scratchCartesian1
1043
+ );
1044
+ const closestPolar = Stereographic_default.clone(lastPolar, scratchPolarClosest);
1045
+ closestPolar.position = projected;
1046
+ const adjustedLatitude = closestPolar.getLatitude(ellipsoid);
1047
+ result.south = Math.min(result.south, adjustedLatitude);
1048
+ result.north = Math.max(result.north, adjustedLatitude);
1049
+ if (Math.abs(latitude) > Math.abs(adjustedLatitude)) {
1050
+ segmentLatitude = adjustedLatitude;
1051
+ }
1031
1052
  }
1032
-
1033
- result._polygonHierarchy = polygonHierarchy;
1034
- result._ellipsoid = Matrix3.Ellipsoid.clone(ellipsoid, result._ellipsoid);
1035
- result._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat, result._vertexFormat);
1036
- result._height = height;
1037
- result._extrudedHeight = extrudedHeight;
1038
- result._granularity = granularity;
1039
- result._stRotation = stRotation;
1040
- result._perPositionHeightExtrude = perPositionHeightExtrude;
1041
- result._perPositionHeight = perPositionHeight;
1042
- result._closeTop = closeTop;
1043
- result._closeBottom = closeBottom;
1044
- result._shadowVolume = shadowVolume;
1045
- result._offsetAttribute =
1046
- offsetAttribute === -1 ? undefined : offsetAttribute;
1047
- result._arcType = arcType;
1048
- result._textureCoordinates = textureCoordinates;
1049
- result.packedLength = packedLength;
1050
-
1053
+ }
1054
+ const direction = lastPolar.x * polar.y - polar.x * lastPolar.y;
1055
+ let angle = Math.sign(direction);
1056
+ if (angle !== 0) {
1057
+ angle *= Cartesian2_default.angleBetween(lastPolar.position, polar.position);
1058
+ }
1059
+ if (segmentLatitude >= 0) {
1060
+ polygon2.northAngle += angle;
1061
+ }
1062
+ if (segmentLatitude <= 0) {
1063
+ polygon2.southAngle += angle;
1064
+ }
1065
+ }
1066
+ var scratchPolar = new Stereographic_default();
1067
+ var scratchPolarPrevious = new Stereographic_default();
1068
+ var polygon = {
1069
+ northAngle: 0,
1070
+ southAngle: 0,
1071
+ westOverIdl: 0,
1072
+ eastOverIdl: 0
1073
+ };
1074
+ PolygonGeometry.computeRectangleFromPositions = function(positions, ellipsoid, arcType, result) {
1075
+ Check_default.defined("positions", positions);
1076
+ if (!defined_default(result)) {
1077
+ result = new Rectangle_default();
1078
+ }
1079
+ if (positions.length < 3) {
1051
1080
  return result;
1052
- };
1053
-
1054
- /**
1055
- * Returns the bounding rectangle given the provided options
1056
- *
1057
- * @param {object} options Object with the following properties:
1058
- * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
1059
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions sampled.
1060
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
1061
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
1062
- * @param {Rectangle} [result] An object in which to store the result.
1063
- *
1064
- * @returns {Rectangle} The result rectangle
1065
- */
1066
- PolygonGeometry.computeRectangle = function (options, result) {
1067
- //>>includeStart('debug', pragmas.debug);
1068
- Check.Check.typeOf.object("options", options);
1069
- Check.Check.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
1070
- //>>includeEnd('debug');
1071
-
1072
- const granularity = defaultValue.defaultValue(
1073
- options.granularity,
1074
- Math$1.CesiumMath.RADIANS_PER_DEGREE
1081
+ }
1082
+ result.west = Number.POSITIVE_INFINITY;
1083
+ result.east = Number.NEGATIVE_INFINITY;
1084
+ result.south = Number.POSITIVE_INFINITY;
1085
+ result.north = Number.NEGATIVE_INFINITY;
1086
+ polygon.northAngle = 0;
1087
+ polygon.southAngle = 0;
1088
+ polygon.westOverIdl = Number.POSITIVE_INFINITY;
1089
+ polygon.eastOverIdl = Number.NEGATIVE_INFINITY;
1090
+ const positionsLength = positions.length;
1091
+ let lastPolarPosition = Stereographic_default.fromCartesian(
1092
+ positions[0],
1093
+ scratchPolarPrevious
1094
+ );
1095
+ for (let i = 1; i < positionsLength; i++) {
1096
+ const polarPosition = Stereographic_default.fromCartesian(
1097
+ positions[i],
1098
+ scratchPolar
1075
1099
  );
1076
- const arcType = defaultValue.defaultValue(options.arcType, ArcType.ArcType.GEODESIC);
1077
- //>>includeStart('debug', pragmas.debug);
1078
- if (arcType !== ArcType.ArcType.GEODESIC && arcType !== ArcType.ArcType.RHUMB) {
1079
- throw new Check.DeveloperError(
1080
- "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
1081
- );
1082
- }
1083
- //>>includeEnd('debug');
1084
-
1085
- const polygonHierarchy = options.polygonHierarchy;
1086
- const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
1087
-
1088
- return computeRectangle(
1089
- polygonHierarchy.positions,
1100
+ expandRectangle(
1101
+ polarPosition,
1102
+ lastPolarPosition,
1090
1103
  ellipsoid,
1091
1104
  arcType,
1092
- granularity,
1105
+ polygon,
1093
1106
  result
1094
1107
  );
1095
- };
1096
-
1097
- /**
1098
- * Computes the geometric representation of a polygon, including its vertices, indices, and a bounding sphere.
1099
- *
1100
- * @param {PolygonGeometry} polygonGeometry A description of the polygon.
1101
- * @returns {Geometry|undefined} The computed vertices and indices.
1102
- */
1103
- PolygonGeometry.createGeometry = function (polygonGeometry) {
1104
- const vertexFormat = polygonGeometry._vertexFormat;
1105
- const ellipsoid = polygonGeometry._ellipsoid;
1106
- const granularity = polygonGeometry._granularity;
1107
- const stRotation = polygonGeometry._stRotation;
1108
- const polygonHierarchy = polygonGeometry._polygonHierarchy;
1109
- const perPositionHeight = polygonGeometry._perPositionHeight;
1110
- const closeTop = polygonGeometry._closeTop;
1111
- const closeBottom = polygonGeometry._closeBottom;
1112
- const arcType = polygonGeometry._arcType;
1113
- const textureCoordinates = polygonGeometry._textureCoordinates;
1114
-
1115
- const hasTextureCoordinates = defaultValue.defined(textureCoordinates);
1116
-
1117
- let outerPositions = polygonHierarchy.positions;
1118
- if (outerPositions.length < 3) {
1119
- return;
1108
+ lastPolarPosition = Stereographic_default.clone(polarPosition, lastPolarPosition);
1109
+ }
1110
+ expandRectangle(
1111
+ Stereographic_default.fromCartesian(positions[0], scratchPolar),
1112
+ lastPolarPosition,
1113
+ ellipsoid,
1114
+ arcType,
1115
+ polygon,
1116
+ result
1117
+ );
1118
+ if (result.east - result.west > polygon.eastOverIdl - polygon.westOverIdl) {
1119
+ result.west = polygon.westOverIdl;
1120
+ result.east = polygon.eastOverIdl;
1121
+ if (result.east > Math_default.PI) {
1122
+ result.east = result.east - Math_default.TWO_PI;
1120
1123
  }
1121
-
1122
- const tangentPlane = EllipsoidTangentPlane.EllipsoidTangentPlane.fromPoints(
1123
- outerPositions,
1124
- ellipsoid
1124
+ if (result.west > Math_default.PI) {
1125
+ result.west = result.west - Math_default.TWO_PI;
1126
+ }
1127
+ }
1128
+ if (Math_default.equalsEpsilon(
1129
+ Math.abs(polygon.northAngle),
1130
+ Math_default.TWO_PI,
1131
+ Math_default.EPSILON10
1132
+ )) {
1133
+ result.north = Math_default.PI_OVER_TWO;
1134
+ result.east = Math_default.PI;
1135
+ result.west = -Math_default.PI;
1136
+ }
1137
+ if (Math_default.equalsEpsilon(
1138
+ Math.abs(polygon.southAngle),
1139
+ Math_default.TWO_PI,
1140
+ Math_default.EPSILON10
1141
+ )) {
1142
+ result.south = -Math_default.PI_OVER_TWO;
1143
+ result.east = Math_default.PI;
1144
+ result.west = -Math_default.PI;
1145
+ }
1146
+ return result;
1147
+ };
1148
+ PolygonGeometry.computeRectangle = function(options, result) {
1149
+ Check_default.typeOf.object("options", options);
1150
+ Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
1151
+ deprecationWarning_default(
1152
+ "PolygonGeometry.computeRectangle",
1153
+ "PolygonGeometry.computeRectangle was deprecated in CesiumJS 1.110. It will be removed in CesiumJS 1.112. Use PolygonGeometry.computeRectangleFromPositions instead."
1154
+ );
1155
+ const granularity = defaultValue_default(
1156
+ options.granularity,
1157
+ Math_default.RADIANS_PER_DEGREE
1158
+ );
1159
+ const arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
1160
+ if (arcType !== ArcType_default.GEODESIC && arcType !== ArcType_default.RHUMB) {
1161
+ throw new DeveloperError_default(
1162
+ "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
1125
1163
  );
1126
-
1127
- const results = PolygonGeometryLibrary.PolygonGeometryLibrary.polygonsFromHierarchy(
1128
- polygonHierarchy,
1129
- hasTextureCoordinates,
1130
- tangentPlane.projectPointsOntoPlane.bind(tangentPlane),
1131
- !perPositionHeight,
1132
- ellipsoid
1164
+ }
1165
+ const polygonHierarchy = options.polygonHierarchy;
1166
+ const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
1167
+ return computeRectangle(
1168
+ polygonHierarchy.positions,
1169
+ ellipsoid,
1170
+ arcType,
1171
+ granularity,
1172
+ result
1173
+ );
1174
+ };
1175
+ var scratchPolarForPlane = new Stereographic_default();
1176
+ function getTangentPlane(rectangle, positions, ellipsoid) {
1177
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1178
+ const polar = Stereographic_default.fromCartesian(
1179
+ positions[0],
1180
+ scratchPolarForPlane
1133
1181
  );
1134
-
1135
- const hierarchy = results.hierarchy;
1136
- const polygons = results.polygons;
1137
-
1138
- const dummyFunction = function (identity) {
1139
- return identity;
1182
+ return polar.tangentPlane;
1183
+ }
1184
+ return EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
1185
+ }
1186
+ var scratchCartographicCyllindrical = new Cartographic_default();
1187
+ function createProjectTo2d(rectangle, ellipsoid) {
1188
+ return (positions, results) => {
1189
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1190
+ if (rectangle.south < 0 && rectangle.north > 0) {
1191
+ if (!defined_default(results)) {
1192
+ results = [];
1193
+ }
1194
+ for (let i = 0; i < positions.length; ++i) {
1195
+ const cartographic = ellipsoid.cartesianToCartographic(
1196
+ positions[i],
1197
+ scratchCartographicCyllindrical
1198
+ );
1199
+ results[i] = new Cartesian2_default(
1200
+ cartographic.longitude / Math_default.PI,
1201
+ cartographic.latitude / Math_default.PI_OVER_TWO
1202
+ );
1203
+ }
1204
+ results.length = positions.length;
1205
+ return results;
1206
+ }
1207
+ return Stereographic_default.fromCartesianArray(positions, results);
1208
+ }
1209
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
1210
+ return tangentPlane.projectPointsOntoPlane(positions, results);
1211
+ };
1212
+ }
1213
+ function createProjectPositionTo2d(rectangle, outerRing, ellipsoid) {
1214
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1215
+ return (position, result) => {
1216
+ if (rectangle.south < 0 && rectangle.north > 0) {
1217
+ const cartographic = ellipsoid.cartesianToCartographic(
1218
+ position,
1219
+ scratchCartographicCyllindrical
1220
+ );
1221
+ if (!defined_default(result)) {
1222
+ result = new Cartesian2_default();
1223
+ }
1224
+ result.x = cartographic.longitude / Math_default.PI;
1225
+ result.y = cartographic.latitude / Math_default.PI_OVER_TWO;
1226
+ return result;
1227
+ }
1228
+ return Stereographic_default.fromCartesian(position, result);
1140
1229
  };
1141
-
1142
- const textureCoordinatePolygons = hasTextureCoordinates
1143
- ? PolygonGeometryLibrary.PolygonGeometryLibrary.polygonsFromHierarchy(
1144
- textureCoordinates,
1145
- true,
1146
- dummyFunction,
1147
- false
1148
- ).polygons
1149
- : undefined;
1150
-
1151
- if (hierarchy.length === 0) {
1152
- return;
1230
+ }
1231
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
1232
+ return (position, result) => {
1233
+ return tangentPlane.projectPointsOntoPlane(position, result);
1234
+ };
1235
+ }
1236
+ function createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight) {
1237
+ return (polygons, results) => {
1238
+ if (!perPositionHeight && (rectangle.height >= Math_default.PI_OVER_TWO || rectangle.width >= 2 * Math_default.PI_OVER_THREE)) {
1239
+ return PolygonGeometryLibrary_default.splitPolygonsOnEquator(
1240
+ polygons,
1241
+ ellipsoid,
1242
+ arcType,
1243
+ results
1244
+ );
1153
1245
  }
1154
-
1155
- outerPositions = hierarchy[0].outerRing;
1156
- const boundingRectangle = PolygonGeometryLibrary.PolygonGeometryLibrary.computeBoundingRectangle(
1157
- tangentPlane.plane.normal,
1158
- tangentPlane.projectPointOntoPlane.bind(tangentPlane),
1159
- outerPositions,
1160
- stRotation,
1246
+ return polygons;
1247
+ };
1248
+ }
1249
+ function computeBoundingRectangle(outerRing, rectangle, ellipsoid, stRotation) {
1250
+ if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
1251
+ return BoundingRectangle_default.fromRectangle(
1252
+ rectangle,
1253
+ void 0,
1161
1254
  scratchBoundingRectangle
1162
1255
  );
1163
-
1164
- const geometries = [];
1165
-
1166
- const height = polygonGeometry._height;
1167
- const extrudedHeight = polygonGeometry._extrudedHeight;
1168
- const extrude =
1169
- polygonGeometry._perPositionHeightExtrude ||
1170
- !Math$1.CesiumMath.equalsEpsilon(height, extrudedHeight, 0, Math$1.CesiumMath.EPSILON2);
1171
-
1172
- const options = {
1173
- perPositionHeight: perPositionHeight,
1174
- vertexFormat: vertexFormat,
1175
- geometry: undefined,
1176
- tangentPlane: tangentPlane,
1177
- boundingRectangle: boundingRectangle,
1178
- ellipsoid: ellipsoid,
1179
- stRotation: stRotation,
1180
- textureCoordinates: undefined,
1181
- bottom: false,
1182
- top: true,
1183
- wall: false,
1184
- extrude: false,
1185
- arcType: arcType,
1186
- };
1187
-
1188
- let i;
1189
-
1190
- if (extrude) {
1191
- options.extrude = true;
1192
- options.top = closeTop;
1193
- options.bottom = closeBottom;
1194
- options.shadowVolume = polygonGeometry._shadowVolume;
1195
- options.offsetAttribute = polygonGeometry._offsetAttribute;
1196
- for (i = 0; i < polygons.length; i++) {
1197
- const splitGeometry = createGeometryFromPositionsExtruded(
1256
+ }
1257
+ const outerPositions = outerRing;
1258
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
1259
+ outerPositions,
1260
+ ellipsoid
1261
+ );
1262
+ return PolygonGeometryLibrary_default.computeBoundingRectangle(
1263
+ tangentPlane.plane.normal,
1264
+ tangentPlane.projectPointOntoPlane.bind(tangentPlane),
1265
+ outerPositions,
1266
+ stRotation,
1267
+ scratchBoundingRectangle
1268
+ );
1269
+ }
1270
+ PolygonGeometry.createGeometry = function(polygonGeometry) {
1271
+ const vertexFormat = polygonGeometry._vertexFormat;
1272
+ const ellipsoid = polygonGeometry._ellipsoid;
1273
+ const granularity = polygonGeometry._granularity;
1274
+ const stRotation = polygonGeometry._stRotation;
1275
+ const polygonHierarchy = polygonGeometry._polygonHierarchy;
1276
+ const perPositionHeight = polygonGeometry._perPositionHeight;
1277
+ const closeTop = polygonGeometry._closeTop;
1278
+ const closeBottom = polygonGeometry._closeBottom;
1279
+ const arcType = polygonGeometry._arcType;
1280
+ const textureCoordinates = polygonGeometry._textureCoordinates;
1281
+ const hasTextureCoordinates = defined_default(textureCoordinates);
1282
+ const outerPositions = polygonHierarchy.positions;
1283
+ if (outerPositions.length < 3) {
1284
+ return;
1285
+ }
1286
+ const rectangle = polygonGeometry.rectangle;
1287
+ const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
1288
+ polygonHierarchy,
1289
+ hasTextureCoordinates,
1290
+ createProjectTo2d(rectangle, ellipsoid),
1291
+ !perPositionHeight,
1292
+ ellipsoid,
1293
+ createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight)
1294
+ );
1295
+ const hierarchy = results.hierarchy;
1296
+ const polygons = results.polygons;
1297
+ const dummyFunction = function(identity) {
1298
+ return identity;
1299
+ };
1300
+ const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
1301
+ textureCoordinates,
1302
+ true,
1303
+ dummyFunction,
1304
+ false,
1305
+ ellipsoid
1306
+ ).polygons : void 0;
1307
+ if (hierarchy.length === 0) {
1308
+ return;
1309
+ }
1310
+ const outerRing = hierarchy[0].outerRing;
1311
+ const boundingRectangle = computeBoundingRectangle(
1312
+ outerRing,
1313
+ rectangle,
1314
+ ellipsoid,
1315
+ stRotation
1316
+ );
1317
+ const geometries = [];
1318
+ const height = polygonGeometry._height;
1319
+ const extrudedHeight = polygonGeometry._extrudedHeight;
1320
+ const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
1321
+ const options = {
1322
+ perPositionHeight,
1323
+ vertexFormat,
1324
+ geometry: void 0,
1325
+ rotationAxis: getTangentPlane(rectangle, outerRing, ellipsoid).plane.normal,
1326
+ projectTo2d: createProjectPositionTo2d(rectangle, outerRing, ellipsoid),
1327
+ boundingRectangle,
1328
+ ellipsoid,
1329
+ stRotation,
1330
+ textureCoordinates: void 0,
1331
+ bottom: false,
1332
+ top: true,
1333
+ wall: false,
1334
+ extrude: false,
1335
+ arcType
1336
+ };
1337
+ let i;
1338
+ if (extrude) {
1339
+ options.extrude = true;
1340
+ options.top = closeTop;
1341
+ options.bottom = closeBottom;
1342
+ options.shadowVolume = polygonGeometry._shadowVolume;
1343
+ options.offsetAttribute = polygonGeometry._offsetAttribute;
1344
+ for (i = 0; i < polygons.length; i++) {
1345
+ const splitGeometry = createGeometryFromPositionsExtruded(
1346
+ ellipsoid,
1347
+ polygons[i],
1348
+ hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
1349
+ granularity,
1350
+ hierarchy[i],
1351
+ perPositionHeight,
1352
+ closeTop,
1353
+ closeBottom,
1354
+ vertexFormat,
1355
+ arcType
1356
+ );
1357
+ let topAndBottom;
1358
+ if (closeTop && closeBottom) {
1359
+ topAndBottom = splitGeometry.topAndBottom;
1360
+ options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
1361
+ topAndBottom.geometry,
1362
+ height,
1363
+ extrudedHeight,
1364
+ ellipsoid,
1365
+ perPositionHeight
1366
+ );
1367
+ } else if (closeTop) {
1368
+ topAndBottom = splitGeometry.topAndBottom;
1369
+ topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1370
+ topAndBottom.geometry.attributes.position.values,
1371
+ height,
1372
+ ellipsoid,
1373
+ !perPositionHeight
1374
+ );
1375
+ options.geometry = topAndBottom.geometry;
1376
+ } else if (closeBottom) {
1377
+ topAndBottom = splitGeometry.topAndBottom;
1378
+ topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1379
+ topAndBottom.geometry.attributes.position.values,
1380
+ extrudedHeight,
1381
+ ellipsoid,
1382
+ true
1383
+ );
1384
+ options.geometry = topAndBottom.geometry;
1385
+ }
1386
+ if (closeTop || closeBottom) {
1387
+ options.wall = false;
1388
+ topAndBottom.geometry = computeAttributes(options);
1389
+ geometries.push(topAndBottom);
1390
+ }
1391
+ const walls = splitGeometry.walls;
1392
+ options.wall = true;
1393
+ for (let k = 0; k < walls.length; k++) {
1394
+ const wall = walls[k];
1395
+ options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
1396
+ wall.geometry,
1397
+ height,
1398
+ extrudedHeight,
1399
+ ellipsoid,
1400
+ perPositionHeight
1401
+ );
1402
+ wall.geometry = computeAttributes(options);
1403
+ geometries.push(wall);
1404
+ }
1405
+ }
1406
+ } else {
1407
+ for (i = 0; i < polygons.length; i++) {
1408
+ const geometryInstance = new GeometryInstance_default({
1409
+ geometry: PolygonGeometryLibrary_default.createGeometryFromPositions(
1198
1410
  ellipsoid,
1199
1411
  polygons[i],
1200
- hasTextureCoordinates ? textureCoordinatePolygons[i] : undefined,
1412
+ hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
1201
1413
  granularity,
1202
- hierarchy[i],
1203
1414
  perPositionHeight,
1204
- closeTop,
1205
- closeBottom,
1206
1415
  vertexFormat,
1207
1416
  arcType
1417
+ )
1418
+ });
1419
+ geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
1420
+ geometryInstance.geometry.attributes.position.values,
1421
+ height,
1422
+ ellipsoid,
1423
+ !perPositionHeight
1424
+ );
1425
+ options.geometry = geometryInstance.geometry;
1426
+ geometryInstance.geometry = computeAttributes(options);
1427
+ if (defined_default(polygonGeometry._offsetAttribute)) {
1428
+ const length = geometryInstance.geometry.attributes.position.values.length;
1429
+ const offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
1430
+ const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
1431
+ geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
1432
+ {
1433
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
1434
+ componentsPerAttribute: 1,
1435
+ values: applyOffset
1436
+ }
1208
1437
  );
1209
-
1210
- let topAndBottom;
1211
- if (closeTop && closeBottom) {
1212
- topAndBottom = splitGeometry.topAndBottom;
1213
- options.geometry = PolygonGeometryLibrary.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(
1214
- topAndBottom.geometry,
1215
- height,
1216
- extrudedHeight,
1217
- ellipsoid,
1218
- perPositionHeight
1219
- );
1220
- } else if (closeTop) {
1221
- topAndBottom = splitGeometry.topAndBottom;
1222
- topAndBottom.geometry.attributes.position.values = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
1223
- topAndBottom.geometry.attributes.position.values,
1224
- height,
1225
- ellipsoid,
1226
- !perPositionHeight
1227
- );
1228
- options.geometry = topAndBottom.geometry;
1229
- } else if (closeBottom) {
1230
- topAndBottom = splitGeometry.topAndBottom;
1231
- topAndBottom.geometry.attributes.position.values = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
1232
- topAndBottom.geometry.attributes.position.values,
1233
- extrudedHeight,
1234
- ellipsoid,
1235
- true
1236
- );
1237
- options.geometry = topAndBottom.geometry;
1238
- }
1239
- if (closeTop || closeBottom) {
1240
- options.wall = false;
1241
- topAndBottom.geometry = computeAttributes(options);
1242
- geometries.push(topAndBottom);
1243
- }
1244
-
1245
- const walls = splitGeometry.walls;
1246
- options.wall = true;
1247
- for (let k = 0; k < walls.length; k++) {
1248
- const wall = walls[k];
1249
- options.geometry = PolygonGeometryLibrary.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(
1250
- wall.geometry,
1251
- height,
1252
- extrudedHeight,
1253
- ellipsoid,
1254
- perPositionHeight
1255
- );
1256
- wall.geometry = computeAttributes(options);
1257
- geometries.push(wall);
1258
- }
1259
1438
  }
1260
- } else {
1261
- for (i = 0; i < polygons.length; i++) {
1262
- const geometryInstance = new GeometryInstance.GeometryInstance({
1263
- geometry: PolygonGeometryLibrary.PolygonGeometryLibrary.createGeometryFromPositions(
1264
- ellipsoid,
1265
- polygons[i],
1266
- hasTextureCoordinates ? textureCoordinatePolygons[i] : undefined,
1267
- granularity,
1268
- perPositionHeight,
1269
- vertexFormat,
1270
- arcType
1271
- ),
1272
- });
1273
- geometryInstance.geometry.attributes.position.values = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
1274
- geometryInstance.geometry.attributes.position.values,
1275
- height,
1276
- ellipsoid,
1277
- !perPositionHeight
1439
+ geometries.push(geometryInstance);
1440
+ }
1441
+ }
1442
+ const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
1443
+ geometry.attributes.position.values = new Float64Array(
1444
+ geometry.attributes.position.values
1445
+ );
1446
+ geometry.indices = IndexDatatype_default.createTypedArray(
1447
+ geometry.attributes.position.values.length / 3,
1448
+ geometry.indices
1449
+ );
1450
+ const attributes = geometry.attributes;
1451
+ const boundingSphere = BoundingSphere_default.fromVertices(
1452
+ attributes.position.values
1453
+ );
1454
+ if (!vertexFormat.position) {
1455
+ delete attributes.position;
1456
+ }
1457
+ return new Geometry_default({
1458
+ attributes,
1459
+ indices: geometry.indices,
1460
+ primitiveType: geometry.primitiveType,
1461
+ boundingSphere,
1462
+ offsetAttribute: polygonGeometry._offsetAttribute
1463
+ });
1464
+ };
1465
+ PolygonGeometry.createShadowVolume = function(polygonGeometry, minHeightFunc, maxHeightFunc) {
1466
+ const granularity = polygonGeometry._granularity;
1467
+ const ellipsoid = polygonGeometry._ellipsoid;
1468
+ const minHeight = minHeightFunc(granularity, ellipsoid);
1469
+ const maxHeight = maxHeightFunc(granularity, ellipsoid);
1470
+ return new PolygonGeometry({
1471
+ polygonHierarchy: polygonGeometry._polygonHierarchy,
1472
+ ellipsoid,
1473
+ stRotation: polygonGeometry._stRotation,
1474
+ granularity,
1475
+ perPositionHeight: false,
1476
+ extrudedHeight: minHeight,
1477
+ height: maxHeight,
1478
+ vertexFormat: VertexFormat_default.POSITION_ONLY,
1479
+ shadowVolume: true,
1480
+ arcType: polygonGeometry._arcType
1481
+ });
1482
+ };
1483
+ function textureCoordinateRotationPoints(polygonGeometry) {
1484
+ const stRotation = -polygonGeometry._stRotation;
1485
+ if (stRotation === 0) {
1486
+ return [0, 0, 0, 1, 1, 0];
1487
+ }
1488
+ const ellipsoid = polygonGeometry._ellipsoid;
1489
+ const positions = polygonGeometry._polygonHierarchy.positions;
1490
+ const boundingRectangle = polygonGeometry.rectangle;
1491
+ return Geometry_default._textureCoordinateRotationPoints(
1492
+ positions,
1493
+ stRotation,
1494
+ ellipsoid,
1495
+ boundingRectangle
1496
+ );
1497
+ }
1498
+ Object.defineProperties(PolygonGeometry.prototype, {
1499
+ /**
1500
+ * @private
1501
+ */
1502
+ rectangle: {
1503
+ get: function() {
1504
+ if (!defined_default(this._rectangle)) {
1505
+ const positions = this._polygonHierarchy.positions;
1506
+ this._rectangle = PolygonGeometry.computeRectangleFromPositions(
1507
+ positions,
1508
+ this._ellipsoid,
1509
+ this._arcType
1278
1510
  );
1279
- options.geometry = geometryInstance.geometry;
1280
-
1281
- geometryInstance.geometry = computeAttributes(options);
1282
-
1283
- if (defaultValue.defined(polygonGeometry._offsetAttribute)) {
1284
- const length =
1285
- geometryInstance.geometry.attributes.position.values.length;
1286
- const offsetValue =
1287
- polygonGeometry._offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE
1288
- ? 0
1289
- : 1;
1290
- const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
1291
- geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute.GeometryAttribute(
1292
- {
1293
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
1294
- componentsPerAttribute: 1,
1295
- values: applyOffset,
1296
- }
1297
- );
1298
- }
1299
-
1300
- geometries.push(geometryInstance);
1301
1511
  }
1512
+ return this._rectangle;
1302
1513
  }
1303
-
1304
- const geometry = GeometryPipeline.GeometryPipeline.combineInstances(geometries)[0];
1305
- geometry.attributes.position.values = new Float64Array(
1306
- geometry.attributes.position.values
1307
- );
1308
- geometry.indices = IndexDatatype.IndexDatatype.createTypedArray(
1309
- geometry.attributes.position.values.length / 3,
1310
- geometry.indices
1311
- );
1312
-
1313
- const attributes = geometry.attributes;
1314
- const boundingSphere = Transforms.BoundingSphere.fromVertices(
1315
- attributes.position.values
1316
- );
1317
-
1318
- if (!vertexFormat.position) {
1319
- delete attributes.position;
1320
- }
1321
-
1322
- return new GeometryAttribute.Geometry({
1323
- attributes: attributes,
1324
- indices: geometry.indices,
1325
- primitiveType: geometry.primitiveType,
1326
- boundingSphere: boundingSphere,
1327
- offsetAttribute: polygonGeometry._offsetAttribute,
1328
- });
1329
- };
1330
-
1514
+ },
1331
1515
  /**
1516
+ * For remapping texture coordinates when rendering PolygonGeometries as GroundPrimitives.
1332
1517
  * @private
1333
1518
  */
1334
- PolygonGeometry.createShadowVolume = function (
1335
- polygonGeometry,
1336
- minHeightFunc,
1337
- maxHeightFunc
1338
- ) {
1339
- const granularity = polygonGeometry._granularity;
1340
- const ellipsoid = polygonGeometry._ellipsoid;
1341
-
1342
- const minHeight = minHeightFunc(granularity, ellipsoid);
1343
- const maxHeight = maxHeightFunc(granularity, ellipsoid);
1344
-
1345
- return new PolygonGeometry({
1346
- polygonHierarchy: polygonGeometry._polygonHierarchy,
1347
- ellipsoid: ellipsoid,
1348
- stRotation: polygonGeometry._stRotation,
1349
- granularity: granularity,
1350
- perPositionHeight: false,
1351
- extrudedHeight: minHeight,
1352
- height: maxHeight,
1353
- vertexFormat: VertexFormat.VertexFormat.POSITION_ONLY,
1354
- shadowVolume: true,
1355
- arcType: polygonGeometry._arcType,
1356
- });
1357
- };
1358
-
1359
- function textureCoordinateRotationPoints(polygonGeometry) {
1360
- const stRotation = -polygonGeometry._stRotation;
1361
- if (stRotation === 0.0) {
1362
- return [0, 0, 0, 1, 1, 0];
1519
+ textureCoordinateRotationPoints: {
1520
+ get: function() {
1521
+ if (!defined_default(this._textureCoordinateRotationPoints)) {
1522
+ this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
1523
+ this
1524
+ );
1525
+ }
1526
+ return this._textureCoordinateRotationPoints;
1363
1527
  }
1364
- const ellipsoid = polygonGeometry._ellipsoid;
1365
- const positions = polygonGeometry._polygonHierarchy.positions;
1366
- const boundingRectangle = polygonGeometry.rectangle;
1367
- return GeometryAttribute.Geometry._textureCoordinateRotationPoints(
1368
- positions,
1369
- stRotation,
1370
- ellipsoid,
1371
- boundingRectangle
1372
- );
1373
1528
  }
1529
+ });
1530
+ var PolygonGeometry_default = PolygonGeometry;
1374
1531
 
1375
- Object.defineProperties(PolygonGeometry.prototype, {
1376
- /**
1377
- * @private
1378
- */
1379
- rectangle: {
1380
- get: function () {
1381
- if (!defaultValue.defined(this._rectangle)) {
1382
- const positions = this._polygonHierarchy.positions;
1383
- this._rectangle = computeRectangle(
1384
- positions,
1385
- this._ellipsoid,
1386
- this._arcType,
1387
- this._granularity
1388
- );
1389
- }
1390
-
1391
- return this._rectangle;
1392
- },
1393
- },
1394
- /**
1395
- * For remapping texture coordinates when rendering PolygonGeometries as GroundPrimitives.
1396
- * @private
1397
- */
1398
- textureCoordinateRotationPoints: {
1399
- get: function () {
1400
- if (!defaultValue.defined(this._textureCoordinateRotationPoints)) {
1401
- this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
1402
- this
1403
- );
1404
- }
1405
- return this._textureCoordinateRotationPoints;
1406
- },
1407
- },
1408
- });
1409
-
1410
- function createPolygonGeometry(polygonGeometry, offset) {
1411
- if (defaultValue.defined(offset)) {
1412
- polygonGeometry = PolygonGeometry.unpack(polygonGeometry, offset);
1413
- }
1414
- polygonGeometry._ellipsoid = Matrix3.Ellipsoid.clone(polygonGeometry._ellipsoid);
1415
- return PolygonGeometry.createGeometry(polygonGeometry);
1532
+ // packages/engine/Source/Workers/createPolygonGeometry.js
1533
+ function createPolygonGeometry(polygonGeometry, offset) {
1534
+ if (defined_default(offset)) {
1535
+ polygonGeometry = PolygonGeometry_default.unpack(polygonGeometry, offset);
1416
1536
  }
1417
-
1418
- return createPolygonGeometry;
1419
-
1420
- }));
1537
+ polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
1538
+ return PolygonGeometry_default.createGeometry(polygonGeometry);
1539
+ }
1540
+ var createPolygonGeometry_default = createPolygonGeometry;
1541
+ export {
1542
+ createPolygonGeometry_default as default
1543
+ };