@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.
- package/Build/ThirdParty/Workers/z-worker-pako.js +7 -10
- package/Build/Workers/{chunk-F4HFJMGM.js → chunk-2CSEEWHN.js} +6 -6
- package/Build/Workers/{chunk-7TC63SJW.js → chunk-34DGOKCO.js} +10 -12
- package/Build/Workers/{chunk-7ZFGPDJA.js → chunk-3RZK5NNV.js} +4 -4
- package/Build/Workers/{chunk-M7ERACJJ.js → chunk-3S2MFY4B.js} +13 -13
- package/Build/Workers/{chunk-BROJAZRZ.js → chunk-4AJGCQFX.js} +13 -13
- package/Build/Workers/{chunk-2FWRMUTY.js → chunk-4KIUON73.js} +4 -4
- package/Build/Workers/{chunk-5QULIR53.js → chunk-4PHPQRSH.js} +4 -4
- package/Build/Workers/{chunk-X4356LRH.js → chunk-66E3H2KU.js} +12 -12
- package/Build/Workers/{chunk-G43QFN4Q.js → chunk-6HCAQOVK.js} +6 -6
- package/Build/Workers/{chunk-23UFSGND.js → chunk-7LPEGKOF.js} +7 -7
- package/Build/Workers/{chunk-DDUQAJ4P.js → chunk-7VZNXIKG.js} +7 -7
- package/Build/Workers/{chunk-JURN7NPV.js → chunk-A6NCZSL3.js} +19 -19
- package/Build/Workers/{chunk-ZT7KWISZ.js → chunk-AOFMPKUB.js} +4 -4
- package/Build/Workers/{chunk-BIKA3NRA.js → chunk-AOIKO5Y7.js} +5 -5
- package/Build/Workers/{chunk-YWTJ2B4B.js → chunk-BDUJXBVF.js} +1 -1
- package/Build/Workers/{chunk-OGXZVPPM.js → chunk-C5CE4OG6.js} +469 -6
- package/Build/Workers/{chunk-FNIRWHJB.js → chunk-CE6GTZ4I.js} +11 -13
- package/Build/Workers/{chunk-SH5USDPI.js → chunk-CYAJYEKW.js} +6 -6
- package/Build/Workers/{chunk-Y5UQJLYE.js → chunk-FOZQIHZK.js} +6 -6
- package/Build/Workers/{chunk-2FRVPMCS.js → chunk-G7CJQKKD.js} +7 -7
- package/Build/Workers/{chunk-EERJKOAF.js → chunk-GIFJ77E4.js} +4 -4
- package/Build/Workers/{chunk-FJKNFAKQ.js → chunk-I5TDPPC4.js} +7197 -5096
- package/Build/Workers/{chunk-3VAZEH7M.js → chunk-IBXGK4WV.js} +2 -2
- package/Build/Workers/{chunk-VOXYEYJT.js → chunk-JI2445T5.js} +11 -11
- package/Build/Workers/{chunk-PGSJK77E.js → chunk-KPY4F4BW.js} +6 -6
- package/Build/Workers/{chunk-I46ZRR5W.js → chunk-LVJCR7DH.js} +17 -17
- package/Build/Workers/{chunk-T3XIFPYR.js → chunk-LW7WGHEU.js} +16 -16
- package/Build/Workers/{chunk-HU6N6EXB.js → chunk-MWYZ64MH.js} +12 -11
- package/Build/Workers/chunk-NI2R52QD.js +961 -0
- package/Build/Workers/{chunk-SOWMRMWA.js → chunk-PEABJLCK.js} +1 -1
- package/Build/Workers/{chunk-EG6PTBY2.js → chunk-PK7TEP3J.js} +15 -15
- package/Build/Workers/{chunk-GRC2ZTAF.js → chunk-POLFRINT.js} +14 -14
- package/Build/Workers/{chunk-Z3TIFFGF.js → chunk-PS6AEMBR.js} +7 -7
- package/Build/Workers/{chunk-Y2ME2IJV.js → chunk-PWF3YJJ5.js} +13 -13
- package/Build/Workers/{chunk-2A75IWRS.js → chunk-QKF7XXEQ.js} +7 -7
- package/Build/Workers/{chunk-4H7PY4U5.js → chunk-RL73GOEF.js} +2 -2
- package/Build/Workers/{chunk-MDWEGWPA.js → chunk-RR7EOKGZ.js} +10 -10
- package/Build/Workers/{chunk-F3YA3Y2Z.js → chunk-S4XDCPKD.js} +1 -1
- package/Build/Workers/{chunk-PPH7OFP3.js → chunk-TMMOULW3.js} +5 -5
- package/Build/Workers/{chunk-XGI5BXZY.js → chunk-U4IMCOF5.js} +2 -2
- package/Build/Workers/{chunk-4DO5W5XZ.js → chunk-UAJEGIWA.js} +6 -6
- package/Build/Workers/{chunk-BBWDMCVU.js → chunk-UCPPWV64.js} +1 -1
- package/Build/Workers/{chunk-FZRIVR7Y.js → chunk-V7JB576Q.js} +5 -5
- package/Build/Workers/{chunk-2UPKWTMJ.js → chunk-WEGCQ5DY.js} +6 -6
- package/Build/Workers/{chunk-STW2DGFI.js → chunk-WFICTTOE.js} +2 -2
- package/Build/Workers/{chunk-LPR3YNP2.js → chunk-WWP3I7R5.js} +5 -5
- package/Build/Workers/{chunk-A5DWLWCY.js → chunk-XHLDDE65.js} +10 -10
- package/Build/Workers/{chunk-UEXTBDBE.js → chunk-XWML5Y7N.js} +11 -13
- package/Build/Workers/{chunk-EHWHNOEX.js → chunk-YLZTCEBJ.js} +1 -1
- package/Build/Workers/{chunk-34FXV7D7.js → chunk-ZC4AGBZK.js} +2 -2
- package/Build/Workers/{chunk-GATZHF3K.js → chunk-ZDP32RQI.js} +2 -2
- package/Build/Workers/{chunk-KKCR2YOP.js → chunk-ZWPIM77Q.js} +11 -11
- package/Build/Workers/combineGeometry.js +22 -24
- package/Build/Workers/createBoxGeometry.js +16 -18
- package/Build/Workers/createBoxOutlineGeometry.js +14 -16
- package/Build/Workers/createCircleGeometry.js +24 -26
- package/Build/Workers/createCircleOutlineGeometry.js +17 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
- package/Build/Workers/createCorridorGeometry.js +27 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
- package/Build/Workers/createCylinderGeometry.js +18 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
- package/Build/Workers/createEllipseGeometry.js +24 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
- package/Build/Workers/createEllipsoidGeometry.js +17 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
- package/Build/Workers/createFrustumGeometry.js +16 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
- package/Build/Workers/createGeometry.js +23 -25
- package/Build/Workers/createGroundPolylineGeometry.js +23 -25
- package/Build/Workers/createPlaneGeometry.js +14 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
- package/Build/Workers/createPolygonGeometry.js +33 -35
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
- package/Build/Workers/createPolylineGeometry.js +23 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
- package/Build/Workers/createRectangleGeometry.js +27 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
- package/Build/Workers/createSimplePolylineGeometry.js +21 -23
- package/Build/Workers/createSphereGeometry.js +17 -19
- package/Build/Workers/createSphereOutlineGeometry.js +16 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
- package/Build/Workers/createVectorTileGeometries.js +22 -24
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -16
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
- package/Build/Workers/createVerticesFromHeightmap.js +23 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
- package/Build/Workers/createWallGeometry.js +22 -24
- package/Build/Workers/createWallOutlineGeometry.js +21 -23
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -11
- package/Build/Workers/transcodeKTX2.js +8 -8
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
- package/Source/Core/Check.d.ts +127 -0
- package/Source/Core/Check.js +0 -1
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +1 -0
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/Rectangle.js +89 -0
- package/Source/Core/VerticalExaggeration.js +2 -1
- package/Source/DataSources/DataSourceDisplay.js +5 -0
- package/Source/Renderer/ShaderBuilder.js +6 -3
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +37 -3
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +4 -0
- package/Source/Scene/Cesium3DTile.js +65 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
- package/Source/Scene/Cesium3DTileset.js +52 -40
- package/Source/Scene/ClippingPolygon.js +212 -0
- package/Source/Scene/ClippingPolygonCollection.js +968 -0
- package/Source/Scene/Globe.js +14 -67
- package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
- package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
- package/Source/Scene/Label.js +33 -0
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Model/Model.js +83 -0
- package/Source/Scene/Model/Model3DTileContent.js +21 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
- package/Source/Scene/Model/ModelSceneGraph.js +5 -0
- package/Source/Scene/Primitive.js +0 -3
- package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
- package/Source/Scene/Terrain.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +0 -15
- package/Source/Scene/VoxelCylinderShape.js +14 -131
- package/Source/Scene/VoxelEllipsoidShape.js +136 -227
- package/Source/Scene/VoxelPrimitive.js +106 -14
- package/Source/Scene/VoxelRenderResources.js +9 -3
- package/Source/Scene/VoxelShape.js +0 -10
- package/Source/Scene/processVoxelProperties.js +1 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
- package/Source/Shaders/GlobeFS.glsl +12 -0
- package/Source/Shaders/GlobeFS.js +12 -0
- package/Source/Shaders/GlobeVS.glsl +32 -0
- package/Source/Shaders/GlobeVS.js +32 -0
- package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageVS.js +1 -1
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
- package/Source/Shaders/Model/ModelFS.glsl +6 -0
- package/Source/Shaders/Model/ModelFS.js +7 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -0
- package/Source/Shaders/Model/ModelVS.js +4 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
- package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
- package/Source/Shaders/Voxels/IntersectBox.js +21 -47
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +66 -96
- package/Source/Shaders/Voxels/IntersectCylinder.js +66 -96
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +226 -154
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +226 -154
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
- package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
- package/Source/Shaders/Voxels/Megatexture.js +1 -2
- package/Source/Shaders/Voxels/Octree.glsl +14 -9
- package/Source/Shaders/Voxels/Octree.js +14 -9
- package/Source/Shaders/Voxels/VoxelFS.glsl +93 -43
- package/Source/Shaders/Voxels/VoxelFS.js +93 -43
- package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
- package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
- package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +50 -8
- package/Source/Shaders/Voxels/convertUvToCylinder.js +50 -8
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +82 -53
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +82 -53
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/Workers/createGeometry.js +1 -1
- package/index.d.ts +478 -35
- package/index.js +61 -52
- package/package.json +2 -2
- package/Build/Workers/chunk-BG4UCVXN.js +0 -73
- package/Build/Workers/chunk-TTUZP4BO.js +0 -501
- package/Build/Workers/chunk-YJEBABKH.js +0 -2977
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import Check from "../Core/Check.js";
|
|
2
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
|
+
import Cartographic from "../Core/Cartographic.js";
|
|
4
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
5
|
+
import defined from "../Core/defined.js";
|
|
6
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
7
|
+
import CesiumMath from "../Core/Math.js";
|
|
8
|
+
import PolygonGeometry from "../Core/PolygonGeometry.js";
|
|
9
|
+
import Rectangle from "../Core/Rectangle.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A geodesic polygon to be used with {@link ClippingPlaneCollection} for selectively hiding regions in a model, a 3D tileset, or the globe.
|
|
13
|
+
* @alias ClippingPolygon
|
|
14
|
+
* @constructor
|
|
15
|
+
*
|
|
16
|
+
* @param {object} options Object with the following properties:
|
|
17
|
+
* @param {Cartesian3[]} options.positions A list of three or more Cartesian coordinates defining the outer ring of the clipping polygon.
|
|
18
|
+
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84]
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const positions = Cesium.Cartesian3.fromRadiansArray([
|
|
22
|
+
* -1.3194369277314022,
|
|
23
|
+
* 0.6988062530900625,
|
|
24
|
+
* -1.31941,
|
|
25
|
+
* 0.69879,
|
|
26
|
+
* -1.3193955980204217,
|
|
27
|
+
* 0.6988091578771254,
|
|
28
|
+
* -1.3193931220959367,
|
|
29
|
+
* 0.698743632490865,
|
|
30
|
+
* -1.3194358224045408,
|
|
31
|
+
* 0.6987471965556998,
|
|
32
|
+
* ]);
|
|
33
|
+
*
|
|
34
|
+
* const polygon = new Cesium.ClippingPolygon({
|
|
35
|
+
* positions: positions
|
|
36
|
+
* });
|
|
37
|
+
*/
|
|
38
|
+
function ClippingPolygon(options) {
|
|
39
|
+
//>>includeStart('debug', pragmas.debug);
|
|
40
|
+
Check.typeOf.object("options", options);
|
|
41
|
+
Check.typeOf.object("options.positions", options.positions);
|
|
42
|
+
Check.typeOf.number.greaterThanOrEquals(
|
|
43
|
+
"options.positions.length",
|
|
44
|
+
options.positions.length,
|
|
45
|
+
3
|
|
46
|
+
);
|
|
47
|
+
//>>includeEnd('debug');
|
|
48
|
+
|
|
49
|
+
this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
|
|
50
|
+
this._positions = [...options.positions];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Object.defineProperties(ClippingPolygon.prototype, {
|
|
54
|
+
/**
|
|
55
|
+
* Returns the total number of positions in the polygon, include any holes.
|
|
56
|
+
*
|
|
57
|
+
* @memberof ClippingPolygon.prototype
|
|
58
|
+
* @type {number}
|
|
59
|
+
* @readonly
|
|
60
|
+
*/
|
|
61
|
+
length: {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this._positions.length;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Returns the outer ring of positions.
|
|
68
|
+
*
|
|
69
|
+
* @memberof ClippingPolygon.prototype
|
|
70
|
+
* @type {Cartesian3[]}
|
|
71
|
+
* @readonly
|
|
72
|
+
*/
|
|
73
|
+
positions: {
|
|
74
|
+
get: function () {
|
|
75
|
+
return this._positions;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Returns the ellipsoid used to project the polygon onto surfaces when clipping.
|
|
80
|
+
*
|
|
81
|
+
* @memberof ClippingPolygon.prototype
|
|
82
|
+
* @type {Ellipsoid}
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
85
|
+
ellipsoid: {
|
|
86
|
+
get: function () {
|
|
87
|
+
return this._ellipsoid;
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Clones the ClippingPolygon without setting its ownership.
|
|
94
|
+
* @param {ClippingPolygon} polygon The ClippingPolygon to be cloned
|
|
95
|
+
* @param {ClippingPolygon} [result] The object on which to store the cloned parameters.
|
|
96
|
+
* @returns {ClippingPolygon} a clone of the input ClippingPolygon
|
|
97
|
+
*/
|
|
98
|
+
ClippingPolygon.clone = function (polygon, result) {
|
|
99
|
+
//>>includeStart('debug', pragmas.debug);
|
|
100
|
+
Check.typeOf.object("polygon", polygon);
|
|
101
|
+
//>>includeEnd('debug');
|
|
102
|
+
|
|
103
|
+
if (!defined(result)) {
|
|
104
|
+
return new ClippingPolygon({
|
|
105
|
+
positions: polygon.positions,
|
|
106
|
+
ellipsoid: polygon.ellipsoid,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
result._ellipsoid = polygon.ellipsoid;
|
|
111
|
+
result._positions.length = 0;
|
|
112
|
+
result._positions.push(...polygon.positions);
|
|
113
|
+
return result;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Compares the provided ClippingPolygons and returns
|
|
118
|
+
* <code>true</code> if they are equal, <code>false</code> otherwise.
|
|
119
|
+
*
|
|
120
|
+
* @param {Plane} left The first polygon.
|
|
121
|
+
* @param {Plane} right The second polygon.
|
|
122
|
+
* @returns {boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
|
|
123
|
+
*/
|
|
124
|
+
ClippingPolygon.equals = function (left, right) {
|
|
125
|
+
//>>includeStart('debug', pragmas.debug);
|
|
126
|
+
Check.typeOf.object("left", left);
|
|
127
|
+
Check.typeOf.object("right", right);
|
|
128
|
+
//>>includeEnd('debug');
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
left.ellipsoid.equals(right.ellipsoid) && left.positions === right.positions
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Computes a cartographic rectangle which encloses the polygon defined by the list of positions, including cases over the international date line and the poles.
|
|
137
|
+
*
|
|
138
|
+
* @param {Rectangle} [result] An object in which to store the result.
|
|
139
|
+
* @returns {Rectangle} The result rectangle
|
|
140
|
+
*/
|
|
141
|
+
ClippingPolygon.prototype.computeRectangle = function (result) {
|
|
142
|
+
return PolygonGeometry.computeRectangleFromPositions(
|
|
143
|
+
this.positions,
|
|
144
|
+
this.ellipsoid,
|
|
145
|
+
undefined,
|
|
146
|
+
result
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const scratchRectangle = new Rectangle();
|
|
151
|
+
const spherePointScratch = new Cartesian3();
|
|
152
|
+
/**
|
|
153
|
+
* Computes a rectangle with the spherical extents that encloses the polygon defined by the list of positions, including cases over the international date line and the poles.
|
|
154
|
+
*
|
|
155
|
+
* @private
|
|
156
|
+
*
|
|
157
|
+
* @param {Rectangle} [result] An object in which to store the result.
|
|
158
|
+
* @returns {Rectangle} The result rectangle with spherical extents.
|
|
159
|
+
*/
|
|
160
|
+
ClippingPolygon.prototype.computeSphericalExtents = function (result) {
|
|
161
|
+
if (!defined(result)) {
|
|
162
|
+
result = new Rectangle();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const rectangle = this.computeRectangle(scratchRectangle);
|
|
166
|
+
|
|
167
|
+
let spherePoint = Cartographic.toCartesian(
|
|
168
|
+
Rectangle.southwest(rectangle),
|
|
169
|
+
this.ellipsoid,
|
|
170
|
+
spherePointScratch
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// Project into plane with vertical for latitude
|
|
174
|
+
let magXY = Math.sqrt(
|
|
175
|
+
spherePoint.x * spherePoint.x + spherePoint.y * spherePoint.y
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// Use fastApproximateAtan2 for alignment with shader
|
|
179
|
+
let sphereLatitude = CesiumMath.fastApproximateAtan2(magXY, spherePoint.z);
|
|
180
|
+
let sphereLongitude = CesiumMath.fastApproximateAtan2(
|
|
181
|
+
spherePoint.x,
|
|
182
|
+
spherePoint.y
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
result.south = sphereLatitude;
|
|
186
|
+
result.west = sphereLongitude;
|
|
187
|
+
|
|
188
|
+
spherePoint = Cartographic.toCartesian(
|
|
189
|
+
Rectangle.northeast(rectangle),
|
|
190
|
+
this.ellipsoid,
|
|
191
|
+
spherePointScratch
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
// Project into plane with vertical for latitude
|
|
195
|
+
magXY = Math.sqrt(
|
|
196
|
+
spherePoint.x * spherePoint.x + spherePoint.y * spherePoint.y
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// Use fastApproximateAtan2 for alignment with shader
|
|
200
|
+
sphereLatitude = CesiumMath.fastApproximateAtan2(magXY, spherePoint.z);
|
|
201
|
+
sphereLongitude = CesiumMath.fastApproximateAtan2(
|
|
202
|
+
spherePoint.x,
|
|
203
|
+
spherePoint.y
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
result.north = sphereLatitude;
|
|
207
|
+
result.east = sphereLongitude;
|
|
208
|
+
|
|
209
|
+
return result;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export default ClippingPolygon;
|