@rtzh/engine 0.0.2 → 0.0.4
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-2APW7KRS.js +101 -0
- package/Build/Workers/chunk-2BLQ3B4Q.js +299 -0
- package/Build/Workers/chunk-2CAIFJD5.js +387 -0
- package/Build/Workers/chunk-3K2PK2OU.js +1045 -0
- package/Build/Workers/chunk-3M5CRHSG.js +288 -0
- package/Build/Workers/chunk-5BIQOSBV.js +55 -0
- package/Build/Workers/chunk-5CSRWY7L.js +280 -0
- package/Build/Workers/chunk-5QTPACZQ.js +455 -0
- package/Build/Workers/chunk-64W2RXA4.js +219 -0
- package/Build/Workers/chunk-6QVMKRJ4.js +3514 -0
- package/Build/Workers/chunk-ACH67MPW.js +1483 -0
- package/Build/Workers/chunk-BJ6WXQOW.js +305 -0
- package/Build/Workers/chunk-BN4WA7LX.js +75 -0
- package/Build/Workers/chunk-BXBGWQ3Z.js +171 -0
- package/Build/Workers/chunk-D7TGILR3.js +1054 -0
- package/Build/Workers/chunk-DBKYAGM6.js +1800 -0
- package/Build/Workers/chunk-DEIMB3B5.js +629 -0
- package/Build/Workers/chunk-DSBEWMOQ.js +1067 -0
- package/Build/Workers/chunk-E2CARZA7.js +73 -0
- package/Build/Workers/chunk-EISI2CR2.js +2058 -0
- package/Build/Workers/chunk-F5LAPCFC.js +1460 -0
- package/Build/Workers/chunk-FJREGHFG.js +138 -0
- package/Build/Workers/chunk-HAWJ7FMN.js +8366 -0
- package/Build/Workers/chunk-HGIGANIQ.js +163 -0
- package/Build/Workers/chunk-HI6X33GO.js +58 -0
- package/Build/Workers/chunk-HU5P7PMU.js +1317 -0
- package/Build/Workers/chunk-IDVURFRN.js +241 -0
- package/Build/Workers/chunk-J3FBVUY4.js +37 -0
- package/Build/Workers/chunk-JH27ZGLN.js +352 -0
- package/Build/Workers/chunk-JURLMTV2.js +398 -0
- package/Build/Workers/chunk-KBAGFNQ4.js +139 -0
- package/Build/Workers/chunk-KHKSE4WQ.js +778 -0
- package/Build/Workers/chunk-KKYQRQ57.js +368 -0
- package/Build/Workers/chunk-KUAWPGSB.js +511 -0
- package/Build/Workers/chunk-KVDSJXRK.js +114 -0
- package/Build/Workers/chunk-KXB3AARU.js +162 -0
- package/Build/Workers/chunk-LN4NMLYY.js +55 -0
- package/Build/Workers/chunk-LPM2FVDN.js +642 -0
- package/Build/Workers/chunk-MLFVICFZ.js +102 -0
- package/Build/Workers/chunk-MQ62ZE2U.js +124 -0
- package/Build/Workers/chunk-NOH3R3YY.js +198 -0
- package/Build/Workers/chunk-OOB2KZC6.js +476 -0
- package/Build/Workers/chunk-OVPPHDU7.js +97 -0
- package/Build/Workers/chunk-P7M4VYFT.js +788 -0
- package/Build/Workers/chunk-PHB5MRHM.js +439 -0
- package/Build/Workers/chunk-TDI7UQBO.js +57 -0
- package/Build/Workers/chunk-U364CIW4.js +682 -0
- package/Build/Workers/chunk-UOD5YNH3.js +940 -0
- package/Build/Workers/chunk-UUJXSLQ2.js +2719 -0
- package/Build/Workers/chunk-VIYQ56Z7.js +837 -0
- package/Build/Workers/chunk-VR2L2Y4Z.js +1443 -0
- package/Build/Workers/chunk-WLREXLZ7.js +414 -0
- package/Build/Workers/chunk-WMGESUDW.js +497 -0
- package/Build/Workers/chunk-XJKMLTSH.js +692 -0
- package/Build/Workers/chunk-YBVMSCW4.js +352 -0
- package/Build/Workers/chunk-Z356SW7E.js +256 -0
- package/Build/Workers/chunk-ZV42SJKS.js +44 -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/Source/Scene/GltfLoader.js +2 -2
- package/Source/Scene/Model/I3dmLoader.js +2 -2
- package/index.js +110 -110
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.4
|
|
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-UOD5YNH3.js";
|
|
29
|
+
import {
|
|
30
|
+
Matrix2_default,
|
|
31
|
+
Rectangle_default
|
|
32
|
+
} from "./chunk-HAWJ7FMN.js";
|
|
33
|
+
import {
|
|
34
|
+
Cartographic_default,
|
|
35
|
+
Ellipsoid_default
|
|
36
|
+
} from "./chunk-F5LAPCFC.js";
|
|
37
|
+
import {
|
|
38
|
+
Cartesian3_default
|
|
39
|
+
} from "./chunk-VR2L2Y4Z.js";
|
|
40
|
+
import {
|
|
41
|
+
Math_default
|
|
42
|
+
} from "./chunk-WMGESUDW.js";
|
|
43
|
+
import {
|
|
44
|
+
DeveloperError_default
|
|
45
|
+
} from "./chunk-HGIGANIQ.js";
|
|
46
|
+
import {
|
|
47
|
+
defined_default
|
|
48
|
+
} from "./chunk-BN4WA7LX.js";
|
|
49
|
+
|
|
50
|
+
// packages/engine/Source/Core/RectangleGeometryLibrary.js
|
|
51
|
+
var cos = Math.cos;
|
|
52
|
+
var sin = Math.sin;
|
|
53
|
+
var sqrt = Math.sqrt;
|
|
54
|
+
var RectangleGeometryLibrary = {};
|
|
55
|
+
RectangleGeometryLibrary.computePosition = function(computedOptions, ellipsoid, computeST, row, col, position, st) {
|
|
56
|
+
const radiiSquared = ellipsoid.radiiSquared;
|
|
57
|
+
const nwCorner = computedOptions.nwCorner;
|
|
58
|
+
const rectangle = computedOptions.boundingRectangle;
|
|
59
|
+
let stLatitude = nwCorner.latitude - computedOptions.granYCos * row + col * computedOptions.granXSin;
|
|
60
|
+
const cosLatitude = cos(stLatitude);
|
|
61
|
+
const nZ = sin(stLatitude);
|
|
62
|
+
const kZ = radiiSquared.z * nZ;
|
|
63
|
+
let stLongitude = nwCorner.longitude + row * computedOptions.granYSin + col * computedOptions.granXCos;
|
|
64
|
+
const nX = cosLatitude * cos(stLongitude);
|
|
65
|
+
const nY = cosLatitude * sin(stLongitude);
|
|
66
|
+
const kX = radiiSquared.x * nX;
|
|
67
|
+
const kY = radiiSquared.y * nY;
|
|
68
|
+
const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);
|
|
69
|
+
position.x = kX / gamma;
|
|
70
|
+
position.y = kY / gamma;
|
|
71
|
+
position.z = kZ / gamma;
|
|
72
|
+
if (computeST) {
|
|
73
|
+
const stNwCorner = computedOptions.stNwCorner;
|
|
74
|
+
if (defined_default(stNwCorner)) {
|
|
75
|
+
stLatitude = stNwCorner.latitude - computedOptions.stGranYCos * row + col * computedOptions.stGranXSin;
|
|
76
|
+
stLongitude = stNwCorner.longitude + row * computedOptions.stGranYSin + col * computedOptions.stGranXCos;
|
|
77
|
+
st.x = (stLongitude - computedOptions.stWest) * computedOptions.lonScalar;
|
|
78
|
+
st.y = (stLatitude - computedOptions.stSouth) * computedOptions.latScalar;
|
|
79
|
+
} else {
|
|
80
|
+
st.x = (stLongitude - rectangle.west) * computedOptions.lonScalar;
|
|
81
|
+
st.y = (stLatitude - rectangle.south) * computedOptions.latScalar;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var rotationMatrixScratch = new Matrix2_default();
|
|
86
|
+
var nwCartesian = new Cartesian3_default();
|
|
87
|
+
var centerScratch = new Cartographic_default();
|
|
88
|
+
var centerCartesian = new Cartesian3_default();
|
|
89
|
+
var proj = new GeographicProjection_default();
|
|
90
|
+
function getRotationOptions(nwCorner, rotation, granularityX, granularityY, center, width, height) {
|
|
91
|
+
const cosRotation = Math.cos(rotation);
|
|
92
|
+
const granYCos = granularityY * cosRotation;
|
|
93
|
+
const granXCos = granularityX * cosRotation;
|
|
94
|
+
const sinRotation = Math.sin(rotation);
|
|
95
|
+
const granYSin = granularityY * sinRotation;
|
|
96
|
+
const granXSin = granularityX * sinRotation;
|
|
97
|
+
proj._ellipsoid = Ellipsoid_default.default;
|
|
98
|
+
nwCartesian = proj.project(nwCorner, nwCartesian);
|
|
99
|
+
nwCartesian = Cartesian3_default.subtract(nwCartesian, centerCartesian, nwCartesian);
|
|
100
|
+
const rotationMatrix = Matrix2_default.fromRotation(rotation, rotationMatrixScratch);
|
|
101
|
+
nwCartesian = Matrix2_default.multiplyByVector(
|
|
102
|
+
rotationMatrix,
|
|
103
|
+
nwCartesian,
|
|
104
|
+
nwCartesian
|
|
105
|
+
);
|
|
106
|
+
nwCartesian = Cartesian3_default.add(nwCartesian, centerCartesian, nwCartesian);
|
|
107
|
+
nwCorner = proj.unproject(nwCartesian, nwCorner);
|
|
108
|
+
width -= 1;
|
|
109
|
+
height -= 1;
|
|
110
|
+
const latitude = nwCorner.latitude;
|
|
111
|
+
const latitude0 = latitude + width * granXSin;
|
|
112
|
+
const latitude1 = latitude - granYCos * height;
|
|
113
|
+
const latitude2 = latitude - granYCos * height + width * granXSin;
|
|
114
|
+
const north = Math.max(latitude, latitude0, latitude1, latitude2);
|
|
115
|
+
const south = Math.min(latitude, latitude0, latitude1, latitude2);
|
|
116
|
+
const longitude = nwCorner.longitude;
|
|
117
|
+
const longitude0 = longitude + width * granXCos;
|
|
118
|
+
const longitude1 = longitude + height * granYSin;
|
|
119
|
+
const longitude2 = longitude + height * granYSin + width * granXCos;
|
|
120
|
+
const east = Math.max(longitude, longitude0, longitude1, longitude2);
|
|
121
|
+
const west = Math.min(longitude, longitude0, longitude1, longitude2);
|
|
122
|
+
return {
|
|
123
|
+
north,
|
|
124
|
+
south,
|
|
125
|
+
east,
|
|
126
|
+
west,
|
|
127
|
+
granYCos,
|
|
128
|
+
granYSin,
|
|
129
|
+
granXCos,
|
|
130
|
+
granXSin,
|
|
131
|
+
nwCorner
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
RectangleGeometryLibrary.computeOptions = function(rectangle, granularity, rotation, stRotation, boundingRectangleScratch, nwCornerResult, stNwCornerResult) {
|
|
135
|
+
let east = rectangle.east;
|
|
136
|
+
let west = rectangle.west;
|
|
137
|
+
let north = rectangle.north;
|
|
138
|
+
let south = rectangle.south;
|
|
139
|
+
let northCap = false;
|
|
140
|
+
let southCap = false;
|
|
141
|
+
if (north === Math_default.PI_OVER_TWO) {
|
|
142
|
+
northCap = true;
|
|
143
|
+
}
|
|
144
|
+
if (south === -Math_default.PI_OVER_TWO) {
|
|
145
|
+
southCap = true;
|
|
146
|
+
}
|
|
147
|
+
let dx;
|
|
148
|
+
const dy = north - south;
|
|
149
|
+
if (west > east) {
|
|
150
|
+
dx = Math_default.TWO_PI - west + east;
|
|
151
|
+
} else {
|
|
152
|
+
dx = east - west;
|
|
153
|
+
}
|
|
154
|
+
const width = Math.ceil(dx / granularity) + 1;
|
|
155
|
+
const height = Math.ceil(dy / granularity) + 1;
|
|
156
|
+
const granularityX = dx / (width - 1);
|
|
157
|
+
const granularityY = dy / (height - 1);
|
|
158
|
+
const nwCorner = Rectangle_default.northwest(rectangle, nwCornerResult);
|
|
159
|
+
const center = Rectangle_default.center(rectangle, centerScratch);
|
|
160
|
+
if (rotation !== 0 || stRotation !== 0) {
|
|
161
|
+
if (center.longitude < nwCorner.longitude) {
|
|
162
|
+
center.longitude += Math_default.TWO_PI;
|
|
163
|
+
}
|
|
164
|
+
proj._ellipsoid = Ellipsoid_default.default;
|
|
165
|
+
centerCartesian = proj.project(center, centerCartesian);
|
|
166
|
+
}
|
|
167
|
+
const granYCos = granularityY;
|
|
168
|
+
const granXCos = granularityX;
|
|
169
|
+
const granYSin = 0;
|
|
170
|
+
const granXSin = 0;
|
|
171
|
+
const boundingRectangle = Rectangle_default.clone(
|
|
172
|
+
rectangle,
|
|
173
|
+
boundingRectangleScratch
|
|
174
|
+
);
|
|
175
|
+
const computedOptions = {
|
|
176
|
+
granYCos,
|
|
177
|
+
granYSin,
|
|
178
|
+
granXCos,
|
|
179
|
+
granXSin,
|
|
180
|
+
nwCorner,
|
|
181
|
+
boundingRectangle,
|
|
182
|
+
width,
|
|
183
|
+
height,
|
|
184
|
+
northCap,
|
|
185
|
+
southCap
|
|
186
|
+
};
|
|
187
|
+
if (rotation !== 0) {
|
|
188
|
+
const rotationOptions = getRotationOptions(
|
|
189
|
+
nwCorner,
|
|
190
|
+
rotation,
|
|
191
|
+
granularityX,
|
|
192
|
+
granularityY,
|
|
193
|
+
center,
|
|
194
|
+
width,
|
|
195
|
+
height
|
|
196
|
+
);
|
|
197
|
+
north = rotationOptions.north;
|
|
198
|
+
south = rotationOptions.south;
|
|
199
|
+
east = rotationOptions.east;
|
|
200
|
+
west = rotationOptions.west;
|
|
201
|
+
if (north < -Math_default.PI_OVER_TWO || north > Math_default.PI_OVER_TWO || south < -Math_default.PI_OVER_TWO || south > Math_default.PI_OVER_TWO) {
|
|
202
|
+
throw new DeveloperError_default(
|
|
203
|
+
"Rotated rectangle is invalid. It crosses over either the north or south pole."
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
computedOptions.granYCos = rotationOptions.granYCos;
|
|
207
|
+
computedOptions.granYSin = rotationOptions.granYSin;
|
|
208
|
+
computedOptions.granXCos = rotationOptions.granXCos;
|
|
209
|
+
computedOptions.granXSin = rotationOptions.granXSin;
|
|
210
|
+
boundingRectangle.north = north;
|
|
211
|
+
boundingRectangle.south = south;
|
|
212
|
+
boundingRectangle.east = east;
|
|
213
|
+
boundingRectangle.west = west;
|
|
214
|
+
}
|
|
215
|
+
if (stRotation !== 0) {
|
|
216
|
+
rotation = rotation - stRotation;
|
|
217
|
+
const stNwCorner = Rectangle_default.northwest(boundingRectangle, stNwCornerResult);
|
|
218
|
+
const stRotationOptions = getRotationOptions(
|
|
219
|
+
stNwCorner,
|
|
220
|
+
rotation,
|
|
221
|
+
granularityX,
|
|
222
|
+
granularityY,
|
|
223
|
+
center,
|
|
224
|
+
width,
|
|
225
|
+
height
|
|
226
|
+
);
|
|
227
|
+
computedOptions.stGranYCos = stRotationOptions.granYCos;
|
|
228
|
+
computedOptions.stGranXCos = stRotationOptions.granXCos;
|
|
229
|
+
computedOptions.stGranYSin = stRotationOptions.granYSin;
|
|
230
|
+
computedOptions.stGranXSin = stRotationOptions.granXSin;
|
|
231
|
+
computedOptions.stNwCorner = stNwCorner;
|
|
232
|
+
computedOptions.stWest = stRotationOptions.west;
|
|
233
|
+
computedOptions.stSouth = stRotationOptions.south;
|
|
234
|
+
}
|
|
235
|
+
return computedOptions;
|
|
236
|
+
};
|
|
237
|
+
var RectangleGeometryLibrary_default = RectangleGeometryLibrary;
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
RectangleGeometryLibrary_default
|
|
241
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.4
|
|
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
|
+
|
|
27
|
+
// packages/engine/Source/Core/GeometryOffsetAttribute.js
|
|
28
|
+
var GeometryOffsetAttribute = {
|
|
29
|
+
NONE: 0,
|
|
30
|
+
TOP: 1,
|
|
31
|
+
ALL: 2
|
|
32
|
+
};
|
|
33
|
+
var GeometryOffsetAttribute_default = Object.freeze(GeometryOffsetAttribute);
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
GeometryOffsetAttribute_default
|
|
37
|
+
};
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.4
|
|
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
|
+
Cartographic_default,
|
|
28
|
+
Ellipsoid_default
|
|
29
|
+
} from "./chunk-F5LAPCFC.js";
|
|
30
|
+
import {
|
|
31
|
+
Cartesian3_default
|
|
32
|
+
} from "./chunk-VR2L2Y4Z.js";
|
|
33
|
+
import {
|
|
34
|
+
Math_default
|
|
35
|
+
} from "./chunk-WMGESUDW.js";
|
|
36
|
+
import {
|
|
37
|
+
Check_default
|
|
38
|
+
} from "./chunk-HGIGANIQ.js";
|
|
39
|
+
import {
|
|
40
|
+
defined_default
|
|
41
|
+
} from "./chunk-BN4WA7LX.js";
|
|
42
|
+
|
|
43
|
+
// packages/engine/Source/Core/EllipsoidGeodesic.js
|
|
44
|
+
function setConstants(ellipsoidGeodesic) {
|
|
45
|
+
const uSquared = ellipsoidGeodesic._uSquared;
|
|
46
|
+
const a = ellipsoidGeodesic._ellipsoid.maximumRadius;
|
|
47
|
+
const b = ellipsoidGeodesic._ellipsoid.minimumRadius;
|
|
48
|
+
const f = (a - b) / a;
|
|
49
|
+
const cosineHeading = Math.cos(ellipsoidGeodesic._startHeading);
|
|
50
|
+
const sineHeading = Math.sin(ellipsoidGeodesic._startHeading);
|
|
51
|
+
const tanU = (1 - f) * Math.tan(ellipsoidGeodesic._start.latitude);
|
|
52
|
+
const cosineU = 1 / Math.sqrt(1 + tanU * tanU);
|
|
53
|
+
const sineU = cosineU * tanU;
|
|
54
|
+
const sigma = Math.atan2(tanU, cosineHeading);
|
|
55
|
+
const sineAlpha = cosineU * sineHeading;
|
|
56
|
+
const sineSquaredAlpha = sineAlpha * sineAlpha;
|
|
57
|
+
const cosineSquaredAlpha = 1 - sineSquaredAlpha;
|
|
58
|
+
const cosineAlpha = Math.sqrt(cosineSquaredAlpha);
|
|
59
|
+
const u2Over4 = uSquared / 4;
|
|
60
|
+
const u4Over16 = u2Over4 * u2Over4;
|
|
61
|
+
const u6Over64 = u4Over16 * u2Over4;
|
|
62
|
+
const u8Over256 = u4Over16 * u4Over16;
|
|
63
|
+
const a0 = 1 + u2Over4 - 3 * u4Over16 / 4 + 5 * u6Over64 / 4 - 175 * u8Over256 / 64;
|
|
64
|
+
const a1 = 1 - u2Over4 + 15 * u4Over16 / 8 - 35 * u6Over64 / 8;
|
|
65
|
+
const a2 = 1 - 3 * u2Over4 + 35 * u4Over16 / 4;
|
|
66
|
+
const a3 = 1 - 5 * u2Over4;
|
|
67
|
+
const distanceRatio = a0 * sigma - a1 * Math.sin(2 * sigma) * u2Over4 / 2 - a2 * Math.sin(4 * sigma) * u4Over16 / 16 - a3 * Math.sin(6 * sigma) * u6Over64 / 48 - Math.sin(8 * sigma) * 5 * u8Over256 / 512;
|
|
68
|
+
const constants = ellipsoidGeodesic._constants;
|
|
69
|
+
constants.a = a;
|
|
70
|
+
constants.b = b;
|
|
71
|
+
constants.f = f;
|
|
72
|
+
constants.cosineHeading = cosineHeading;
|
|
73
|
+
constants.sineHeading = sineHeading;
|
|
74
|
+
constants.tanU = tanU;
|
|
75
|
+
constants.cosineU = cosineU;
|
|
76
|
+
constants.sineU = sineU;
|
|
77
|
+
constants.sigma = sigma;
|
|
78
|
+
constants.sineAlpha = sineAlpha;
|
|
79
|
+
constants.sineSquaredAlpha = sineSquaredAlpha;
|
|
80
|
+
constants.cosineSquaredAlpha = cosineSquaredAlpha;
|
|
81
|
+
constants.cosineAlpha = cosineAlpha;
|
|
82
|
+
constants.u2Over4 = u2Over4;
|
|
83
|
+
constants.u4Over16 = u4Over16;
|
|
84
|
+
constants.u6Over64 = u6Over64;
|
|
85
|
+
constants.u8Over256 = u8Over256;
|
|
86
|
+
constants.a0 = a0;
|
|
87
|
+
constants.a1 = a1;
|
|
88
|
+
constants.a2 = a2;
|
|
89
|
+
constants.a3 = a3;
|
|
90
|
+
constants.distanceRatio = distanceRatio;
|
|
91
|
+
}
|
|
92
|
+
function computeC(f, cosineSquaredAlpha) {
|
|
93
|
+
return f * cosineSquaredAlpha * (4 + f * (4 - 3 * cosineSquaredAlpha)) / 16;
|
|
94
|
+
}
|
|
95
|
+
function computeDeltaLambda(f, sineAlpha, cosineSquaredAlpha, sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint) {
|
|
96
|
+
const C = computeC(f, cosineSquaredAlpha);
|
|
97
|
+
return (1 - C) * f * sineAlpha * (sigma + C * sineSigma * (cosineTwiceSigmaMidpoint + C * cosineSigma * (2 * cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint - 1)));
|
|
98
|
+
}
|
|
99
|
+
function vincentyInverseFormula(ellipsoidGeodesic, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
|
|
100
|
+
const eff = (major - minor) / major;
|
|
101
|
+
const l = secondLongitude - firstLongitude;
|
|
102
|
+
const u1 = Math.atan((1 - eff) * Math.tan(firstLatitude));
|
|
103
|
+
const u2 = Math.atan((1 - eff) * Math.tan(secondLatitude));
|
|
104
|
+
const cosineU1 = Math.cos(u1);
|
|
105
|
+
const sineU1 = Math.sin(u1);
|
|
106
|
+
const cosineU2 = Math.cos(u2);
|
|
107
|
+
const sineU2 = Math.sin(u2);
|
|
108
|
+
const cc = cosineU1 * cosineU2;
|
|
109
|
+
const cs = cosineU1 * sineU2;
|
|
110
|
+
const ss = sineU1 * sineU2;
|
|
111
|
+
const sc = sineU1 * cosineU2;
|
|
112
|
+
let lambda = l;
|
|
113
|
+
let lambdaDot = Math_default.TWO_PI;
|
|
114
|
+
let cosineLambda = Math.cos(lambda);
|
|
115
|
+
let sineLambda = Math.sin(lambda);
|
|
116
|
+
let sigma;
|
|
117
|
+
let cosineSigma;
|
|
118
|
+
let sineSigma;
|
|
119
|
+
let cosineSquaredAlpha;
|
|
120
|
+
let cosineTwiceSigmaMidpoint;
|
|
121
|
+
do {
|
|
122
|
+
cosineLambda = Math.cos(lambda);
|
|
123
|
+
sineLambda = Math.sin(lambda);
|
|
124
|
+
const temp = cs - sc * cosineLambda;
|
|
125
|
+
sineSigma = Math.sqrt(
|
|
126
|
+
cosineU2 * cosineU2 * sineLambda * sineLambda + temp * temp
|
|
127
|
+
);
|
|
128
|
+
cosineSigma = ss + cc * cosineLambda;
|
|
129
|
+
sigma = Math.atan2(sineSigma, cosineSigma);
|
|
130
|
+
let sineAlpha;
|
|
131
|
+
if (sineSigma === 0) {
|
|
132
|
+
sineAlpha = 0;
|
|
133
|
+
cosineSquaredAlpha = 1;
|
|
134
|
+
} else {
|
|
135
|
+
sineAlpha = cc * sineLambda / sineSigma;
|
|
136
|
+
cosineSquaredAlpha = 1 - sineAlpha * sineAlpha;
|
|
137
|
+
}
|
|
138
|
+
lambdaDot = lambda;
|
|
139
|
+
cosineTwiceSigmaMidpoint = cosineSigma - 2 * ss / cosineSquaredAlpha;
|
|
140
|
+
if (!isFinite(cosineTwiceSigmaMidpoint)) {
|
|
141
|
+
cosineTwiceSigmaMidpoint = 0;
|
|
142
|
+
}
|
|
143
|
+
lambda = l + computeDeltaLambda(
|
|
144
|
+
eff,
|
|
145
|
+
sineAlpha,
|
|
146
|
+
cosineSquaredAlpha,
|
|
147
|
+
sigma,
|
|
148
|
+
sineSigma,
|
|
149
|
+
cosineSigma,
|
|
150
|
+
cosineTwiceSigmaMidpoint
|
|
151
|
+
);
|
|
152
|
+
} while (Math.abs(lambda - lambdaDot) > Math_default.EPSILON12);
|
|
153
|
+
const uSquared = cosineSquaredAlpha * (major * major - minor * minor) / (minor * minor);
|
|
154
|
+
const A = 1 + uSquared * (4096 + uSquared * (uSquared * (320 - 175 * uSquared) - 768)) / 16384;
|
|
155
|
+
const B = uSquared * (256 + uSquared * (uSquared * (74 - 47 * uSquared) - 128)) / 1024;
|
|
156
|
+
const cosineSquaredTwiceSigmaMidpoint = cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint;
|
|
157
|
+
const deltaSigma = B * sineSigma * (cosineTwiceSigmaMidpoint + B * (cosineSigma * (2 * cosineSquaredTwiceSigmaMidpoint - 1) - B * cosineTwiceSigmaMidpoint * (4 * sineSigma * sineSigma - 3) * (4 * cosineSquaredTwiceSigmaMidpoint - 3) / 6) / 4);
|
|
158
|
+
const distance = minor * A * (sigma - deltaSigma);
|
|
159
|
+
const startHeading = Math.atan2(
|
|
160
|
+
cosineU2 * sineLambda,
|
|
161
|
+
cs - sc * cosineLambda
|
|
162
|
+
);
|
|
163
|
+
const endHeading = Math.atan2(cosineU1 * sineLambda, cs * cosineLambda - sc);
|
|
164
|
+
ellipsoidGeodesic._distance = distance;
|
|
165
|
+
ellipsoidGeodesic._startHeading = startHeading;
|
|
166
|
+
ellipsoidGeodesic._endHeading = endHeading;
|
|
167
|
+
ellipsoidGeodesic._uSquared = uSquared;
|
|
168
|
+
}
|
|
169
|
+
var scratchCart1 = new Cartesian3_default();
|
|
170
|
+
var scratchCart2 = new Cartesian3_default();
|
|
171
|
+
function computeProperties(ellipsoidGeodesic, start, end, ellipsoid) {
|
|
172
|
+
const firstCartesian = Cartesian3_default.normalize(
|
|
173
|
+
ellipsoid.cartographicToCartesian(start, scratchCart2),
|
|
174
|
+
scratchCart1
|
|
175
|
+
);
|
|
176
|
+
const lastCartesian = Cartesian3_default.normalize(
|
|
177
|
+
ellipsoid.cartographicToCartesian(end, scratchCart2),
|
|
178
|
+
scratchCart2
|
|
179
|
+
);
|
|
180
|
+
Check_default.typeOf.number.greaterThanOrEquals(
|
|
181
|
+
"value",
|
|
182
|
+
Math.abs(
|
|
183
|
+
Math.abs(Cartesian3_default.angleBetween(firstCartesian, lastCartesian)) - Math.PI
|
|
184
|
+
),
|
|
185
|
+
0.0125
|
|
186
|
+
);
|
|
187
|
+
vincentyInverseFormula(
|
|
188
|
+
ellipsoidGeodesic,
|
|
189
|
+
ellipsoid.maximumRadius,
|
|
190
|
+
ellipsoid.minimumRadius,
|
|
191
|
+
start.longitude,
|
|
192
|
+
start.latitude,
|
|
193
|
+
end.longitude,
|
|
194
|
+
end.latitude
|
|
195
|
+
);
|
|
196
|
+
ellipsoidGeodesic._start = Cartographic_default.clone(
|
|
197
|
+
start,
|
|
198
|
+
ellipsoidGeodesic._start
|
|
199
|
+
);
|
|
200
|
+
ellipsoidGeodesic._end = Cartographic_default.clone(end, ellipsoidGeodesic._end);
|
|
201
|
+
ellipsoidGeodesic._start.height = 0;
|
|
202
|
+
ellipsoidGeodesic._end.height = 0;
|
|
203
|
+
setConstants(ellipsoidGeodesic);
|
|
204
|
+
}
|
|
205
|
+
function EllipsoidGeodesic(start, end, ellipsoid) {
|
|
206
|
+
const e = ellipsoid ?? Ellipsoid_default.default;
|
|
207
|
+
this._ellipsoid = e;
|
|
208
|
+
this._start = new Cartographic_default();
|
|
209
|
+
this._end = new Cartographic_default();
|
|
210
|
+
this._constants = {};
|
|
211
|
+
this._startHeading = void 0;
|
|
212
|
+
this._endHeading = void 0;
|
|
213
|
+
this._distance = void 0;
|
|
214
|
+
this._uSquared = void 0;
|
|
215
|
+
if (defined_default(start) && defined_default(end)) {
|
|
216
|
+
computeProperties(this, start, end, e);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
Object.defineProperties(EllipsoidGeodesic.prototype, {
|
|
220
|
+
/**
|
|
221
|
+
* Gets the ellipsoid.
|
|
222
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
223
|
+
* @type {Ellipsoid}
|
|
224
|
+
* @readonly
|
|
225
|
+
*/
|
|
226
|
+
ellipsoid: {
|
|
227
|
+
get: function() {
|
|
228
|
+
return this._ellipsoid;
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Gets the surface distance between the start and end point
|
|
233
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
234
|
+
* @type {number}
|
|
235
|
+
* @readonly
|
|
236
|
+
*/
|
|
237
|
+
surfaceDistance: {
|
|
238
|
+
get: function() {
|
|
239
|
+
Check_default.defined("distance", this._distance);
|
|
240
|
+
return this._distance;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Gets the initial planetodetic point on the path.
|
|
245
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
246
|
+
* @type {Cartographic}
|
|
247
|
+
* @readonly
|
|
248
|
+
*/
|
|
249
|
+
start: {
|
|
250
|
+
get: function() {
|
|
251
|
+
return this._start;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* Gets the final planetodetic point on the path.
|
|
256
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
257
|
+
* @type {Cartographic}
|
|
258
|
+
* @readonly
|
|
259
|
+
*/
|
|
260
|
+
end: {
|
|
261
|
+
get: function() {
|
|
262
|
+
return this._end;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
/**
|
|
266
|
+
* Gets the heading at the initial point.
|
|
267
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
268
|
+
* @type {number}
|
|
269
|
+
* @readonly
|
|
270
|
+
*/
|
|
271
|
+
startHeading: {
|
|
272
|
+
get: function() {
|
|
273
|
+
Check_default.defined("distance", this._distance);
|
|
274
|
+
return this._startHeading;
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Gets the heading at the final point.
|
|
279
|
+
* @memberof EllipsoidGeodesic.prototype
|
|
280
|
+
* @type {number}
|
|
281
|
+
* @readonly
|
|
282
|
+
*/
|
|
283
|
+
endHeading: {
|
|
284
|
+
get: function() {
|
|
285
|
+
Check_default.defined("distance", this._distance);
|
|
286
|
+
return this._endHeading;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
EllipsoidGeodesic.prototype.setEndPoints = function(start, end) {
|
|
291
|
+
Check_default.defined("start", start);
|
|
292
|
+
Check_default.defined("end", end);
|
|
293
|
+
computeProperties(this, start, end, this._ellipsoid);
|
|
294
|
+
};
|
|
295
|
+
EllipsoidGeodesic.prototype.interpolateUsingFraction = function(fraction, result) {
|
|
296
|
+
return this.interpolateUsingSurfaceDistance(
|
|
297
|
+
this._distance * fraction,
|
|
298
|
+
result
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance, result) {
|
|
302
|
+
Check_default.defined("distance", this._distance);
|
|
303
|
+
const constants = this._constants;
|
|
304
|
+
const s = constants.distanceRatio + distance / constants.b;
|
|
305
|
+
const cosine2S = Math.cos(2 * s);
|
|
306
|
+
const cosine4S = Math.cos(4 * s);
|
|
307
|
+
const cosine6S = Math.cos(6 * s);
|
|
308
|
+
const sine2S = Math.sin(2 * s);
|
|
309
|
+
const sine4S = Math.sin(4 * s);
|
|
310
|
+
const sine6S = Math.sin(6 * s);
|
|
311
|
+
const sine8S = Math.sin(8 * s);
|
|
312
|
+
const s2 = s * s;
|
|
313
|
+
const s3 = s * s2;
|
|
314
|
+
const u8Over256 = constants.u8Over256;
|
|
315
|
+
const u2Over4 = constants.u2Over4;
|
|
316
|
+
const u6Over64 = constants.u6Over64;
|
|
317
|
+
const u4Over16 = constants.u4Over16;
|
|
318
|
+
let sigma = 2 * s3 * u8Over256 * cosine2S / 3 + s * (1 - u2Over4 + 7 * u4Over16 / 4 - 15 * u6Over64 / 4 + 579 * u8Over256 / 64 - (u4Over16 - 15 * u6Over64 / 4 + 187 * u8Over256 / 16) * cosine2S - (5 * u6Over64 / 4 - 115 * u8Over256 / 16) * cosine4S - 29 * u8Over256 * cosine6S / 16) + (u2Over4 / 2 - u4Over16 + 71 * u6Over64 / 32 - 85 * u8Over256 / 16) * sine2S + (5 * u4Over16 / 16 - 5 * u6Over64 / 4 + 383 * u8Over256 / 96) * sine4S - s2 * ((u6Over64 - 11 * u8Over256 / 2) * sine2S + 5 * u8Over256 * sine4S / 2) + (29 * u6Over64 / 96 - 29 * u8Over256 / 16) * sine6S + 539 * u8Over256 * sine8S / 1536;
|
|
319
|
+
const theta = Math.asin(Math.sin(sigma) * constants.cosineAlpha);
|
|
320
|
+
const latitude = Math.atan(constants.a / constants.b * Math.tan(theta));
|
|
321
|
+
sigma = sigma - constants.sigma;
|
|
322
|
+
const cosineTwiceSigmaMidpoint = Math.cos(2 * constants.sigma + sigma);
|
|
323
|
+
const sineSigma = Math.sin(sigma);
|
|
324
|
+
const cosineSigma = Math.cos(sigma);
|
|
325
|
+
const cc = constants.cosineU * cosineSigma;
|
|
326
|
+
const ss = constants.sineU * sineSigma;
|
|
327
|
+
const lambda = Math.atan2(
|
|
328
|
+
sineSigma * constants.sineHeading,
|
|
329
|
+
cc - ss * constants.cosineHeading
|
|
330
|
+
);
|
|
331
|
+
const l = lambda - computeDeltaLambda(
|
|
332
|
+
constants.f,
|
|
333
|
+
constants.sineAlpha,
|
|
334
|
+
constants.cosineSquaredAlpha,
|
|
335
|
+
sigma,
|
|
336
|
+
sineSigma,
|
|
337
|
+
cosineSigma,
|
|
338
|
+
cosineTwiceSigmaMidpoint
|
|
339
|
+
);
|
|
340
|
+
if (defined_default(result)) {
|
|
341
|
+
result.longitude = this._start.longitude + l;
|
|
342
|
+
result.latitude = latitude;
|
|
343
|
+
result.height = 0;
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
return new Cartographic_default(this._start.longitude + l, latitude, 0);
|
|
347
|
+
};
|
|
348
|
+
var EllipsoidGeodesic_default = EllipsoidGeodesic;
|
|
349
|
+
|
|
350
|
+
export {
|
|
351
|
+
EllipsoidGeodesic_default
|
|
352
|
+
};
|