@cesium/engine 8.0.0 → 9.1.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 (192) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +7 -10
  2. package/Build/Workers/{chunk-F4HFJMGM.js → chunk-2CSEEWHN.js} +6 -6
  3. package/Build/Workers/{chunk-7TC63SJW.js → chunk-34DGOKCO.js} +10 -12
  4. package/Build/Workers/{chunk-7ZFGPDJA.js → chunk-3RZK5NNV.js} +4 -4
  5. package/Build/Workers/{chunk-M7ERACJJ.js → chunk-3S2MFY4B.js} +13 -13
  6. package/Build/Workers/{chunk-BROJAZRZ.js → chunk-4AJGCQFX.js} +13 -13
  7. package/Build/Workers/{chunk-2FWRMUTY.js → chunk-4KIUON73.js} +4 -4
  8. package/Build/Workers/{chunk-5QULIR53.js → chunk-4PHPQRSH.js} +4 -4
  9. package/Build/Workers/{chunk-X4356LRH.js → chunk-66E3H2KU.js} +12 -12
  10. package/Build/Workers/{chunk-G43QFN4Q.js → chunk-6HCAQOVK.js} +6 -6
  11. package/Build/Workers/{chunk-23UFSGND.js → chunk-7LPEGKOF.js} +7 -7
  12. package/Build/Workers/{chunk-DDUQAJ4P.js → chunk-7VZNXIKG.js} +7 -7
  13. package/Build/Workers/{chunk-JURN7NPV.js → chunk-A6NCZSL3.js} +19 -19
  14. package/Build/Workers/{chunk-ZT7KWISZ.js → chunk-AOFMPKUB.js} +4 -4
  15. package/Build/Workers/{chunk-BIKA3NRA.js → chunk-AOIKO5Y7.js} +5 -5
  16. package/Build/Workers/{chunk-YWTJ2B4B.js → chunk-BDUJXBVF.js} +1 -1
  17. package/Build/Workers/{chunk-OGXZVPPM.js → chunk-C5CE4OG6.js} +469 -6
  18. package/Build/Workers/{chunk-FNIRWHJB.js → chunk-CE6GTZ4I.js} +11 -13
  19. package/Build/Workers/{chunk-SH5USDPI.js → chunk-CYAJYEKW.js} +6 -6
  20. package/Build/Workers/{chunk-Y5UQJLYE.js → chunk-FOZQIHZK.js} +6 -6
  21. package/Build/Workers/{chunk-2FRVPMCS.js → chunk-G7CJQKKD.js} +7 -7
  22. package/Build/Workers/{chunk-EERJKOAF.js → chunk-GIFJ77E4.js} +4 -4
  23. package/Build/Workers/{chunk-FJKNFAKQ.js → chunk-I5TDPPC4.js} +7197 -5096
  24. package/Build/Workers/{chunk-3VAZEH7M.js → chunk-IBXGK4WV.js} +2 -2
  25. package/Build/Workers/{chunk-VOXYEYJT.js → chunk-JI2445T5.js} +11 -11
  26. package/Build/Workers/{chunk-PGSJK77E.js → chunk-KPY4F4BW.js} +6 -6
  27. package/Build/Workers/{chunk-I46ZRR5W.js → chunk-LVJCR7DH.js} +17 -17
  28. package/Build/Workers/{chunk-T3XIFPYR.js → chunk-LW7WGHEU.js} +16 -16
  29. package/Build/Workers/{chunk-HU6N6EXB.js → chunk-MWYZ64MH.js} +12 -11
  30. package/Build/Workers/chunk-NI2R52QD.js +961 -0
  31. package/Build/Workers/{chunk-SOWMRMWA.js → chunk-PEABJLCK.js} +1 -1
  32. package/Build/Workers/{chunk-EG6PTBY2.js → chunk-PK7TEP3J.js} +15 -15
  33. package/Build/Workers/{chunk-GRC2ZTAF.js → chunk-POLFRINT.js} +14 -14
  34. package/Build/Workers/{chunk-Z3TIFFGF.js → chunk-PS6AEMBR.js} +7 -7
  35. package/Build/Workers/{chunk-Y2ME2IJV.js → chunk-PWF3YJJ5.js} +13 -13
  36. package/Build/Workers/{chunk-2A75IWRS.js → chunk-QKF7XXEQ.js} +7 -7
  37. package/Build/Workers/{chunk-4H7PY4U5.js → chunk-RL73GOEF.js} +2 -2
  38. package/Build/Workers/{chunk-MDWEGWPA.js → chunk-RR7EOKGZ.js} +10 -10
  39. package/Build/Workers/{chunk-F3YA3Y2Z.js → chunk-S4XDCPKD.js} +1 -1
  40. package/Build/Workers/{chunk-PPH7OFP3.js → chunk-TMMOULW3.js} +5 -5
  41. package/Build/Workers/{chunk-XGI5BXZY.js → chunk-U4IMCOF5.js} +2 -2
  42. package/Build/Workers/{chunk-4DO5W5XZ.js → chunk-UAJEGIWA.js} +6 -6
  43. package/Build/Workers/{chunk-BBWDMCVU.js → chunk-UCPPWV64.js} +1 -1
  44. package/Build/Workers/{chunk-FZRIVR7Y.js → chunk-V7JB576Q.js} +5 -5
  45. package/Build/Workers/{chunk-2UPKWTMJ.js → chunk-WEGCQ5DY.js} +6 -6
  46. package/Build/Workers/{chunk-STW2DGFI.js → chunk-WFICTTOE.js} +2 -2
  47. package/Build/Workers/{chunk-LPR3YNP2.js → chunk-WWP3I7R5.js} +5 -5
  48. package/Build/Workers/{chunk-A5DWLWCY.js → chunk-XHLDDE65.js} +10 -10
  49. package/Build/Workers/{chunk-UEXTBDBE.js → chunk-XWML5Y7N.js} +11 -13
  50. package/Build/Workers/{chunk-EHWHNOEX.js → chunk-YLZTCEBJ.js} +1 -1
  51. package/Build/Workers/{chunk-34FXV7D7.js → chunk-ZC4AGBZK.js} +2 -2
  52. package/Build/Workers/{chunk-GATZHF3K.js → chunk-ZDP32RQI.js} +2 -2
  53. package/Build/Workers/{chunk-KKCR2YOP.js → chunk-ZWPIM77Q.js} +11 -11
  54. package/Build/Workers/combineGeometry.js +22 -24
  55. package/Build/Workers/createBoxGeometry.js +16 -18
  56. package/Build/Workers/createBoxOutlineGeometry.js +14 -16
  57. package/Build/Workers/createCircleGeometry.js +24 -26
  58. package/Build/Workers/createCircleOutlineGeometry.js +17 -19
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
  61. package/Build/Workers/createCorridorGeometry.js +27 -29
  62. package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
  63. package/Build/Workers/createCylinderGeometry.js +18 -20
  64. package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
  65. package/Build/Workers/createEllipseGeometry.js +24 -26
  66. package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
  67. package/Build/Workers/createEllipsoidGeometry.js +17 -19
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
  69. package/Build/Workers/createFrustumGeometry.js +16 -18
  70. package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
  71. package/Build/Workers/createGeometry.js +23 -25
  72. package/Build/Workers/createGroundPolylineGeometry.js +23 -25
  73. package/Build/Workers/createPlaneGeometry.js +14 -16
  74. package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
  75. package/Build/Workers/createPolygonGeometry.js +33 -35
  76. package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
  77. package/Build/Workers/createPolylineGeometry.js +23 -25
  78. package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
  80. package/Build/Workers/createRectangleGeometry.js +27 -29
  81. package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
  82. package/Build/Workers/createSimplePolylineGeometry.js +21 -23
  83. package/Build/Workers/createSphereGeometry.js +17 -19
  84. package/Build/Workers/createSphereOutlineGeometry.js +16 -18
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
  87. package/Build/Workers/createVectorTileGeometries.js +22 -24
  88. package/Build/Workers/createVectorTilePoints.js +12 -12
  89. package/Build/Workers/createVectorTilePolygons.js +20 -22
  90. package/Build/Workers/createVectorTilePolylines.js +14 -16
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
  92. package/Build/Workers/createVerticesFromHeightmap.js +23 -25
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
  94. package/Build/Workers/createWallGeometry.js +22 -24
  95. package/Build/Workers/createWallOutlineGeometry.js +21 -23
  96. package/Build/Workers/decodeDraco.js +11 -11
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +10 -11
  99. package/Build/Workers/transcodeKTX2.js +8 -8
  100. package/Build/Workers/transferTypedArrayTest.js +1 -1
  101. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
  102. package/Source/Core/Check.d.ts +127 -0
  103. package/Source/Core/Check.js +0 -1
  104. package/Source/Core/Geometry.js +1 -1
  105. package/Source/Core/Ion.js +1 -1
  106. package/Source/Core/PixelFormat.js +1 -0
  107. package/Source/Core/PolygonGeometry.js +1 -1
  108. package/Source/Core/Rectangle.js +89 -0
  109. package/Source/Core/VerticalExaggeration.js +2 -1
  110. package/Source/DataSources/DataSourceDisplay.js +5 -0
  111. package/Source/Renderer/ShaderBuilder.js +6 -3
  112. package/Source/Scene/ArcGisMapService.js +1 -1
  113. package/Source/Scene/Billboard.js +37 -3
  114. package/Source/Scene/BillboardCollection.js +1 -1
  115. package/Source/Scene/BingMapsImageryProvider.js +4 -0
  116. package/Source/Scene/Cesium3DTile.js +65 -0
  117. package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
  118. package/Source/Scene/Cesium3DTileset.js +52 -40
  119. package/Source/Scene/ClippingPolygon.js +212 -0
  120. package/Source/Scene/ClippingPolygonCollection.js +968 -0
  121. package/Source/Scene/Globe.js +14 -67
  122. package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
  123. package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
  124. package/Source/Scene/Label.js +33 -0
  125. package/Source/Scene/LabelCollection.js +2 -1
  126. package/Source/Scene/Model/Model.js +83 -0
  127. package/Source/Scene/Model/Model3DTileContent.js +21 -0
  128. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
  129. package/Source/Scene/Model/ModelSceneGraph.js +5 -0
  130. package/Source/Scene/Primitive.js +0 -3
  131. package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
  132. package/Source/Scene/Terrain.js +2 -2
  133. package/Source/Scene/VoxelBoxShape.js +0 -15
  134. package/Source/Scene/VoxelCylinderShape.js +14 -131
  135. package/Source/Scene/VoxelEllipsoidShape.js +136 -227
  136. package/Source/Scene/VoxelPrimitive.js +106 -14
  137. package/Source/Scene/VoxelRenderResources.js +9 -3
  138. package/Source/Scene/VoxelShape.js +0 -10
  139. package/Source/Scene/processVoxelProperties.js +1 -0
  140. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  141. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
  142. package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
  143. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
  144. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
  145. package/Source/Shaders/GlobeFS.glsl +12 -0
  146. package/Source/Shaders/GlobeFS.js +12 -0
  147. package/Source/Shaders/GlobeVS.glsl +32 -0
  148. package/Source/Shaders/GlobeVS.js +32 -0
  149. package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
  150. package/Source/Shaders/Model/GeometryStageVS.js +1 -1
  151. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
  152. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
  153. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
  154. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
  155. package/Source/Shaders/Model/ModelFS.glsl +6 -0
  156. package/Source/Shaders/Model/ModelFS.js +7 -1
  157. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  158. package/Source/Shaders/Model/ModelVS.js +4 -0
  159. package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
  160. package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
  161. package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
  162. package/Source/Shaders/Voxels/IntersectBox.js +21 -47
  163. package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
  164. package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
  165. package/Source/Shaders/Voxels/IntersectCylinder.glsl +66 -96
  166. package/Source/Shaders/Voxels/IntersectCylinder.js +66 -96
  167. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +226 -154
  168. package/Source/Shaders/Voxels/IntersectEllipsoid.js +226 -154
  169. package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
  170. package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
  171. package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
  172. package/Source/Shaders/Voxels/Megatexture.js +1 -2
  173. package/Source/Shaders/Voxels/Octree.glsl +14 -9
  174. package/Source/Shaders/Voxels/Octree.js +14 -9
  175. package/Source/Shaders/Voxels/VoxelFS.glsl +93 -43
  176. package/Source/Shaders/Voxels/VoxelFS.js +93 -43
  177. package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
  178. package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
  179. package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
  180. package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
  181. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +50 -8
  182. package/Source/Shaders/Voxels/convertUvToCylinder.js +50 -8
  183. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +82 -53
  184. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +82 -53
  185. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  186. package/Source/Workers/createGeometry.js +1 -1
  187. package/index.d.ts +478 -35
  188. package/index.js +61 -52
  189. package/package.json +2 -2
  190. package/Build/Workers/chunk-BG4UCVXN.js +0 -73
  191. package/Build/Workers/chunk-TTUZP4BO.js +0 -501
  192. package/Build/Workers/chunk-YJEBABKH.js +0 -2977
@@ -1,2977 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.115
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
- Cartesian2_default,
28
- Cartesian3_default,
29
- Cartographic_default,
30
- Ellipsoid_default,
31
- Matrix3_default
32
- } from "./chunk-OGXZVPPM.js";
33
- import {
34
- Math_default
35
- } from "./chunk-5QULIR53.js";
36
- import {
37
- RuntimeError_default
38
- } from "./chunk-STW2DGFI.js";
39
- import {
40
- defaultValue_default
41
- } from "./chunk-BBWDMCVU.js";
42
- import {
43
- Check_default,
44
- DeveloperError_default
45
- } from "./chunk-XGI5BXZY.js";
46
- import {
47
- defined_default
48
- } from "./chunk-YWTJ2B4B.js";
49
-
50
- // packages/engine/Source/Core/Cartesian4.js
51
- function Cartesian4(x, y, z, w) {
52
- this.x = defaultValue_default(x, 0);
53
- this.y = defaultValue_default(y, 0);
54
- this.z = defaultValue_default(z, 0);
55
- this.w = defaultValue_default(w, 0);
56
- }
57
- Cartesian4.fromElements = function(x, y, z, w, result) {
58
- if (!defined_default(result)) {
59
- return new Cartesian4(x, y, z, w);
60
- }
61
- result.x = x;
62
- result.y = y;
63
- result.z = z;
64
- result.w = w;
65
- return result;
66
- };
67
- Cartesian4.fromColor = function(color, result) {
68
- Check_default.typeOf.object("color", color);
69
- if (!defined_default(result)) {
70
- return new Cartesian4(color.red, color.green, color.blue, color.alpha);
71
- }
72
- result.x = color.red;
73
- result.y = color.green;
74
- result.z = color.blue;
75
- result.w = color.alpha;
76
- return result;
77
- };
78
- Cartesian4.clone = function(cartesian, result) {
79
- if (!defined_default(cartesian)) {
80
- return void 0;
81
- }
82
- if (!defined_default(result)) {
83
- return new Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
84
- }
85
- result.x = cartesian.x;
86
- result.y = cartesian.y;
87
- result.z = cartesian.z;
88
- result.w = cartesian.w;
89
- return result;
90
- };
91
- Cartesian4.packedLength = 4;
92
- Cartesian4.pack = function(value, array, startingIndex) {
93
- Check_default.typeOf.object("value", value);
94
- Check_default.defined("array", array);
95
- startingIndex = defaultValue_default(startingIndex, 0);
96
- array[startingIndex++] = value.x;
97
- array[startingIndex++] = value.y;
98
- array[startingIndex++] = value.z;
99
- array[startingIndex] = value.w;
100
- return array;
101
- };
102
- Cartesian4.unpack = function(array, startingIndex, result) {
103
- Check_default.defined("array", array);
104
- startingIndex = defaultValue_default(startingIndex, 0);
105
- if (!defined_default(result)) {
106
- result = new Cartesian4();
107
- }
108
- result.x = array[startingIndex++];
109
- result.y = array[startingIndex++];
110
- result.z = array[startingIndex++];
111
- result.w = array[startingIndex];
112
- return result;
113
- };
114
- Cartesian4.packArray = function(array, result) {
115
- Check_default.defined("array", array);
116
- const length = array.length;
117
- const resultLength = length * 4;
118
- if (!defined_default(result)) {
119
- result = new Array(resultLength);
120
- } else if (!Array.isArray(result) && result.length !== resultLength) {
121
- throw new DeveloperError_default(
122
- "If result is a typed array, it must have exactly array.length * 4 elements"
123
- );
124
- } else if (result.length !== resultLength) {
125
- result.length = resultLength;
126
- }
127
- for (let i = 0; i < length; ++i) {
128
- Cartesian4.pack(array[i], result, i * 4);
129
- }
130
- return result;
131
- };
132
- Cartesian4.unpackArray = function(array, result) {
133
- Check_default.defined("array", array);
134
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
135
- if (array.length % 4 !== 0) {
136
- throw new DeveloperError_default("array length must be a multiple of 4.");
137
- }
138
- const length = array.length;
139
- if (!defined_default(result)) {
140
- result = new Array(length / 4);
141
- } else {
142
- result.length = length / 4;
143
- }
144
- for (let i = 0; i < length; i += 4) {
145
- const index = i / 4;
146
- result[index] = Cartesian4.unpack(array, i, result[index]);
147
- }
148
- return result;
149
- };
150
- Cartesian4.fromArray = Cartesian4.unpack;
151
- Cartesian4.maximumComponent = function(cartesian) {
152
- Check_default.typeOf.object("cartesian", cartesian);
153
- return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
154
- };
155
- Cartesian4.minimumComponent = function(cartesian) {
156
- Check_default.typeOf.object("cartesian", cartesian);
157
- return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
158
- };
159
- Cartesian4.minimumByComponent = function(first, second, result) {
160
- Check_default.typeOf.object("first", first);
161
- Check_default.typeOf.object("second", second);
162
- Check_default.typeOf.object("result", result);
163
- result.x = Math.min(first.x, second.x);
164
- result.y = Math.min(first.y, second.y);
165
- result.z = Math.min(first.z, second.z);
166
- result.w = Math.min(first.w, second.w);
167
- return result;
168
- };
169
- Cartesian4.maximumByComponent = function(first, second, result) {
170
- Check_default.typeOf.object("first", first);
171
- Check_default.typeOf.object("second", second);
172
- Check_default.typeOf.object("result", result);
173
- result.x = Math.max(first.x, second.x);
174
- result.y = Math.max(first.y, second.y);
175
- result.z = Math.max(first.z, second.z);
176
- result.w = Math.max(first.w, second.w);
177
- return result;
178
- };
179
- Cartesian4.clamp = function(value, min, max, result) {
180
- Check_default.typeOf.object("value", value);
181
- Check_default.typeOf.object("min", min);
182
- Check_default.typeOf.object("max", max);
183
- Check_default.typeOf.object("result", result);
184
- const x = Math_default.clamp(value.x, min.x, max.x);
185
- const y = Math_default.clamp(value.y, min.y, max.y);
186
- const z = Math_default.clamp(value.z, min.z, max.z);
187
- const w = Math_default.clamp(value.w, min.w, max.w);
188
- result.x = x;
189
- result.y = y;
190
- result.z = z;
191
- result.w = w;
192
- return result;
193
- };
194
- Cartesian4.magnitudeSquared = function(cartesian) {
195
- Check_default.typeOf.object("cartesian", cartesian);
196
- return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
197
- };
198
- Cartesian4.magnitude = function(cartesian) {
199
- return Math.sqrt(Cartesian4.magnitudeSquared(cartesian));
200
- };
201
- var distanceScratch = new Cartesian4();
202
- Cartesian4.distance = function(left, right) {
203
- Check_default.typeOf.object("left", left);
204
- Check_default.typeOf.object("right", right);
205
- Cartesian4.subtract(left, right, distanceScratch);
206
- return Cartesian4.magnitude(distanceScratch);
207
- };
208
- Cartesian4.distanceSquared = function(left, right) {
209
- Check_default.typeOf.object("left", left);
210
- Check_default.typeOf.object("right", right);
211
- Cartesian4.subtract(left, right, distanceScratch);
212
- return Cartesian4.magnitudeSquared(distanceScratch);
213
- };
214
- Cartesian4.normalize = function(cartesian, result) {
215
- Check_default.typeOf.object("cartesian", cartesian);
216
- Check_default.typeOf.object("result", result);
217
- const magnitude = Cartesian4.magnitude(cartesian);
218
- result.x = cartesian.x / magnitude;
219
- result.y = cartesian.y / magnitude;
220
- result.z = cartesian.z / magnitude;
221
- result.w = cartesian.w / magnitude;
222
- if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
223
- throw new DeveloperError_default("normalized result is not a number");
224
- }
225
- return result;
226
- };
227
- Cartesian4.dot = function(left, right) {
228
- Check_default.typeOf.object("left", left);
229
- Check_default.typeOf.object("right", right);
230
- return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
231
- };
232
- Cartesian4.multiplyComponents = function(left, right, result) {
233
- Check_default.typeOf.object("left", left);
234
- Check_default.typeOf.object("right", right);
235
- Check_default.typeOf.object("result", result);
236
- result.x = left.x * right.x;
237
- result.y = left.y * right.y;
238
- result.z = left.z * right.z;
239
- result.w = left.w * right.w;
240
- return result;
241
- };
242
- Cartesian4.divideComponents = function(left, right, result) {
243
- Check_default.typeOf.object("left", left);
244
- Check_default.typeOf.object("right", right);
245
- Check_default.typeOf.object("result", result);
246
- result.x = left.x / right.x;
247
- result.y = left.y / right.y;
248
- result.z = left.z / right.z;
249
- result.w = left.w / right.w;
250
- return result;
251
- };
252
- Cartesian4.add = function(left, right, result) {
253
- Check_default.typeOf.object("left", left);
254
- Check_default.typeOf.object("right", right);
255
- Check_default.typeOf.object("result", result);
256
- result.x = left.x + right.x;
257
- result.y = left.y + right.y;
258
- result.z = left.z + right.z;
259
- result.w = left.w + right.w;
260
- return result;
261
- };
262
- Cartesian4.subtract = function(left, right, result) {
263
- Check_default.typeOf.object("left", left);
264
- Check_default.typeOf.object("right", right);
265
- Check_default.typeOf.object("result", result);
266
- result.x = left.x - right.x;
267
- result.y = left.y - right.y;
268
- result.z = left.z - right.z;
269
- result.w = left.w - right.w;
270
- return result;
271
- };
272
- Cartesian4.multiplyByScalar = function(cartesian, scalar, result) {
273
- Check_default.typeOf.object("cartesian", cartesian);
274
- Check_default.typeOf.number("scalar", scalar);
275
- Check_default.typeOf.object("result", result);
276
- result.x = cartesian.x * scalar;
277
- result.y = cartesian.y * scalar;
278
- result.z = cartesian.z * scalar;
279
- result.w = cartesian.w * scalar;
280
- return result;
281
- };
282
- Cartesian4.divideByScalar = function(cartesian, scalar, result) {
283
- Check_default.typeOf.object("cartesian", cartesian);
284
- Check_default.typeOf.number("scalar", scalar);
285
- Check_default.typeOf.object("result", result);
286
- result.x = cartesian.x / scalar;
287
- result.y = cartesian.y / scalar;
288
- result.z = cartesian.z / scalar;
289
- result.w = cartesian.w / scalar;
290
- return result;
291
- };
292
- Cartesian4.negate = function(cartesian, result) {
293
- Check_default.typeOf.object("cartesian", cartesian);
294
- Check_default.typeOf.object("result", result);
295
- result.x = -cartesian.x;
296
- result.y = -cartesian.y;
297
- result.z = -cartesian.z;
298
- result.w = -cartesian.w;
299
- return result;
300
- };
301
- Cartesian4.abs = function(cartesian, result) {
302
- Check_default.typeOf.object("cartesian", cartesian);
303
- Check_default.typeOf.object("result", result);
304
- result.x = Math.abs(cartesian.x);
305
- result.y = Math.abs(cartesian.y);
306
- result.z = Math.abs(cartesian.z);
307
- result.w = Math.abs(cartesian.w);
308
- return result;
309
- };
310
- var lerpScratch = new Cartesian4();
311
- Cartesian4.lerp = function(start, end, t, result) {
312
- Check_default.typeOf.object("start", start);
313
- Check_default.typeOf.object("end", end);
314
- Check_default.typeOf.number("t", t);
315
- Check_default.typeOf.object("result", result);
316
- Cartesian4.multiplyByScalar(end, t, lerpScratch);
317
- result = Cartesian4.multiplyByScalar(start, 1 - t, result);
318
- return Cartesian4.add(lerpScratch, result, result);
319
- };
320
- var mostOrthogonalAxisScratch = new Cartesian4();
321
- Cartesian4.mostOrthogonalAxis = function(cartesian, result) {
322
- Check_default.typeOf.object("cartesian", cartesian);
323
- Check_default.typeOf.object("result", result);
324
- const f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
325
- Cartesian4.abs(f, f);
326
- if (f.x <= f.y) {
327
- if (f.x <= f.z) {
328
- if (f.x <= f.w) {
329
- result = Cartesian4.clone(Cartesian4.UNIT_X, result);
330
- } else {
331
- result = Cartesian4.clone(Cartesian4.UNIT_W, result);
332
- }
333
- } else if (f.z <= f.w) {
334
- result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
335
- } else {
336
- result = Cartesian4.clone(Cartesian4.UNIT_W, result);
337
- }
338
- } else if (f.y <= f.z) {
339
- if (f.y <= f.w) {
340
- result = Cartesian4.clone(Cartesian4.UNIT_Y, result);
341
- } else {
342
- result = Cartesian4.clone(Cartesian4.UNIT_W, result);
343
- }
344
- } else if (f.z <= f.w) {
345
- result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
346
- } else {
347
- result = Cartesian4.clone(Cartesian4.UNIT_W, result);
348
- }
349
- return result;
350
- };
351
- Cartesian4.equals = function(left, right) {
352
- return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
353
- };
354
- Cartesian4.equalsArray = function(cartesian, array, offset) {
355
- return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2] && cartesian.w === array[offset + 3];
356
- };
357
- Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
358
- return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
359
- left.x,
360
- right.x,
361
- relativeEpsilon,
362
- absoluteEpsilon
363
- ) && Math_default.equalsEpsilon(
364
- left.y,
365
- right.y,
366
- relativeEpsilon,
367
- absoluteEpsilon
368
- ) && Math_default.equalsEpsilon(
369
- left.z,
370
- right.z,
371
- relativeEpsilon,
372
- absoluteEpsilon
373
- ) && Math_default.equalsEpsilon(
374
- left.w,
375
- right.w,
376
- relativeEpsilon,
377
- absoluteEpsilon
378
- );
379
- };
380
- Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
381
- Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
382
- Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
383
- Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
384
- Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
385
- Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
386
- Cartesian4.prototype.clone = function(result) {
387
- return Cartesian4.clone(this, result);
388
- };
389
- Cartesian4.prototype.equals = function(right) {
390
- return Cartesian4.equals(this, right);
391
- };
392
- Cartesian4.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
393
- return Cartesian4.equalsEpsilon(
394
- this,
395
- right,
396
- relativeEpsilon,
397
- absoluteEpsilon
398
- );
399
- };
400
- Cartesian4.prototype.toString = function() {
401
- return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
402
- };
403
- var scratchF32Array = new Float32Array(1);
404
- var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
405
- var testU32 = new Uint32Array([287454020]);
406
- var testU8 = new Uint8Array(testU32.buffer);
407
- var littleEndian = testU8[0] === 68;
408
- Cartesian4.packFloat = function(value, result) {
409
- Check_default.typeOf.number("value", value);
410
- if (!defined_default(result)) {
411
- result = new Cartesian4();
412
- }
413
- scratchF32Array[0] = value;
414
- if (littleEndian) {
415
- result.x = scratchU8Array[0];
416
- result.y = scratchU8Array[1];
417
- result.z = scratchU8Array[2];
418
- result.w = scratchU8Array[3];
419
- } else {
420
- result.x = scratchU8Array[3];
421
- result.y = scratchU8Array[2];
422
- result.z = scratchU8Array[1];
423
- result.w = scratchU8Array[0];
424
- }
425
- return result;
426
- };
427
- Cartesian4.unpackFloat = function(packedFloat) {
428
- Check_default.typeOf.object("packedFloat", packedFloat);
429
- if (littleEndian) {
430
- scratchU8Array[0] = packedFloat.x;
431
- scratchU8Array[1] = packedFloat.y;
432
- scratchU8Array[2] = packedFloat.z;
433
- scratchU8Array[3] = packedFloat.w;
434
- } else {
435
- scratchU8Array[0] = packedFloat.w;
436
- scratchU8Array[1] = packedFloat.z;
437
- scratchU8Array[2] = packedFloat.y;
438
- scratchU8Array[3] = packedFloat.x;
439
- }
440
- return scratchF32Array[0];
441
- };
442
- var Cartesian4_default = Cartesian4;
443
-
444
- // packages/engine/Source/Core/Matrix4.js
445
- function Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3) {
446
- this[0] = defaultValue_default(column0Row0, 0);
447
- this[1] = defaultValue_default(column0Row1, 0);
448
- this[2] = defaultValue_default(column0Row2, 0);
449
- this[3] = defaultValue_default(column0Row3, 0);
450
- this[4] = defaultValue_default(column1Row0, 0);
451
- this[5] = defaultValue_default(column1Row1, 0);
452
- this[6] = defaultValue_default(column1Row2, 0);
453
- this[7] = defaultValue_default(column1Row3, 0);
454
- this[8] = defaultValue_default(column2Row0, 0);
455
- this[9] = defaultValue_default(column2Row1, 0);
456
- this[10] = defaultValue_default(column2Row2, 0);
457
- this[11] = defaultValue_default(column2Row3, 0);
458
- this[12] = defaultValue_default(column3Row0, 0);
459
- this[13] = defaultValue_default(column3Row1, 0);
460
- this[14] = defaultValue_default(column3Row2, 0);
461
- this[15] = defaultValue_default(column3Row3, 0);
462
- }
463
- Matrix4.packedLength = 16;
464
- Matrix4.pack = function(value, array, startingIndex) {
465
- Check_default.typeOf.object("value", value);
466
- Check_default.defined("array", array);
467
- startingIndex = defaultValue_default(startingIndex, 0);
468
- array[startingIndex++] = value[0];
469
- array[startingIndex++] = value[1];
470
- array[startingIndex++] = value[2];
471
- array[startingIndex++] = value[3];
472
- array[startingIndex++] = value[4];
473
- array[startingIndex++] = value[5];
474
- array[startingIndex++] = value[6];
475
- array[startingIndex++] = value[7];
476
- array[startingIndex++] = value[8];
477
- array[startingIndex++] = value[9];
478
- array[startingIndex++] = value[10];
479
- array[startingIndex++] = value[11];
480
- array[startingIndex++] = value[12];
481
- array[startingIndex++] = value[13];
482
- array[startingIndex++] = value[14];
483
- array[startingIndex] = value[15];
484
- return array;
485
- };
486
- Matrix4.unpack = function(array, startingIndex, result) {
487
- Check_default.defined("array", array);
488
- startingIndex = defaultValue_default(startingIndex, 0);
489
- if (!defined_default(result)) {
490
- result = new Matrix4();
491
- }
492
- result[0] = array[startingIndex++];
493
- result[1] = array[startingIndex++];
494
- result[2] = array[startingIndex++];
495
- result[3] = array[startingIndex++];
496
- result[4] = array[startingIndex++];
497
- result[5] = array[startingIndex++];
498
- result[6] = array[startingIndex++];
499
- result[7] = array[startingIndex++];
500
- result[8] = array[startingIndex++];
501
- result[9] = array[startingIndex++];
502
- result[10] = array[startingIndex++];
503
- result[11] = array[startingIndex++];
504
- result[12] = array[startingIndex++];
505
- result[13] = array[startingIndex++];
506
- result[14] = array[startingIndex++];
507
- result[15] = array[startingIndex];
508
- return result;
509
- };
510
- Matrix4.packArray = function(array, result) {
511
- Check_default.defined("array", array);
512
- const length = array.length;
513
- const resultLength = length * 16;
514
- if (!defined_default(result)) {
515
- result = new Array(resultLength);
516
- } else if (!Array.isArray(result) && result.length !== resultLength) {
517
- throw new DeveloperError_default(
518
- "If result is a typed array, it must have exactly array.length * 16 elements"
519
- );
520
- } else if (result.length !== resultLength) {
521
- result.length = resultLength;
522
- }
523
- for (let i = 0; i < length; ++i) {
524
- Matrix4.pack(array[i], result, i * 16);
525
- }
526
- return result;
527
- };
528
- Matrix4.unpackArray = function(array, result) {
529
- Check_default.defined("array", array);
530
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 16);
531
- if (array.length % 16 !== 0) {
532
- throw new DeveloperError_default("array length must be a multiple of 16.");
533
- }
534
- const length = array.length;
535
- if (!defined_default(result)) {
536
- result = new Array(length / 16);
537
- } else {
538
- result.length = length / 16;
539
- }
540
- for (let i = 0; i < length; i += 16) {
541
- const index = i / 16;
542
- result[index] = Matrix4.unpack(array, i, result[index]);
543
- }
544
- return result;
545
- };
546
- Matrix4.clone = function(matrix, result) {
547
- if (!defined_default(matrix)) {
548
- return void 0;
549
- }
550
- if (!defined_default(result)) {
551
- return new Matrix4(
552
- matrix[0],
553
- matrix[4],
554
- matrix[8],
555
- matrix[12],
556
- matrix[1],
557
- matrix[5],
558
- matrix[9],
559
- matrix[13],
560
- matrix[2],
561
- matrix[6],
562
- matrix[10],
563
- matrix[14],
564
- matrix[3],
565
- matrix[7],
566
- matrix[11],
567
- matrix[15]
568
- );
569
- }
570
- result[0] = matrix[0];
571
- result[1] = matrix[1];
572
- result[2] = matrix[2];
573
- result[3] = matrix[3];
574
- result[4] = matrix[4];
575
- result[5] = matrix[5];
576
- result[6] = matrix[6];
577
- result[7] = matrix[7];
578
- result[8] = matrix[8];
579
- result[9] = matrix[9];
580
- result[10] = matrix[10];
581
- result[11] = matrix[11];
582
- result[12] = matrix[12];
583
- result[13] = matrix[13];
584
- result[14] = matrix[14];
585
- result[15] = matrix[15];
586
- return result;
587
- };
588
- Matrix4.fromArray = Matrix4.unpack;
589
- Matrix4.fromColumnMajorArray = function(values, result) {
590
- Check_default.defined("values", values);
591
- return Matrix4.clone(values, result);
592
- };
593
- Matrix4.fromRowMajorArray = function(values, result) {
594
- Check_default.defined("values", values);
595
- if (!defined_default(result)) {
596
- return new Matrix4(
597
- values[0],
598
- values[1],
599
- values[2],
600
- values[3],
601
- values[4],
602
- values[5],
603
- values[6],
604
- values[7],
605
- values[8],
606
- values[9],
607
- values[10],
608
- values[11],
609
- values[12],
610
- values[13],
611
- values[14],
612
- values[15]
613
- );
614
- }
615
- result[0] = values[0];
616
- result[1] = values[4];
617
- result[2] = values[8];
618
- result[3] = values[12];
619
- result[4] = values[1];
620
- result[5] = values[5];
621
- result[6] = values[9];
622
- result[7] = values[13];
623
- result[8] = values[2];
624
- result[9] = values[6];
625
- result[10] = values[10];
626
- result[11] = values[14];
627
- result[12] = values[3];
628
- result[13] = values[7];
629
- result[14] = values[11];
630
- result[15] = values[15];
631
- return result;
632
- };
633
- Matrix4.fromRotationTranslation = function(rotation, translation, result) {
634
- Check_default.typeOf.object("rotation", rotation);
635
- translation = defaultValue_default(translation, Cartesian3_default.ZERO);
636
- if (!defined_default(result)) {
637
- return new Matrix4(
638
- rotation[0],
639
- rotation[3],
640
- rotation[6],
641
- translation.x,
642
- rotation[1],
643
- rotation[4],
644
- rotation[7],
645
- translation.y,
646
- rotation[2],
647
- rotation[5],
648
- rotation[8],
649
- translation.z,
650
- 0,
651
- 0,
652
- 0,
653
- 1
654
- );
655
- }
656
- result[0] = rotation[0];
657
- result[1] = rotation[1];
658
- result[2] = rotation[2];
659
- result[3] = 0;
660
- result[4] = rotation[3];
661
- result[5] = rotation[4];
662
- result[6] = rotation[5];
663
- result[7] = 0;
664
- result[8] = rotation[6];
665
- result[9] = rotation[7];
666
- result[10] = rotation[8];
667
- result[11] = 0;
668
- result[12] = translation.x;
669
- result[13] = translation.y;
670
- result[14] = translation.z;
671
- result[15] = 1;
672
- return result;
673
- };
674
- Matrix4.fromTranslationQuaternionRotationScale = function(translation, rotation, scale, result) {
675
- Check_default.typeOf.object("translation", translation);
676
- Check_default.typeOf.object("rotation", rotation);
677
- Check_default.typeOf.object("scale", scale);
678
- if (!defined_default(result)) {
679
- result = new Matrix4();
680
- }
681
- const scaleX = scale.x;
682
- const scaleY = scale.y;
683
- const scaleZ = scale.z;
684
- const x2 = rotation.x * rotation.x;
685
- const xy = rotation.x * rotation.y;
686
- const xz = rotation.x * rotation.z;
687
- const xw = rotation.x * rotation.w;
688
- const y2 = rotation.y * rotation.y;
689
- const yz = rotation.y * rotation.z;
690
- const yw = rotation.y * rotation.w;
691
- const z2 = rotation.z * rotation.z;
692
- const zw = rotation.z * rotation.w;
693
- const w2 = rotation.w * rotation.w;
694
- const m00 = x2 - y2 - z2 + w2;
695
- const m01 = 2 * (xy - zw);
696
- const m02 = 2 * (xz + yw);
697
- const m10 = 2 * (xy + zw);
698
- const m11 = -x2 + y2 - z2 + w2;
699
- const m12 = 2 * (yz - xw);
700
- const m20 = 2 * (xz - yw);
701
- const m21 = 2 * (yz + xw);
702
- const m22 = -x2 - y2 + z2 + w2;
703
- result[0] = m00 * scaleX;
704
- result[1] = m10 * scaleX;
705
- result[2] = m20 * scaleX;
706
- result[3] = 0;
707
- result[4] = m01 * scaleY;
708
- result[5] = m11 * scaleY;
709
- result[6] = m21 * scaleY;
710
- result[7] = 0;
711
- result[8] = m02 * scaleZ;
712
- result[9] = m12 * scaleZ;
713
- result[10] = m22 * scaleZ;
714
- result[11] = 0;
715
- result[12] = translation.x;
716
- result[13] = translation.y;
717
- result[14] = translation.z;
718
- result[15] = 1;
719
- return result;
720
- };
721
- Matrix4.fromTranslationRotationScale = function(translationRotationScale, result) {
722
- Check_default.typeOf.object("translationRotationScale", translationRotationScale);
723
- return Matrix4.fromTranslationQuaternionRotationScale(
724
- translationRotationScale.translation,
725
- translationRotationScale.rotation,
726
- translationRotationScale.scale,
727
- result
728
- );
729
- };
730
- Matrix4.fromTranslation = function(translation, result) {
731
- Check_default.typeOf.object("translation", translation);
732
- return Matrix4.fromRotationTranslation(Matrix3_default.IDENTITY, translation, result);
733
- };
734
- Matrix4.fromScale = function(scale, result) {
735
- Check_default.typeOf.object("scale", scale);
736
- if (!defined_default(result)) {
737
- return new Matrix4(
738
- scale.x,
739
- 0,
740
- 0,
741
- 0,
742
- 0,
743
- scale.y,
744
- 0,
745
- 0,
746
- 0,
747
- 0,
748
- scale.z,
749
- 0,
750
- 0,
751
- 0,
752
- 0,
753
- 1
754
- );
755
- }
756
- result[0] = scale.x;
757
- result[1] = 0;
758
- result[2] = 0;
759
- result[3] = 0;
760
- result[4] = 0;
761
- result[5] = scale.y;
762
- result[6] = 0;
763
- result[7] = 0;
764
- result[8] = 0;
765
- result[9] = 0;
766
- result[10] = scale.z;
767
- result[11] = 0;
768
- result[12] = 0;
769
- result[13] = 0;
770
- result[14] = 0;
771
- result[15] = 1;
772
- return result;
773
- };
774
- Matrix4.fromUniformScale = function(scale, result) {
775
- Check_default.typeOf.number("scale", scale);
776
- if (!defined_default(result)) {
777
- return new Matrix4(
778
- scale,
779
- 0,
780
- 0,
781
- 0,
782
- 0,
783
- scale,
784
- 0,
785
- 0,
786
- 0,
787
- 0,
788
- scale,
789
- 0,
790
- 0,
791
- 0,
792
- 0,
793
- 1
794
- );
795
- }
796
- result[0] = scale;
797
- result[1] = 0;
798
- result[2] = 0;
799
- result[3] = 0;
800
- result[4] = 0;
801
- result[5] = scale;
802
- result[6] = 0;
803
- result[7] = 0;
804
- result[8] = 0;
805
- result[9] = 0;
806
- result[10] = scale;
807
- result[11] = 0;
808
- result[12] = 0;
809
- result[13] = 0;
810
- result[14] = 0;
811
- result[15] = 1;
812
- return result;
813
- };
814
- Matrix4.fromRotation = function(rotation, result) {
815
- Check_default.typeOf.object("rotation", rotation);
816
- if (!defined_default(result)) {
817
- result = new Matrix4();
818
- }
819
- result[0] = rotation[0];
820
- result[1] = rotation[1];
821
- result[2] = rotation[2];
822
- result[3] = 0;
823
- result[4] = rotation[3];
824
- result[5] = rotation[4];
825
- result[6] = rotation[5];
826
- result[7] = 0;
827
- result[8] = rotation[6];
828
- result[9] = rotation[7];
829
- result[10] = rotation[8];
830
- result[11] = 0;
831
- result[12] = 0;
832
- result[13] = 0;
833
- result[14] = 0;
834
- result[15] = 1;
835
- return result;
836
- };
837
- var fromCameraF = new Cartesian3_default();
838
- var fromCameraR = new Cartesian3_default();
839
- var fromCameraU = new Cartesian3_default();
840
- Matrix4.fromCamera = function(camera, result) {
841
- Check_default.typeOf.object("camera", camera);
842
- const position = camera.position;
843
- const direction = camera.direction;
844
- const up = camera.up;
845
- Check_default.typeOf.object("camera.position", position);
846
- Check_default.typeOf.object("camera.direction", direction);
847
- Check_default.typeOf.object("camera.up", up);
848
- Cartesian3_default.normalize(direction, fromCameraF);
849
- Cartesian3_default.normalize(
850
- Cartesian3_default.cross(fromCameraF, up, fromCameraR),
851
- fromCameraR
852
- );
853
- Cartesian3_default.normalize(
854
- Cartesian3_default.cross(fromCameraR, fromCameraF, fromCameraU),
855
- fromCameraU
856
- );
857
- const sX = fromCameraR.x;
858
- const sY = fromCameraR.y;
859
- const sZ = fromCameraR.z;
860
- const fX = fromCameraF.x;
861
- const fY = fromCameraF.y;
862
- const fZ = fromCameraF.z;
863
- const uX = fromCameraU.x;
864
- const uY = fromCameraU.y;
865
- const uZ = fromCameraU.z;
866
- const positionX = position.x;
867
- const positionY = position.y;
868
- const positionZ = position.z;
869
- const t0 = sX * -positionX + sY * -positionY + sZ * -positionZ;
870
- const t1 = uX * -positionX + uY * -positionY + uZ * -positionZ;
871
- const t2 = fX * positionX + fY * positionY + fZ * positionZ;
872
- if (!defined_default(result)) {
873
- return new Matrix4(
874
- sX,
875
- sY,
876
- sZ,
877
- t0,
878
- uX,
879
- uY,
880
- uZ,
881
- t1,
882
- -fX,
883
- -fY,
884
- -fZ,
885
- t2,
886
- 0,
887
- 0,
888
- 0,
889
- 1
890
- );
891
- }
892
- result[0] = sX;
893
- result[1] = uX;
894
- result[2] = -fX;
895
- result[3] = 0;
896
- result[4] = sY;
897
- result[5] = uY;
898
- result[6] = -fY;
899
- result[7] = 0;
900
- result[8] = sZ;
901
- result[9] = uZ;
902
- result[10] = -fZ;
903
- result[11] = 0;
904
- result[12] = t0;
905
- result[13] = t1;
906
- result[14] = t2;
907
- result[15] = 1;
908
- return result;
909
- };
910
- Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
911
- Check_default.typeOf.number.greaterThan("fovY", fovY, 0);
912
- Check_default.typeOf.number.lessThan("fovY", fovY, Math.PI);
913
- Check_default.typeOf.number.greaterThan("near", near, 0);
914
- Check_default.typeOf.number.greaterThan("far", far, 0);
915
- Check_default.typeOf.object("result", result);
916
- const bottom = Math.tan(fovY * 0.5);
917
- const column1Row1 = 1 / bottom;
918
- const column0Row0 = column1Row1 / aspectRatio;
919
- const column2Row2 = (far + near) / (near - far);
920
- const column3Row2 = 2 * far * near / (near - far);
921
- result[0] = column0Row0;
922
- result[1] = 0;
923
- result[2] = 0;
924
- result[3] = 0;
925
- result[4] = 0;
926
- result[5] = column1Row1;
927
- result[6] = 0;
928
- result[7] = 0;
929
- result[8] = 0;
930
- result[9] = 0;
931
- result[10] = column2Row2;
932
- result[11] = -1;
933
- result[12] = 0;
934
- result[13] = 0;
935
- result[14] = column3Row2;
936
- result[15] = 0;
937
- return result;
938
- };
939
- Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
940
- Check_default.typeOf.number("left", left);
941
- Check_default.typeOf.number("right", right);
942
- Check_default.typeOf.number("bottom", bottom);
943
- Check_default.typeOf.number("top", top);
944
- Check_default.typeOf.number("near", near);
945
- Check_default.typeOf.number("far", far);
946
- Check_default.typeOf.object("result", result);
947
- let a = 1 / (right - left);
948
- let b = 1 / (top - bottom);
949
- let c = 1 / (far - near);
950
- const tx = -(right + left) * a;
951
- const ty = -(top + bottom) * b;
952
- const tz = -(far + near) * c;
953
- a *= 2;
954
- b *= 2;
955
- c *= -2;
956
- result[0] = a;
957
- result[1] = 0;
958
- result[2] = 0;
959
- result[3] = 0;
960
- result[4] = 0;
961
- result[5] = b;
962
- result[6] = 0;
963
- result[7] = 0;
964
- result[8] = 0;
965
- result[9] = 0;
966
- result[10] = c;
967
- result[11] = 0;
968
- result[12] = tx;
969
- result[13] = ty;
970
- result[14] = tz;
971
- result[15] = 1;
972
- return result;
973
- };
974
- Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
975
- Check_default.typeOf.number("left", left);
976
- Check_default.typeOf.number("right", right);
977
- Check_default.typeOf.number("bottom", bottom);
978
- Check_default.typeOf.number("top", top);
979
- Check_default.typeOf.number("near", near);
980
- Check_default.typeOf.number("far", far);
981
- Check_default.typeOf.object("result", result);
982
- const column0Row0 = 2 * near / (right - left);
983
- const column1Row1 = 2 * near / (top - bottom);
984
- const column2Row0 = (right + left) / (right - left);
985
- const column2Row1 = (top + bottom) / (top - bottom);
986
- const column2Row2 = -(far + near) / (far - near);
987
- const column2Row3 = -1;
988
- const column3Row2 = -2 * far * near / (far - near);
989
- result[0] = column0Row0;
990
- result[1] = 0;
991
- result[2] = 0;
992
- result[3] = 0;
993
- result[4] = 0;
994
- result[5] = column1Row1;
995
- result[6] = 0;
996
- result[7] = 0;
997
- result[8] = column2Row0;
998
- result[9] = column2Row1;
999
- result[10] = column2Row2;
1000
- result[11] = column2Row3;
1001
- result[12] = 0;
1002
- result[13] = 0;
1003
- result[14] = column3Row2;
1004
- result[15] = 0;
1005
- return result;
1006
- };
1007
- Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
1008
- Check_default.typeOf.number("left", left);
1009
- Check_default.typeOf.number("right", right);
1010
- Check_default.typeOf.number("bottom", bottom);
1011
- Check_default.typeOf.number("top", top);
1012
- Check_default.typeOf.number("near", near);
1013
- Check_default.typeOf.object("result", result);
1014
- const column0Row0 = 2 * near / (right - left);
1015
- const column1Row1 = 2 * near / (top - bottom);
1016
- const column2Row0 = (right + left) / (right - left);
1017
- const column2Row1 = (top + bottom) / (top - bottom);
1018
- const column2Row2 = -1;
1019
- const column2Row3 = -1;
1020
- const column3Row2 = -2 * near;
1021
- result[0] = column0Row0;
1022
- result[1] = 0;
1023
- result[2] = 0;
1024
- result[3] = 0;
1025
- result[4] = 0;
1026
- result[5] = column1Row1;
1027
- result[6] = 0;
1028
- result[7] = 0;
1029
- result[8] = column2Row0;
1030
- result[9] = column2Row1;
1031
- result[10] = column2Row2;
1032
- result[11] = column2Row3;
1033
- result[12] = 0;
1034
- result[13] = 0;
1035
- result[14] = column3Row2;
1036
- result[15] = 0;
1037
- return result;
1038
- };
1039
- Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
1040
- if (!defined_default(result)) {
1041
- result = new Matrix4();
1042
- }
1043
- viewport = defaultValue_default(viewport, defaultValue_default.EMPTY_OBJECT);
1044
- const x = defaultValue_default(viewport.x, 0);
1045
- const y = defaultValue_default(viewport.y, 0);
1046
- const width = defaultValue_default(viewport.width, 0);
1047
- const height = defaultValue_default(viewport.height, 0);
1048
- nearDepthRange = defaultValue_default(nearDepthRange, 0);
1049
- farDepthRange = defaultValue_default(farDepthRange, 1);
1050
- const halfWidth = width * 0.5;
1051
- const halfHeight = height * 0.5;
1052
- const halfDepth = (farDepthRange - nearDepthRange) * 0.5;
1053
- const column0Row0 = halfWidth;
1054
- const column1Row1 = halfHeight;
1055
- const column2Row2 = halfDepth;
1056
- const column3Row0 = x + halfWidth;
1057
- const column3Row1 = y + halfHeight;
1058
- const column3Row2 = nearDepthRange + halfDepth;
1059
- const column3Row3 = 1;
1060
- result[0] = column0Row0;
1061
- result[1] = 0;
1062
- result[2] = 0;
1063
- result[3] = 0;
1064
- result[4] = 0;
1065
- result[5] = column1Row1;
1066
- result[6] = 0;
1067
- result[7] = 0;
1068
- result[8] = 0;
1069
- result[9] = 0;
1070
- result[10] = column2Row2;
1071
- result[11] = 0;
1072
- result[12] = column3Row0;
1073
- result[13] = column3Row1;
1074
- result[14] = column3Row2;
1075
- result[15] = column3Row3;
1076
- return result;
1077
- };
1078
- Matrix4.computeView = function(position, direction, up, right, result) {
1079
- Check_default.typeOf.object("position", position);
1080
- Check_default.typeOf.object("direction", direction);
1081
- Check_default.typeOf.object("up", up);
1082
- Check_default.typeOf.object("right", right);
1083
- Check_default.typeOf.object("result", result);
1084
- result[0] = right.x;
1085
- result[1] = up.x;
1086
- result[2] = -direction.x;
1087
- result[3] = 0;
1088
- result[4] = right.y;
1089
- result[5] = up.y;
1090
- result[6] = -direction.y;
1091
- result[7] = 0;
1092
- result[8] = right.z;
1093
- result[9] = up.z;
1094
- result[10] = -direction.z;
1095
- result[11] = 0;
1096
- result[12] = -Cartesian3_default.dot(right, position);
1097
- result[13] = -Cartesian3_default.dot(up, position);
1098
- result[14] = Cartesian3_default.dot(direction, position);
1099
- result[15] = 1;
1100
- return result;
1101
- };
1102
- Matrix4.toArray = function(matrix, result) {
1103
- Check_default.typeOf.object("matrix", matrix);
1104
- if (!defined_default(result)) {
1105
- return [
1106
- matrix[0],
1107
- matrix[1],
1108
- matrix[2],
1109
- matrix[3],
1110
- matrix[4],
1111
- matrix[5],
1112
- matrix[6],
1113
- matrix[7],
1114
- matrix[8],
1115
- matrix[9],
1116
- matrix[10],
1117
- matrix[11],
1118
- matrix[12],
1119
- matrix[13],
1120
- matrix[14],
1121
- matrix[15]
1122
- ];
1123
- }
1124
- result[0] = matrix[0];
1125
- result[1] = matrix[1];
1126
- result[2] = matrix[2];
1127
- result[3] = matrix[3];
1128
- result[4] = matrix[4];
1129
- result[5] = matrix[5];
1130
- result[6] = matrix[6];
1131
- result[7] = matrix[7];
1132
- result[8] = matrix[8];
1133
- result[9] = matrix[9];
1134
- result[10] = matrix[10];
1135
- result[11] = matrix[11];
1136
- result[12] = matrix[12];
1137
- result[13] = matrix[13];
1138
- result[14] = matrix[14];
1139
- result[15] = matrix[15];
1140
- return result;
1141
- };
1142
- Matrix4.getElementIndex = function(column, row) {
1143
- Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
1144
- Check_default.typeOf.number.lessThanOrEquals("row", row, 3);
1145
- Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
1146
- Check_default.typeOf.number.lessThanOrEquals("column", column, 3);
1147
- return column * 4 + row;
1148
- };
1149
- Matrix4.getColumn = function(matrix, index, result) {
1150
- Check_default.typeOf.object("matrix", matrix);
1151
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1152
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1153
- Check_default.typeOf.object("result", result);
1154
- const startIndex = index * 4;
1155
- const x = matrix[startIndex];
1156
- const y = matrix[startIndex + 1];
1157
- const z = matrix[startIndex + 2];
1158
- const w = matrix[startIndex + 3];
1159
- result.x = x;
1160
- result.y = y;
1161
- result.z = z;
1162
- result.w = w;
1163
- return result;
1164
- };
1165
- Matrix4.setColumn = function(matrix, index, cartesian, result) {
1166
- Check_default.typeOf.object("matrix", matrix);
1167
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1168
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1169
- Check_default.typeOf.object("cartesian", cartesian);
1170
- Check_default.typeOf.object("result", result);
1171
- result = Matrix4.clone(matrix, result);
1172
- const startIndex = index * 4;
1173
- result[startIndex] = cartesian.x;
1174
- result[startIndex + 1] = cartesian.y;
1175
- result[startIndex + 2] = cartesian.z;
1176
- result[startIndex + 3] = cartesian.w;
1177
- return result;
1178
- };
1179
- Matrix4.getRow = function(matrix, index, result) {
1180
- Check_default.typeOf.object("matrix", matrix);
1181
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1182
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1183
- Check_default.typeOf.object("result", result);
1184
- const x = matrix[index];
1185
- const y = matrix[index + 4];
1186
- const z = matrix[index + 8];
1187
- const w = matrix[index + 12];
1188
- result.x = x;
1189
- result.y = y;
1190
- result.z = z;
1191
- result.w = w;
1192
- return result;
1193
- };
1194
- Matrix4.setRow = function(matrix, index, cartesian, result) {
1195
- Check_default.typeOf.object("matrix", matrix);
1196
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
1197
- Check_default.typeOf.number.lessThanOrEquals("index", index, 3);
1198
- Check_default.typeOf.object("cartesian", cartesian);
1199
- Check_default.typeOf.object("result", result);
1200
- result = Matrix4.clone(matrix, result);
1201
- result[index] = cartesian.x;
1202
- result[index + 4] = cartesian.y;
1203
- result[index + 8] = cartesian.z;
1204
- result[index + 12] = cartesian.w;
1205
- return result;
1206
- };
1207
- Matrix4.setTranslation = function(matrix, translation, result) {
1208
- Check_default.typeOf.object("matrix", matrix);
1209
- Check_default.typeOf.object("translation", translation);
1210
- Check_default.typeOf.object("result", result);
1211
- result[0] = matrix[0];
1212
- result[1] = matrix[1];
1213
- result[2] = matrix[2];
1214
- result[3] = matrix[3];
1215
- result[4] = matrix[4];
1216
- result[5] = matrix[5];
1217
- result[6] = matrix[6];
1218
- result[7] = matrix[7];
1219
- result[8] = matrix[8];
1220
- result[9] = matrix[9];
1221
- result[10] = matrix[10];
1222
- result[11] = matrix[11];
1223
- result[12] = translation.x;
1224
- result[13] = translation.y;
1225
- result[14] = translation.z;
1226
- result[15] = matrix[15];
1227
- return result;
1228
- };
1229
- var scaleScratch1 = new Cartesian3_default();
1230
- Matrix4.setScale = function(matrix, scale, result) {
1231
- Check_default.typeOf.object("matrix", matrix);
1232
- Check_default.typeOf.object("scale", scale);
1233
- Check_default.typeOf.object("result", result);
1234
- const existingScale = Matrix4.getScale(matrix, scaleScratch1);
1235
- const scaleRatioX = scale.x / existingScale.x;
1236
- const scaleRatioY = scale.y / existingScale.y;
1237
- const scaleRatioZ = scale.z / existingScale.z;
1238
- result[0] = matrix[0] * scaleRatioX;
1239
- result[1] = matrix[1] * scaleRatioX;
1240
- result[2] = matrix[2] * scaleRatioX;
1241
- result[3] = matrix[3];
1242
- result[4] = matrix[4] * scaleRatioY;
1243
- result[5] = matrix[5] * scaleRatioY;
1244
- result[6] = matrix[6] * scaleRatioY;
1245
- result[7] = matrix[7];
1246
- result[8] = matrix[8] * scaleRatioZ;
1247
- result[9] = matrix[9] * scaleRatioZ;
1248
- result[10] = matrix[10] * scaleRatioZ;
1249
- result[11] = matrix[11];
1250
- result[12] = matrix[12];
1251
- result[13] = matrix[13];
1252
- result[14] = matrix[14];
1253
- result[15] = matrix[15];
1254
- return result;
1255
- };
1256
- var scaleScratch2 = new Cartesian3_default();
1257
- Matrix4.setUniformScale = function(matrix, scale, result) {
1258
- Check_default.typeOf.object("matrix", matrix);
1259
- Check_default.typeOf.number("scale", scale);
1260
- Check_default.typeOf.object("result", result);
1261
- const existingScale = Matrix4.getScale(matrix, scaleScratch2);
1262
- const scaleRatioX = scale / existingScale.x;
1263
- const scaleRatioY = scale / existingScale.y;
1264
- const scaleRatioZ = scale / existingScale.z;
1265
- result[0] = matrix[0] * scaleRatioX;
1266
- result[1] = matrix[1] * scaleRatioX;
1267
- result[2] = matrix[2] * scaleRatioX;
1268
- result[3] = matrix[3];
1269
- result[4] = matrix[4] * scaleRatioY;
1270
- result[5] = matrix[5] * scaleRatioY;
1271
- result[6] = matrix[6] * scaleRatioY;
1272
- result[7] = matrix[7];
1273
- result[8] = matrix[8] * scaleRatioZ;
1274
- result[9] = matrix[9] * scaleRatioZ;
1275
- result[10] = matrix[10] * scaleRatioZ;
1276
- result[11] = matrix[11];
1277
- result[12] = matrix[12];
1278
- result[13] = matrix[13];
1279
- result[14] = matrix[14];
1280
- result[15] = matrix[15];
1281
- return result;
1282
- };
1283
- var scratchColumn = new Cartesian3_default();
1284
- Matrix4.getScale = function(matrix, result) {
1285
- Check_default.typeOf.object("matrix", matrix);
1286
- Check_default.typeOf.object("result", result);
1287
- result.x = Cartesian3_default.magnitude(
1288
- Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
1289
- );
1290
- result.y = Cartesian3_default.magnitude(
1291
- Cartesian3_default.fromElements(matrix[4], matrix[5], matrix[6], scratchColumn)
1292
- );
1293
- result.z = Cartesian3_default.magnitude(
1294
- Cartesian3_default.fromElements(matrix[8], matrix[9], matrix[10], scratchColumn)
1295
- );
1296
- return result;
1297
- };
1298
- var scaleScratch3 = new Cartesian3_default();
1299
- Matrix4.getMaximumScale = function(matrix) {
1300
- Matrix4.getScale(matrix, scaleScratch3);
1301
- return Cartesian3_default.maximumComponent(scaleScratch3);
1302
- };
1303
- var scaleScratch4 = new Cartesian3_default();
1304
- Matrix4.setRotation = function(matrix, rotation, result) {
1305
- Check_default.typeOf.object("matrix", matrix);
1306
- Check_default.typeOf.object("result", result);
1307
- const scale = Matrix4.getScale(matrix, scaleScratch4);
1308
- result[0] = rotation[0] * scale.x;
1309
- result[1] = rotation[1] * scale.x;
1310
- result[2] = rotation[2] * scale.x;
1311
- result[3] = matrix[3];
1312
- result[4] = rotation[3] * scale.y;
1313
- result[5] = rotation[4] * scale.y;
1314
- result[6] = rotation[5] * scale.y;
1315
- result[7] = matrix[7];
1316
- result[8] = rotation[6] * scale.z;
1317
- result[9] = rotation[7] * scale.z;
1318
- result[10] = rotation[8] * scale.z;
1319
- result[11] = matrix[11];
1320
- result[12] = matrix[12];
1321
- result[13] = matrix[13];
1322
- result[14] = matrix[14];
1323
- result[15] = matrix[15];
1324
- return result;
1325
- };
1326
- var scaleScratch5 = new Cartesian3_default();
1327
- Matrix4.getRotation = function(matrix, result) {
1328
- Check_default.typeOf.object("matrix", matrix);
1329
- Check_default.typeOf.object("result", result);
1330
- const scale = Matrix4.getScale(matrix, scaleScratch5);
1331
- result[0] = matrix[0] / scale.x;
1332
- result[1] = matrix[1] / scale.x;
1333
- result[2] = matrix[2] / scale.x;
1334
- result[3] = matrix[4] / scale.y;
1335
- result[4] = matrix[5] / scale.y;
1336
- result[5] = matrix[6] / scale.y;
1337
- result[6] = matrix[8] / scale.z;
1338
- result[7] = matrix[9] / scale.z;
1339
- result[8] = matrix[10] / scale.z;
1340
- return result;
1341
- };
1342
- Matrix4.multiply = function(left, right, result) {
1343
- Check_default.typeOf.object("left", left);
1344
- Check_default.typeOf.object("right", right);
1345
- Check_default.typeOf.object("result", result);
1346
- const left0 = left[0];
1347
- const left1 = left[1];
1348
- const left2 = left[2];
1349
- const left3 = left[3];
1350
- const left4 = left[4];
1351
- const left5 = left[5];
1352
- const left6 = left[6];
1353
- const left7 = left[7];
1354
- const left8 = left[8];
1355
- const left9 = left[9];
1356
- const left10 = left[10];
1357
- const left11 = left[11];
1358
- const left12 = left[12];
1359
- const left13 = left[13];
1360
- const left14 = left[14];
1361
- const left15 = left[15];
1362
- const right0 = right[0];
1363
- const right1 = right[1];
1364
- const right2 = right[2];
1365
- const right3 = right[3];
1366
- const right4 = right[4];
1367
- const right5 = right[5];
1368
- const right6 = right[6];
1369
- const right7 = right[7];
1370
- const right8 = right[8];
1371
- const right9 = right[9];
1372
- const right10 = right[10];
1373
- const right11 = right[11];
1374
- const right12 = right[12];
1375
- const right13 = right[13];
1376
- const right14 = right[14];
1377
- const right15 = right[15];
1378
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
1379
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
1380
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
1381
- const column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
1382
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
1383
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
1384
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
1385
- const column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
1386
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
1387
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
1388
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
1389
- const column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
1390
- const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
1391
- const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
1392
- const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
1393
- const column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
1394
- result[0] = column0Row0;
1395
- result[1] = column0Row1;
1396
- result[2] = column0Row2;
1397
- result[3] = column0Row3;
1398
- result[4] = column1Row0;
1399
- result[5] = column1Row1;
1400
- result[6] = column1Row2;
1401
- result[7] = column1Row3;
1402
- result[8] = column2Row0;
1403
- result[9] = column2Row1;
1404
- result[10] = column2Row2;
1405
- result[11] = column2Row3;
1406
- result[12] = column3Row0;
1407
- result[13] = column3Row1;
1408
- result[14] = column3Row2;
1409
- result[15] = column3Row3;
1410
- return result;
1411
- };
1412
- Matrix4.add = function(left, right, result) {
1413
- Check_default.typeOf.object("left", left);
1414
- Check_default.typeOf.object("right", right);
1415
- Check_default.typeOf.object("result", result);
1416
- result[0] = left[0] + right[0];
1417
- result[1] = left[1] + right[1];
1418
- result[2] = left[2] + right[2];
1419
- result[3] = left[3] + right[3];
1420
- result[4] = left[4] + right[4];
1421
- result[5] = left[5] + right[5];
1422
- result[6] = left[6] + right[6];
1423
- result[7] = left[7] + right[7];
1424
- result[8] = left[8] + right[8];
1425
- result[9] = left[9] + right[9];
1426
- result[10] = left[10] + right[10];
1427
- result[11] = left[11] + right[11];
1428
- result[12] = left[12] + right[12];
1429
- result[13] = left[13] + right[13];
1430
- result[14] = left[14] + right[14];
1431
- result[15] = left[15] + right[15];
1432
- return result;
1433
- };
1434
- Matrix4.subtract = function(left, right, result) {
1435
- Check_default.typeOf.object("left", left);
1436
- Check_default.typeOf.object("right", right);
1437
- Check_default.typeOf.object("result", result);
1438
- result[0] = left[0] - right[0];
1439
- result[1] = left[1] - right[1];
1440
- result[2] = left[2] - right[2];
1441
- result[3] = left[3] - right[3];
1442
- result[4] = left[4] - right[4];
1443
- result[5] = left[5] - right[5];
1444
- result[6] = left[6] - right[6];
1445
- result[7] = left[7] - right[7];
1446
- result[8] = left[8] - right[8];
1447
- result[9] = left[9] - right[9];
1448
- result[10] = left[10] - right[10];
1449
- result[11] = left[11] - right[11];
1450
- result[12] = left[12] - right[12];
1451
- result[13] = left[13] - right[13];
1452
- result[14] = left[14] - right[14];
1453
- result[15] = left[15] - right[15];
1454
- return result;
1455
- };
1456
- Matrix4.multiplyTransformation = function(left, right, result) {
1457
- Check_default.typeOf.object("left", left);
1458
- Check_default.typeOf.object("right", right);
1459
- Check_default.typeOf.object("result", result);
1460
- const left0 = left[0];
1461
- const left1 = left[1];
1462
- const left2 = left[2];
1463
- const left4 = left[4];
1464
- const left5 = left[5];
1465
- const left6 = left[6];
1466
- const left8 = left[8];
1467
- const left9 = left[9];
1468
- const left10 = left[10];
1469
- const left12 = left[12];
1470
- const left13 = left[13];
1471
- const left14 = left[14];
1472
- const right0 = right[0];
1473
- const right1 = right[1];
1474
- const right2 = right[2];
1475
- const right4 = right[4];
1476
- const right5 = right[5];
1477
- const right6 = right[6];
1478
- const right8 = right[8];
1479
- const right9 = right[9];
1480
- const right10 = right[10];
1481
- const right12 = right[12];
1482
- const right13 = right[13];
1483
- const right14 = right[14];
1484
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
1485
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
1486
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
1487
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
1488
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
1489
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
1490
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
1491
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
1492
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
1493
- const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12;
1494
- const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13;
1495
- const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14;
1496
- result[0] = column0Row0;
1497
- result[1] = column0Row1;
1498
- result[2] = column0Row2;
1499
- result[3] = 0;
1500
- result[4] = column1Row0;
1501
- result[5] = column1Row1;
1502
- result[6] = column1Row2;
1503
- result[7] = 0;
1504
- result[8] = column2Row0;
1505
- result[9] = column2Row1;
1506
- result[10] = column2Row2;
1507
- result[11] = 0;
1508
- result[12] = column3Row0;
1509
- result[13] = column3Row1;
1510
- result[14] = column3Row2;
1511
- result[15] = 1;
1512
- return result;
1513
- };
1514
- Matrix4.multiplyByMatrix3 = function(matrix, rotation, result) {
1515
- Check_default.typeOf.object("matrix", matrix);
1516
- Check_default.typeOf.object("rotation", rotation);
1517
- Check_default.typeOf.object("result", result);
1518
- const left0 = matrix[0];
1519
- const left1 = matrix[1];
1520
- const left2 = matrix[2];
1521
- const left4 = matrix[4];
1522
- const left5 = matrix[5];
1523
- const left6 = matrix[6];
1524
- const left8 = matrix[8];
1525
- const left9 = matrix[9];
1526
- const left10 = matrix[10];
1527
- const right0 = rotation[0];
1528
- const right1 = rotation[1];
1529
- const right2 = rotation[2];
1530
- const right4 = rotation[3];
1531
- const right5 = rotation[4];
1532
- const right6 = rotation[5];
1533
- const right8 = rotation[6];
1534
- const right9 = rotation[7];
1535
- const right10 = rotation[8];
1536
- const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
1537
- const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
1538
- const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
1539
- const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
1540
- const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
1541
- const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
1542
- const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
1543
- const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
1544
- const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
1545
- result[0] = column0Row0;
1546
- result[1] = column0Row1;
1547
- result[2] = column0Row2;
1548
- result[3] = 0;
1549
- result[4] = column1Row0;
1550
- result[5] = column1Row1;
1551
- result[6] = column1Row2;
1552
- result[7] = 0;
1553
- result[8] = column2Row0;
1554
- result[9] = column2Row1;
1555
- result[10] = column2Row2;
1556
- result[11] = 0;
1557
- result[12] = matrix[12];
1558
- result[13] = matrix[13];
1559
- result[14] = matrix[14];
1560
- result[15] = matrix[15];
1561
- return result;
1562
- };
1563
- Matrix4.multiplyByTranslation = function(matrix, translation, result) {
1564
- Check_default.typeOf.object("matrix", matrix);
1565
- Check_default.typeOf.object("translation", translation);
1566
- Check_default.typeOf.object("result", result);
1567
- const x = translation.x;
1568
- const y = translation.y;
1569
- const z = translation.z;
1570
- const tx = x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12];
1571
- const ty = x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13];
1572
- const tz = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14];
1573
- result[0] = matrix[0];
1574
- result[1] = matrix[1];
1575
- result[2] = matrix[2];
1576
- result[3] = matrix[3];
1577
- result[4] = matrix[4];
1578
- result[5] = matrix[5];
1579
- result[6] = matrix[6];
1580
- result[7] = matrix[7];
1581
- result[8] = matrix[8];
1582
- result[9] = matrix[9];
1583
- result[10] = matrix[10];
1584
- result[11] = matrix[11];
1585
- result[12] = tx;
1586
- result[13] = ty;
1587
- result[14] = tz;
1588
- result[15] = matrix[15];
1589
- return result;
1590
- };
1591
- Matrix4.multiplyByScale = function(matrix, scale, result) {
1592
- Check_default.typeOf.object("matrix", matrix);
1593
- Check_default.typeOf.object("scale", scale);
1594
- Check_default.typeOf.object("result", result);
1595
- const scaleX = scale.x;
1596
- const scaleY = scale.y;
1597
- const scaleZ = scale.z;
1598
- if (scaleX === 1 && scaleY === 1 && scaleZ === 1) {
1599
- return Matrix4.clone(matrix, result);
1600
- }
1601
- result[0] = scaleX * matrix[0];
1602
- result[1] = scaleX * matrix[1];
1603
- result[2] = scaleX * matrix[2];
1604
- result[3] = matrix[3];
1605
- result[4] = scaleY * matrix[4];
1606
- result[5] = scaleY * matrix[5];
1607
- result[6] = scaleY * matrix[6];
1608
- result[7] = matrix[7];
1609
- result[8] = scaleZ * matrix[8];
1610
- result[9] = scaleZ * matrix[9];
1611
- result[10] = scaleZ * matrix[10];
1612
- result[11] = matrix[11];
1613
- result[12] = matrix[12];
1614
- result[13] = matrix[13];
1615
- result[14] = matrix[14];
1616
- result[15] = matrix[15];
1617
- return result;
1618
- };
1619
- Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
1620
- Check_default.typeOf.object("matrix", matrix);
1621
- Check_default.typeOf.number("scale", scale);
1622
- Check_default.typeOf.object("result", result);
1623
- result[0] = matrix[0] * scale;
1624
- result[1] = matrix[1] * scale;
1625
- result[2] = matrix[2] * scale;
1626
- result[3] = matrix[3];
1627
- result[4] = matrix[4] * scale;
1628
- result[5] = matrix[5] * scale;
1629
- result[6] = matrix[6] * scale;
1630
- result[7] = matrix[7];
1631
- result[8] = matrix[8] * scale;
1632
- result[9] = matrix[9] * scale;
1633
- result[10] = matrix[10] * scale;
1634
- result[11] = matrix[11];
1635
- result[12] = matrix[12];
1636
- result[13] = matrix[13];
1637
- result[14] = matrix[14];
1638
- result[15] = matrix[15];
1639
- return result;
1640
- };
1641
- Matrix4.multiplyByVector = function(matrix, cartesian, result) {
1642
- Check_default.typeOf.object("matrix", matrix);
1643
- Check_default.typeOf.object("cartesian", cartesian);
1644
- Check_default.typeOf.object("result", result);
1645
- const vX = cartesian.x;
1646
- const vY = cartesian.y;
1647
- const vZ = cartesian.z;
1648
- const vW = cartesian.w;
1649
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
1650
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
1651
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
1652
- const w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
1653
- result.x = x;
1654
- result.y = y;
1655
- result.z = z;
1656
- result.w = w;
1657
- return result;
1658
- };
1659
- Matrix4.multiplyByPointAsVector = function(matrix, cartesian, result) {
1660
- Check_default.typeOf.object("matrix", matrix);
1661
- Check_default.typeOf.object("cartesian", cartesian);
1662
- Check_default.typeOf.object("result", result);
1663
- const vX = cartesian.x;
1664
- const vY = cartesian.y;
1665
- const vZ = cartesian.z;
1666
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ;
1667
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ;
1668
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ;
1669
- result.x = x;
1670
- result.y = y;
1671
- result.z = z;
1672
- return result;
1673
- };
1674
- Matrix4.multiplyByPoint = function(matrix, cartesian, result) {
1675
- Check_default.typeOf.object("matrix", matrix);
1676
- Check_default.typeOf.object("cartesian", cartesian);
1677
- Check_default.typeOf.object("result", result);
1678
- const vX = cartesian.x;
1679
- const vY = cartesian.y;
1680
- const vZ = cartesian.z;
1681
- const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12];
1682
- const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13];
1683
- const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14];
1684
- result.x = x;
1685
- result.y = y;
1686
- result.z = z;
1687
- return result;
1688
- };
1689
- Matrix4.multiplyByScalar = function(matrix, scalar, result) {
1690
- Check_default.typeOf.object("matrix", matrix);
1691
- Check_default.typeOf.number("scalar", scalar);
1692
- Check_default.typeOf.object("result", result);
1693
- result[0] = matrix[0] * scalar;
1694
- result[1] = matrix[1] * scalar;
1695
- result[2] = matrix[2] * scalar;
1696
- result[3] = matrix[3] * scalar;
1697
- result[4] = matrix[4] * scalar;
1698
- result[5] = matrix[5] * scalar;
1699
- result[6] = matrix[6] * scalar;
1700
- result[7] = matrix[7] * scalar;
1701
- result[8] = matrix[8] * scalar;
1702
- result[9] = matrix[9] * scalar;
1703
- result[10] = matrix[10] * scalar;
1704
- result[11] = matrix[11] * scalar;
1705
- result[12] = matrix[12] * scalar;
1706
- result[13] = matrix[13] * scalar;
1707
- result[14] = matrix[14] * scalar;
1708
- result[15] = matrix[15] * scalar;
1709
- return result;
1710
- };
1711
- Matrix4.negate = function(matrix, result) {
1712
- Check_default.typeOf.object("matrix", matrix);
1713
- Check_default.typeOf.object("result", result);
1714
- result[0] = -matrix[0];
1715
- result[1] = -matrix[1];
1716
- result[2] = -matrix[2];
1717
- result[3] = -matrix[3];
1718
- result[4] = -matrix[4];
1719
- result[5] = -matrix[5];
1720
- result[6] = -matrix[6];
1721
- result[7] = -matrix[7];
1722
- result[8] = -matrix[8];
1723
- result[9] = -matrix[9];
1724
- result[10] = -matrix[10];
1725
- result[11] = -matrix[11];
1726
- result[12] = -matrix[12];
1727
- result[13] = -matrix[13];
1728
- result[14] = -matrix[14];
1729
- result[15] = -matrix[15];
1730
- return result;
1731
- };
1732
- Matrix4.transpose = function(matrix, result) {
1733
- Check_default.typeOf.object("matrix", matrix);
1734
- Check_default.typeOf.object("result", result);
1735
- const matrix1 = matrix[1];
1736
- const matrix2 = matrix[2];
1737
- const matrix3 = matrix[3];
1738
- const matrix6 = matrix[6];
1739
- const matrix7 = matrix[7];
1740
- const matrix11 = matrix[11];
1741
- result[0] = matrix[0];
1742
- result[1] = matrix[4];
1743
- result[2] = matrix[8];
1744
- result[3] = matrix[12];
1745
- result[4] = matrix1;
1746
- result[5] = matrix[5];
1747
- result[6] = matrix[9];
1748
- result[7] = matrix[13];
1749
- result[8] = matrix2;
1750
- result[9] = matrix6;
1751
- result[10] = matrix[10];
1752
- result[11] = matrix[14];
1753
- result[12] = matrix3;
1754
- result[13] = matrix7;
1755
- result[14] = matrix11;
1756
- result[15] = matrix[15];
1757
- return result;
1758
- };
1759
- Matrix4.abs = function(matrix, result) {
1760
- Check_default.typeOf.object("matrix", matrix);
1761
- Check_default.typeOf.object("result", result);
1762
- result[0] = Math.abs(matrix[0]);
1763
- result[1] = Math.abs(matrix[1]);
1764
- result[2] = Math.abs(matrix[2]);
1765
- result[3] = Math.abs(matrix[3]);
1766
- result[4] = Math.abs(matrix[4]);
1767
- result[5] = Math.abs(matrix[5]);
1768
- result[6] = Math.abs(matrix[6]);
1769
- result[7] = Math.abs(matrix[7]);
1770
- result[8] = Math.abs(matrix[8]);
1771
- result[9] = Math.abs(matrix[9]);
1772
- result[10] = Math.abs(matrix[10]);
1773
- result[11] = Math.abs(matrix[11]);
1774
- result[12] = Math.abs(matrix[12]);
1775
- result[13] = Math.abs(matrix[13]);
1776
- result[14] = Math.abs(matrix[14]);
1777
- result[15] = Math.abs(matrix[15]);
1778
- return result;
1779
- };
1780
- Matrix4.equals = function(left, right) {
1781
- return left === right || defined_default(left) && defined_default(right) && // Translation
1782
- left[12] === right[12] && left[13] === right[13] && left[14] === right[14] && // Rotation/scale
1783
- left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[8] === right[8] && left[9] === right[9] && left[10] === right[10] && // Bottom row
1784
- left[3] === right[3] && left[7] === right[7] && left[11] === right[11] && left[15] === right[15];
1785
- };
1786
- Matrix4.equalsEpsilon = function(left, right, epsilon) {
1787
- epsilon = defaultValue_default(epsilon, 0);
1788
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon && Math.abs(left[9] - right[9]) <= epsilon && Math.abs(left[10] - right[10]) <= epsilon && Math.abs(left[11] - right[11]) <= epsilon && Math.abs(left[12] - right[12]) <= epsilon && Math.abs(left[13] - right[13]) <= epsilon && Math.abs(left[14] - right[14]) <= epsilon && Math.abs(left[15] - right[15]) <= epsilon;
1789
- };
1790
- Matrix4.getTranslation = function(matrix, result) {
1791
- Check_default.typeOf.object("matrix", matrix);
1792
- Check_default.typeOf.object("result", result);
1793
- result.x = matrix[12];
1794
- result.y = matrix[13];
1795
- result.z = matrix[14];
1796
- return result;
1797
- };
1798
- Matrix4.getMatrix3 = function(matrix, result) {
1799
- Check_default.typeOf.object("matrix", matrix);
1800
- Check_default.typeOf.object("result", result);
1801
- result[0] = matrix[0];
1802
- result[1] = matrix[1];
1803
- result[2] = matrix[2];
1804
- result[3] = matrix[4];
1805
- result[4] = matrix[5];
1806
- result[5] = matrix[6];
1807
- result[6] = matrix[8];
1808
- result[7] = matrix[9];
1809
- result[8] = matrix[10];
1810
- return result;
1811
- };
1812
- var scratchInverseRotation = new Matrix3_default();
1813
- var scratchMatrix3Zero = new Matrix3_default();
1814
- var scratchBottomRow = new Cartesian4_default();
1815
- var scratchExpectedBottomRow = new Cartesian4_default(0, 0, 0, 1);
1816
- Matrix4.inverse = function(matrix, result) {
1817
- Check_default.typeOf.object("matrix", matrix);
1818
- Check_default.typeOf.object("result", result);
1819
- const src0 = matrix[0];
1820
- const src1 = matrix[4];
1821
- const src2 = matrix[8];
1822
- const src3 = matrix[12];
1823
- const src4 = matrix[1];
1824
- const src5 = matrix[5];
1825
- const src6 = matrix[9];
1826
- const src7 = matrix[13];
1827
- const src8 = matrix[2];
1828
- const src9 = matrix[6];
1829
- const src10 = matrix[10];
1830
- const src11 = matrix[14];
1831
- const src12 = matrix[3];
1832
- const src13 = matrix[7];
1833
- const src14 = matrix[11];
1834
- const src15 = matrix[15];
1835
- let tmp0 = src10 * src15;
1836
- let tmp1 = src11 * src14;
1837
- let tmp2 = src9 * src15;
1838
- let tmp3 = src11 * src13;
1839
- let tmp4 = src9 * src14;
1840
- let tmp5 = src10 * src13;
1841
- let tmp6 = src8 * src15;
1842
- let tmp7 = src11 * src12;
1843
- let tmp8 = src8 * src14;
1844
- let tmp9 = src10 * src12;
1845
- let tmp10 = src8 * src13;
1846
- let tmp11 = src9 * src12;
1847
- const dst0 = tmp0 * src5 + tmp3 * src6 + tmp4 * src7 - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
1848
- const dst1 = tmp1 * src4 + tmp6 * src6 + tmp9 * src7 - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
1849
- const dst2 = tmp2 * src4 + tmp7 * src5 + tmp10 * src7 - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
1850
- const dst3 = tmp5 * src4 + tmp8 * src5 + tmp11 * src6 - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
1851
- const dst4 = tmp1 * src1 + tmp2 * src2 + tmp5 * src3 - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
1852
- const dst5 = tmp0 * src0 + tmp7 * src2 + tmp8 * src3 - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
1853
- const dst6 = tmp3 * src0 + tmp6 * src1 + tmp11 * src3 - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
1854
- const dst7 = tmp4 * src0 + tmp9 * src1 + tmp10 * src2 - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
1855
- tmp0 = src2 * src7;
1856
- tmp1 = src3 * src6;
1857
- tmp2 = src1 * src7;
1858
- tmp3 = src3 * src5;
1859
- tmp4 = src1 * src6;
1860
- tmp5 = src2 * src5;
1861
- tmp6 = src0 * src7;
1862
- tmp7 = src3 * src4;
1863
- tmp8 = src0 * src6;
1864
- tmp9 = src2 * src4;
1865
- tmp10 = src0 * src5;
1866
- tmp11 = src1 * src4;
1867
- const dst8 = tmp0 * src13 + tmp3 * src14 + tmp4 * src15 - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
1868
- const dst9 = tmp1 * src12 + tmp6 * src14 + tmp9 * src15 - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
1869
- const dst10 = tmp2 * src12 + tmp7 * src13 + tmp10 * src15 - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
1870
- const dst11 = tmp5 * src12 + tmp8 * src13 + tmp11 * src14 - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
1871
- const dst12 = tmp2 * src10 + tmp5 * src11 + tmp1 * src9 - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
1872
- const dst13 = tmp8 * src11 + tmp0 * src8 + tmp7 * src10 - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
1873
- const dst14 = tmp6 * src9 + tmp11 * src11 + tmp3 * src8 - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
1874
- const dst15 = tmp10 * src10 + tmp4 * src8 + tmp9 * src9 - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
1875
- let det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
1876
- if (Math.abs(det) < Math_default.EPSILON21) {
1877
- if (Matrix3_default.equalsEpsilon(
1878
- Matrix4.getMatrix3(matrix, scratchInverseRotation),
1879
- scratchMatrix3Zero,
1880
- Math_default.EPSILON7
1881
- ) && Cartesian4_default.equals(
1882
- Matrix4.getRow(matrix, 3, scratchBottomRow),
1883
- scratchExpectedBottomRow
1884
- )) {
1885
- result[0] = 0;
1886
- result[1] = 0;
1887
- result[2] = 0;
1888
- result[3] = 0;
1889
- result[4] = 0;
1890
- result[5] = 0;
1891
- result[6] = 0;
1892
- result[7] = 0;
1893
- result[8] = 0;
1894
- result[9] = 0;
1895
- result[10] = 0;
1896
- result[11] = 0;
1897
- result[12] = -matrix[12];
1898
- result[13] = -matrix[13];
1899
- result[14] = -matrix[14];
1900
- result[15] = 1;
1901
- return result;
1902
- }
1903
- throw new RuntimeError_default(
1904
- "matrix is not invertible because its determinate is zero."
1905
- );
1906
- }
1907
- det = 1 / det;
1908
- result[0] = dst0 * det;
1909
- result[1] = dst1 * det;
1910
- result[2] = dst2 * det;
1911
- result[3] = dst3 * det;
1912
- result[4] = dst4 * det;
1913
- result[5] = dst5 * det;
1914
- result[6] = dst6 * det;
1915
- result[7] = dst7 * det;
1916
- result[8] = dst8 * det;
1917
- result[9] = dst9 * det;
1918
- result[10] = dst10 * det;
1919
- result[11] = dst11 * det;
1920
- result[12] = dst12 * det;
1921
- result[13] = dst13 * det;
1922
- result[14] = dst14 * det;
1923
- result[15] = dst15 * det;
1924
- return result;
1925
- };
1926
- Matrix4.inverseTransformation = function(matrix, result) {
1927
- Check_default.typeOf.object("matrix", matrix);
1928
- Check_default.typeOf.object("result", result);
1929
- const matrix0 = matrix[0];
1930
- const matrix1 = matrix[1];
1931
- const matrix2 = matrix[2];
1932
- const matrix4 = matrix[4];
1933
- const matrix5 = matrix[5];
1934
- const matrix6 = matrix[6];
1935
- const matrix8 = matrix[8];
1936
- const matrix9 = matrix[9];
1937
- const matrix10 = matrix[10];
1938
- const vX = matrix[12];
1939
- const vY = matrix[13];
1940
- const vZ = matrix[14];
1941
- const x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
1942
- const y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
1943
- const z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
1944
- result[0] = matrix0;
1945
- result[1] = matrix4;
1946
- result[2] = matrix8;
1947
- result[3] = 0;
1948
- result[4] = matrix1;
1949
- result[5] = matrix5;
1950
- result[6] = matrix9;
1951
- result[7] = 0;
1952
- result[8] = matrix2;
1953
- result[9] = matrix6;
1954
- result[10] = matrix10;
1955
- result[11] = 0;
1956
- result[12] = x;
1957
- result[13] = y;
1958
- result[14] = z;
1959
- result[15] = 1;
1960
- return result;
1961
- };
1962
- var scratchTransposeMatrix = new Matrix4();
1963
- Matrix4.inverseTranspose = function(matrix, result) {
1964
- Check_default.typeOf.object("matrix", matrix);
1965
- Check_default.typeOf.object("result", result);
1966
- return Matrix4.inverse(
1967
- Matrix4.transpose(matrix, scratchTransposeMatrix),
1968
- result
1969
- );
1970
- };
1971
- Matrix4.IDENTITY = Object.freeze(
1972
- new Matrix4(
1973
- 1,
1974
- 0,
1975
- 0,
1976
- 0,
1977
- 0,
1978
- 1,
1979
- 0,
1980
- 0,
1981
- 0,
1982
- 0,
1983
- 1,
1984
- 0,
1985
- 0,
1986
- 0,
1987
- 0,
1988
- 1
1989
- )
1990
- );
1991
- Matrix4.ZERO = Object.freeze(
1992
- new Matrix4(
1993
- 0,
1994
- 0,
1995
- 0,
1996
- 0,
1997
- 0,
1998
- 0,
1999
- 0,
2000
- 0,
2001
- 0,
2002
- 0,
2003
- 0,
2004
- 0,
2005
- 0,
2006
- 0,
2007
- 0,
2008
- 0
2009
- )
2010
- );
2011
- Matrix4.COLUMN0ROW0 = 0;
2012
- Matrix4.COLUMN0ROW1 = 1;
2013
- Matrix4.COLUMN0ROW2 = 2;
2014
- Matrix4.COLUMN0ROW3 = 3;
2015
- Matrix4.COLUMN1ROW0 = 4;
2016
- Matrix4.COLUMN1ROW1 = 5;
2017
- Matrix4.COLUMN1ROW2 = 6;
2018
- Matrix4.COLUMN1ROW3 = 7;
2019
- Matrix4.COLUMN2ROW0 = 8;
2020
- Matrix4.COLUMN2ROW1 = 9;
2021
- Matrix4.COLUMN2ROW2 = 10;
2022
- Matrix4.COLUMN2ROW3 = 11;
2023
- Matrix4.COLUMN3ROW0 = 12;
2024
- Matrix4.COLUMN3ROW1 = 13;
2025
- Matrix4.COLUMN3ROW2 = 14;
2026
- Matrix4.COLUMN3ROW3 = 15;
2027
- Object.defineProperties(Matrix4.prototype, {
2028
- /**
2029
- * Gets the number of items in the collection.
2030
- * @memberof Matrix4.prototype
2031
- *
2032
- * @type {number}
2033
- */
2034
- length: {
2035
- get: function() {
2036
- return Matrix4.packedLength;
2037
- }
2038
- }
2039
- });
2040
- Matrix4.prototype.clone = function(result) {
2041
- return Matrix4.clone(this, result);
2042
- };
2043
- Matrix4.prototype.equals = function(right) {
2044
- return Matrix4.equals(this, right);
2045
- };
2046
- Matrix4.equalsArray = function(matrix, array, offset) {
2047
- return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3] && matrix[4] === array[offset + 4] && matrix[5] === array[offset + 5] && matrix[6] === array[offset + 6] && matrix[7] === array[offset + 7] && matrix[8] === array[offset + 8] && matrix[9] === array[offset + 9] && matrix[10] === array[offset + 10] && matrix[11] === array[offset + 11] && matrix[12] === array[offset + 12] && matrix[13] === array[offset + 13] && matrix[14] === array[offset + 14] && matrix[15] === array[offset + 15];
2048
- };
2049
- Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
2050
- return Matrix4.equalsEpsilon(this, right, epsilon);
2051
- };
2052
- Matrix4.prototype.toString = function() {
2053
- return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
2054
- (${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
2055
- (${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
2056
- (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`;
2057
- };
2058
- var Matrix4_default = Matrix4;
2059
-
2060
- // packages/engine/Source/Core/Rectangle.js
2061
- function Rectangle(west, south, east, north) {
2062
- this.west = defaultValue_default(west, 0);
2063
- this.south = defaultValue_default(south, 0);
2064
- this.east = defaultValue_default(east, 0);
2065
- this.north = defaultValue_default(north, 0);
2066
- }
2067
- Object.defineProperties(Rectangle.prototype, {
2068
- /**
2069
- * Gets the width of the rectangle in radians.
2070
- * @memberof Rectangle.prototype
2071
- * @type {number}
2072
- * @readonly
2073
- */
2074
- width: {
2075
- get: function() {
2076
- return Rectangle.computeWidth(this);
2077
- }
2078
- },
2079
- /**
2080
- * Gets the height of the rectangle in radians.
2081
- * @memberof Rectangle.prototype
2082
- * @type {number}
2083
- * @readonly
2084
- */
2085
- height: {
2086
- get: function() {
2087
- return Rectangle.computeHeight(this);
2088
- }
2089
- }
2090
- });
2091
- Rectangle.packedLength = 4;
2092
- Rectangle.pack = function(value, array, startingIndex) {
2093
- Check_default.typeOf.object("value", value);
2094
- Check_default.defined("array", array);
2095
- startingIndex = defaultValue_default(startingIndex, 0);
2096
- array[startingIndex++] = value.west;
2097
- array[startingIndex++] = value.south;
2098
- array[startingIndex++] = value.east;
2099
- array[startingIndex] = value.north;
2100
- return array;
2101
- };
2102
- Rectangle.unpack = function(array, startingIndex, result) {
2103
- Check_default.defined("array", array);
2104
- startingIndex = defaultValue_default(startingIndex, 0);
2105
- if (!defined_default(result)) {
2106
- result = new Rectangle();
2107
- }
2108
- result.west = array[startingIndex++];
2109
- result.south = array[startingIndex++];
2110
- result.east = array[startingIndex++];
2111
- result.north = array[startingIndex];
2112
- return result;
2113
- };
2114
- Rectangle.computeWidth = function(rectangle) {
2115
- Check_default.typeOf.object("rectangle", rectangle);
2116
- let east = rectangle.east;
2117
- const west = rectangle.west;
2118
- if (east < west) {
2119
- east += Math_default.TWO_PI;
2120
- }
2121
- return east - west;
2122
- };
2123
- Rectangle.computeHeight = function(rectangle) {
2124
- Check_default.typeOf.object("rectangle", rectangle);
2125
- return rectangle.north - rectangle.south;
2126
- };
2127
- Rectangle.fromDegrees = function(west, south, east, north, result) {
2128
- west = Math_default.toRadians(defaultValue_default(west, 0));
2129
- south = Math_default.toRadians(defaultValue_default(south, 0));
2130
- east = Math_default.toRadians(defaultValue_default(east, 0));
2131
- north = Math_default.toRadians(defaultValue_default(north, 0));
2132
- if (!defined_default(result)) {
2133
- return new Rectangle(west, south, east, north);
2134
- }
2135
- result.west = west;
2136
- result.south = south;
2137
- result.east = east;
2138
- result.north = north;
2139
- return result;
2140
- };
2141
- Rectangle.fromRadians = function(west, south, east, north, result) {
2142
- if (!defined_default(result)) {
2143
- return new Rectangle(west, south, east, north);
2144
- }
2145
- result.west = defaultValue_default(west, 0);
2146
- result.south = defaultValue_default(south, 0);
2147
- result.east = defaultValue_default(east, 0);
2148
- result.north = defaultValue_default(north, 0);
2149
- return result;
2150
- };
2151
- Rectangle.fromCartographicArray = function(cartographics, result) {
2152
- Check_default.defined("cartographics", cartographics);
2153
- let west = Number.MAX_VALUE;
2154
- let east = -Number.MAX_VALUE;
2155
- let westOverIDL = Number.MAX_VALUE;
2156
- let eastOverIDL = -Number.MAX_VALUE;
2157
- let south = Number.MAX_VALUE;
2158
- let north = -Number.MAX_VALUE;
2159
- for (let i = 0, len = cartographics.length; i < len; i++) {
2160
- const position = cartographics[i];
2161
- west = Math.min(west, position.longitude);
2162
- east = Math.max(east, position.longitude);
2163
- south = Math.min(south, position.latitude);
2164
- north = Math.max(north, position.latitude);
2165
- const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
2166
- westOverIDL = Math.min(westOverIDL, lonAdjusted);
2167
- eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
2168
- }
2169
- if (east - west > eastOverIDL - westOverIDL) {
2170
- west = westOverIDL;
2171
- east = eastOverIDL;
2172
- if (east > Math_default.PI) {
2173
- east = east - Math_default.TWO_PI;
2174
- }
2175
- if (west > Math_default.PI) {
2176
- west = west - Math_default.TWO_PI;
2177
- }
2178
- }
2179
- if (!defined_default(result)) {
2180
- return new Rectangle(west, south, east, north);
2181
- }
2182
- result.west = west;
2183
- result.south = south;
2184
- result.east = east;
2185
- result.north = north;
2186
- return result;
2187
- };
2188
- Rectangle.fromCartesianArray = function(cartesians, ellipsoid, result) {
2189
- Check_default.defined("cartesians", cartesians);
2190
- ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
2191
- let west = Number.MAX_VALUE;
2192
- let east = -Number.MAX_VALUE;
2193
- let westOverIDL = Number.MAX_VALUE;
2194
- let eastOverIDL = -Number.MAX_VALUE;
2195
- let south = Number.MAX_VALUE;
2196
- let north = -Number.MAX_VALUE;
2197
- for (let i = 0, len = cartesians.length; i < len; i++) {
2198
- const position = ellipsoid.cartesianToCartographic(cartesians[i]);
2199
- west = Math.min(west, position.longitude);
2200
- east = Math.max(east, position.longitude);
2201
- south = Math.min(south, position.latitude);
2202
- north = Math.max(north, position.latitude);
2203
- const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
2204
- westOverIDL = Math.min(westOverIDL, lonAdjusted);
2205
- eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
2206
- }
2207
- if (east - west > eastOverIDL - westOverIDL) {
2208
- west = westOverIDL;
2209
- east = eastOverIDL;
2210
- if (east > Math_default.PI) {
2211
- east = east - Math_default.TWO_PI;
2212
- }
2213
- if (west > Math_default.PI) {
2214
- west = west - Math_default.TWO_PI;
2215
- }
2216
- }
2217
- if (!defined_default(result)) {
2218
- return new Rectangle(west, south, east, north);
2219
- }
2220
- result.west = west;
2221
- result.south = south;
2222
- result.east = east;
2223
- result.north = north;
2224
- return result;
2225
- };
2226
- Rectangle.clone = function(rectangle, result) {
2227
- if (!defined_default(rectangle)) {
2228
- return void 0;
2229
- }
2230
- if (!defined_default(result)) {
2231
- return new Rectangle(
2232
- rectangle.west,
2233
- rectangle.south,
2234
- rectangle.east,
2235
- rectangle.north
2236
- );
2237
- }
2238
- result.west = rectangle.west;
2239
- result.south = rectangle.south;
2240
- result.east = rectangle.east;
2241
- result.north = rectangle.north;
2242
- return result;
2243
- };
2244
- Rectangle.equalsEpsilon = function(left, right, absoluteEpsilon) {
2245
- absoluteEpsilon = defaultValue_default(absoluteEpsilon, 0);
2246
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left.west - right.west) <= absoluteEpsilon && Math.abs(left.south - right.south) <= absoluteEpsilon && Math.abs(left.east - right.east) <= absoluteEpsilon && Math.abs(left.north - right.north) <= absoluteEpsilon;
2247
- };
2248
- Rectangle.prototype.clone = function(result) {
2249
- return Rectangle.clone(this, result);
2250
- };
2251
- Rectangle.prototype.equals = function(other) {
2252
- return Rectangle.equals(this, other);
2253
- };
2254
- Rectangle.equals = function(left, right) {
2255
- return left === right || defined_default(left) && defined_default(right) && left.west === right.west && left.south === right.south && left.east === right.east && left.north === right.north;
2256
- };
2257
- Rectangle.prototype.equalsEpsilon = function(other, epsilon) {
2258
- return Rectangle.equalsEpsilon(this, other, epsilon);
2259
- };
2260
- Rectangle.validate = function(rectangle) {
2261
- Check_default.typeOf.object("rectangle", rectangle);
2262
- const north = rectangle.north;
2263
- Check_default.typeOf.number.greaterThanOrEquals(
2264
- "north",
2265
- north,
2266
- -Math_default.PI_OVER_TWO
2267
- );
2268
- Check_default.typeOf.number.lessThanOrEquals("north", north, Math_default.PI_OVER_TWO);
2269
- const south = rectangle.south;
2270
- Check_default.typeOf.number.greaterThanOrEquals(
2271
- "south",
2272
- south,
2273
- -Math_default.PI_OVER_TWO
2274
- );
2275
- Check_default.typeOf.number.lessThanOrEquals("south", south, Math_default.PI_OVER_TWO);
2276
- const west = rectangle.west;
2277
- Check_default.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
2278
- Check_default.typeOf.number.lessThanOrEquals("west", west, Math.PI);
2279
- const east = rectangle.east;
2280
- Check_default.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
2281
- Check_default.typeOf.number.lessThanOrEquals("east", east, Math.PI);
2282
- };
2283
- Rectangle.southwest = function(rectangle, result) {
2284
- Check_default.typeOf.object("rectangle", rectangle);
2285
- if (!defined_default(result)) {
2286
- return new Cartographic_default(rectangle.west, rectangle.south);
2287
- }
2288
- result.longitude = rectangle.west;
2289
- result.latitude = rectangle.south;
2290
- result.height = 0;
2291
- return result;
2292
- };
2293
- Rectangle.northwest = function(rectangle, result) {
2294
- Check_default.typeOf.object("rectangle", rectangle);
2295
- if (!defined_default(result)) {
2296
- return new Cartographic_default(rectangle.west, rectangle.north);
2297
- }
2298
- result.longitude = rectangle.west;
2299
- result.latitude = rectangle.north;
2300
- result.height = 0;
2301
- return result;
2302
- };
2303
- Rectangle.northeast = function(rectangle, result) {
2304
- Check_default.typeOf.object("rectangle", rectangle);
2305
- if (!defined_default(result)) {
2306
- return new Cartographic_default(rectangle.east, rectangle.north);
2307
- }
2308
- result.longitude = rectangle.east;
2309
- result.latitude = rectangle.north;
2310
- result.height = 0;
2311
- return result;
2312
- };
2313
- Rectangle.southeast = function(rectangle, result) {
2314
- Check_default.typeOf.object("rectangle", rectangle);
2315
- if (!defined_default(result)) {
2316
- return new Cartographic_default(rectangle.east, rectangle.south);
2317
- }
2318
- result.longitude = rectangle.east;
2319
- result.latitude = rectangle.south;
2320
- result.height = 0;
2321
- return result;
2322
- };
2323
- Rectangle.center = function(rectangle, result) {
2324
- Check_default.typeOf.object("rectangle", rectangle);
2325
- let east = rectangle.east;
2326
- const west = rectangle.west;
2327
- if (east < west) {
2328
- east += Math_default.TWO_PI;
2329
- }
2330
- const longitude = Math_default.negativePiToPi((west + east) * 0.5);
2331
- const latitude = (rectangle.south + rectangle.north) * 0.5;
2332
- if (!defined_default(result)) {
2333
- return new Cartographic_default(longitude, latitude);
2334
- }
2335
- result.longitude = longitude;
2336
- result.latitude = latitude;
2337
- result.height = 0;
2338
- return result;
2339
- };
2340
- Rectangle.intersection = function(rectangle, otherRectangle, result) {
2341
- Check_default.typeOf.object("rectangle", rectangle);
2342
- Check_default.typeOf.object("otherRectangle", otherRectangle);
2343
- let rectangleEast = rectangle.east;
2344
- let rectangleWest = rectangle.west;
2345
- let otherRectangleEast = otherRectangle.east;
2346
- let otherRectangleWest = otherRectangle.west;
2347
- if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
2348
- rectangleEast += Math_default.TWO_PI;
2349
- } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
2350
- otherRectangleEast += Math_default.TWO_PI;
2351
- }
2352
- if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
2353
- otherRectangleWest += Math_default.TWO_PI;
2354
- } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
2355
- rectangleWest += Math_default.TWO_PI;
2356
- }
2357
- const west = Math_default.negativePiToPi(
2358
- Math.max(rectangleWest, otherRectangleWest)
2359
- );
2360
- const east = Math_default.negativePiToPi(
2361
- Math.min(rectangleEast, otherRectangleEast)
2362
- );
2363
- if ((rectangle.west < rectangle.east || otherRectangle.west < otherRectangle.east) && east <= west) {
2364
- return void 0;
2365
- }
2366
- const south = Math.max(rectangle.south, otherRectangle.south);
2367
- const north = Math.min(rectangle.north, otherRectangle.north);
2368
- if (south >= north) {
2369
- return void 0;
2370
- }
2371
- if (!defined_default(result)) {
2372
- return new Rectangle(west, south, east, north);
2373
- }
2374
- result.west = west;
2375
- result.south = south;
2376
- result.east = east;
2377
- result.north = north;
2378
- return result;
2379
- };
2380
- Rectangle.simpleIntersection = function(rectangle, otherRectangle, result) {
2381
- Check_default.typeOf.object("rectangle", rectangle);
2382
- Check_default.typeOf.object("otherRectangle", otherRectangle);
2383
- const west = Math.max(rectangle.west, otherRectangle.west);
2384
- const south = Math.max(rectangle.south, otherRectangle.south);
2385
- const east = Math.min(rectangle.east, otherRectangle.east);
2386
- const north = Math.min(rectangle.north, otherRectangle.north);
2387
- if (south >= north || west >= east) {
2388
- return void 0;
2389
- }
2390
- if (!defined_default(result)) {
2391
- return new Rectangle(west, south, east, north);
2392
- }
2393
- result.west = west;
2394
- result.south = south;
2395
- result.east = east;
2396
- result.north = north;
2397
- return result;
2398
- };
2399
- Rectangle.union = function(rectangle, otherRectangle, result) {
2400
- Check_default.typeOf.object("rectangle", rectangle);
2401
- Check_default.typeOf.object("otherRectangle", otherRectangle);
2402
- if (!defined_default(result)) {
2403
- result = new Rectangle();
2404
- }
2405
- let rectangleEast = rectangle.east;
2406
- let rectangleWest = rectangle.west;
2407
- let otherRectangleEast = otherRectangle.east;
2408
- let otherRectangleWest = otherRectangle.west;
2409
- if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
2410
- rectangleEast += Math_default.TWO_PI;
2411
- } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
2412
- otherRectangleEast += Math_default.TWO_PI;
2413
- }
2414
- if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
2415
- otherRectangleWest += Math_default.TWO_PI;
2416
- } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
2417
- rectangleWest += Math_default.TWO_PI;
2418
- }
2419
- const west = Math_default.negativePiToPi(
2420
- Math.min(rectangleWest, otherRectangleWest)
2421
- );
2422
- const east = Math_default.negativePiToPi(
2423
- Math.max(rectangleEast, otherRectangleEast)
2424
- );
2425
- result.west = west;
2426
- result.south = Math.min(rectangle.south, otherRectangle.south);
2427
- result.east = east;
2428
- result.north = Math.max(rectangle.north, otherRectangle.north);
2429
- return result;
2430
- };
2431
- Rectangle.expand = function(rectangle, cartographic, result) {
2432
- Check_default.typeOf.object("rectangle", rectangle);
2433
- Check_default.typeOf.object("cartographic", cartographic);
2434
- if (!defined_default(result)) {
2435
- result = new Rectangle();
2436
- }
2437
- result.west = Math.min(rectangle.west, cartographic.longitude);
2438
- result.south = Math.min(rectangle.south, cartographic.latitude);
2439
- result.east = Math.max(rectangle.east, cartographic.longitude);
2440
- result.north = Math.max(rectangle.north, cartographic.latitude);
2441
- return result;
2442
- };
2443
- Rectangle.contains = function(rectangle, cartographic) {
2444
- Check_default.typeOf.object("rectangle", rectangle);
2445
- Check_default.typeOf.object("cartographic", cartographic);
2446
- let longitude = cartographic.longitude;
2447
- const latitude = cartographic.latitude;
2448
- const west = rectangle.west;
2449
- let east = rectangle.east;
2450
- if (east < west) {
2451
- east += Math_default.TWO_PI;
2452
- if (longitude < 0) {
2453
- longitude += Math_default.TWO_PI;
2454
- }
2455
- }
2456
- return (longitude > west || Math_default.equalsEpsilon(longitude, west, Math_default.EPSILON14)) && (longitude < east || Math_default.equalsEpsilon(longitude, east, Math_default.EPSILON14)) && latitude >= rectangle.south && latitude <= rectangle.north;
2457
- };
2458
- var subsampleLlaScratch = new Cartographic_default();
2459
- Rectangle.subsample = function(rectangle, ellipsoid, surfaceHeight, result) {
2460
- Check_default.typeOf.object("rectangle", rectangle);
2461
- ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
2462
- surfaceHeight = defaultValue_default(surfaceHeight, 0);
2463
- if (!defined_default(result)) {
2464
- result = [];
2465
- }
2466
- let length = 0;
2467
- const north = rectangle.north;
2468
- const south = rectangle.south;
2469
- const east = rectangle.east;
2470
- const west = rectangle.west;
2471
- const lla = subsampleLlaScratch;
2472
- lla.height = surfaceHeight;
2473
- lla.longitude = west;
2474
- lla.latitude = north;
2475
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2476
- length++;
2477
- lla.longitude = east;
2478
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2479
- length++;
2480
- lla.latitude = south;
2481
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2482
- length++;
2483
- lla.longitude = west;
2484
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2485
- length++;
2486
- if (north < 0) {
2487
- lla.latitude = north;
2488
- } else if (south > 0) {
2489
- lla.latitude = south;
2490
- } else {
2491
- lla.latitude = 0;
2492
- }
2493
- for (let i = 1; i < 8; ++i) {
2494
- lla.longitude = -Math.PI + i * Math_default.PI_OVER_TWO;
2495
- if (Rectangle.contains(rectangle, lla)) {
2496
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2497
- length++;
2498
- }
2499
- }
2500
- if (lla.latitude === 0) {
2501
- lla.longitude = west;
2502
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2503
- length++;
2504
- lla.longitude = east;
2505
- result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
2506
- length++;
2507
- }
2508
- result.length = length;
2509
- return result;
2510
- };
2511
- Rectangle.subsection = function(rectangle, westLerp, southLerp, eastLerp, northLerp, result) {
2512
- Check_default.typeOf.object("rectangle", rectangle);
2513
- Check_default.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0);
2514
- Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1);
2515
- Check_default.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0);
2516
- Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1);
2517
- Check_default.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0);
2518
- Check_default.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1);
2519
- Check_default.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0);
2520
- Check_default.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1);
2521
- Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
2522
- Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
2523
- if (!defined_default(result)) {
2524
- result = new Rectangle();
2525
- }
2526
- if (rectangle.west <= rectangle.east) {
2527
- const width = rectangle.east - rectangle.west;
2528
- result.west = rectangle.west + westLerp * width;
2529
- result.east = rectangle.west + eastLerp * width;
2530
- } else {
2531
- const width = Math_default.TWO_PI + rectangle.east - rectangle.west;
2532
- result.west = Math_default.negativePiToPi(rectangle.west + westLerp * width);
2533
- result.east = Math_default.negativePiToPi(rectangle.west + eastLerp * width);
2534
- }
2535
- const height = rectangle.north - rectangle.south;
2536
- result.south = rectangle.south + southLerp * height;
2537
- result.north = rectangle.south + northLerp * height;
2538
- if (westLerp === 1) {
2539
- result.west = rectangle.east;
2540
- }
2541
- if (eastLerp === 1) {
2542
- result.east = rectangle.east;
2543
- }
2544
- if (southLerp === 1) {
2545
- result.south = rectangle.north;
2546
- }
2547
- if (northLerp === 1) {
2548
- result.north = rectangle.north;
2549
- }
2550
- return result;
2551
- };
2552
- Rectangle.MAX_VALUE = Object.freeze(
2553
- new Rectangle(
2554
- -Math.PI,
2555
- -Math_default.PI_OVER_TWO,
2556
- Math.PI,
2557
- Math_default.PI_OVER_TWO
2558
- )
2559
- );
2560
- var Rectangle_default = Rectangle;
2561
-
2562
- // packages/engine/Source/Core/Matrix2.js
2563
- function Matrix2(column0Row0, column1Row0, column0Row1, column1Row1) {
2564
- this[0] = defaultValue_default(column0Row0, 0);
2565
- this[1] = defaultValue_default(column0Row1, 0);
2566
- this[2] = defaultValue_default(column1Row0, 0);
2567
- this[3] = defaultValue_default(column1Row1, 0);
2568
- }
2569
- Matrix2.packedLength = 4;
2570
- Matrix2.pack = function(value, array, startingIndex) {
2571
- Check_default.typeOf.object("value", value);
2572
- Check_default.defined("array", array);
2573
- startingIndex = defaultValue_default(startingIndex, 0);
2574
- array[startingIndex++] = value[0];
2575
- array[startingIndex++] = value[1];
2576
- array[startingIndex++] = value[2];
2577
- array[startingIndex++] = value[3];
2578
- return array;
2579
- };
2580
- Matrix2.unpack = function(array, startingIndex, result) {
2581
- Check_default.defined("array", array);
2582
- startingIndex = defaultValue_default(startingIndex, 0);
2583
- if (!defined_default(result)) {
2584
- result = new Matrix2();
2585
- }
2586
- result[0] = array[startingIndex++];
2587
- result[1] = array[startingIndex++];
2588
- result[2] = array[startingIndex++];
2589
- result[3] = array[startingIndex++];
2590
- return result;
2591
- };
2592
- Matrix2.packArray = function(array, result) {
2593
- Check_default.defined("array", array);
2594
- const length = array.length;
2595
- const resultLength = length * 4;
2596
- if (!defined_default(result)) {
2597
- result = new Array(resultLength);
2598
- } else if (!Array.isArray(result) && result.length !== resultLength) {
2599
- throw new DeveloperError_default(
2600
- "If result is a typed array, it must have exactly array.length * 4 elements"
2601
- );
2602
- } else if (result.length !== resultLength) {
2603
- result.length = resultLength;
2604
- }
2605
- for (let i = 0; i < length; ++i) {
2606
- Matrix2.pack(array[i], result, i * 4);
2607
- }
2608
- return result;
2609
- };
2610
- Matrix2.unpackArray = function(array, result) {
2611
- Check_default.defined("array", array);
2612
- Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
2613
- if (array.length % 4 !== 0) {
2614
- throw new DeveloperError_default("array length must be a multiple of 4.");
2615
- }
2616
- const length = array.length;
2617
- if (!defined_default(result)) {
2618
- result = new Array(length / 4);
2619
- } else {
2620
- result.length = length / 4;
2621
- }
2622
- for (let i = 0; i < length; i += 4) {
2623
- const index = i / 4;
2624
- result[index] = Matrix2.unpack(array, i, result[index]);
2625
- }
2626
- return result;
2627
- };
2628
- Matrix2.clone = function(matrix, result) {
2629
- if (!defined_default(matrix)) {
2630
- return void 0;
2631
- }
2632
- if (!defined_default(result)) {
2633
- return new Matrix2(matrix[0], matrix[2], matrix[1], matrix[3]);
2634
- }
2635
- result[0] = matrix[0];
2636
- result[1] = matrix[1];
2637
- result[2] = matrix[2];
2638
- result[3] = matrix[3];
2639
- return result;
2640
- };
2641
- Matrix2.fromArray = Matrix2.unpack;
2642
- Matrix2.fromColumnMajorArray = function(values, result) {
2643
- Check_default.defined("values", values);
2644
- return Matrix2.clone(values, result);
2645
- };
2646
- Matrix2.fromRowMajorArray = function(values, result) {
2647
- Check_default.defined("values", values);
2648
- if (!defined_default(result)) {
2649
- return new Matrix2(values[0], values[1], values[2], values[3]);
2650
- }
2651
- result[0] = values[0];
2652
- result[1] = values[2];
2653
- result[2] = values[1];
2654
- result[3] = values[3];
2655
- return result;
2656
- };
2657
- Matrix2.fromScale = function(scale, result) {
2658
- Check_default.typeOf.object("scale", scale);
2659
- if (!defined_default(result)) {
2660
- return new Matrix2(scale.x, 0, 0, scale.y);
2661
- }
2662
- result[0] = scale.x;
2663
- result[1] = 0;
2664
- result[2] = 0;
2665
- result[3] = scale.y;
2666
- return result;
2667
- };
2668
- Matrix2.fromUniformScale = function(scale, result) {
2669
- Check_default.typeOf.number("scale", scale);
2670
- if (!defined_default(result)) {
2671
- return new Matrix2(scale, 0, 0, scale);
2672
- }
2673
- result[0] = scale;
2674
- result[1] = 0;
2675
- result[2] = 0;
2676
- result[3] = scale;
2677
- return result;
2678
- };
2679
- Matrix2.fromRotation = function(angle, result) {
2680
- Check_default.typeOf.number("angle", angle);
2681
- const cosAngle = Math.cos(angle);
2682
- const sinAngle = Math.sin(angle);
2683
- if (!defined_default(result)) {
2684
- return new Matrix2(cosAngle, -sinAngle, sinAngle, cosAngle);
2685
- }
2686
- result[0] = cosAngle;
2687
- result[1] = sinAngle;
2688
- result[2] = -sinAngle;
2689
- result[3] = cosAngle;
2690
- return result;
2691
- };
2692
- Matrix2.toArray = function(matrix, result) {
2693
- Check_default.typeOf.object("matrix", matrix);
2694
- if (!defined_default(result)) {
2695
- return [matrix[0], matrix[1], matrix[2], matrix[3]];
2696
- }
2697
- result[0] = matrix[0];
2698
- result[1] = matrix[1];
2699
- result[2] = matrix[2];
2700
- result[3] = matrix[3];
2701
- return result;
2702
- };
2703
- Matrix2.getElementIndex = function(column, row) {
2704
- Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
2705
- Check_default.typeOf.number.lessThanOrEquals("row", row, 1);
2706
- Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
2707
- Check_default.typeOf.number.lessThanOrEquals("column", column, 1);
2708
- return column * 2 + row;
2709
- };
2710
- Matrix2.getColumn = function(matrix, index, result) {
2711
- Check_default.typeOf.object("matrix", matrix);
2712
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
2713
- Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
2714
- Check_default.typeOf.object("result", result);
2715
- const startIndex = index * 2;
2716
- const x = matrix[startIndex];
2717
- const y = matrix[startIndex + 1];
2718
- result.x = x;
2719
- result.y = y;
2720
- return result;
2721
- };
2722
- Matrix2.setColumn = function(matrix, index, cartesian, result) {
2723
- Check_default.typeOf.object("matrix", matrix);
2724
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
2725
- Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
2726
- Check_default.typeOf.object("cartesian", cartesian);
2727
- Check_default.typeOf.object("result", result);
2728
- result = Matrix2.clone(matrix, result);
2729
- const startIndex = index * 2;
2730
- result[startIndex] = cartesian.x;
2731
- result[startIndex + 1] = cartesian.y;
2732
- return result;
2733
- };
2734
- Matrix2.getRow = function(matrix, index, result) {
2735
- Check_default.typeOf.object("matrix", matrix);
2736
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
2737
- Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
2738
- Check_default.typeOf.object("result", result);
2739
- const x = matrix[index];
2740
- const y = matrix[index + 2];
2741
- result.x = x;
2742
- result.y = y;
2743
- return result;
2744
- };
2745
- Matrix2.setRow = function(matrix, index, cartesian, result) {
2746
- Check_default.typeOf.object("matrix", matrix);
2747
- Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
2748
- Check_default.typeOf.number.lessThanOrEquals("index", index, 1);
2749
- Check_default.typeOf.object("cartesian", cartesian);
2750
- Check_default.typeOf.object("result", result);
2751
- result = Matrix2.clone(matrix, result);
2752
- result[index] = cartesian.x;
2753
- result[index + 2] = cartesian.y;
2754
- return result;
2755
- };
2756
- var scaleScratch12 = new Cartesian2_default();
2757
- Matrix2.setScale = function(matrix, scale, result) {
2758
- Check_default.typeOf.object("matrix", matrix);
2759
- Check_default.typeOf.object("scale", scale);
2760
- Check_default.typeOf.object("result", result);
2761
- const existingScale = Matrix2.getScale(matrix, scaleScratch12);
2762
- const scaleRatioX = scale.x / existingScale.x;
2763
- const scaleRatioY = scale.y / existingScale.y;
2764
- result[0] = matrix[0] * scaleRatioX;
2765
- result[1] = matrix[1] * scaleRatioX;
2766
- result[2] = matrix[2] * scaleRatioY;
2767
- result[3] = matrix[3] * scaleRatioY;
2768
- return result;
2769
- };
2770
- var scaleScratch22 = new Cartesian2_default();
2771
- Matrix2.setUniformScale = function(matrix, scale, result) {
2772
- Check_default.typeOf.object("matrix", matrix);
2773
- Check_default.typeOf.number("scale", scale);
2774
- Check_default.typeOf.object("result", result);
2775
- const existingScale = Matrix2.getScale(matrix, scaleScratch22);
2776
- const scaleRatioX = scale / existingScale.x;
2777
- const scaleRatioY = scale / existingScale.y;
2778
- result[0] = matrix[0] * scaleRatioX;
2779
- result[1] = matrix[1] * scaleRatioX;
2780
- result[2] = matrix[2] * scaleRatioY;
2781
- result[3] = matrix[3] * scaleRatioY;
2782
- return result;
2783
- };
2784
- var scratchColumn2 = new Cartesian2_default();
2785
- Matrix2.getScale = function(matrix, result) {
2786
- Check_default.typeOf.object("matrix", matrix);
2787
- Check_default.typeOf.object("result", result);
2788
- result.x = Cartesian2_default.magnitude(
2789
- Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn2)
2790
- );
2791
- result.y = Cartesian2_default.magnitude(
2792
- Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn2)
2793
- );
2794
- return result;
2795
- };
2796
- var scaleScratch32 = new Cartesian2_default();
2797
- Matrix2.getMaximumScale = function(matrix) {
2798
- Matrix2.getScale(matrix, scaleScratch32);
2799
- return Cartesian2_default.maximumComponent(scaleScratch32);
2800
- };
2801
- var scaleScratch42 = new Cartesian2_default();
2802
- Matrix2.setRotation = function(matrix, rotation, result) {
2803
- Check_default.typeOf.object("matrix", matrix);
2804
- Check_default.typeOf.object("result", result);
2805
- const scale = Matrix2.getScale(matrix, scaleScratch42);
2806
- result[0] = rotation[0] * scale.x;
2807
- result[1] = rotation[1] * scale.x;
2808
- result[2] = rotation[2] * scale.y;
2809
- result[3] = rotation[3] * scale.y;
2810
- return result;
2811
- };
2812
- var scaleScratch52 = new Cartesian2_default();
2813
- Matrix2.getRotation = function(matrix, result) {
2814
- Check_default.typeOf.object("matrix", matrix);
2815
- Check_default.typeOf.object("result", result);
2816
- const scale = Matrix2.getScale(matrix, scaleScratch52);
2817
- result[0] = matrix[0] / scale.x;
2818
- result[1] = matrix[1] / scale.x;
2819
- result[2] = matrix[2] / scale.y;
2820
- result[3] = matrix[3] / scale.y;
2821
- return result;
2822
- };
2823
- Matrix2.multiply = function(left, right, result) {
2824
- Check_default.typeOf.object("left", left);
2825
- Check_default.typeOf.object("right", right);
2826
- Check_default.typeOf.object("result", result);
2827
- const column0Row0 = left[0] * right[0] + left[2] * right[1];
2828
- const column1Row0 = left[0] * right[2] + left[2] * right[3];
2829
- const column0Row1 = left[1] * right[0] + left[3] * right[1];
2830
- const column1Row1 = left[1] * right[2] + left[3] * right[3];
2831
- result[0] = column0Row0;
2832
- result[1] = column0Row1;
2833
- result[2] = column1Row0;
2834
- result[3] = column1Row1;
2835
- return result;
2836
- };
2837
- Matrix2.add = function(left, right, result) {
2838
- Check_default.typeOf.object("left", left);
2839
- Check_default.typeOf.object("right", right);
2840
- Check_default.typeOf.object("result", result);
2841
- result[0] = left[0] + right[0];
2842
- result[1] = left[1] + right[1];
2843
- result[2] = left[2] + right[2];
2844
- result[3] = left[3] + right[3];
2845
- return result;
2846
- };
2847
- Matrix2.subtract = function(left, right, result) {
2848
- Check_default.typeOf.object("left", left);
2849
- Check_default.typeOf.object("right", right);
2850
- Check_default.typeOf.object("result", result);
2851
- result[0] = left[0] - right[0];
2852
- result[1] = left[1] - right[1];
2853
- result[2] = left[2] - right[2];
2854
- result[3] = left[3] - right[3];
2855
- return result;
2856
- };
2857
- Matrix2.multiplyByVector = function(matrix, cartesian, result) {
2858
- Check_default.typeOf.object("matrix", matrix);
2859
- Check_default.typeOf.object("cartesian", cartesian);
2860
- Check_default.typeOf.object("result", result);
2861
- const x = matrix[0] * cartesian.x + matrix[2] * cartesian.y;
2862
- const y = matrix[1] * cartesian.x + matrix[3] * cartesian.y;
2863
- result.x = x;
2864
- result.y = y;
2865
- return result;
2866
- };
2867
- Matrix2.multiplyByScalar = function(matrix, scalar, result) {
2868
- Check_default.typeOf.object("matrix", matrix);
2869
- Check_default.typeOf.number("scalar", scalar);
2870
- Check_default.typeOf.object("result", result);
2871
- result[0] = matrix[0] * scalar;
2872
- result[1] = matrix[1] * scalar;
2873
- result[2] = matrix[2] * scalar;
2874
- result[3] = matrix[3] * scalar;
2875
- return result;
2876
- };
2877
- Matrix2.multiplyByScale = function(matrix, scale, result) {
2878
- Check_default.typeOf.object("matrix", matrix);
2879
- Check_default.typeOf.object("scale", scale);
2880
- Check_default.typeOf.object("result", result);
2881
- result[0] = matrix[0] * scale.x;
2882
- result[1] = matrix[1] * scale.x;
2883
- result[2] = matrix[2] * scale.y;
2884
- result[3] = matrix[3] * scale.y;
2885
- return result;
2886
- };
2887
- Matrix2.multiplyByUniformScale = function(matrix, scale, result) {
2888
- Check_default.typeOf.object("matrix", matrix);
2889
- Check_default.typeOf.number("scale", scale);
2890
- Check_default.typeOf.object("result", result);
2891
- result[0] = matrix[0] * scale;
2892
- result[1] = matrix[1] * scale;
2893
- result[2] = matrix[2] * scale;
2894
- result[3] = matrix[3] * scale;
2895
- return result;
2896
- };
2897
- Matrix2.negate = function(matrix, result) {
2898
- Check_default.typeOf.object("matrix", matrix);
2899
- Check_default.typeOf.object("result", result);
2900
- result[0] = -matrix[0];
2901
- result[1] = -matrix[1];
2902
- result[2] = -matrix[2];
2903
- result[3] = -matrix[3];
2904
- return result;
2905
- };
2906
- Matrix2.transpose = function(matrix, result) {
2907
- Check_default.typeOf.object("matrix", matrix);
2908
- Check_default.typeOf.object("result", result);
2909
- const column0Row0 = matrix[0];
2910
- const column0Row1 = matrix[2];
2911
- const column1Row0 = matrix[1];
2912
- const column1Row1 = matrix[3];
2913
- result[0] = column0Row0;
2914
- result[1] = column0Row1;
2915
- result[2] = column1Row0;
2916
- result[3] = column1Row1;
2917
- return result;
2918
- };
2919
- Matrix2.abs = function(matrix, result) {
2920
- Check_default.typeOf.object("matrix", matrix);
2921
- Check_default.typeOf.object("result", result);
2922
- result[0] = Math.abs(matrix[0]);
2923
- result[1] = Math.abs(matrix[1]);
2924
- result[2] = Math.abs(matrix[2]);
2925
- result[3] = Math.abs(matrix[3]);
2926
- return result;
2927
- };
2928
- Matrix2.equals = function(left, right) {
2929
- return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3];
2930
- };
2931
- Matrix2.equalsArray = function(matrix, array, offset) {
2932
- return matrix[0] === array[offset] && matrix[1] === array[offset + 1] && matrix[2] === array[offset + 2] && matrix[3] === array[offset + 3];
2933
- };
2934
- Matrix2.equalsEpsilon = function(left, right, epsilon) {
2935
- epsilon = defaultValue_default(epsilon, 0);
2936
- return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon;
2937
- };
2938
- Matrix2.IDENTITY = Object.freeze(new Matrix2(1, 0, 0, 1));
2939
- Matrix2.ZERO = Object.freeze(new Matrix2(0, 0, 0, 0));
2940
- Matrix2.COLUMN0ROW0 = 0;
2941
- Matrix2.COLUMN0ROW1 = 1;
2942
- Matrix2.COLUMN1ROW0 = 2;
2943
- Matrix2.COLUMN1ROW1 = 3;
2944
- Object.defineProperties(Matrix2.prototype, {
2945
- /**
2946
- * Gets the number of items in the collection.
2947
- * @memberof Matrix2.prototype
2948
- *
2949
- * @type {number}
2950
- */
2951
- length: {
2952
- get: function() {
2953
- return Matrix2.packedLength;
2954
- }
2955
- }
2956
- });
2957
- Matrix2.prototype.clone = function(result) {
2958
- return Matrix2.clone(this, result);
2959
- };
2960
- Matrix2.prototype.equals = function(right) {
2961
- return Matrix2.equals(this, right);
2962
- };
2963
- Matrix2.prototype.equalsEpsilon = function(right, epsilon) {
2964
- return Matrix2.equalsEpsilon(this, right, epsilon);
2965
- };
2966
- Matrix2.prototype.toString = function() {
2967
- return `(${this[0]}, ${this[2]})
2968
- (${this[1]}, ${this[3]})`;
2969
- };
2970
- var Matrix2_default = Matrix2;
2971
-
2972
- export {
2973
- Cartesian4_default,
2974
- Matrix4_default,
2975
- Rectangle_default,
2976
- Matrix2_default
2977
- };