deeptwins-engine-3d 0.1.76 → 0.2.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/dist/assets/Build/DeepTwins/Image/noise.png +0 -0
- package/dist/assets/Build/DeepTwins/Workers/CustomRasterClip.worker.js +1 -2
- package/dist/assets/Build/DeepTwins/Workers/MvtVector.worker.js +1 -1
- package/dist/assets/Build/Map3d/ThirdParty/Workers/zip-web-worker.js +640 -0
- package/dist/assets/Build/Map3d/ThirdParty/wasm_splats_bg.wasm +0 -0
- package/dist/assets/Build/Map3d/ThirdParty/zip-module.wasm +0 -0
- package/dist/assets/Build/Map3d/Workers/chunk-27NG6PQR.js +456 -0
- package/dist/assets/Build/Map3d/Workers/chunk-2JVMMMWT.js +353 -0
- package/dist/assets/Build/Map3d/Workers/chunk-2Y2XYQCS.js +1481 -0
- package/dist/assets/Build/Map3d/Workers/chunk-34RF3V5G.js +220 -0
- package/dist/assets/Build/Map3d/Workers/chunk-35H7BYLJ.js +1800 -0
- package/dist/assets/Build/Map3d/Workers/chunk-57OGEF5V.js +435 -0
- package/dist/assets/Build/Map3d/Workers/chunk-5PX3DYJA.js +196 -0
- package/dist/assets/Build/Map3d/Workers/chunk-7B5XGQRN.js +171 -0
- package/dist/assets/Build/Map3d/Workers/chunk-ATLWOZFF.js +39 -0
- package/dist/assets/Build/Map3d/Workers/chunk-BMSUECTA.js +1055 -0
- package/dist/assets/Build/Map3d/Workers/chunk-C6IA4TKW.js +476 -0
- package/dist/assets/Build/Map3d/Workers/chunk-CZ44I32U.js +157 -0
- package/dist/assets/Build/Map3d/Workers/chunk-DE6UV44R.js +122 -0
- package/dist/assets/Build/Map3d/Workers/chunk-DUCCKVOG.js +834 -0
- package/dist/assets/Build/Map3d/Workers/chunk-EBJBPIYX.js +239 -0
- package/dist/assets/Build/Map3d/Workers/chunk-EYSYQ2R6.js +138 -0
- package/dist/assets/Build/Map3d/Workers/chunk-FMCAAUQI.js +368 -0
- package/dist/assets/Build/Map3d/Workers/chunk-GMYZNRRQ.js +2717 -0
- package/dist/assets/Build/Map3d/Workers/chunk-GWPNZZV4.js +781 -0
- package/dist/assets/Build/Map3d/Workers/chunk-HLP2U4KW.js +758 -0
- package/dist/assets/Build/Map3d/Workers/chunk-HSJSUPQV.js +500 -0
- package/dist/assets/Build/Map3d/Workers/chunk-I73Q3AG7.js +58 -0
- package/dist/assets/Build/Map3d/Workers/chunk-IMZ4YIMV.js +511 -0
- package/dist/assets/Build/Map3d/Workers/chunk-IZSK4DVF.js +421 -0
- package/dist/assets/Build/Map3d/Workers/chunk-JKLMRPKK.js +75 -0
- package/dist/assets/Build/Map3d/Workers/chunk-KGM345JM.js +691 -0
- package/dist/assets/Build/Map3d/Workers/chunk-L4IR5U4G.js +102 -0
- package/dist/assets/Build/Map3d/Workers/chunk-MG4EVQH2.js +44 -0
- package/dist/assets/Build/Map3d/Workers/chunk-NXWEFAZJ.js +300 -0
- package/dist/assets/Build/Map3d/Workers/chunk-PDFAJISJ.js +59 -0
- package/dist/assets/Build/Map3d/Workers/chunk-PHWZFJR5.js +100 -0
- package/dist/assets/Build/Map3d/Workers/chunk-PLE7CHBE.js +101 -0
- package/dist/assets/Build/Map3d/Workers/chunk-PN3GIZ5Q.js +163 -0
- package/dist/assets/Build/Map3d/Workers/chunk-PXL5XLHV.js +1073 -0
- package/dist/assets/Build/Map3d/Workers/chunk-QYXOF5JC.js +959 -0
- package/dist/assets/Build/Map3d/Workers/chunk-R2LIFXV3.js +115 -0
- package/dist/assets/Build/Map3d/Workers/chunk-R4W6IRJZ.js +10357 -0
- package/dist/assets/Build/Map3d/Workers/chunk-R5PZXG56.js +1258 -0
- package/dist/assets/Build/Map3d/Workers/chunk-RZQLZIUI.js +629 -0
- package/dist/assets/Build/Map3d/Workers/chunk-SIBDD6Y4.js +390 -0
- package/dist/assets/Build/Map3d/Workers/chunk-U5NN6JTQ.js +398 -0
- package/dist/assets/Build/Map3d/Workers/chunk-UA5RPPP3.js +73 -0
- package/dist/assets/Build/Map3d/Workers/chunk-UXLKFS3C.js +305 -0
- package/dist/assets/Build/Map3d/Workers/chunk-VUX4BQIM.js +37 -0
- package/dist/assets/Build/Map3d/Workers/chunk-WJDUUUJS.js +684 -0
- package/dist/assets/Build/Map3d/Workers/chunk-XBJOJHWX.js +139 -0
- package/dist/assets/Build/Map3d/Workers/chunk-XJDMTNKD.js +634 -0
- package/dist/assets/Build/Map3d/Workers/chunk-XUCXZZE5.js +963 -0
- package/dist/assets/Build/Map3d/Workers/chunk-YIKGVMJ5.js +287 -0
- package/dist/assets/Build/Map3d/Workers/chunk-YTNCIBPQ.js +262 -0
- package/dist/assets/Build/Map3d/Workers/chunk-ZMDUYETO.js +55 -0
- package/dist/assets/Build/Map3d/Workers/chunk-ZW52HXFN.js +2857 -0
- package/dist/esm/analyze/LineOfSightAnalysis.js +1 -326
- package/dist/esm/analyze/SubmergenceAnalysis.js +1 -137
- package/dist/esm/analyze/SunLightAnalysis.js +1 -91
- package/dist/esm/analyze/TerrainExcavationAnalysis.js +1 -612
- package/dist/esm/analyze/ViewshedAnalysis.js +1 -292
- package/dist/esm/cameraControl/ModelRoamHistory.js +1 -639
- package/dist/esm/cameraControl/ModelRoamRealTime.js +1 -874
- package/dist/esm/cameraControl/Roam.js +1 -418
- package/dist/esm/cameraControl/Rotate.js +1 -134
- package/dist/esm/cameraControl/RotateInPlace.js +1 -99
- package/dist/esm/constant.d.ts +90 -0
- package/dist/esm/constant.js +1 -1287
- package/dist/esm/deepTwins/index.js +1 -121
- package/dist/esm/drawCommand/index.js +1 -3
- package/dist/esm/drawCommand/viewShed/Event.js +1 -142
- package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.js +1 -1306
- package/dist/esm/drawCommand/viewShed/ViewShadowPrimitive.js +1 -66
- package/dist/esm/drawCommand/viewShed/ViewShedAnalyserLayer.js +1 -466
- package/dist/esm/drawCommand/viewShed/ViewShedMap.js +1 -1238
- package/dist/esm/drawCommand/viewShed/config.js +1 -21
- package/dist/esm/drawCommand/volumeCloud/GeometryPrimitive.js +1 -89
- package/dist/esm/drawCommand/volumeCloud/ImprovedNoise.js +1 -112
- package/dist/esm/drawCommand/volumeCloud/VolumeClouds.js +1 -91
- package/dist/esm/drawer/algorithm.js +1 -314
- package/dist/esm/drawer/common.js +1 -965
- package/dist/esm/drawer/coordinate.js +1 -184
- package/dist/esm/drawer/index.d.ts +1 -1
- package/dist/esm/drawer/index.js +1 -688
- package/dist/esm/drawer/plotUtil.js +1 -266
- package/dist/esm/drawer/shape/Assemble.js +1 -415
- package/dist/esm/drawer/shape/AttackArrow.js +1 -442
- package/dist/esm/drawer/shape/BaseShape.js +1 -383
- package/dist/esm/drawer/shape/Bow.js +1 -375
- package/dist/esm/drawer/shape/Circle.js +1 -461
- package/dist/esm/drawer/shape/Curve.js +1 -386
- package/dist/esm/drawer/shape/DragPoint.js +1 -211
- package/dist/esm/drawer/shape/Elliptic.js +1 -491
- package/dist/esm/drawer/shape/Formation.js +1 -395
- package/dist/esm/drawer/shape/PincerArrow.js +1 -445
- package/dist/esm/drawer/shape/Point.js +1 -131
- package/dist/esm/drawer/shape/Polygon.js +1 -368
- package/dist/esm/drawer/shape/Polyline.js +1 -325
- package/dist/esm/drawer/shape/RegularPolygon.js +1 -468
- package/dist/esm/drawer/shape/RightAngleArrow.js +1 -423
- package/dist/esm/drawer/shape/Sector.js +1 -568
- package/dist/esm/drawer/shape/StraightArrow.js +1 -422
- package/dist/esm/drawer/shape/SwallowtailArrow.js +1 -438
- package/dist/esm/drawer/types.js +1 -11
- package/dist/esm/drawer/utils.js +1 -381
- package/dist/esm/global.css +22 -1
- package/dist/esm/graphicLayer/BaseEntity.js +1 -51
- package/dist/esm/graphicLayer/BaseLayer.js +1 -730
- package/dist/esm/graphicLayer/BasePointPrimitive.js +1 -45
- package/dist/esm/graphicLayer/BasePrimitive.js +1 -36
- package/dist/esm/graphicLayer/BasePrimitiveInstance.js +1 -37
- package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/graphicLayer/BaseSource.js +1 -630
- package/dist/esm/graphicLayer/BillboardEntity.js +1 -106
- package/dist/esm/graphicLayer/BillboardPrimitive.js +1 -119
- package/dist/esm/graphicLayer/BoxEntity.js +1 -99
- package/dist/esm/graphicLayer/BoxPrimitive.js +1 -48
- package/dist/esm/graphicLayer/BoxPrimitiveInstance.js +1 -91
- package/dist/esm/graphicLayer/EllipseEntity.js +1 -110
- package/dist/esm/graphicLayer/EllipsePrimitive.js +1 -47
- package/dist/esm/graphicLayer/EllipsePrimitiveInstance.js +1 -98
- package/dist/esm/graphicLayer/EllipsoidEntity.js +1 -118
- package/dist/esm/graphicLayer/EllipsoidPrimitive.js +1 -48
- package/dist/esm/graphicLayer/EllipsoidPrimitiveInstance.js +1 -113
- package/dist/esm/graphicLayer/GraphicLayerCollection.js +1 -491
- package/dist/esm/graphicLayer/HtmlEntity.d.ts +4 -0
- package/dist/esm/graphicLayer/HtmlEntity.js +1 -189
- package/dist/esm/graphicLayer/LabelEntity.js +1 -110
- package/dist/esm/graphicLayer/LabelPrimitive.js +1 -127
- package/dist/esm/graphicLayer/ModelEntity.js +1 -122
- package/dist/esm/graphicLayer/ModelPrimitive.js +1 -59
- package/dist/esm/graphicLayer/ModelPrimitiveInstance.js +1 -86
- package/dist/esm/graphicLayer/PointEntity.js +1 -94
- package/dist/esm/graphicLayer/PointPrimitive.js +1 -107
- package/dist/esm/graphicLayer/PolygonEntity.js +1 -103
- package/dist/esm/graphicLayer/PolygonGroundPrimitive.js +1 -49
- package/dist/esm/graphicLayer/PolygonGroundPrimitiveImageMaterialInstance.js +1 -87
- package/dist/esm/graphicLayer/PolygonPrimitive.js +1 -60
- package/dist/esm/graphicLayer/PolygonPrimitiveImageMaterialInstance.js +1 -84
- package/dist/esm/graphicLayer/PolygonPrimitiveInstance.js +1 -101
- package/dist/esm/graphicLayer/PolylineEntity.js +1 -96
- package/dist/esm/graphicLayer/PolylineGroundPrimitive.js +1 -55
- package/dist/esm/graphicLayer/PolylineGroundPrimitiveInstance.js +1 -85
- package/dist/esm/graphicLayer/PolylinePrimitive.js +1 -53
- package/dist/esm/graphicLayer/PolylinePrimitiveInstance.js +1 -85
- package/dist/esm/graphicLayer/PolylineVolumeEntity.js +1 -105
- package/dist/esm/graphicLayer/PolylineVolumePrimitive.js +1 -47
- package/dist/esm/graphicLayer/PolylineVolumePrimitiveInstance.js +1 -94
- package/dist/esm/graphicLayer/WallEntity.js +1 -96
- package/dist/esm/graphicLayer/WallPrimitive.js +1 -47
- package/dist/esm/graphicLayer/WallPrimitiveInstance.js +1 -88
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +1 -175
- package/dist/esm/lowAltitude/BarrierLayer.js +1 -172
- package/dist/esm/lowAltitude/BaseGridMvtLayer.js +1 -122
- package/dist/esm/lowAltitude/FactorLayer.js +1 -199
- package/dist/esm/lowAltitude/FlightPlanning.js +1 -411
- package/dist/esm/lowAltitude/FlightRiskEvaluation.js +1 -543
- package/dist/esm/lowAltitude/GridDraw.js +1 -137
- package/dist/esm/lowAltitude/PoiLayer.js +1 -74
- package/dist/esm/lowAltitude/RoutePlanning.js +1 -318
- package/dist/esm/lowAltitude/VisitLayer.js +1 -180
- package/dist/esm/map/Event.js +1 -377
- package/dist/esm/map/GroundSkyBox.js +1 -166
- package/dist/esm/map/Map.js +1 -881
- package/dist/esm/map/Property.js +1 -35
- package/dist/esm/material/AtmosphericDispersion.js +1 -569
- package/dist/esm/material/GlobalVolumetricCloud.js +1 -377
- package/dist/esm/material/VolumeCloud.js +1 -115
- package/dist/esm/material/WeatherEffects.js +1 -351
- package/dist/esm/material/entity/BaseMaterialProperty.js +1 -51
- package/dist/esm/material/entity/CircleWaveMaterialProperty.js +1 -101
- package/dist/esm/material/entity/DynamicWallMaterialProperty.js +1 -101
- package/dist/esm/material/entity/ImageGlowingMaterialProperty.js +1 -89
- package/dist/esm/material/entity/ImageMaterialProperty.js +1 -34
- package/dist/esm/material/entity/PolylineTrailLinkMaterialProperty.js +1 -132
- package/dist/esm/material/primitive/BaseMaterialAppearance.js +1 -28
- package/dist/esm/material/primitive/ImageGlowingMaterialAppearance.js +1 -77
- package/dist/esm/material/primitive/ImageMaterialAppearance.js +1 -77
- package/dist/esm/measure/Area.js +1 -220
- package/dist/esm/measure/BaseDraw.js +1 -105
- package/dist/esm/measure/Distance.js +1 -223
- package/dist/esm/measure/index.js +1 -266
- package/dist/esm/measure/types.js +1 -17
- package/dist/esm/measure/utils.js +1 -319
- package/dist/esm/particle/BaseParticle.js +1 -196
- package/dist/esm/particle/FireParticle.js +1 -65
- package/dist/esm/particle/FountainParticle.js +1 -80
- package/dist/esm/particle/SmokeParticle.js +1 -65
- package/dist/esm/particle/common.js +1 -23
- package/dist/esm/particle/index.js +1 -5
- package/dist/esm/property/PositionProperty.js +1 -56
- package/dist/esm/tileLayer/ArcGisLayer.js +1 -41
- package/dist/esm/tileLayer/CustomRasterClipWorkerClient.js +1 -147
- package/dist/esm/tileLayer/CustomRasterLayer.js +1 -1136
- package/dist/esm/tileLayer/ImageryLayer.js +1 -44
- package/dist/esm/tileLayer/MvtVectorLoad.js +1 -1549
- package/dist/esm/tileLayer/MvtVectorWorkerClient.js +1 -126
- package/dist/esm/tileLayer/RasterLayer.js +1 -23
- package/dist/esm/tileLayer/WmsLayer.js +1 -26
- package/dist/esm/tileLayer/WmtsLayer.js +1 -23
- package/dist/esm/tool/BuildClampedPolygonGrid.js +1 -278
- package/dist/esm/tool/Compass.js +1 -282
- package/dist/esm/tool/PrimitiveCluster.js +1 -706
- package/dist/esm/tool/TimerInterval.js +1 -58
- package/dist/esm/tool/common.js +1 -405
- package/dist/esm/tool/fetch.js +1 -222
- package/dist/esm/tool/heatmap.js +1 -631
- package/dist/esm/tool/utils.d.ts +1 -0
- package/dist/esm/tool/utils.js +1 -501
- package/dist/esm/toolTip/index.js +1 -79
- package/dist/esm/videoFusion/BaseVideo.d.ts +7 -0
- package/dist/esm/videoFusion/BaseVideo.js +1 -330
- package/dist/esm/videoFusion/VideoProject.js +1 -230
- package/dist/esm/videoFusion/VideoTexture.js +1 -163
- package/dist/esm/visualization/BaseHeatmap.js +1 -271
- package/dist/esm/visualization/BoundaryHighlight.d.ts +136 -0
- package/dist/esm/visualization/BoundaryHighlight.js +1 -0
- package/dist/esm/visualization/DynamicWater.js +1 -289
- package/dist/esm/visualization/Frustum.js +1 -248
- package/dist/esm/visualization/Heatmap2d.js +1 -97
- package/dist/esm/visualization/Heatmap3d.js +1 -281
- package/dist/esm/visualization/MigrationEffect.js +1 -397
- package/dist/esm/visualization/PointCluster.js +1 -220
- package/dist/esm/visualization/RadarScan.js +1 -333
- package/dist/esm/visualization/SampledTerrainRiver.d.ts +180 -0
- package/dist/esm/visualization/SampledTerrainRiver.js +1 -0
- package/dist/esm/visualization/SampledTerrainWater.d.ts +170 -0
- package/dist/esm/visualization/SampledTerrainWater.js +1 -0
- package/dist/esm/visualization/WindField.d.ts +72 -0
- package/dist/esm/visualization/WindField.js +1 -0
- package/dist/esm/visualization/windCore.d.ts +161 -0
- package/dist/esm/visualization/windCore.js +8 -0
- package/dist/umd/deeptwins-engine-3d.min.css +1 -1
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.42
|
|
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
|
+
ArcType_default
|
|
28
|
+
} from "./chunk-ZMDUYETO.js";
|
|
29
|
+
import {
|
|
30
|
+
GeometryPipeline_default
|
|
31
|
+
} from "./chunk-GMYZNRRQ.js";
|
|
32
|
+
import {
|
|
33
|
+
PolygonPipeline_default,
|
|
34
|
+
WindingOrder_default
|
|
35
|
+
} from "./chunk-QYXOF5JC.js";
|
|
36
|
+
import {
|
|
37
|
+
arrayRemoveDuplicates_default
|
|
38
|
+
} from "./chunk-PHWZFJR5.js";
|
|
39
|
+
import {
|
|
40
|
+
EllipsoidRhumbLine_default
|
|
41
|
+
} from "./chunk-27NG6PQR.js";
|
|
42
|
+
import {
|
|
43
|
+
IntersectionTests_default
|
|
44
|
+
} from "./chunk-R5PZXG56.js";
|
|
45
|
+
import {
|
|
46
|
+
Plane_default
|
|
47
|
+
} from "./chunk-7B5XGQRN.js";
|
|
48
|
+
import {
|
|
49
|
+
IndexDatatype_default
|
|
50
|
+
} from "./chunk-XBJOJHWX.js";
|
|
51
|
+
import {
|
|
52
|
+
GeometryAttributes_default
|
|
53
|
+
} from "./chunk-MG4EVQH2.js";
|
|
54
|
+
import {
|
|
55
|
+
GeometryAttribute_default,
|
|
56
|
+
Geometry_default,
|
|
57
|
+
PrimitiveType_default
|
|
58
|
+
} from "./chunk-NXWEFAZJ.js";
|
|
59
|
+
import {
|
|
60
|
+
Quaternion_default
|
|
61
|
+
} from "./chunk-R4W6IRJZ.js";
|
|
62
|
+
import {
|
|
63
|
+
ComponentDatatype_default
|
|
64
|
+
} from "./chunk-YTNCIBPQ.js";
|
|
65
|
+
import {
|
|
66
|
+
Cartesian2_default,
|
|
67
|
+
Cartesian3_default,
|
|
68
|
+
Cartographic_default,
|
|
69
|
+
Ellipsoid_default,
|
|
70
|
+
Matrix3_default
|
|
71
|
+
} from "./chunk-ZW52HXFN.js";
|
|
72
|
+
import {
|
|
73
|
+
Math_default
|
|
74
|
+
} from "./chunk-HSJSUPQV.js";
|
|
75
|
+
import {
|
|
76
|
+
defaultValue_default
|
|
77
|
+
} from "./chunk-ATLWOZFF.js";
|
|
78
|
+
import {
|
|
79
|
+
defined_default
|
|
80
|
+
} from "./chunk-JKLMRPKK.js";
|
|
81
|
+
|
|
82
|
+
// packages/engine/Source/Core/PolygonHierarchy.js
|
|
83
|
+
function PolygonHierarchy(positions, holes) {
|
|
84
|
+
this.positions = defined_default(positions) ? positions : [];
|
|
85
|
+
this.holes = defined_default(holes) ? holes : [];
|
|
86
|
+
}
|
|
87
|
+
var PolygonHierarchy_default = PolygonHierarchy;
|
|
88
|
+
|
|
89
|
+
// packages/engine/Source/Core/Queue.js
|
|
90
|
+
function Queue() {
|
|
91
|
+
this._array = [];
|
|
92
|
+
this._offset = 0;
|
|
93
|
+
this._length = 0;
|
|
94
|
+
}
|
|
95
|
+
Object.defineProperties(Queue.prototype, {
|
|
96
|
+
/**
|
|
97
|
+
* The length of the queue.
|
|
98
|
+
*
|
|
99
|
+
* @memberof Queue.prototype
|
|
100
|
+
*
|
|
101
|
+
* @type {number}
|
|
102
|
+
* @readonly
|
|
103
|
+
*/
|
|
104
|
+
length: {
|
|
105
|
+
get: function() {
|
|
106
|
+
return this._length;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Queue.prototype.enqueue = function(item) {
|
|
111
|
+
this._array.push(item);
|
|
112
|
+
this._length++;
|
|
113
|
+
};
|
|
114
|
+
Queue.prototype.dequeue = function() {
|
|
115
|
+
if (this._length === 0) {
|
|
116
|
+
return void 0;
|
|
117
|
+
}
|
|
118
|
+
const array = this._array;
|
|
119
|
+
let offset = this._offset;
|
|
120
|
+
const item = array[offset];
|
|
121
|
+
array[offset] = void 0;
|
|
122
|
+
offset++;
|
|
123
|
+
if (offset > 10 && offset * 2 > array.length) {
|
|
124
|
+
this._array = array.slice(offset);
|
|
125
|
+
offset = 0;
|
|
126
|
+
}
|
|
127
|
+
this._offset = offset;
|
|
128
|
+
this._length--;
|
|
129
|
+
return item;
|
|
130
|
+
};
|
|
131
|
+
Queue.prototype.peek = function() {
|
|
132
|
+
if (this._length === 0) {
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
return this._array[this._offset];
|
|
136
|
+
};
|
|
137
|
+
Queue.prototype.contains = function(item) {
|
|
138
|
+
return this._array.indexOf(item) !== -1;
|
|
139
|
+
};
|
|
140
|
+
Queue.prototype.clear = function() {
|
|
141
|
+
this._array.length = this._offset = this._length = 0;
|
|
142
|
+
};
|
|
143
|
+
Queue.prototype.sort = function(compareFunction) {
|
|
144
|
+
if (this._offset > 0) {
|
|
145
|
+
this._array = this._array.slice(this._offset);
|
|
146
|
+
this._offset = 0;
|
|
147
|
+
}
|
|
148
|
+
this._array.sort(compareFunction);
|
|
149
|
+
};
|
|
150
|
+
var Queue_default = Queue;
|
|
151
|
+
|
|
152
|
+
// packages/engine/Source/Core/PolygonGeometryLibrary.js
|
|
153
|
+
var PolygonGeometryLibrary = {};
|
|
154
|
+
PolygonGeometryLibrary.computeHierarchyPackedLength = function(polygonHierarchy, CartesianX) {
|
|
155
|
+
let numComponents = 0;
|
|
156
|
+
const stack = [polygonHierarchy];
|
|
157
|
+
while (stack.length > 0) {
|
|
158
|
+
const hierarchy = stack.pop();
|
|
159
|
+
if (!defined_default(hierarchy)) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
numComponents += 2;
|
|
163
|
+
const positions = hierarchy.positions;
|
|
164
|
+
const holes = hierarchy.holes;
|
|
165
|
+
if (defined_default(positions) && positions.length > 0) {
|
|
166
|
+
numComponents += positions.length * CartesianX.packedLength;
|
|
167
|
+
}
|
|
168
|
+
if (defined_default(holes)) {
|
|
169
|
+
const length = holes.length;
|
|
170
|
+
for (let i = 0; i < length; ++i) {
|
|
171
|
+
stack.push(holes[i]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return numComponents;
|
|
176
|
+
};
|
|
177
|
+
PolygonGeometryLibrary.packPolygonHierarchy = function(polygonHierarchy, array, startingIndex, CartesianX) {
|
|
178
|
+
const stack = [polygonHierarchy];
|
|
179
|
+
while (stack.length > 0) {
|
|
180
|
+
const hierarchy = stack.pop();
|
|
181
|
+
if (!defined_default(hierarchy)) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const positions = hierarchy.positions;
|
|
185
|
+
const holes = hierarchy.holes;
|
|
186
|
+
array[startingIndex++] = defined_default(positions) ? positions.length : 0;
|
|
187
|
+
array[startingIndex++] = defined_default(holes) ? holes.length : 0;
|
|
188
|
+
if (defined_default(positions)) {
|
|
189
|
+
const positionsLength = positions.length;
|
|
190
|
+
for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
|
|
191
|
+
CartesianX.pack(positions[i], array, startingIndex);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (defined_default(holes)) {
|
|
195
|
+
const holesLength = holes.length;
|
|
196
|
+
for (let j = 0; j < holesLength; ++j) {
|
|
197
|
+
stack.push(holes[j]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return startingIndex;
|
|
202
|
+
};
|
|
203
|
+
PolygonGeometryLibrary.unpackPolygonHierarchy = function(array, startingIndex, CartesianX) {
|
|
204
|
+
const positionsLength = array[startingIndex++];
|
|
205
|
+
const holesLength = array[startingIndex++];
|
|
206
|
+
const positions = new Array(positionsLength);
|
|
207
|
+
const holes = holesLength > 0 ? new Array(holesLength) : void 0;
|
|
208
|
+
for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
|
|
209
|
+
positions[i] = CartesianX.unpack(array, startingIndex);
|
|
210
|
+
}
|
|
211
|
+
for (let j = 0; j < holesLength; ++j) {
|
|
212
|
+
holes[j] = PolygonGeometryLibrary.unpackPolygonHierarchy(
|
|
213
|
+
array,
|
|
214
|
+
startingIndex,
|
|
215
|
+
CartesianX
|
|
216
|
+
);
|
|
217
|
+
startingIndex = holes[j].startingIndex;
|
|
218
|
+
delete holes[j].startingIndex;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
positions,
|
|
222
|
+
holes,
|
|
223
|
+
startingIndex
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
var distance2DScratch = new Cartesian2_default();
|
|
227
|
+
function getPointAtDistance2D(p0, p1, distance, length) {
|
|
228
|
+
Cartesian2_default.subtract(p1, p0, distance2DScratch);
|
|
229
|
+
Cartesian2_default.multiplyByScalar(
|
|
230
|
+
distance2DScratch,
|
|
231
|
+
distance / length,
|
|
232
|
+
distance2DScratch
|
|
233
|
+
);
|
|
234
|
+
Cartesian2_default.add(p0, distance2DScratch, distance2DScratch);
|
|
235
|
+
return [distance2DScratch.x, distance2DScratch.y];
|
|
236
|
+
}
|
|
237
|
+
var distanceScratch = new Cartesian3_default();
|
|
238
|
+
function getPointAtDistance(p0, p1, distance, length) {
|
|
239
|
+
Cartesian3_default.subtract(p1, p0, distanceScratch);
|
|
240
|
+
Cartesian3_default.multiplyByScalar(
|
|
241
|
+
distanceScratch,
|
|
242
|
+
distance / length,
|
|
243
|
+
distanceScratch
|
|
244
|
+
);
|
|
245
|
+
Cartesian3_default.add(p0, distanceScratch, distanceScratch);
|
|
246
|
+
return [distanceScratch.x, distanceScratch.y, distanceScratch.z];
|
|
247
|
+
}
|
|
248
|
+
PolygonGeometryLibrary.subdivideLineCount = function(p0, p1, minDistance) {
|
|
249
|
+
const distance = Cartesian3_default.distance(p0, p1);
|
|
250
|
+
const n = distance / minDistance;
|
|
251
|
+
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
|
|
252
|
+
return Math.pow(2, countDivide);
|
|
253
|
+
};
|
|
254
|
+
var scratchCartographic0 = new Cartographic_default();
|
|
255
|
+
var scratchCartographic1 = new Cartographic_default();
|
|
256
|
+
var scratchCartographic2 = new Cartographic_default();
|
|
257
|
+
var scratchCartesian0 = new Cartesian3_default();
|
|
258
|
+
var scratchRhumbLine = new EllipsoidRhumbLine_default();
|
|
259
|
+
PolygonGeometryLibrary.subdivideRhumbLineCount = function(ellipsoid, p0, p1, minDistance) {
|
|
260
|
+
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
|
|
261
|
+
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
|
|
262
|
+
const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
|
|
263
|
+
const n = rhumb.surfaceDistance / minDistance;
|
|
264
|
+
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
|
|
265
|
+
return Math.pow(2, countDivide);
|
|
266
|
+
};
|
|
267
|
+
PolygonGeometryLibrary.subdivideTexcoordLine = function(t0, t1, p0, p1, minDistance, result) {
|
|
268
|
+
const subdivisions = PolygonGeometryLibrary.subdivideLineCount(
|
|
269
|
+
p0,
|
|
270
|
+
p1,
|
|
271
|
+
minDistance
|
|
272
|
+
);
|
|
273
|
+
const length2D = Cartesian2_default.distance(t0, t1);
|
|
274
|
+
const distanceBetweenCoords = length2D / subdivisions;
|
|
275
|
+
const texcoords = result;
|
|
276
|
+
texcoords.length = subdivisions * 2;
|
|
277
|
+
let index = 0;
|
|
278
|
+
for (let i = 0; i < subdivisions; i++) {
|
|
279
|
+
const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
|
|
280
|
+
texcoords[index++] = t[0];
|
|
281
|
+
texcoords[index++] = t[1];
|
|
282
|
+
}
|
|
283
|
+
return texcoords;
|
|
284
|
+
};
|
|
285
|
+
PolygonGeometryLibrary.subdivideLine = function(p0, p1, minDistance, result) {
|
|
286
|
+
const numVertices = PolygonGeometryLibrary.subdivideLineCount(
|
|
287
|
+
p0,
|
|
288
|
+
p1,
|
|
289
|
+
minDistance
|
|
290
|
+
);
|
|
291
|
+
const length = Cartesian3_default.distance(p0, p1);
|
|
292
|
+
const distanceBetweenVertices = length / numVertices;
|
|
293
|
+
if (!defined_default(result)) {
|
|
294
|
+
result = [];
|
|
295
|
+
}
|
|
296
|
+
const positions = result;
|
|
297
|
+
positions.length = numVertices * 3;
|
|
298
|
+
let index = 0;
|
|
299
|
+
for (let i = 0; i < numVertices; i++) {
|
|
300
|
+
const p = getPointAtDistance(p0, p1, i * distanceBetweenVertices, length);
|
|
301
|
+
positions[index++] = p[0];
|
|
302
|
+
positions[index++] = p[1];
|
|
303
|
+
positions[index++] = p[2];
|
|
304
|
+
}
|
|
305
|
+
return positions;
|
|
306
|
+
};
|
|
307
|
+
PolygonGeometryLibrary.subdivideTexcoordRhumbLine = function(t0, t1, ellipsoid, p0, p1, minDistance, result) {
|
|
308
|
+
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
|
|
309
|
+
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
|
|
310
|
+
scratchRhumbLine.setEndPoints(c0, c1);
|
|
311
|
+
const n = scratchRhumbLine.surfaceDistance / minDistance;
|
|
312
|
+
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
|
|
313
|
+
const subdivisions = Math.pow(2, countDivide);
|
|
314
|
+
const length2D = Cartesian2_default.distance(t0, t1);
|
|
315
|
+
const distanceBetweenCoords = length2D / subdivisions;
|
|
316
|
+
const texcoords = result;
|
|
317
|
+
texcoords.length = subdivisions * 2;
|
|
318
|
+
let index = 0;
|
|
319
|
+
for (let i = 0; i < subdivisions; i++) {
|
|
320
|
+
const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
|
|
321
|
+
texcoords[index++] = t[0];
|
|
322
|
+
texcoords[index++] = t[1];
|
|
323
|
+
}
|
|
324
|
+
return texcoords;
|
|
325
|
+
};
|
|
326
|
+
PolygonGeometryLibrary.subdivideRhumbLine = function(ellipsoid, p0, p1, minDistance, result) {
|
|
327
|
+
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
|
|
328
|
+
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
|
|
329
|
+
const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
|
|
330
|
+
if (!defined_default(result)) {
|
|
331
|
+
result = [];
|
|
332
|
+
}
|
|
333
|
+
if (rhumb.surfaceDistance <= minDistance) {
|
|
334
|
+
result.length = 3;
|
|
335
|
+
result[0] = p0.x;
|
|
336
|
+
result[1] = p0.y;
|
|
337
|
+
result[2] = p0.z;
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
const n = rhumb.surfaceDistance / minDistance;
|
|
341
|
+
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
|
|
342
|
+
const numVertices = Math.pow(2, countDivide);
|
|
343
|
+
const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
|
|
344
|
+
const positions = result;
|
|
345
|
+
positions.length = numVertices * 3;
|
|
346
|
+
let index = 0;
|
|
347
|
+
for (let i = 0; i < numVertices; i++) {
|
|
348
|
+
const c = rhumb.interpolateUsingSurfaceDistance(
|
|
349
|
+
i * distanceBetweenVertices,
|
|
350
|
+
scratchCartographic2
|
|
351
|
+
);
|
|
352
|
+
const p = ellipsoid.cartographicToCartesian(c, scratchCartesian0);
|
|
353
|
+
positions[index++] = p.x;
|
|
354
|
+
positions[index++] = p.y;
|
|
355
|
+
positions[index++] = p.z;
|
|
356
|
+
}
|
|
357
|
+
return positions;
|
|
358
|
+
};
|
|
359
|
+
var scaleToGeodeticHeightN1 = new Cartesian3_default();
|
|
360
|
+
var scaleToGeodeticHeightN2 = new Cartesian3_default();
|
|
361
|
+
var scaleToGeodeticHeightP1 = new Cartesian3_default();
|
|
362
|
+
var scaleToGeodeticHeightP2 = new Cartesian3_default();
|
|
363
|
+
PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
|
|
364
|
+
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
|
|
365
|
+
const n1 = scaleToGeodeticHeightN1;
|
|
366
|
+
let n2 = scaleToGeodeticHeightN2;
|
|
367
|
+
const p = scaleToGeodeticHeightP1;
|
|
368
|
+
let p2 = scaleToGeodeticHeightP2;
|
|
369
|
+
if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
|
|
370
|
+
const positions = geometry.attributes.position.values;
|
|
371
|
+
const length = positions.length / 2;
|
|
372
|
+
for (let i = 0; i < length; i += 3) {
|
|
373
|
+
Cartesian3_default.fromArray(positions, i, p);
|
|
374
|
+
ellipsoid.geodeticSurfaceNormal(p, n1);
|
|
375
|
+
p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
|
|
376
|
+
n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
|
|
377
|
+
n2 = Cartesian3_default.add(p2, n2, n2);
|
|
378
|
+
positions[i + length] = n2.x;
|
|
379
|
+
positions[i + 1 + length] = n2.y;
|
|
380
|
+
positions[i + 2 + length] = n2.z;
|
|
381
|
+
if (perPositionHeight) {
|
|
382
|
+
p2 = Cartesian3_default.clone(p, p2);
|
|
383
|
+
}
|
|
384
|
+
n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
|
|
385
|
+
n2 = Cartesian3_default.add(p2, n2, n2);
|
|
386
|
+
positions[i] = n2.x;
|
|
387
|
+
positions[i + 1] = n2.y;
|
|
388
|
+
positions[i + 2] = n2.z;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return geometry;
|
|
392
|
+
};
|
|
393
|
+
PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
|
|
394
|
+
const polygons = [];
|
|
395
|
+
const queue = new Queue_default();
|
|
396
|
+
queue.enqueue(polygonHierarchy);
|
|
397
|
+
let i;
|
|
398
|
+
let j;
|
|
399
|
+
let length;
|
|
400
|
+
while (queue.length !== 0) {
|
|
401
|
+
const outerNode = queue.dequeue();
|
|
402
|
+
let outerRing = outerNode.positions;
|
|
403
|
+
if (scaleToEllipsoidSurface) {
|
|
404
|
+
length = outerRing.length;
|
|
405
|
+
for (i = 0; i < length; i++) {
|
|
406
|
+
ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
outerRing = arrayRemoveDuplicates_default(
|
|
410
|
+
outerRing,
|
|
411
|
+
Cartesian3_default.equalsEpsilon,
|
|
412
|
+
true
|
|
413
|
+
);
|
|
414
|
+
if (outerRing.length < 3) {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
const numChildren = outerNode.holes ? outerNode.holes.length : 0;
|
|
418
|
+
for (i = 0; i < numChildren; i++) {
|
|
419
|
+
const hole = outerNode.holes[i];
|
|
420
|
+
let holePositions = hole.positions;
|
|
421
|
+
if (scaleToEllipsoidSurface) {
|
|
422
|
+
length = holePositions.length;
|
|
423
|
+
for (j = 0; j < length; ++j) {
|
|
424
|
+
ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
holePositions = arrayRemoveDuplicates_default(
|
|
428
|
+
holePositions,
|
|
429
|
+
Cartesian3_default.equalsEpsilon,
|
|
430
|
+
true
|
|
431
|
+
);
|
|
432
|
+
if (holePositions.length < 3) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
polygons.push(holePositions);
|
|
436
|
+
let numGrandchildren = 0;
|
|
437
|
+
if (defined_default(hole.holes)) {
|
|
438
|
+
numGrandchildren = hole.holes.length;
|
|
439
|
+
}
|
|
440
|
+
for (j = 0; j < numGrandchildren; j++) {
|
|
441
|
+
queue.enqueue(hole.holes[j]);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
polygons.push(outerRing);
|
|
445
|
+
}
|
|
446
|
+
return polygons;
|
|
447
|
+
};
|
|
448
|
+
var scratchRhumbIntersection = new Cartographic_default();
|
|
449
|
+
function computeEquatorIntersectionRhumb(start, end, ellipsoid) {
|
|
450
|
+
const c0 = ellipsoid.cartesianToCartographic(start, scratchCartographic0);
|
|
451
|
+
const c1 = ellipsoid.cartesianToCartographic(end, scratchCartographic1);
|
|
452
|
+
if (Math.sign(c0.latitude) === Math.sign(c1.latitude)) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
scratchRhumbLine.setEndPoints(c0, c1);
|
|
456
|
+
const intersection = scratchRhumbLine.findIntersectionWithLatitude(
|
|
457
|
+
0,
|
|
458
|
+
scratchRhumbIntersection
|
|
459
|
+
);
|
|
460
|
+
if (!defined_default(intersection)) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
let minLongitude = Math.min(c0.longitude, c1.longitude);
|
|
464
|
+
let maxLongitude = Math.max(c0.longitude, c1.longitude);
|
|
465
|
+
if (Math.abs(maxLongitude - minLongitude) > Math_default.PI) {
|
|
466
|
+
const swap = minLongitude;
|
|
467
|
+
minLongitude = maxLongitude;
|
|
468
|
+
maxLongitude = swap;
|
|
469
|
+
}
|
|
470
|
+
if (intersection.longitude < minLongitude || intersection.longitude > maxLongitude) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
return ellipsoid.cartographicToCartesian(intersection);
|
|
474
|
+
}
|
|
475
|
+
function computeEquatorIntersection(start, end, ellipsoid, arcType) {
|
|
476
|
+
if (arcType === ArcType_default.RHUMB) {
|
|
477
|
+
return computeEquatorIntersectionRhumb(start, end, ellipsoid);
|
|
478
|
+
}
|
|
479
|
+
const intersection = IntersectionTests_default.lineSegmentPlane(
|
|
480
|
+
start,
|
|
481
|
+
end,
|
|
482
|
+
Plane_default.ORIGIN_XY_PLANE
|
|
483
|
+
);
|
|
484
|
+
if (!defined_default(intersection)) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
return ellipsoid.scaleToGeodeticSurface(intersection, intersection);
|
|
488
|
+
}
|
|
489
|
+
var scratchCartographic = new Cartographic_default();
|
|
490
|
+
function computeEdgesOnPlane(positions, ellipsoid, arcType) {
|
|
491
|
+
const edgesOnPlane = [];
|
|
492
|
+
let startPoint, endPoint, type, next, intersection, i = 0;
|
|
493
|
+
while (i < positions.length) {
|
|
494
|
+
startPoint = positions[i];
|
|
495
|
+
endPoint = positions[(i + 1) % positions.length];
|
|
496
|
+
type = Math_default.sign(startPoint.z);
|
|
497
|
+
next = Math_default.sign(endPoint.z);
|
|
498
|
+
const getLongitude = (position) => {
|
|
499
|
+
const cartographic = ellipsoid.cartesianToCartographic(
|
|
500
|
+
position,
|
|
501
|
+
scratchCartographic
|
|
502
|
+
);
|
|
503
|
+
return cartographic.longitude;
|
|
504
|
+
};
|
|
505
|
+
if (type === 0) {
|
|
506
|
+
edgesOnPlane.push({
|
|
507
|
+
position: i,
|
|
508
|
+
type,
|
|
509
|
+
visited: false,
|
|
510
|
+
next,
|
|
511
|
+
theta: getLongitude(startPoint)
|
|
512
|
+
});
|
|
513
|
+
} else if (next !== 0) {
|
|
514
|
+
intersection = computeEquatorIntersection(
|
|
515
|
+
startPoint,
|
|
516
|
+
endPoint,
|
|
517
|
+
ellipsoid,
|
|
518
|
+
arcType
|
|
519
|
+
);
|
|
520
|
+
++i;
|
|
521
|
+
if (!defined_default(intersection)) {
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
positions.splice(i, 0, intersection);
|
|
525
|
+
edgesOnPlane.push({
|
|
526
|
+
position: i,
|
|
527
|
+
type,
|
|
528
|
+
visited: false,
|
|
529
|
+
next,
|
|
530
|
+
theta: getLongitude(intersection)
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
++i;
|
|
534
|
+
}
|
|
535
|
+
return edgesOnPlane;
|
|
536
|
+
}
|
|
537
|
+
function wirePolygon(polygons, polygonIndex, positions, edgesOnPlane, toDelete, startIndex, abovePlane) {
|
|
538
|
+
const polygon = [];
|
|
539
|
+
let i = startIndex;
|
|
540
|
+
const getMatchingEdge = (i2) => (edge) => edge.position === i2;
|
|
541
|
+
const polygonsToWire = [];
|
|
542
|
+
do {
|
|
543
|
+
const position = positions[i];
|
|
544
|
+
polygon.push(position);
|
|
545
|
+
const edgeIndex = edgesOnPlane.findIndex(getMatchingEdge(i));
|
|
546
|
+
const edge = edgesOnPlane[edgeIndex];
|
|
547
|
+
if (!defined_default(edge)) {
|
|
548
|
+
++i;
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
const { visited: hasBeenVisited, type, next } = edge;
|
|
552
|
+
edge.visited = true;
|
|
553
|
+
if (type === 0) {
|
|
554
|
+
if (next === 0) {
|
|
555
|
+
const previousEdge = edgesOnPlane[edgeIndex - (abovePlane ? 1 : -1)];
|
|
556
|
+
if (previousEdge?.position === i + 1) {
|
|
557
|
+
previousEdge.visited = true;
|
|
558
|
+
} else {
|
|
559
|
+
++i;
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (!hasBeenVisited && abovePlane && next > 0 || startIndex === i && !abovePlane && next < 0) {
|
|
564
|
+
++i;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
const followEdge = abovePlane ? type >= 0 : type <= 0;
|
|
569
|
+
if (!followEdge) {
|
|
570
|
+
++i;
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
if (!hasBeenVisited) {
|
|
574
|
+
polygonsToWire.push(i);
|
|
575
|
+
}
|
|
576
|
+
const nextEdgeIndex = edgeIndex + (abovePlane ? 1 : -1);
|
|
577
|
+
const nextEdge = edgesOnPlane[nextEdgeIndex];
|
|
578
|
+
if (!defined_default(nextEdge)) {
|
|
579
|
+
++i;
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
i = nextEdge.position;
|
|
583
|
+
} while (i < positions.length && i >= 0 && i !== startIndex && polygon.length < positions.length);
|
|
584
|
+
polygons.splice(polygonIndex, toDelete, polygon);
|
|
585
|
+
for (const index of polygonsToWire) {
|
|
586
|
+
polygonIndex = wirePolygon(
|
|
587
|
+
polygons,
|
|
588
|
+
++polygonIndex,
|
|
589
|
+
positions,
|
|
590
|
+
edgesOnPlane,
|
|
591
|
+
0,
|
|
592
|
+
index,
|
|
593
|
+
!abovePlane
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
return polygonIndex;
|
|
597
|
+
}
|
|
598
|
+
PolygonGeometryLibrary.splitPolygonsOnEquator = function(outerRings, ellipsoid, arcType, result) {
|
|
599
|
+
if (!defined_default(result)) {
|
|
600
|
+
result = [];
|
|
601
|
+
}
|
|
602
|
+
result.splice(0, 0, ...outerRings);
|
|
603
|
+
result.length = outerRings.length;
|
|
604
|
+
let currentPolygon = 0;
|
|
605
|
+
while (currentPolygon < result.length) {
|
|
606
|
+
const outerRing = result[currentPolygon];
|
|
607
|
+
const positions = outerRing.slice();
|
|
608
|
+
if (outerRing.length < 3) {
|
|
609
|
+
result[currentPolygon] = positions;
|
|
610
|
+
++currentPolygon;
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
const edgesOnPlane = computeEdgesOnPlane(positions, ellipsoid, arcType);
|
|
614
|
+
if (positions.length === outerRing.length || edgesOnPlane.length <= 1) {
|
|
615
|
+
result[currentPolygon] = positions;
|
|
616
|
+
++currentPolygon;
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
edgesOnPlane.sort((a, b) => {
|
|
620
|
+
return a.theta - b.theta;
|
|
621
|
+
});
|
|
622
|
+
const north = positions[0].z >= 0;
|
|
623
|
+
currentPolygon = wirePolygon(
|
|
624
|
+
result,
|
|
625
|
+
currentPolygon,
|
|
626
|
+
positions,
|
|
627
|
+
edgesOnPlane,
|
|
628
|
+
1,
|
|
629
|
+
0,
|
|
630
|
+
north
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
return result;
|
|
634
|
+
};
|
|
635
|
+
PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, keepDuplicates, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid, splitPolygons) {
|
|
636
|
+
const hierarchy = [];
|
|
637
|
+
const polygons = [];
|
|
638
|
+
const queue = new Queue_default();
|
|
639
|
+
queue.enqueue(polygonHierarchy);
|
|
640
|
+
let split = defined_default(splitPolygons);
|
|
641
|
+
while (queue.length !== 0) {
|
|
642
|
+
const outerNode = queue.dequeue();
|
|
643
|
+
let outerRing = outerNode.positions;
|
|
644
|
+
const holes = outerNode.holes;
|
|
645
|
+
let i;
|
|
646
|
+
let length;
|
|
647
|
+
if (scaleToEllipsoidSurface) {
|
|
648
|
+
length = outerRing.length;
|
|
649
|
+
for (i = 0; i < length; i++) {
|
|
650
|
+
ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (!keepDuplicates) {
|
|
654
|
+
outerRing = arrayRemoveDuplicates_default(
|
|
655
|
+
outerRing,
|
|
656
|
+
Cartesian3_default.equalsEpsilon,
|
|
657
|
+
true
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
if (outerRing.length < 3) {
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
let positions2D = projectPointsTo2D(outerRing);
|
|
664
|
+
if (!defined_default(positions2D)) {
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
const holeIndices = [];
|
|
668
|
+
let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
|
|
669
|
+
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
|
|
670
|
+
positions2D.reverse();
|
|
671
|
+
outerRing = outerRing.slice().reverse();
|
|
672
|
+
}
|
|
673
|
+
if (split) {
|
|
674
|
+
split = false;
|
|
675
|
+
let polygons2 = [outerRing];
|
|
676
|
+
polygons2 = splitPolygons(polygons2, polygons2);
|
|
677
|
+
if (polygons2.length > 1) {
|
|
678
|
+
for (const positions2 of polygons2) {
|
|
679
|
+
queue.enqueue(new PolygonHierarchy_default(positions2, holes));
|
|
680
|
+
}
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
let positions = outerRing.slice();
|
|
685
|
+
const numChildren = defined_default(holes) ? holes.length : 0;
|
|
686
|
+
const polygonHoles = [];
|
|
687
|
+
let j;
|
|
688
|
+
for (i = 0; i < numChildren; i++) {
|
|
689
|
+
const hole = holes[i];
|
|
690
|
+
let holePositions = hole.positions;
|
|
691
|
+
if (scaleToEllipsoidSurface) {
|
|
692
|
+
length = holePositions.length;
|
|
693
|
+
for (j = 0; j < length; ++j) {
|
|
694
|
+
ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (!keepDuplicates) {
|
|
698
|
+
holePositions = arrayRemoveDuplicates_default(
|
|
699
|
+
holePositions,
|
|
700
|
+
Cartesian3_default.equalsEpsilon,
|
|
701
|
+
true
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
if (holePositions.length < 3) {
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
const holePositions2D = projectPointsTo2D(holePositions);
|
|
708
|
+
if (!defined_default(holePositions2D)) {
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(holePositions2D);
|
|
712
|
+
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
|
|
713
|
+
holePositions2D.reverse();
|
|
714
|
+
holePositions = holePositions.slice().reverse();
|
|
715
|
+
}
|
|
716
|
+
polygonHoles.push(holePositions);
|
|
717
|
+
holeIndices.push(positions.length);
|
|
718
|
+
positions = positions.concat(holePositions);
|
|
719
|
+
positions2D = positions2D.concat(holePositions2D);
|
|
720
|
+
let numGrandchildren = 0;
|
|
721
|
+
if (defined_default(hole.holes)) {
|
|
722
|
+
numGrandchildren = hole.holes.length;
|
|
723
|
+
}
|
|
724
|
+
for (j = 0; j < numGrandchildren; j++) {
|
|
725
|
+
queue.enqueue(hole.holes[j]);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
hierarchy.push({
|
|
729
|
+
outerRing,
|
|
730
|
+
holes: polygonHoles
|
|
731
|
+
});
|
|
732
|
+
polygons.push({
|
|
733
|
+
positions,
|
|
734
|
+
positions2D,
|
|
735
|
+
holes: holeIndices
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
return {
|
|
739
|
+
hierarchy,
|
|
740
|
+
polygons
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
var computeBoundingRectangleCartesian2 = new Cartesian2_default();
|
|
744
|
+
var computeBoundingRectangleCartesian3 = new Cartesian3_default();
|
|
745
|
+
var computeBoundingRectangleQuaternion = new Quaternion_default();
|
|
746
|
+
var computeBoundingRectangleMatrix3 = new Matrix3_default();
|
|
747
|
+
PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
|
|
748
|
+
const rotation = Quaternion_default.fromAxisAngle(
|
|
749
|
+
planeNormal,
|
|
750
|
+
angle,
|
|
751
|
+
computeBoundingRectangleQuaternion
|
|
752
|
+
);
|
|
753
|
+
const textureMatrix = Matrix3_default.fromQuaternion(
|
|
754
|
+
rotation,
|
|
755
|
+
computeBoundingRectangleMatrix3
|
|
756
|
+
);
|
|
757
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
758
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
759
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
760
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
761
|
+
const length = positions.length;
|
|
762
|
+
for (let i = 0; i < length; ++i) {
|
|
763
|
+
const p = Cartesian3_default.clone(
|
|
764
|
+
positions[i],
|
|
765
|
+
computeBoundingRectangleCartesian3
|
|
766
|
+
);
|
|
767
|
+
Matrix3_default.multiplyByVector(textureMatrix, p, p);
|
|
768
|
+
const st = projectPointTo2D(p, computeBoundingRectangleCartesian2);
|
|
769
|
+
if (defined_default(st)) {
|
|
770
|
+
minX = Math.min(minX, st.x);
|
|
771
|
+
maxX = Math.max(maxX, st.x);
|
|
772
|
+
minY = Math.min(minY, st.y);
|
|
773
|
+
maxY = Math.max(maxY, st.y);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
result.x = minX;
|
|
777
|
+
result.y = minY;
|
|
778
|
+
result.width = maxX - minX;
|
|
779
|
+
result.height = maxY - minY;
|
|
780
|
+
return result;
|
|
781
|
+
};
|
|
782
|
+
PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, textureCoordinates, granularity, perPositionHeight, vertexFormat, arcType) {
|
|
783
|
+
let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
|
|
784
|
+
if (indices.length < 3) {
|
|
785
|
+
indices = [0, 1, 2];
|
|
786
|
+
}
|
|
787
|
+
const positions = polygon.positions;
|
|
788
|
+
const hasTexcoords = defined_default(textureCoordinates);
|
|
789
|
+
const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
|
|
790
|
+
if (perPositionHeight) {
|
|
791
|
+
const length = positions.length;
|
|
792
|
+
const flattenedPositions = new Array(length * 3);
|
|
793
|
+
let index = 0;
|
|
794
|
+
for (let i = 0; i < length; i++) {
|
|
795
|
+
const p = positions[i];
|
|
796
|
+
flattenedPositions[index++] = p.x;
|
|
797
|
+
flattenedPositions[index++] = p.y;
|
|
798
|
+
flattenedPositions[index++] = p.z;
|
|
799
|
+
}
|
|
800
|
+
const geometryOptions = {
|
|
801
|
+
attributes: {
|
|
802
|
+
position: new GeometryAttribute_default({
|
|
803
|
+
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
804
|
+
componentsPerAttribute: 3,
|
|
805
|
+
values: flattenedPositions
|
|
806
|
+
})
|
|
807
|
+
},
|
|
808
|
+
indices,
|
|
809
|
+
primitiveType: PrimitiveType_default.TRIANGLES
|
|
810
|
+
};
|
|
811
|
+
if (hasTexcoords) {
|
|
812
|
+
geometryOptions.attributes.st = new GeometryAttribute_default({
|
|
813
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
814
|
+
componentsPerAttribute: 2,
|
|
815
|
+
values: Cartesian2_default.packArray(texcoords)
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
const geometry = new Geometry_default(geometryOptions);
|
|
819
|
+
if (vertexFormat.normal) {
|
|
820
|
+
return GeometryPipeline_default.computeNormal(geometry);
|
|
821
|
+
}
|
|
822
|
+
return geometry;
|
|
823
|
+
}
|
|
824
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
825
|
+
return PolygonPipeline_default.computeSubdivision(
|
|
826
|
+
ellipsoid,
|
|
827
|
+
positions,
|
|
828
|
+
indices,
|
|
829
|
+
texcoords,
|
|
830
|
+
granularity
|
|
831
|
+
);
|
|
832
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
833
|
+
return PolygonPipeline_default.computeRhumbLineSubdivision(
|
|
834
|
+
ellipsoid,
|
|
835
|
+
positions,
|
|
836
|
+
indices,
|
|
837
|
+
texcoords,
|
|
838
|
+
granularity
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
var computeWallTexcoordsSubdivided = [];
|
|
843
|
+
var computeWallIndicesSubdivided = [];
|
|
844
|
+
var p1Scratch = new Cartesian3_default();
|
|
845
|
+
var p2Scratch = new Cartesian3_default();
|
|
846
|
+
PolygonGeometryLibrary.computeWallGeometry = function(positions, textureCoordinates, ellipsoid, granularity, perPositionHeight, arcType) {
|
|
847
|
+
let edgePositions;
|
|
848
|
+
let topEdgeLength;
|
|
849
|
+
let i;
|
|
850
|
+
let p1;
|
|
851
|
+
let p2;
|
|
852
|
+
let t1;
|
|
853
|
+
let t2;
|
|
854
|
+
let edgeTexcoords;
|
|
855
|
+
let topEdgeTexcoordLength;
|
|
856
|
+
let length = positions.length;
|
|
857
|
+
let index = 0;
|
|
858
|
+
let textureIndex = 0;
|
|
859
|
+
const hasTexcoords = defined_default(textureCoordinates);
|
|
860
|
+
const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
|
|
861
|
+
if (!perPositionHeight) {
|
|
862
|
+
const minDistance = Math_default.chordLength(
|
|
863
|
+
granularity,
|
|
864
|
+
ellipsoid.maximumRadius
|
|
865
|
+
);
|
|
866
|
+
let numVertices = 0;
|
|
867
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
868
|
+
for (i = 0; i < length; i++) {
|
|
869
|
+
numVertices += PolygonGeometryLibrary.subdivideLineCount(
|
|
870
|
+
positions[i],
|
|
871
|
+
positions[(i + 1) % length],
|
|
872
|
+
minDistance
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
876
|
+
for (i = 0; i < length; i++) {
|
|
877
|
+
numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
|
|
878
|
+
ellipsoid,
|
|
879
|
+
positions[i],
|
|
880
|
+
positions[(i + 1) % length],
|
|
881
|
+
minDistance
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
topEdgeLength = (numVertices + length) * 3;
|
|
886
|
+
edgePositions = new Array(topEdgeLength * 2);
|
|
887
|
+
if (hasTexcoords) {
|
|
888
|
+
topEdgeTexcoordLength = (numVertices + length) * 2;
|
|
889
|
+
edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
|
|
890
|
+
}
|
|
891
|
+
for (i = 0; i < length; i++) {
|
|
892
|
+
p1 = positions[i];
|
|
893
|
+
p2 = positions[(i + 1) % length];
|
|
894
|
+
let tempPositions;
|
|
895
|
+
let tempTexcoords;
|
|
896
|
+
if (hasTexcoords) {
|
|
897
|
+
t1 = texcoords[i];
|
|
898
|
+
t2 = texcoords[(i + 1) % length];
|
|
899
|
+
}
|
|
900
|
+
if (arcType === ArcType_default.GEODESIC) {
|
|
901
|
+
tempPositions = PolygonGeometryLibrary.subdivideLine(
|
|
902
|
+
p1,
|
|
903
|
+
p2,
|
|
904
|
+
minDistance,
|
|
905
|
+
computeWallIndicesSubdivided
|
|
906
|
+
);
|
|
907
|
+
if (hasTexcoords) {
|
|
908
|
+
tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordLine(
|
|
909
|
+
t1,
|
|
910
|
+
t2,
|
|
911
|
+
p1,
|
|
912
|
+
p2,
|
|
913
|
+
minDistance,
|
|
914
|
+
computeWallTexcoordsSubdivided
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
} else if (arcType === ArcType_default.RHUMB) {
|
|
918
|
+
tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
|
|
919
|
+
ellipsoid,
|
|
920
|
+
p1,
|
|
921
|
+
p2,
|
|
922
|
+
minDistance,
|
|
923
|
+
computeWallIndicesSubdivided
|
|
924
|
+
);
|
|
925
|
+
if (hasTexcoords) {
|
|
926
|
+
tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordRhumbLine(
|
|
927
|
+
t1,
|
|
928
|
+
t2,
|
|
929
|
+
ellipsoid,
|
|
930
|
+
p1,
|
|
931
|
+
p2,
|
|
932
|
+
minDistance,
|
|
933
|
+
computeWallTexcoordsSubdivided
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
const tempPositionsLength = tempPositions.length;
|
|
938
|
+
for (let j = 0; j < tempPositionsLength; ++j, ++index) {
|
|
939
|
+
edgePositions[index] = tempPositions[j];
|
|
940
|
+
edgePositions[index + topEdgeLength] = tempPositions[j];
|
|
941
|
+
}
|
|
942
|
+
edgePositions[index] = p2.x;
|
|
943
|
+
edgePositions[index + topEdgeLength] = p2.x;
|
|
944
|
+
++index;
|
|
945
|
+
edgePositions[index] = p2.y;
|
|
946
|
+
edgePositions[index + topEdgeLength] = p2.y;
|
|
947
|
+
++index;
|
|
948
|
+
edgePositions[index] = p2.z;
|
|
949
|
+
edgePositions[index + topEdgeLength] = p2.z;
|
|
950
|
+
++index;
|
|
951
|
+
if (hasTexcoords) {
|
|
952
|
+
const tempTexcoordsLength = tempTexcoords.length;
|
|
953
|
+
for (let k = 0; k < tempTexcoordsLength; ++k, ++textureIndex) {
|
|
954
|
+
edgeTexcoords[textureIndex] = tempTexcoords[k];
|
|
955
|
+
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = tempTexcoords[k];
|
|
956
|
+
}
|
|
957
|
+
edgeTexcoords[textureIndex] = t2.x;
|
|
958
|
+
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
|
|
959
|
+
++textureIndex;
|
|
960
|
+
edgeTexcoords[textureIndex] = t2.y;
|
|
961
|
+
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
|
|
962
|
+
++textureIndex;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
966
|
+
topEdgeLength = length * 3 * 2;
|
|
967
|
+
edgePositions = new Array(topEdgeLength * 2);
|
|
968
|
+
if (hasTexcoords) {
|
|
969
|
+
topEdgeTexcoordLength = length * 2 * 2;
|
|
970
|
+
edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
|
|
971
|
+
}
|
|
972
|
+
for (i = 0; i < length; i++) {
|
|
973
|
+
p1 = positions[i];
|
|
974
|
+
p2 = positions[(i + 1) % length];
|
|
975
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.x;
|
|
976
|
+
++index;
|
|
977
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.y;
|
|
978
|
+
++index;
|
|
979
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.z;
|
|
980
|
+
++index;
|
|
981
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.x;
|
|
982
|
+
++index;
|
|
983
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.y;
|
|
984
|
+
++index;
|
|
985
|
+
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.z;
|
|
986
|
+
++index;
|
|
987
|
+
if (hasTexcoords) {
|
|
988
|
+
t1 = texcoords[i];
|
|
989
|
+
t2 = texcoords[(i + 1) % length];
|
|
990
|
+
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.x;
|
|
991
|
+
++textureIndex;
|
|
992
|
+
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.y;
|
|
993
|
+
++textureIndex;
|
|
994
|
+
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
|
|
995
|
+
++textureIndex;
|
|
996
|
+
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
|
|
997
|
+
++textureIndex;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
length = edgePositions.length;
|
|
1002
|
+
const indices = IndexDatatype_default.createTypedArray(
|
|
1003
|
+
length / 3,
|
|
1004
|
+
length - positions.length * 6
|
|
1005
|
+
);
|
|
1006
|
+
let edgeIndex = 0;
|
|
1007
|
+
length /= 6;
|
|
1008
|
+
for (i = 0; i < length; i++) {
|
|
1009
|
+
const UL = i;
|
|
1010
|
+
const UR = UL + 1;
|
|
1011
|
+
const LL = UL + length;
|
|
1012
|
+
const LR = LL + 1;
|
|
1013
|
+
p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch);
|
|
1014
|
+
p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch);
|
|
1015
|
+
if (Cartesian3_default.equalsEpsilon(
|
|
1016
|
+
p1,
|
|
1017
|
+
p2,
|
|
1018
|
+
Math_default.EPSILON10,
|
|
1019
|
+
Math_default.EPSILON10
|
|
1020
|
+
)) {
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
indices[edgeIndex++] = UL;
|
|
1024
|
+
indices[edgeIndex++] = LL;
|
|
1025
|
+
indices[edgeIndex++] = UR;
|
|
1026
|
+
indices[edgeIndex++] = UR;
|
|
1027
|
+
indices[edgeIndex++] = LL;
|
|
1028
|
+
indices[edgeIndex++] = LR;
|
|
1029
|
+
}
|
|
1030
|
+
const geometryOptions = {
|
|
1031
|
+
attributes: new GeometryAttributes_default({
|
|
1032
|
+
position: new GeometryAttribute_default({
|
|
1033
|
+
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
1034
|
+
componentsPerAttribute: 3,
|
|
1035
|
+
values: edgePositions
|
|
1036
|
+
})
|
|
1037
|
+
}),
|
|
1038
|
+
indices,
|
|
1039
|
+
primitiveType: PrimitiveType_default.TRIANGLES
|
|
1040
|
+
};
|
|
1041
|
+
if (hasTexcoords) {
|
|
1042
|
+
geometryOptions.attributes.st = new GeometryAttribute_default({
|
|
1043
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
1044
|
+
componentsPerAttribute: 2,
|
|
1045
|
+
values: edgeTexcoords
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
const geometry = new Geometry_default(geometryOptions);
|
|
1049
|
+
return geometry;
|
|
1050
|
+
};
|
|
1051
|
+
var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
|
|
1052
|
+
|
|
1053
|
+
export {
|
|
1054
|
+
PolygonGeometryLibrary_default
|
|
1055
|
+
};
|