deeptwins-cesium-engine 0.0.3 → 0.0.5
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.
- package/Build/Workers/chunk-25U3LB43.js +139 -0
- package/Build/Workers/chunk-2GSMCVKA.js +837 -0
- package/Build/Workers/chunk-3G3JCTFQ.js +101 -0
- package/Build/Workers/chunk-3GRIO7U2.js +162 -0
- package/Build/Workers/chunk-3ZQ33WD3.js +455 -0
- package/Build/Workers/chunk-4U7LLSJ4.js +288 -0
- package/Build/Workers/chunk-4ZMC542T.js +55 -0
- package/Build/Workers/chunk-57TENMAK.js +37 -0
- package/Build/Workers/chunk-5JCUBAVN.js +387 -0
- package/Build/Workers/chunk-5MAQRQUK.js +102 -0
- package/Build/Workers/chunk-5XRGC6C7.js +299 -0
- package/Build/Workers/chunk-63UAUZT6.js +414 -0
- package/Build/Workers/chunk-6BUOGRYV.js +2058 -0
- package/Build/Workers/chunk-7D5ZXLGY.js +163 -0
- package/Build/Workers/chunk-7N66TCUJ.js +1800 -0
- package/Build/Workers/chunk-AG6ARNCB.js +682 -0
- package/Build/Workers/chunk-ARXSS5JC.js +788 -0
- package/Build/Workers/chunk-BDVACEHF.js +778 -0
- package/Build/Workers/chunk-BU67FVEG.js +97 -0
- package/Build/Workers/chunk-BYC4YR4M.js +352 -0
- package/Build/Workers/chunk-CH66JW7J.js +629 -0
- package/Build/Workers/chunk-CV2CR5WA.js +114 -0
- package/Build/Workers/chunk-DGMXFRAL.js +1443 -0
- package/Build/Workers/chunk-EDP33VH5.js +1054 -0
- package/Build/Workers/chunk-F7AOI3UD.js +73 -0
- package/Build/Workers/chunk-FKKSB7ZT.js +8366 -0
- package/Build/Workers/chunk-FTK6K2HA.js +1483 -0
- package/Build/Workers/chunk-IUPJ4QGV.js +476 -0
- package/Build/Workers/chunk-K7Z6W3PJ.js +368 -0
- package/Build/Workers/chunk-KBCQ5JGP.js +57 -0
- package/Build/Workers/chunk-KKTCNH5B.js +398 -0
- package/Build/Workers/chunk-LCSOUDEK.js +58 -0
- package/Build/Workers/chunk-LE5B7M4M.js +642 -0
- package/Build/Workers/chunk-LPPTJ7CE.js +511 -0
- package/Build/Workers/chunk-M3CFFEB7.js +280 -0
- package/Build/Workers/chunk-NN52QO5J.js +497 -0
- package/Build/Workers/chunk-NO3BDHBF.js +241 -0
- package/Build/Workers/chunk-O2H3UW6F.js +256 -0
- package/Build/Workers/chunk-OLJ7MBC7.js +439 -0
- package/Build/Workers/chunk-OZMVAGFQ.js +2719 -0
- package/Build/Workers/chunk-P3S5BWX6.js +219 -0
- package/Build/Workers/chunk-PLQPDE4E.js +171 -0
- package/Build/Workers/chunk-PYMMZCF6.js +3514 -0
- package/Build/Workers/chunk-QIK67M72.js +692 -0
- package/Build/Workers/chunk-RDQU66WA.js +124 -0
- package/Build/Workers/chunk-S6YC56IM.js +940 -0
- package/Build/Workers/chunk-S7CL5IXE.js +138 -0
- package/Build/Workers/chunk-SCVFHATG.js +1317 -0
- package/Build/Workers/chunk-V3IFABPY.js +44 -0
- package/Build/Workers/chunk-VKRSYA3C.js +1067 -0
- package/Build/Workers/chunk-VXIA6U3E.js +75 -0
- package/Build/Workers/chunk-WKTTAMO3.js +305 -0
- package/Build/Workers/chunk-WMMHNRGJ.js +198 -0
- package/Build/Workers/chunk-WY6ZUQRU.js +55 -0
- package/Build/Workers/chunk-X33W4QLH.js +958 -0
- package/Build/Workers/chunk-ZB5XJVWP.js +1460 -0
- package/Build/Workers/chunk-ZNQU6MNK.js +352 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/README.md +1 -1
- package/Source/Scene/DerivedCommand.js +1 -1
- package/Source/Scene/TextureAtlasRegress.js +558 -0
- package/Source/Scene/VoxelContent.js +1 -1
- package/Source/ThirdParty/Workers/pako_deflate.min.js +2 -0
- package/Source/ThirdParty/Workers/pako_inflate.min.js +2 -0
- package/index.d.ts +1 -1
- package/index.js +28 -27
- package/package.json +7 -11
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.29
|
|
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
|
+
GeographicProjection_default
|
|
28
|
+
} from "./chunk-S6YC56IM.js";
|
|
29
|
+
import {
|
|
30
|
+
Intersect_default
|
|
31
|
+
} from "./chunk-4ZMC542T.js";
|
|
32
|
+
import {
|
|
33
|
+
Rectangle_default
|
|
34
|
+
} from "./chunk-FKKSB7ZT.js";
|
|
35
|
+
import {
|
|
36
|
+
Cartesian2_default,
|
|
37
|
+
Cartographic_default,
|
|
38
|
+
Ellipsoid_default
|
|
39
|
+
} from "./chunk-ZB5XJVWP.js";
|
|
40
|
+
import {
|
|
41
|
+
Check_default
|
|
42
|
+
} from "./chunk-7D5ZXLGY.js";
|
|
43
|
+
import {
|
|
44
|
+
defined_default
|
|
45
|
+
} from "./chunk-VXIA6U3E.js";
|
|
46
|
+
|
|
47
|
+
// packages/engine/Source/Core/BoundingRectangle.js
|
|
48
|
+
function BoundingRectangle(x, y, width, height) {
|
|
49
|
+
this.x = x ?? 0;
|
|
50
|
+
this.y = y ?? 0;
|
|
51
|
+
this.width = width ?? 0;
|
|
52
|
+
this.height = height ?? 0;
|
|
53
|
+
}
|
|
54
|
+
BoundingRectangle.packedLength = 4;
|
|
55
|
+
BoundingRectangle.pack = function(value, array, startingIndex) {
|
|
56
|
+
Check_default.typeOf.object("value", value);
|
|
57
|
+
Check_default.defined("array", array);
|
|
58
|
+
startingIndex = startingIndex ?? 0;
|
|
59
|
+
array[startingIndex++] = value.x;
|
|
60
|
+
array[startingIndex++] = value.y;
|
|
61
|
+
array[startingIndex++] = value.width;
|
|
62
|
+
array[startingIndex] = value.height;
|
|
63
|
+
return array;
|
|
64
|
+
};
|
|
65
|
+
BoundingRectangle.unpack = function(array, startingIndex, result) {
|
|
66
|
+
Check_default.defined("array", array);
|
|
67
|
+
startingIndex = startingIndex ?? 0;
|
|
68
|
+
if (!defined_default(result)) {
|
|
69
|
+
result = new BoundingRectangle();
|
|
70
|
+
}
|
|
71
|
+
result.x = array[startingIndex++];
|
|
72
|
+
result.y = array[startingIndex++];
|
|
73
|
+
result.width = array[startingIndex++];
|
|
74
|
+
result.height = array[startingIndex];
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
BoundingRectangle.fromPoints = function(positions, result) {
|
|
78
|
+
if (!defined_default(result)) {
|
|
79
|
+
result = new BoundingRectangle();
|
|
80
|
+
}
|
|
81
|
+
if (!defined_default(positions) || positions.length === 0) {
|
|
82
|
+
result.x = 0;
|
|
83
|
+
result.y = 0;
|
|
84
|
+
result.width = 0;
|
|
85
|
+
result.height = 0;
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
const length = positions.length;
|
|
89
|
+
let minimumX = positions[0].x;
|
|
90
|
+
let minimumY = positions[0].y;
|
|
91
|
+
let maximumX = positions[0].x;
|
|
92
|
+
let maximumY = positions[0].y;
|
|
93
|
+
for (let i = 1; i < length; i++) {
|
|
94
|
+
const p = positions[i];
|
|
95
|
+
const x = p.x;
|
|
96
|
+
const y = p.y;
|
|
97
|
+
minimumX = Math.min(x, minimumX);
|
|
98
|
+
maximumX = Math.max(x, maximumX);
|
|
99
|
+
minimumY = Math.min(y, minimumY);
|
|
100
|
+
maximumY = Math.max(y, maximumY);
|
|
101
|
+
}
|
|
102
|
+
result.x = minimumX;
|
|
103
|
+
result.y = minimumY;
|
|
104
|
+
result.width = maximumX - minimumX;
|
|
105
|
+
result.height = maximumY - minimumY;
|
|
106
|
+
return result;
|
|
107
|
+
};
|
|
108
|
+
var defaultProjection = new GeographicProjection_default();
|
|
109
|
+
var fromRectangleLowerLeft = new Cartographic_default();
|
|
110
|
+
var fromRectangleUpperRight = new Cartographic_default();
|
|
111
|
+
BoundingRectangle.fromRectangle = function(rectangle, projection, result) {
|
|
112
|
+
if (!defined_default(result)) {
|
|
113
|
+
result = new BoundingRectangle();
|
|
114
|
+
}
|
|
115
|
+
if (!defined_default(rectangle)) {
|
|
116
|
+
result.x = 0;
|
|
117
|
+
result.y = 0;
|
|
118
|
+
result.width = 0;
|
|
119
|
+
result.height = 0;
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
defaultProjection._ellipsoid = Ellipsoid_default.default;
|
|
123
|
+
projection = projection ?? defaultProjection;
|
|
124
|
+
const lowerLeft = projection.project(
|
|
125
|
+
Rectangle_default.southwest(rectangle, fromRectangleLowerLeft)
|
|
126
|
+
);
|
|
127
|
+
const upperRight = projection.project(
|
|
128
|
+
Rectangle_default.northeast(rectangle, fromRectangleUpperRight)
|
|
129
|
+
);
|
|
130
|
+
Cartesian2_default.subtract(upperRight, lowerLeft, upperRight);
|
|
131
|
+
result.x = lowerLeft.x;
|
|
132
|
+
result.y = lowerLeft.y;
|
|
133
|
+
result.width = upperRight.x;
|
|
134
|
+
result.height = upperRight.y;
|
|
135
|
+
return result;
|
|
136
|
+
};
|
|
137
|
+
BoundingRectangle.clone = function(rectangle, result) {
|
|
138
|
+
if (!defined_default(rectangle)) {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
if (!defined_default(result)) {
|
|
142
|
+
return new BoundingRectangle(
|
|
143
|
+
rectangle.x,
|
|
144
|
+
rectangle.y,
|
|
145
|
+
rectangle.width,
|
|
146
|
+
rectangle.height
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
result.x = rectangle.x;
|
|
150
|
+
result.y = rectangle.y;
|
|
151
|
+
result.width = rectangle.width;
|
|
152
|
+
result.height = rectangle.height;
|
|
153
|
+
return result;
|
|
154
|
+
};
|
|
155
|
+
BoundingRectangle.union = function(left, right, result) {
|
|
156
|
+
Check_default.typeOf.object("left", left);
|
|
157
|
+
Check_default.typeOf.object("right", right);
|
|
158
|
+
if (!defined_default(result)) {
|
|
159
|
+
result = new BoundingRectangle();
|
|
160
|
+
}
|
|
161
|
+
const lowerLeftX = Math.min(left.x, right.x);
|
|
162
|
+
const lowerLeftY = Math.min(left.y, right.y);
|
|
163
|
+
const upperRightX = Math.max(left.x + left.width, right.x + right.width);
|
|
164
|
+
const upperRightY = Math.max(left.y + left.height, right.y + right.height);
|
|
165
|
+
result.x = lowerLeftX;
|
|
166
|
+
result.y = lowerLeftY;
|
|
167
|
+
result.width = upperRightX - lowerLeftX;
|
|
168
|
+
result.height = upperRightY - lowerLeftY;
|
|
169
|
+
return result;
|
|
170
|
+
};
|
|
171
|
+
BoundingRectangle.expand = function(rectangle, point, result) {
|
|
172
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
173
|
+
Check_default.typeOf.object("point", point);
|
|
174
|
+
result = BoundingRectangle.clone(rectangle, result);
|
|
175
|
+
const width = point.x - result.x;
|
|
176
|
+
const height = point.y - result.y;
|
|
177
|
+
if (width > result.width) {
|
|
178
|
+
result.width = width;
|
|
179
|
+
} else if (width < 0) {
|
|
180
|
+
result.width -= width;
|
|
181
|
+
result.x = point.x;
|
|
182
|
+
}
|
|
183
|
+
if (height > result.height) {
|
|
184
|
+
result.height = height;
|
|
185
|
+
} else if (height < 0) {
|
|
186
|
+
result.height -= height;
|
|
187
|
+
result.y = point.y;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
};
|
|
191
|
+
BoundingRectangle.intersect = function(left, right) {
|
|
192
|
+
Check_default.typeOf.object("left", left);
|
|
193
|
+
Check_default.typeOf.object("right", right);
|
|
194
|
+
const leftX = left.x;
|
|
195
|
+
const leftY = left.y;
|
|
196
|
+
const rightX = right.x;
|
|
197
|
+
const rightY = right.y;
|
|
198
|
+
if (!(leftX > rightX + right.width || leftX + left.width < rightX || leftY + left.height < rightY || leftY > rightY + right.height)) {
|
|
199
|
+
return Intersect_default.INTERSECTING;
|
|
200
|
+
}
|
|
201
|
+
return Intersect_default.OUTSIDE;
|
|
202
|
+
};
|
|
203
|
+
BoundingRectangle.equals = function(left, right) {
|
|
204
|
+
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
|
|
205
|
+
};
|
|
206
|
+
BoundingRectangle.prototype.clone = function(result) {
|
|
207
|
+
return BoundingRectangle.clone(this, result);
|
|
208
|
+
};
|
|
209
|
+
BoundingRectangle.prototype.intersect = function(right) {
|
|
210
|
+
return BoundingRectangle.intersect(this, right);
|
|
211
|
+
};
|
|
212
|
+
BoundingRectangle.prototype.equals = function(right) {
|
|
213
|
+
return BoundingRectangle.equals(this, right);
|
|
214
|
+
};
|
|
215
|
+
var BoundingRectangle_default = BoundingRectangle;
|
|
216
|
+
|
|
217
|
+
export {
|
|
218
|
+
BoundingRectangle_default
|
|
219
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.29
|
|
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
|
+
Cartesian4_default,
|
|
28
|
+
Matrix4_default
|
|
29
|
+
} from "./chunk-6BUOGRYV.js";
|
|
30
|
+
import {
|
|
31
|
+
Cartesian3_default
|
|
32
|
+
} from "./chunk-DGMXFRAL.js";
|
|
33
|
+
import {
|
|
34
|
+
Math_default
|
|
35
|
+
} from "./chunk-NN52QO5J.js";
|
|
36
|
+
import {
|
|
37
|
+
Check_default,
|
|
38
|
+
DeveloperError_default
|
|
39
|
+
} from "./chunk-7D5ZXLGY.js";
|
|
40
|
+
import {
|
|
41
|
+
defined_default
|
|
42
|
+
} from "./chunk-VXIA6U3E.js";
|
|
43
|
+
|
|
44
|
+
// packages/engine/Source/Core/Plane.js
|
|
45
|
+
function Plane(normal, distance) {
|
|
46
|
+
Check_default.typeOf.object("normal", normal);
|
|
47
|
+
if (!Math_default.equalsEpsilon(
|
|
48
|
+
Cartesian3_default.magnitude(normal),
|
|
49
|
+
1,
|
|
50
|
+
Math_default.EPSILON6
|
|
51
|
+
)) {
|
|
52
|
+
throw new DeveloperError_default("normal must be normalized.");
|
|
53
|
+
}
|
|
54
|
+
Check_default.typeOf.number("distance", distance);
|
|
55
|
+
this.normal = Cartesian3_default.clone(normal);
|
|
56
|
+
this.distance = distance;
|
|
57
|
+
}
|
|
58
|
+
Plane.fromPointNormal = function(point, normal, result) {
|
|
59
|
+
Check_default.typeOf.object("point", point);
|
|
60
|
+
Check_default.typeOf.object("normal", normal);
|
|
61
|
+
if (!Math_default.equalsEpsilon(
|
|
62
|
+
Cartesian3_default.magnitude(normal),
|
|
63
|
+
1,
|
|
64
|
+
Math_default.EPSILON6
|
|
65
|
+
)) {
|
|
66
|
+
throw new DeveloperError_default("normal must be normalized.");
|
|
67
|
+
}
|
|
68
|
+
const distance = -Cartesian3_default.dot(normal, point);
|
|
69
|
+
if (!defined_default(result)) {
|
|
70
|
+
return new Plane(normal, distance);
|
|
71
|
+
}
|
|
72
|
+
Cartesian3_default.clone(normal, result.normal);
|
|
73
|
+
result.distance = distance;
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
var scratchNormal = new Cartesian3_default();
|
|
77
|
+
Plane.fromCartesian4 = function(coefficients, result) {
|
|
78
|
+
Check_default.typeOf.object("coefficients", coefficients);
|
|
79
|
+
const normal = Cartesian3_default.fromCartesian4(coefficients, scratchNormal);
|
|
80
|
+
const distance = coefficients.w;
|
|
81
|
+
if (!Math_default.equalsEpsilon(
|
|
82
|
+
Cartesian3_default.magnitude(normal),
|
|
83
|
+
1,
|
|
84
|
+
Math_default.EPSILON6
|
|
85
|
+
)) {
|
|
86
|
+
throw new DeveloperError_default("normal must be normalized.");
|
|
87
|
+
}
|
|
88
|
+
if (!defined_default(result)) {
|
|
89
|
+
return new Plane(normal, distance);
|
|
90
|
+
}
|
|
91
|
+
Cartesian3_default.clone(normal, result.normal);
|
|
92
|
+
result.distance = distance;
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
Plane.getPointDistance = function(plane, point) {
|
|
96
|
+
Check_default.typeOf.object("plane", plane);
|
|
97
|
+
Check_default.typeOf.object("point", point);
|
|
98
|
+
return Cartesian3_default.dot(plane.normal, point) + plane.distance;
|
|
99
|
+
};
|
|
100
|
+
var scratchCartesian = new Cartesian3_default();
|
|
101
|
+
Plane.projectPointOntoPlane = function(plane, point, result) {
|
|
102
|
+
Check_default.typeOf.object("plane", plane);
|
|
103
|
+
Check_default.typeOf.object("point", point);
|
|
104
|
+
if (!defined_default(result)) {
|
|
105
|
+
result = new Cartesian3_default();
|
|
106
|
+
}
|
|
107
|
+
const pointDistance = Plane.getPointDistance(plane, point);
|
|
108
|
+
const scaledNormal = Cartesian3_default.multiplyByScalar(
|
|
109
|
+
plane.normal,
|
|
110
|
+
pointDistance,
|
|
111
|
+
scratchCartesian
|
|
112
|
+
);
|
|
113
|
+
return Cartesian3_default.subtract(point, scaledNormal, result);
|
|
114
|
+
};
|
|
115
|
+
var scratchInverseTranspose = new Matrix4_default();
|
|
116
|
+
var scratchPlaneCartesian4 = new Cartesian4_default();
|
|
117
|
+
var scratchTransformNormal = new Cartesian3_default();
|
|
118
|
+
Plane.transform = function(plane, transform, result) {
|
|
119
|
+
Check_default.typeOf.object("plane", plane);
|
|
120
|
+
Check_default.typeOf.object("transform", transform);
|
|
121
|
+
const normal = plane.normal;
|
|
122
|
+
const distance = plane.distance;
|
|
123
|
+
const inverseTranspose = Matrix4_default.inverseTranspose(
|
|
124
|
+
transform,
|
|
125
|
+
scratchInverseTranspose
|
|
126
|
+
);
|
|
127
|
+
let planeAsCartesian4 = Cartesian4_default.fromElements(
|
|
128
|
+
normal.x,
|
|
129
|
+
normal.y,
|
|
130
|
+
normal.z,
|
|
131
|
+
distance,
|
|
132
|
+
scratchPlaneCartesian4
|
|
133
|
+
);
|
|
134
|
+
planeAsCartesian4 = Matrix4_default.multiplyByVector(
|
|
135
|
+
inverseTranspose,
|
|
136
|
+
planeAsCartesian4,
|
|
137
|
+
planeAsCartesian4
|
|
138
|
+
);
|
|
139
|
+
const transformedNormal = Cartesian3_default.fromCartesian4(
|
|
140
|
+
planeAsCartesian4,
|
|
141
|
+
scratchTransformNormal
|
|
142
|
+
);
|
|
143
|
+
planeAsCartesian4 = Cartesian4_default.divideByScalar(
|
|
144
|
+
planeAsCartesian4,
|
|
145
|
+
Cartesian3_default.magnitude(transformedNormal),
|
|
146
|
+
planeAsCartesian4
|
|
147
|
+
);
|
|
148
|
+
return Plane.fromCartesian4(planeAsCartesian4, result);
|
|
149
|
+
};
|
|
150
|
+
Plane.clone = function(plane, result) {
|
|
151
|
+
Check_default.typeOf.object("plane", plane);
|
|
152
|
+
if (!defined_default(result)) {
|
|
153
|
+
return new Plane(plane.normal, plane.distance);
|
|
154
|
+
}
|
|
155
|
+
Cartesian3_default.clone(plane.normal, result.normal);
|
|
156
|
+
result.distance = plane.distance;
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
Plane.equals = function(left, right) {
|
|
160
|
+
Check_default.typeOf.object("left", left);
|
|
161
|
+
Check_default.typeOf.object("right", right);
|
|
162
|
+
return left.distance === right.distance && Cartesian3_default.equals(left.normal, right.normal);
|
|
163
|
+
};
|
|
164
|
+
Plane.ORIGIN_XY_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Z, 0));
|
|
165
|
+
Plane.ORIGIN_YZ_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_X, 0));
|
|
166
|
+
Plane.ORIGIN_ZX_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Y, 0));
|
|
167
|
+
var Plane_default = Plane;
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
Plane_default
|
|
171
|
+
};
|