@cesium/engine 4.0.0 → 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 (126) hide show
  1. package/Build/Workers/{chunk-LGSGX2RH.js → chunk-2U6EBIRX.js} +10 -10
  2. package/Build/Workers/{chunk-FVDTKX3F.js → chunk-2ZI7FZ3Q.js} +2 -2
  3. package/Build/Workers/{chunk-DJUTBX6A.js → chunk-3TSHZWOZ.js} +2 -2
  4. package/Build/Workers/{chunk-FYHCAKU6.js → chunk-44B6FQSJ.js} +11 -11
  5. package/Build/Workers/{chunk-4VWUFKYW.js → chunk-4AJR66C5.js} +12 -12
  6. package/Build/Workers/{chunk-PWDYKCNC.js → chunk-4HN3N5SE.js} +4 -4
  7. package/Build/Workers/{chunk-I5MQWHBR.js → chunk-4QGPYV3W.js} +4 -4
  8. package/Build/Workers/{chunk-C6MRR5YL.js → chunk-4RKE4B3G.js} +7 -7
  9. package/Build/Workers/{chunk-P4M4QUNQ.js → chunk-5E3V7Y4R.js} +6 -6
  10. package/Build/Workers/{chunk-UN7AK64D.js → chunk-6EHT6GS3.js} +2 -2
  11. package/Build/Workers/{chunk-PGB3EFR7.js → chunk-6I22NWKQ.js} +6 -6
  12. package/Build/Workers/{chunk-7IMAWM6A.js → chunk-7N67FBLW.js} +229 -17
  13. package/Build/Workers/{chunk-LQRFWCNX.js → chunk-AQQGAFKX.js} +5 -5
  14. package/Build/Workers/{chunk-TF5D2H7B.js → chunk-CROU4RHL.js} +5 -5
  15. package/Build/Workers/{chunk-KAFF2QX3.js → chunk-CTJCECTX.js} +5 -5
  16. package/Build/Workers/{chunk-FKHRSGKP.js → chunk-DWJZFZ67.js} +13 -13
  17. package/Build/Workers/{chunk-V2LKNJGT.js → chunk-EHJQEARC.js} +5 -5
  18. package/Build/Workers/{chunk-VSCXSFHE.js → chunk-EVLKHUAE.js} +13 -13
  19. package/Build/Workers/{chunk-YLAFWVOW.js → chunk-FOOYJER7.js} +10 -10
  20. package/Build/Workers/{chunk-F7P2HCYZ.js → chunk-GLCRFDOB.js} +2 -2
  21. package/Build/Workers/{chunk-BT6YIL2N.js → chunk-GPO47TW4.js} +1 -1
  22. package/Build/Workers/{chunk-AXGQUPXA.js → chunk-H5Q2JKIA.js} +17 -17
  23. package/Build/Workers/{chunk-XJCTFTBM.js → chunk-HIDSEUWS.js} +5 -5
  24. package/Build/Workers/{chunk-UGZGTV5K.js → chunk-HV67ARO7.js} +8 -8
  25. package/Build/Workers/{chunk-H52L6U76.js → chunk-IC7G4BX2.js} +11 -11
  26. package/Build/Workers/{chunk-2C65EKYA.js → chunk-IQN2LMGD.js} +1 -1
  27. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  28. package/Build/Workers/{chunk-4V6RCTVH.js → chunk-K3VEWONC.js} +10 -10
  29. package/Build/Workers/{chunk-RDCDRNJ7.js → chunk-KZFXE35V.js} +6 -6
  30. package/Build/Workers/{chunk-SGRWJKNO.js → chunk-MG2TXIO5.js} +15 -15
  31. package/Build/Workers/{chunk-2NLMZNJI.js → chunk-MRCFDEKH.js} +4 -4
  32. package/Build/Workers/{chunk-PW5CA4MJ.js → chunk-MYDS6HBL.js} +7 -7
  33. package/Build/Workers/{chunk-H6MBQ4W4.js → chunk-OCIX2CQ7.js} +4 -4
  34. package/Build/Workers/{chunk-HCZR75II.js → chunk-P32XMW4I.js} +15 -15
  35. package/Build/Workers/{chunk-G3MOT7BZ.js → chunk-PEVZYZBQ.js} +6 -6
  36. package/Build/Workers/{chunk-EQ6ZAP37.js → chunk-PMDLIBEQ.js} +7 -7
  37. package/Build/Workers/{chunk-RDM3BKNC.js → chunk-QDUOGCCO.js} +11 -11
  38. package/Build/Workers/{chunk-P7PWX5HR.js → chunk-QUCJGBCK.js} +7 -7
  39. package/Build/Workers/{chunk-RRUPTJ6P.js → chunk-RCI7BSOM.js} +6 -6
  40. package/Build/Workers/{chunk-NRETMGYL.js → chunk-SVTSC7FX.js} +13 -13
  41. package/Build/Workers/{chunk-QVJ6IRKV.js → chunk-TXOGSFHZ.js} +1 -1
  42. package/Build/Workers/{chunk-527JG4D7.js → chunk-TXYJOVQK.js} +1 -1
  43. package/Build/Workers/{chunk-QIS3NB7U.js → chunk-UFIT5XDI.js} +7 -7
  44. package/Build/Workers/{chunk-FE2XG3SS.js → chunk-ULLMQNFQ.js} +3 -3
  45. package/Build/Workers/{chunk-U5LKG6LX.js → chunk-UM7FIUQW.js} +2 -2
  46. package/Build/Workers/{chunk-A6EA6KIE.js → chunk-UMLTOPAE.js} +1 -1
  47. package/Build/Workers/{chunk-5U4UHRZ2.js → chunk-V5S5N2IS.js} +10 -10
  48. package/Build/Workers/{chunk-TVYIHH4V.js → chunk-VN2IHJKM.js} +14 -14
  49. package/Build/Workers/{chunk-YMJPANZZ.js → chunk-VWSD2XV5.js} +10 -34
  50. package/Build/Workers/{chunk-XZVQMPWG.js → chunk-X2KIWBTW.js} +5 -5
  51. package/Build/Workers/{chunk-7CZEWQWE.js → chunk-Y24CDOJC.js} +6 -6
  52. package/Build/Workers/{chunk-N5MMDSD2.js → chunk-YLMDWSXO.js} +2 -2
  53. package/Build/Workers/{chunk-27R2KRIK.js → chunk-YNZ4DMR7.js} +6 -6
  54. package/Build/Workers/{chunk-YLS3FX3U.js → chunk-Z2MP3UBE.js} +7 -7
  55. package/Build/Workers/combineGeometry.js +23 -23
  56. package/Build/Workers/createBoxGeometry.js +17 -17
  57. package/Build/Workers/createBoxOutlineGeometry.js +15 -15
  58. package/Build/Workers/createCircleGeometry.js +25 -25
  59. package/Build/Workers/createCircleOutlineGeometry.js +18 -18
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
  62. package/Build/Workers/createCorridorGeometry.js +29 -28
  63. package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
  64. package/Build/Workers/createCylinderGeometry.js +19 -19
  65. package/Build/Workers/createCylinderOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipseGeometry.js +25 -25
  67. package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
  68. package/Build/Workers/createEllipsoidGeometry.js +18 -18
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
  70. package/Build/Workers/createFrustumGeometry.js +17 -17
  71. package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
  72. package/Build/Workers/createGeometry.js +23 -23
  73. package/Build/Workers/createGroundPolylineGeometry.js +21 -21
  74. package/Build/Workers/createPlaneGeometry.js +15 -15
  75. package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
  76. package/Build/Workers/createPolygonGeometry.js +469 -60
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +33 -31
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
  81. package/Build/Workers/createRectangleGeometry.js +26 -26
  82. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  83. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  84. package/Build/Workers/createSphereGeometry.js +18 -18
  85. package/Build/Workers/createSphereOutlineGeometry.js +17 -17
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  88. package/Build/Workers/createVectorTileGeometries.js +23 -23
  89. package/Build/Workers/createVectorTilePoints.js +12 -12
  90. package/Build/Workers/createVectorTilePolygons.js +21 -21
  91. package/Build/Workers/createVectorTilePolylines.js +14 -14
  92. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +21 -21
  93. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  94. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +18 -18
  95. package/Build/Workers/createWallGeometry.js +23 -23
  96. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  97. package/Build/Workers/decodeDraco.js +11 -11
  98. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  99. package/Build/Workers/decodeI3S.js +9 -9
  100. package/Build/Workers/transcodeKTX2.js +7 -7
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +21 -21
  103. package/Source/Core/Credit.js +7 -1
  104. package/Source/Core/GoogleMaps.js +1 -2
  105. package/Source/Core/Ion.js +1 -2
  106. package/Source/Core/PolygonGeometry.js +340 -27
  107. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  108. package/Source/Core/Stereographic.js +247 -0
  109. package/Source/Core/TaskProcessor.js +53 -40
  110. package/Source/Core/buildModuleUrl.js +1 -1
  111. package/Source/Core/sampleTerrain.js +43 -10
  112. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  113. package/Source/Scene/ArcGisMapService.js +1 -2
  114. package/Source/Scene/Billboard.js +7 -0
  115. package/Source/Scene/Cesium3DTilePass.js +1 -1
  116. package/Source/Scene/Cesium3DTileset.js +38 -81
  117. package/Source/Scene/CreditDisplay.js +2 -2
  118. package/Source/Scene/LabelCollection.js +3 -1
  119. package/Source/Scene/Model/Model.js +16 -22
  120. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  121. package/Source/Scene/PrimitiveCollection.js +39 -0
  122. package/Source/Scene/Scene.js +3 -0
  123. package/Source/Widget/CesiumWidget.js +2 -1
  124. package/index.d.ts +53 -28
  125. package/index.js +108 -107
  126. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.109
4
+ * Version 1.110
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -25,83 +25,266 @@
25
25
 
26
26
  import {
27
27
  BoundingRectangle_default
28
- } from "./chunk-EQ6ZAP37.js";
28
+ } from "./chunk-PMDLIBEQ.js";
29
29
  import {
30
30
  PolygonGeometryLibrary_default
31
- } from "./chunk-7IMAWM6A.js";
31
+ } from "./chunk-7N67FBLW.js";
32
32
  import {
33
33
  ArcType_default
34
- } from "./chunk-2C65EKYA.js";
34
+ } from "./chunk-IQN2LMGD.js";
35
35
  import {
36
36
  GeometryInstance_default
37
- } from "./chunk-V2LKNJGT.js";
37
+ } from "./chunk-EHJQEARC.js";
38
38
  import {
39
39
  GeometryPipeline_default
40
- } from "./chunk-HCZR75II.js";
41
- import "./chunk-P7PWX5HR.js";
42
- import "./chunk-I5MQWHBR.js";
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";
43
46
  import {
44
47
  EllipsoidGeodesic_default
45
- } from "./chunk-7CZEWQWE.js";
48
+ } from "./chunk-Y24CDOJC.js";
46
49
  import {
47
50
  GeometryOffsetAttribute_default
48
- } from "./chunk-A6EA6KIE.js";
51
+ } from "./chunk-UMLTOPAE.js";
49
52
  import {
50
53
  VertexFormat_default
51
- } from "./chunk-2NLMZNJI.js";
54
+ } from "./chunk-MRCFDEKH.js";
52
55
  import {
53
56
  EllipsoidTangentPlane_default
54
- } from "./chunk-4V6RCTVH.js";
55
- import "./chunk-G3MOT7BZ.js";
57
+ } from "./chunk-K3VEWONC.js";
58
+ import "./chunk-PEVZYZBQ.js";
56
59
  import {
57
60
  PolygonPipeline_default,
58
61
  WindingOrder_default
59
- } from "./chunk-RDM3BKNC.js";
60
- import "./chunk-XZVQMPWG.js";
61
- import "./chunk-RRUPTJ6P.js";
62
- import "./chunk-QIS3NB7U.js";
63
- import "./chunk-PGB3EFR7.js";
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";
64
70
  import {
65
71
  IndexDatatype_default
66
- } from "./chunk-TF5D2H7B.js";
67
- import "./chunk-N5MMDSD2.js";
72
+ } from "./chunk-CROU4RHL.js";
73
+ import "./chunk-YLMDWSXO.js";
68
74
  import {
69
75
  GeometryAttribute_default,
70
76
  Geometry_default
71
- } from "./chunk-UGZGTV5K.js";
77
+ } from "./chunk-HV67ARO7.js";
72
78
  import {
73
79
  BoundingSphere_default,
74
80
  Quaternion_default
75
- } from "./chunk-5U4UHRZ2.js";
76
- import "./chunk-FE2XG3SS.js";
81
+ } from "./chunk-V5S5N2IS.js";
82
+ import "./chunk-ULLMQNFQ.js";
77
83
  import {
78
84
  Cartesian2_default,
79
85
  Rectangle_default
80
- } from "./chunk-PW5CA4MJ.js";
86
+ } from "./chunk-MYDS6HBL.js";
81
87
  import {
82
88
  ComponentDatatype_default
83
- } from "./chunk-KAFF2QX3.js";
89
+ } from "./chunk-CTJCECTX.js";
84
90
  import {
85
91
  Cartesian3_default,
86
92
  Cartographic_default,
87
93
  Ellipsoid_default,
88
94
  Matrix3_default
89
- } from "./chunk-XJCTFTBM.js";
95
+ } from "./chunk-HIDSEUWS.js";
90
96
  import {
91
97
  Math_default
92
- } from "./chunk-PWDYKCNC.js";
93
- import "./chunk-527JG4D7.js";
94
- import "./chunk-FVDTKX3F.js";
98
+ } from "./chunk-4HN3N5SE.js";
99
+ import "./chunk-TXYJOVQK.js";
100
+ import "./chunk-2ZI7FZ3Q.js";
95
101
  import {
96
102
  defaultValue_default
97
- } from "./chunk-BT6YIL2N.js";
103
+ } from "./chunk-GPO47TW4.js";
98
104
  import {
99
105
  Check_default,
100
106
  DeveloperError_default
101
- } from "./chunk-UN7AK64D.js";
107
+ } from "./chunk-6EHT6GS3.js";
102
108
  import {
103
109
  defined_default
104
- } from "./chunk-QVJ6IRKV.js";
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.");
116
+ }
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;
186
+ }
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;
105
288
 
106
289
  // packages/engine/Source/Core/PolygonGeometry.js
107
290
  var scratchCarto1 = new Cartographic_default();
@@ -144,7 +327,8 @@ function computeAttributes(options) {
144
327
  const bottom = options.bottom || wall;
145
328
  if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
146
329
  const boundingRectangle = options.boundingRectangle;
147
- const tangentPlane = options.tangentPlane;
330
+ const rotationAxis = options.rotationAxis;
331
+ const projectTo2d = options.projectTo2d;
148
332
  const ellipsoid = options.ellipsoid;
149
333
  const stRotation = options.stRotation;
150
334
  const perPositionHeight = options.perPositionHeight;
@@ -173,13 +357,13 @@ function computeAttributes(options) {
173
357
  let tangentRotationMatrix = tangentMatrixScratch;
174
358
  if (stRotation !== 0) {
175
359
  let rotation = Quaternion_default.fromAxisAngle(
176
- tangentPlane._plane.normal,
360
+ rotationAxis,
177
361
  stRotation,
178
362
  appendTextureCoordinatesQuaternion
179
363
  );
180
364
  textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
181
365
  rotation = Quaternion_default.fromAxisAngle(
182
- tangentPlane._plane.normal,
366
+ rotationAxis,
183
367
  -stRotation,
184
368
  appendTextureCoordinatesQuaternion
185
369
  );
@@ -215,10 +399,7 @@ function computeAttributes(options) {
215
399
  scratchPosition
216
400
  );
217
401
  p = ellipsoid.scaleToGeodeticSurface(p, p);
218
- const st = tangentPlane.projectPointOntoPlane(
219
- p,
220
- appendTextureCoordinatesCartesian2
221
- );
402
+ const st = projectTo2d(p, appendTextureCoordinatesCartesian2);
222
403
  Cartesian2_default.subtract(st, origin, st);
223
404
  const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
224
405
  const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
@@ -533,7 +714,7 @@ function interpolateAndGrowRectangle(ellipsoidGeodesic2, inverseChordLength, res
533
714
  }
534
715
  }
535
716
  var createGeometryFromPositionsExtrudedPositions = [];
536
- function createGeometryFromPositionsExtruded(ellipsoid, polygon, textureCoordinates, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
717
+ function createGeometryFromPositionsExtruded(ellipsoid, polygon2, textureCoordinates, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
537
718
  const geos = {
538
719
  walls: []
539
720
  };
@@ -541,7 +722,7 @@ function createGeometryFromPositionsExtruded(ellipsoid, polygon, textureCoordina
541
722
  if (closeTop || closeBottom) {
542
723
  const topGeo = PolygonGeometryLibrary_default.createGeometryFromPositions(
543
724
  ellipsoid,
544
- polygon,
725
+ polygon2,
545
726
  textureCoordinates,
546
727
  granularity,
547
728
  perPositionHeight,
@@ -833,9 +1014,144 @@ PolygonGeometry.unpack = function(array, startingIndex, result) {
833
1014
  result.packedLength = packedLength;
834
1015
  return result;
835
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
1036
+ );
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
+ }
1052
+ }
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) {
1080
+ return result;
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
1099
+ );
1100
+ expandRectangle(
1101
+ polarPosition,
1102
+ lastPolarPosition,
1103
+ ellipsoid,
1104
+ arcType,
1105
+ polygon,
1106
+ result
1107
+ );
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;
1123
+ }
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
+ };
836
1148
  PolygonGeometry.computeRectangle = function(options, result) {
837
1149
  Check_default.typeOf.object("options", options);
838
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
+ );
839
1155
  const granularity = defaultValue_default(
840
1156
  options.granularity,
841
1157
  Math_default.RADIANS_PER_DEGREE
@@ -856,6 +1172,101 @@ PolygonGeometry.computeRectangle = function(options, result) {
856
1172
  result
857
1173
  );
858
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
1181
+ );
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);
1229
+ };
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
+ );
1245
+ }
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,
1254
+ scratchBoundingRectangle
1255
+ );
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
+ }
859
1270
  PolygonGeometry.createGeometry = function(polygonGeometry) {
860
1271
  const vertexFormat = polygonGeometry._vertexFormat;
861
1272
  const ellipsoid = polygonGeometry._ellipsoid;
@@ -868,20 +1279,18 @@ PolygonGeometry.createGeometry = function(polygonGeometry) {
868
1279
  const arcType = polygonGeometry._arcType;
869
1280
  const textureCoordinates = polygonGeometry._textureCoordinates;
870
1281
  const hasTextureCoordinates = defined_default(textureCoordinates);
871
- let outerPositions = polygonHierarchy.positions;
1282
+ const outerPositions = polygonHierarchy.positions;
872
1283
  if (outerPositions.length < 3) {
873
1284
  return;
874
1285
  }
875
- const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
876
- outerPositions,
877
- ellipsoid
878
- );
1286
+ const rectangle = polygonGeometry.rectangle;
879
1287
  const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
880
1288
  polygonHierarchy,
881
1289
  hasTextureCoordinates,
882
- tangentPlane.projectPointsOntoPlane.bind(tangentPlane),
1290
+ createProjectTo2d(rectangle, ellipsoid),
883
1291
  !perPositionHeight,
884
- ellipsoid
1292
+ ellipsoid,
1293
+ createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight)
885
1294
  );
886
1295
  const hierarchy = results.hierarchy;
887
1296
  const polygons = results.polygons;
@@ -892,18 +1301,18 @@ PolygonGeometry.createGeometry = function(polygonGeometry) {
892
1301
  textureCoordinates,
893
1302
  true,
894
1303
  dummyFunction,
895
- false
1304
+ false,
1305
+ ellipsoid
896
1306
  ).polygons : void 0;
897
1307
  if (hierarchy.length === 0) {
898
1308
  return;
899
1309
  }
900
- outerPositions = hierarchy[0].outerRing;
901
- const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
902
- tangentPlane.plane.normal,
903
- tangentPlane.projectPointOntoPlane.bind(tangentPlane),
904
- outerPositions,
905
- stRotation,
906
- scratchBoundingRectangle
1310
+ const outerRing = hierarchy[0].outerRing;
1311
+ const boundingRectangle = computeBoundingRectangle(
1312
+ outerRing,
1313
+ rectangle,
1314
+ ellipsoid,
1315
+ stRotation
907
1316
  );
908
1317
  const geometries = [];
909
1318
  const height = polygonGeometry._height;
@@ -913,7 +1322,8 @@ PolygonGeometry.createGeometry = function(polygonGeometry) {
913
1322
  perPositionHeight,
914
1323
  vertexFormat,
915
1324
  geometry: void 0,
916
- tangentPlane,
1325
+ rotationAxis: getTangentPlane(rectangle, outerRing, ellipsoid).plane.normal,
1326
+ projectTo2d: createProjectPositionTo2d(rectangle, outerRing, ellipsoid),
917
1327
  boundingRectangle,
918
1328
  ellipsoid,
919
1329
  stRotation,
@@ -1093,11 +1503,10 @@ Object.defineProperties(PolygonGeometry.prototype, {
1093
1503
  get: function() {
1094
1504
  if (!defined_default(this._rectangle)) {
1095
1505
  const positions = this._polygonHierarchy.positions;
1096
- this._rectangle = computeRectangle(
1506
+ this._rectangle = PolygonGeometry.computeRectangleFromPositions(
1097
1507
  positions,
1098
1508
  this._ellipsoid,
1099
- this._arcType,
1100
- this._granularity
1509
+ this._arcType
1101
1510
  );
1102
1511
  }
1103
1512
  return this._rectangle;