@cesium/engine 10.0.0 → 11.0.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/Workers/{chunk-AA4GZKOT.js → chunk-2EDC3QGH.js} +1 -1
- package/Build/Workers/{chunk-DKVHRNFY.js → chunk-2MKRG7L7.js} +5 -5
- package/Build/Workers/{chunk-X23FRWHJ.js → chunk-2RZYNSMR.js} +6 -6
- package/Build/Workers/{chunk-TO2PVHKI.js → chunk-4NBRIKB3.js} +2 -2
- package/Build/Workers/{chunk-GRAT5GE7.js → chunk-4TK5YR6Q.js} +5 -5
- package/Build/Workers/{chunk-XD445VDH.js → chunk-54VC7SCM.js} +7 -7
- package/Build/Workers/{chunk-G3YR53LY.js → chunk-5IY5BXCT.js} +13 -13
- package/Build/Workers/{chunk-O3JCMSS3.js → chunk-6FFGOENI.js} +54 -7
- package/Build/Workers/{chunk-7XGC6YB2.js → chunk-6PJIHPQB.js} +13 -13
- package/Build/Workers/{chunk-GR3CDLCP.js → chunk-6ZREIBKS.js} +7 -7
- package/Build/Workers/{chunk-4MSUJ4I7.js → chunk-AI3O7UN2.js} +6 -6
- package/Build/Workers/{chunk-COYFZ5VA.js → chunk-AS7P4BHI.js} +6 -6
- package/Build/Workers/{chunk-JYAHOGGL.js → chunk-AUM45VEG.js} +16 -15
- package/Build/Workers/{chunk-BDFNKFOE.js → chunk-BBO6BGLC.js} +13 -13
- package/Build/Workers/{chunk-AVI4IUWC.js → chunk-BH5ZEN4I.js} +10 -10
- package/Build/Workers/{chunk-4BAE4PWO.js → chunk-BJ3WF5RW.js} +6 -6
- package/Build/Workers/{chunk-Q55ECN3Y.js → chunk-BUOFSNFW.js} +1 -1
- package/Build/Workers/{chunk-QX5XS4LC.js → chunk-BZXF3GNX.js} +2 -2
- package/Build/Workers/{chunk-PYHLO636.js → chunk-DJXXI7UF.js} +5 -5
- package/Build/Workers/{chunk-LCLJJ2MZ.js → chunk-DVAIU7A4.js} +17 -17
- package/Build/Workers/{chunk-SYCPRK3D.js → chunk-FJT3ERV7.js} +9 -9
- package/Build/Workers/{chunk-L6RTJ3RE.js → chunk-GOHDOWU5.js} +14 -14
- package/Build/Workers/{chunk-MSKXMXJI.js → chunk-HA6TZ3XT.js} +4 -4
- package/Build/Workers/{chunk-PCP4YQST.js → chunk-HBZSCVZC.js} +11 -11
- package/Build/Workers/{chunk-5S7OLEPK.js → chunk-HC7RYWPZ.js} +12 -12
- package/Build/Workers/{chunk-VE7BFUIX.js → chunk-HFMJM3SX.js} +1 -1
- package/Build/Workers/{chunk-OOK53QUQ.js → chunk-HFPMX5L2.js} +1 -1
- package/Build/Workers/{chunk-VFBNELXB.js → chunk-HO2NTC7I.js} +6 -6
- package/Build/Workers/{chunk-DOXCPOG4.js → chunk-HZPMWR4H.js} +7 -7
- package/Build/Workers/{chunk-I2RC4XVN.js → chunk-IBG5FVXC.js} +4 -4
- package/Build/Workers/{chunk-LEABCTLP.js → chunk-IXLNNST6.js} +4 -4
- package/Build/Workers/{chunk-4YSNMHZ4.js → chunk-JYUCC5NV.js} +6 -6
- package/Build/Workers/{chunk-BCL4PHHT.js → chunk-KFW4UNQH.js} +10 -10
- package/Build/Workers/{chunk-R6B7UCQB.js → chunk-KKAEXHDY.js} +2 -2
- package/Build/Workers/{chunk-BJF5LOWE.js → chunk-L6FARMF6.js} +7 -7
- package/Build/Workers/{chunk-C2CGMAIU.js → chunk-N3BIL6WA.js} +13 -13
- package/Build/Workers/{chunk-STBBMQGG.js → chunk-O5SSW3B3.js} +6 -6
- package/Build/Workers/{chunk-S3PI2KFM.js → chunk-OC4MYPVW.js} +2 -2
- package/Build/Workers/{chunk-MDHQR3ZS.js → chunk-OOA6GXKD.js} +7 -7
- package/Build/Workers/{chunk-AD5HBJ2F.js → chunk-OSCHEWSG.js} +7 -7
- package/Build/Workers/{chunk-NTXTUNEF.js → chunk-QGT2GMOK.js} +4 -4
- package/Build/Workers/{chunk-VO3ACQB2.js → chunk-RFQYEYAL.js} +17 -17
- package/Build/Workers/{chunk-KUN2ZA5X.js → chunk-RJF5ZP76.js} +4 -4
- package/Build/Workers/{chunk-QD4KM3GO.js → chunk-SIZXFNJY.js} +6 -5
- package/Build/Workers/{chunk-FXIHSF7O.js → chunk-SRZJCF7G.js} +9 -9
- package/Build/Workers/{chunk-T77JILCU.js → chunk-T4MB73MC.js} +2 -2
- package/Build/Workers/{chunk-3WUV74WM.js → chunk-TTI2SUWJ.js} +2 -2
- package/Build/Workers/{chunk-QMLTCCYG.js → chunk-VHJ5ESXF.js} +1 -1
- package/Build/Workers/{chunk-2J3JKXCP.js → chunk-VSFFJGTA.js} +9 -5
- package/Build/Workers/{chunk-DGS5QNIO.js → chunk-WQRXRDCZ.js} +11 -11
- package/Build/Workers/{chunk-OORVMGDU.js → chunk-WXDGOYTT.js} +12 -7
- package/Build/Workers/{chunk-RJYML24O.js → chunk-XLCZE6DD.js} +423 -448
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +24 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +28 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +20 -22
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/CompressedTextureBuffer.js +11 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/KTX2Transcoder.js +9 -16
- package/Source/Core/PixelFormat.js +1 -15
- package/Source/Core/Simon1994PlanetaryPositions.js +2 -1
- package/Source/Core/Transforms.js +137 -2
- package/Source/DataSources/BillboardGraphics.js +16 -0
- package/Source/DataSources/BillboardVisualizer.js +7 -0
- package/Source/DataSources/CallbackProperty.js +8 -2
- package/Source/DataSources/CheckerboardMaterialProperty.js +7 -1
- package/Source/DataSources/ColorMaterialProperty.js +7 -1
- package/Source/DataSources/CompositeMaterialProperty.js +5 -4
- package/Source/DataSources/CompositePositionProperty.js +7 -1
- package/Source/DataSources/CompositeProperty.js +5 -5
- package/Source/DataSources/ConstantPositionProperty.js +7 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/GridMaterialProperty.js +7 -1
- package/Source/DataSources/ImageMaterialProperty.js +8 -1
- package/Source/DataSources/MaterialProperty.js +7 -1
- package/Source/DataSources/NodeTransformationProperty.js +7 -1
- package/Source/DataSources/PathVisualizer.js +4 -4
- package/Source/DataSources/PointGraphics.js +17 -0
- package/Source/DataSources/PointVisualizer.js +12 -0
- package/Source/DataSources/PolylineArrowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineDashMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineGlowMaterialProperty.js +7 -1
- package/Source/DataSources/PolylineOutlineMaterialProperty.js +7 -1
- package/Source/DataSources/PositionProperty.js +5 -8
- package/Source/DataSources/PositionPropertyArray.js +7 -1
- package/Source/DataSources/Property.js +1 -1
- package/Source/DataSources/PropertyArray.js +5 -5
- package/Source/DataSources/PropertyBag.js +5 -4
- package/Source/DataSources/ReferenceProperty.js +7 -1
- package/Source/DataSources/SampledPositionProperty.js +7 -1
- package/Source/DataSources/SampledProperty.js +6 -4
- package/Source/DataSources/ScaledPositionProperty.js +6 -0
- package/Source/DataSources/StripeMaterialProperty.js +7 -1
- package/Source/DataSources/TerrainOffsetProperty.js +9 -0
- package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +7 -1
- package/Source/DataSources/TimeIntervalCollectionProperty.js +5 -5
- package/Source/DataSources/VelocityOrientationProperty.js +6 -1
- package/Source/DataSources/VelocityVectorProperty.js +3 -5
- package/Source/Renderer/AutomaticUniforms.js +3 -18
- package/Source/Renderer/Context.js +15 -0
- package/Source/Renderer/CubeMap.js +326 -348
- package/Source/Renderer/CubeMapFace.js +26 -48
- package/Source/Renderer/PixelDatatype.js +23 -0
- package/Source/Renderer/Sampler.js +7 -13
- package/Source/Renderer/ShaderProgram.js +7 -0
- package/Source/Renderer/Texture.js +396 -332
- package/Source/Renderer/UniformState.js +8 -33
- package/Source/Renderer/demodernizeShader.js +2 -0
- package/Source/Renderer/loadCubeMap.js +3 -8
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +29 -2
- package/Source/Scene/BillboardCollection.js +49 -0
- package/Source/Scene/BingMapsImageryProvider.js +10 -1
- package/Source/Scene/CameraEventAggregator.js +49 -5
- package/Source/Scene/Globe.js +1 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +29 -24
- package/Source/Scene/GlobeSurfaceTileProvider.js +5 -3
- package/Source/Scene/ImageBasedLighting.js +36 -36
- package/Source/Scene/Label.js +2 -2
- package/Source/Scene/Material.js +24 -2
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -15
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/PointPrimitive.js +28 -2
- package/Source/Scene/PointPrimitiveCollection.js +22 -9
- package/Source/Scene/PostProcessStageCollection.js +45 -15
- package/Source/Scene/PostProcessStageLibrary.js +26 -0
- package/Source/Scene/Scene.js +20 -22
- package/Source/Scene/SceneTransforms.js +0 -62
- package/Source/Scene/ScreenSpaceCameraController.js +11 -4
- package/Source/Scene/SkyBox.js +13 -19
- package/Source/Scene/SpecularEnvironmentCubeMap.js +240 -0
- package/Source/Scene/Tonemapper.js +35 -23
- package/Source/Scene/VoxelPrimitive.js +0 -29
- package/Source/Scene/VoxelRenderResources.js +0 -3
- package/Source/Shaders/BillboardCollectionFS.glsl +4 -0
- package/Source/Shaders/BillboardCollectionFS.js +4 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +3 -1
- package/Source/Shaders/BillboardCollectionVS.js +3 -1
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +30 -13
- package/Source/Shaders/BrdfLutGeneratorFS.js +30 -13
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -2
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +42 -41
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +42 -41
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.glsl +23 -0
- package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.js +25 -0
- package/Source/Shaders/Builtin/Functions/textureCube.glsl +21 -2
- package/Source/Shaders/Builtin/Functions/textureCube.js +21 -2
- package/Source/Shaders/Builtin/Structs/materialInput.glsl +2 -0
- package/Source/Shaders/Builtin/Structs/materialInput.js +2 -0
- package/Source/Shaders/GlobeFS.glsl +10 -4
- package/Source/Shaders/GlobeFS.js +10 -4
- package/Source/Shaders/Materials/WaterMaskMaterial.glsl +15 -0
- package/Source/Shaders/Materials/WaterMaskMaterial.js +17 -0
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +57 -46
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +57 -46
- package/Source/Shaders/Model/LightingStageFS.glsl +8 -7
- package/Source/Shaders/Model/LightingStageFS.js +8 -7
- package/Source/Shaders/Model/MaterialStageFS.glsl +10 -14
- package/Source/Shaders/Model/MaterialStageFS.js +10 -14
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +4 -0
- package/Source/Shaders/PointPrimitiveCollectionFS.js +4 -0
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +9 -7
- package/Source/Shaders/PointPrimitiveCollectionVS.js +9 -7
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -0
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.glsl +25 -0
- package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.js +27 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -0
- package/Source/Shaders/SkyAtmosphereFS.glsl +1 -1
- package/Source/Shaders/SkyAtmosphereFS.js +1 -1
- package/Source/Widget/CesiumWidget.js +1 -1
- package/index.d.ts +191 -106
- package/index.js +133 -134
- package/package.json +4 -4
- package/Source/Scene/OctahedralProjectedCubeMap.js +0 -445
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +0 -78
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +0 -80
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +0 -89
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +0 -91
- package/Source/Shaders/OctahedralProjectionFS.glsl +0 -14
- package/Source/Shaders/OctahedralProjectionFS.js +0 -16
- package/Source/Shaders/OctahedralProjectionVS.glsl +0 -10
- package/Source/Shaders/OctahedralProjectionVS.js +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.121
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -25,467 +25,36 @@
|
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
EllipsoidRhumbLine_default
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-AI3O7UN2.js";
|
|
29
29
|
import {
|
|
30
30
|
GeometryAttribute_default,
|
|
31
31
|
Geometry_default,
|
|
32
32
|
PrimitiveType_default
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6ZREIBKS.js";
|
|
34
34
|
import {
|
|
35
35
|
ComponentDatatype_default
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-VSFFJGTA.js";
|
|
37
37
|
import {
|
|
38
38
|
Cartesian2_default,
|
|
39
39
|
Cartesian3_default,
|
|
40
40
|
Cartographic_default,
|
|
41
41
|
Ellipsoid_default
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-DJXXI7UF.js";
|
|
43
43
|
import {
|
|
44
44
|
Math_default
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-HA6TZ3XT.js";
|
|
46
46
|
import {
|
|
47
47
|
WebGLConstants_default
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-HFPMX5L2.js";
|
|
49
49
|
import {
|
|
50
50
|
defaultValue_default
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-HFMJM3SX.js";
|
|
52
52
|
import {
|
|
53
53
|
Check_default
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-OC4MYPVW.js";
|
|
55
55
|
import {
|
|
56
|
-
__commonJS,
|
|
57
|
-
__toESM,
|
|
58
56
|
defined_default
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
|
|
61
|
-
// node_modules/earcut/src/earcut.js
|
|
62
|
-
var require_earcut = __commonJS({
|
|
63
|
-
"node_modules/earcut/src/earcut.js"(exports, module) {
|
|
64
|
-
"use strict";
|
|
65
|
-
module.exports = earcut2;
|
|
66
|
-
module.exports.default = earcut2;
|
|
67
|
-
function earcut2(data, holeIndices, dim) {
|
|
68
|
-
dim = dim || 2;
|
|
69
|
-
var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];
|
|
70
|
-
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
|
71
|
-
var minX, minY, maxX, maxY, x, y, invSize;
|
|
72
|
-
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
73
|
-
if (data.length > 80 * dim) {
|
|
74
|
-
minX = maxX = data[0];
|
|
75
|
-
minY = maxY = data[1];
|
|
76
|
-
for (var i = dim; i < outerLen; i += dim) {
|
|
77
|
-
x = data[i];
|
|
78
|
-
y = data[i + 1];
|
|
79
|
-
if (x < minX) minX = x;
|
|
80
|
-
if (y < minY) minY = y;
|
|
81
|
-
if (x > maxX) maxX = x;
|
|
82
|
-
if (y > maxY) maxY = y;
|
|
83
|
-
}
|
|
84
|
-
invSize = Math.max(maxX - minX, maxY - minY);
|
|
85
|
-
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
86
|
-
}
|
|
87
|
-
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
88
|
-
return triangles;
|
|
89
|
-
}
|
|
90
|
-
function linkedList(data, start, end, dim, clockwise) {
|
|
91
|
-
var i, last;
|
|
92
|
-
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
93
|
-
for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
|
|
94
|
-
} else {
|
|
95
|
-
for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
|
|
96
|
-
}
|
|
97
|
-
if (last && equals(last, last.next)) {
|
|
98
|
-
removeNode(last);
|
|
99
|
-
last = last.next;
|
|
100
|
-
}
|
|
101
|
-
return last;
|
|
102
|
-
}
|
|
103
|
-
function filterPoints(start, end) {
|
|
104
|
-
if (!start) return start;
|
|
105
|
-
if (!end) end = start;
|
|
106
|
-
var p = start, again;
|
|
107
|
-
do {
|
|
108
|
-
again = false;
|
|
109
|
-
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
110
|
-
removeNode(p);
|
|
111
|
-
p = end = p.prev;
|
|
112
|
-
if (p === p.next) break;
|
|
113
|
-
again = true;
|
|
114
|
-
} else {
|
|
115
|
-
p = p.next;
|
|
116
|
-
}
|
|
117
|
-
} while (again || p !== end);
|
|
118
|
-
return end;
|
|
119
|
-
}
|
|
120
|
-
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
121
|
-
if (!ear) return;
|
|
122
|
-
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
|
|
123
|
-
var stop = ear, prev, next;
|
|
124
|
-
while (ear.prev !== ear.next) {
|
|
125
|
-
prev = ear.prev;
|
|
126
|
-
next = ear.next;
|
|
127
|
-
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
128
|
-
triangles.push(prev.i / dim | 0);
|
|
129
|
-
triangles.push(ear.i / dim | 0);
|
|
130
|
-
triangles.push(next.i / dim | 0);
|
|
131
|
-
removeNode(ear);
|
|
132
|
-
ear = next.next;
|
|
133
|
-
stop = next.next;
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
ear = next;
|
|
137
|
-
if (ear === stop) {
|
|
138
|
-
if (!pass) {
|
|
139
|
-
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
140
|
-
} else if (pass === 1) {
|
|
141
|
-
ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
|
|
142
|
-
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
143
|
-
} else if (pass === 2) {
|
|
144
|
-
splitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
145
|
-
}
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function isEar(ear) {
|
|
151
|
-
var a = ear.prev, b = ear, c = ear.next;
|
|
152
|
-
if (area(a, b, c) >= 0) return false;
|
|
153
|
-
var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
154
|
-
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
155
|
-
var p = c.next;
|
|
156
|
-
while (p !== a) {
|
|
157
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
158
|
-
p = p.next;
|
|
159
|
-
}
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
function isEarHashed(ear, minX, minY, invSize) {
|
|
163
|
-
var a = ear.prev, b = ear, c = ear.next;
|
|
164
|
-
if (area(a, b, c) >= 0) return false;
|
|
165
|
-
var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
166
|
-
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
167
|
-
var minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
168
|
-
var p = ear.prevZ, n = ear.nextZ;
|
|
169
|
-
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
170
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
171
|
-
p = p.prevZ;
|
|
172
|
-
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
173
|
-
n = n.nextZ;
|
|
174
|
-
}
|
|
175
|
-
while (p && p.z >= minZ) {
|
|
176
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
177
|
-
p = p.prevZ;
|
|
178
|
-
}
|
|
179
|
-
while (n && n.z <= maxZ) {
|
|
180
|
-
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
181
|
-
n = n.nextZ;
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
function cureLocalIntersections(start, triangles, dim) {
|
|
186
|
-
var p = start;
|
|
187
|
-
do {
|
|
188
|
-
var a = p.prev, b = p.next.next;
|
|
189
|
-
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
190
|
-
triangles.push(a.i / dim | 0);
|
|
191
|
-
triangles.push(p.i / dim | 0);
|
|
192
|
-
triangles.push(b.i / dim | 0);
|
|
193
|
-
removeNode(p);
|
|
194
|
-
removeNode(p.next);
|
|
195
|
-
p = start = b;
|
|
196
|
-
}
|
|
197
|
-
p = p.next;
|
|
198
|
-
} while (p !== start);
|
|
199
|
-
return filterPoints(p);
|
|
200
|
-
}
|
|
201
|
-
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
202
|
-
var a = start;
|
|
203
|
-
do {
|
|
204
|
-
var b = a.next.next;
|
|
205
|
-
while (b !== a.prev) {
|
|
206
|
-
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
207
|
-
var c = splitPolygon(a, b);
|
|
208
|
-
a = filterPoints(a, a.next);
|
|
209
|
-
c = filterPoints(c, c.next);
|
|
210
|
-
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
211
|
-
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
b = b.next;
|
|
215
|
-
}
|
|
216
|
-
a = a.next;
|
|
217
|
-
} while (a !== start);
|
|
218
|
-
}
|
|
219
|
-
function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
220
|
-
var queue = [], i, len, start, end, list;
|
|
221
|
-
for (i = 0, len = holeIndices.length; i < len; i++) {
|
|
222
|
-
start = holeIndices[i] * dim;
|
|
223
|
-
end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
224
|
-
list = linkedList(data, start, end, dim, false);
|
|
225
|
-
if (list === list.next) list.steiner = true;
|
|
226
|
-
queue.push(getLeftmost(list));
|
|
227
|
-
}
|
|
228
|
-
queue.sort(compareX);
|
|
229
|
-
for (i = 0; i < queue.length; i++) {
|
|
230
|
-
outerNode = eliminateHole(queue[i], outerNode);
|
|
231
|
-
}
|
|
232
|
-
return outerNode;
|
|
233
|
-
}
|
|
234
|
-
function compareX(a, b) {
|
|
235
|
-
return a.x - b.x;
|
|
236
|
-
}
|
|
237
|
-
function eliminateHole(hole, outerNode) {
|
|
238
|
-
var bridge = findHoleBridge(hole, outerNode);
|
|
239
|
-
if (!bridge) {
|
|
240
|
-
return outerNode;
|
|
241
|
-
}
|
|
242
|
-
var bridgeReverse = splitPolygon(bridge, hole);
|
|
243
|
-
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
244
|
-
return filterPoints(bridge, bridge.next);
|
|
245
|
-
}
|
|
246
|
-
function findHoleBridge(hole, outerNode) {
|
|
247
|
-
var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
|
|
248
|
-
do {
|
|
249
|
-
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
|
|
250
|
-
var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
|
|
251
|
-
if (x <= hx && x > qx) {
|
|
252
|
-
qx = x;
|
|
253
|
-
m = p.x < p.next.x ? p : p.next;
|
|
254
|
-
if (x === hx) return m;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
p = p.next;
|
|
258
|
-
} while (p !== outerNode);
|
|
259
|
-
if (!m) return null;
|
|
260
|
-
var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
|
|
261
|
-
p = m;
|
|
262
|
-
do {
|
|
263
|
-
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
264
|
-
tan = Math.abs(hy - p.y) / (hx - p.x);
|
|
265
|
-
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
|
|
266
|
-
m = p;
|
|
267
|
-
tanMin = tan;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
p = p.next;
|
|
271
|
-
} while (p !== stop);
|
|
272
|
-
return m;
|
|
273
|
-
}
|
|
274
|
-
function sectorContainsSector(m, p) {
|
|
275
|
-
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
|
|
276
|
-
}
|
|
277
|
-
function indexCurve(start, minX, minY, invSize) {
|
|
278
|
-
var p = start;
|
|
279
|
-
do {
|
|
280
|
-
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
281
|
-
p.prevZ = p.prev;
|
|
282
|
-
p.nextZ = p.next;
|
|
283
|
-
p = p.next;
|
|
284
|
-
} while (p !== start);
|
|
285
|
-
p.prevZ.nextZ = null;
|
|
286
|
-
p.prevZ = null;
|
|
287
|
-
sortLinked(p);
|
|
288
|
-
}
|
|
289
|
-
function sortLinked(list) {
|
|
290
|
-
var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
|
|
291
|
-
do {
|
|
292
|
-
p = list;
|
|
293
|
-
list = null;
|
|
294
|
-
tail = null;
|
|
295
|
-
numMerges = 0;
|
|
296
|
-
while (p) {
|
|
297
|
-
numMerges++;
|
|
298
|
-
q = p;
|
|
299
|
-
pSize = 0;
|
|
300
|
-
for (i = 0; i < inSize; i++) {
|
|
301
|
-
pSize++;
|
|
302
|
-
q = q.nextZ;
|
|
303
|
-
if (!q) break;
|
|
304
|
-
}
|
|
305
|
-
qSize = inSize;
|
|
306
|
-
while (pSize > 0 || qSize > 0 && q) {
|
|
307
|
-
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
|
|
308
|
-
e = p;
|
|
309
|
-
p = p.nextZ;
|
|
310
|
-
pSize--;
|
|
311
|
-
} else {
|
|
312
|
-
e = q;
|
|
313
|
-
q = q.nextZ;
|
|
314
|
-
qSize--;
|
|
315
|
-
}
|
|
316
|
-
if (tail) tail.nextZ = e;
|
|
317
|
-
else list = e;
|
|
318
|
-
e.prevZ = tail;
|
|
319
|
-
tail = e;
|
|
320
|
-
}
|
|
321
|
-
p = q;
|
|
322
|
-
}
|
|
323
|
-
tail.nextZ = null;
|
|
324
|
-
inSize *= 2;
|
|
325
|
-
} while (numMerges > 1);
|
|
326
|
-
return list;
|
|
327
|
-
}
|
|
328
|
-
function zOrder(x, y, minX, minY, invSize) {
|
|
329
|
-
x = (x - minX) * invSize | 0;
|
|
330
|
-
y = (y - minY) * invSize | 0;
|
|
331
|
-
x = (x | x << 8) & 16711935;
|
|
332
|
-
x = (x | x << 4) & 252645135;
|
|
333
|
-
x = (x | x << 2) & 858993459;
|
|
334
|
-
x = (x | x << 1) & 1431655765;
|
|
335
|
-
y = (y | y << 8) & 16711935;
|
|
336
|
-
y = (y | y << 4) & 252645135;
|
|
337
|
-
y = (y | y << 2) & 858993459;
|
|
338
|
-
y = (y | y << 1) & 1431655765;
|
|
339
|
-
return x | y << 1;
|
|
340
|
-
}
|
|
341
|
-
function getLeftmost(start) {
|
|
342
|
-
var p = start, leftmost = start;
|
|
343
|
-
do {
|
|
344
|
-
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
|
|
345
|
-
p = p.next;
|
|
346
|
-
} while (p !== start);
|
|
347
|
-
return leftmost;
|
|
348
|
-
}
|
|
349
|
-
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
350
|
-
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
351
|
-
}
|
|
352
|
-
function isValidDiagonal(a, b) {
|
|
353
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
|
|
354
|
-
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
355
|
-
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
356
|
-
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
|
|
357
|
-
}
|
|
358
|
-
function area(p, q, r) {
|
|
359
|
-
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
360
|
-
}
|
|
361
|
-
function equals(p1, p2) {
|
|
362
|
-
return p1.x === p2.x && p1.y === p2.y;
|
|
363
|
-
}
|
|
364
|
-
function intersects(p1, q1, p2, q2) {
|
|
365
|
-
var o1 = sign(area(p1, q1, p2));
|
|
366
|
-
var o2 = sign(area(p1, q1, q2));
|
|
367
|
-
var o3 = sign(area(p2, q2, p1));
|
|
368
|
-
var o4 = sign(area(p2, q2, q1));
|
|
369
|
-
if (o1 !== o2 && o3 !== o4) return true;
|
|
370
|
-
if (o1 === 0 && onSegment(p1, p2, q1)) return true;
|
|
371
|
-
if (o2 === 0 && onSegment(p1, q2, q1)) return true;
|
|
372
|
-
if (o3 === 0 && onSegment(p2, p1, q2)) return true;
|
|
373
|
-
if (o4 === 0 && onSegment(p2, q1, q2)) return true;
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
function onSegment(p, q, r) {
|
|
377
|
-
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
378
|
-
}
|
|
379
|
-
function sign(num) {
|
|
380
|
-
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
381
|
-
}
|
|
382
|
-
function intersectsPolygon(a, b) {
|
|
383
|
-
var p = a;
|
|
384
|
-
do {
|
|
385
|
-
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
|
|
386
|
-
p = p.next;
|
|
387
|
-
} while (p !== a);
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
function locallyInside(a, b) {
|
|
391
|
-
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
|
|
392
|
-
}
|
|
393
|
-
function middleInside(a, b) {
|
|
394
|
-
var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
|
|
395
|
-
do {
|
|
396
|
-
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
|
|
397
|
-
inside = !inside;
|
|
398
|
-
p = p.next;
|
|
399
|
-
} while (p !== a);
|
|
400
|
-
return inside;
|
|
401
|
-
}
|
|
402
|
-
function splitPolygon(a, b) {
|
|
403
|
-
var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;
|
|
404
|
-
a.next = b;
|
|
405
|
-
b.prev = a;
|
|
406
|
-
a2.next = an;
|
|
407
|
-
an.prev = a2;
|
|
408
|
-
b2.next = a2;
|
|
409
|
-
a2.prev = b2;
|
|
410
|
-
bp.next = b2;
|
|
411
|
-
b2.prev = bp;
|
|
412
|
-
return b2;
|
|
413
|
-
}
|
|
414
|
-
function insertNode(i, x, y, last) {
|
|
415
|
-
var p = new Node(i, x, y);
|
|
416
|
-
if (!last) {
|
|
417
|
-
p.prev = p;
|
|
418
|
-
p.next = p;
|
|
419
|
-
} else {
|
|
420
|
-
p.next = last.next;
|
|
421
|
-
p.prev = last;
|
|
422
|
-
last.next.prev = p;
|
|
423
|
-
last.next = p;
|
|
424
|
-
}
|
|
425
|
-
return p;
|
|
426
|
-
}
|
|
427
|
-
function removeNode(p) {
|
|
428
|
-
p.next.prev = p.prev;
|
|
429
|
-
p.prev.next = p.next;
|
|
430
|
-
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
431
|
-
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
432
|
-
}
|
|
433
|
-
function Node(i, x, y) {
|
|
434
|
-
this.i = i;
|
|
435
|
-
this.x = x;
|
|
436
|
-
this.y = y;
|
|
437
|
-
this.prev = null;
|
|
438
|
-
this.next = null;
|
|
439
|
-
this.z = 0;
|
|
440
|
-
this.prevZ = null;
|
|
441
|
-
this.nextZ = null;
|
|
442
|
-
this.steiner = false;
|
|
443
|
-
}
|
|
444
|
-
earcut2.deviation = function(data, holeIndices, dim, triangles) {
|
|
445
|
-
var hasHoles = holeIndices && holeIndices.length;
|
|
446
|
-
var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
447
|
-
var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
|
|
448
|
-
if (hasHoles) {
|
|
449
|
-
for (var i = 0, len = holeIndices.length; i < len; i++) {
|
|
450
|
-
var start = holeIndices[i] * dim;
|
|
451
|
-
var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
452
|
-
polygonArea -= Math.abs(signedArea(data, start, end, dim));
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
var trianglesArea = 0;
|
|
456
|
-
for (i = 0; i < triangles.length; i += 3) {
|
|
457
|
-
var a = triangles[i] * dim;
|
|
458
|
-
var b = triangles[i + 1] * dim;
|
|
459
|
-
var c = triangles[i + 2] * dim;
|
|
460
|
-
trianglesArea += Math.abs(
|
|
461
|
-
(data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1])
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
465
|
-
};
|
|
466
|
-
function signedArea(data, start, end, dim) {
|
|
467
|
-
var sum = 0;
|
|
468
|
-
for (var i = start, j = end - dim; i < end; i += dim) {
|
|
469
|
-
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
470
|
-
j = i;
|
|
471
|
-
}
|
|
472
|
-
return sum;
|
|
473
|
-
}
|
|
474
|
-
earcut2.flatten = function(data) {
|
|
475
|
-
var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
|
|
476
|
-
for (var i = 0; i < data.length; i++) {
|
|
477
|
-
for (var j = 0; j < data[i].length; j++) {
|
|
478
|
-
for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);
|
|
479
|
-
}
|
|
480
|
-
if (i > 0) {
|
|
481
|
-
holeIndex += data[i - 1].length;
|
|
482
|
-
result.holes.push(holeIndex);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return result;
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
});
|
|
57
|
+
} from "./chunk-2EDC3QGH.js";
|
|
489
58
|
|
|
490
59
|
// packages/engine/Source/Core/WindingOrder.js
|
|
491
60
|
var WindingOrder = {
|
|
@@ -509,8 +78,414 @@ WindingOrder.validate = function(windingOrder) {
|
|
|
509
78
|
};
|
|
510
79
|
var WindingOrder_default = Object.freeze(WindingOrder);
|
|
511
80
|
|
|
81
|
+
// node_modules/earcut/src/earcut.js
|
|
82
|
+
function earcut(data, holeIndices, dim = 2) {
|
|
83
|
+
const hasHoles = holeIndices && holeIndices.length;
|
|
84
|
+
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
85
|
+
let outerNode = linkedList(data, 0, outerLen, dim, true);
|
|
86
|
+
const triangles = [];
|
|
87
|
+
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
|
88
|
+
let minX, minY, invSize;
|
|
89
|
+
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
90
|
+
if (data.length > 80 * dim) {
|
|
91
|
+
minX = Infinity;
|
|
92
|
+
minY = Infinity;
|
|
93
|
+
let maxX = -Infinity;
|
|
94
|
+
let maxY = -Infinity;
|
|
95
|
+
for (let i = dim; i < outerLen; i += dim) {
|
|
96
|
+
const x = data[i];
|
|
97
|
+
const y = data[i + 1];
|
|
98
|
+
if (x < minX) minX = x;
|
|
99
|
+
if (y < minY) minY = y;
|
|
100
|
+
if (x > maxX) maxX = x;
|
|
101
|
+
if (y > maxY) maxY = y;
|
|
102
|
+
}
|
|
103
|
+
invSize = Math.max(maxX - minX, maxY - minY);
|
|
104
|
+
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
105
|
+
}
|
|
106
|
+
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
107
|
+
return triangles;
|
|
108
|
+
}
|
|
109
|
+
function linkedList(data, start, end, dim, clockwise) {
|
|
110
|
+
let last;
|
|
111
|
+
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
112
|
+
for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
|
|
113
|
+
} else {
|
|
114
|
+
for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
|
|
115
|
+
}
|
|
116
|
+
if (last && equals(last, last.next)) {
|
|
117
|
+
removeNode(last);
|
|
118
|
+
last = last.next;
|
|
119
|
+
}
|
|
120
|
+
return last;
|
|
121
|
+
}
|
|
122
|
+
function filterPoints(start, end) {
|
|
123
|
+
if (!start) return start;
|
|
124
|
+
if (!end) end = start;
|
|
125
|
+
let p = start, again;
|
|
126
|
+
do {
|
|
127
|
+
again = false;
|
|
128
|
+
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
129
|
+
removeNode(p);
|
|
130
|
+
p = end = p.prev;
|
|
131
|
+
if (p === p.next) break;
|
|
132
|
+
again = true;
|
|
133
|
+
} else {
|
|
134
|
+
p = p.next;
|
|
135
|
+
}
|
|
136
|
+
} while (again || p !== end);
|
|
137
|
+
return end;
|
|
138
|
+
}
|
|
139
|
+
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
140
|
+
if (!ear) return;
|
|
141
|
+
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
|
|
142
|
+
let stop = ear;
|
|
143
|
+
while (ear.prev !== ear.next) {
|
|
144
|
+
const prev = ear.prev;
|
|
145
|
+
const next = ear.next;
|
|
146
|
+
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
147
|
+
triangles.push(prev.i, ear.i, next.i);
|
|
148
|
+
removeNode(ear);
|
|
149
|
+
ear = next.next;
|
|
150
|
+
stop = next.next;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
ear = next;
|
|
154
|
+
if (ear === stop) {
|
|
155
|
+
if (!pass) {
|
|
156
|
+
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
157
|
+
} else if (pass === 1) {
|
|
158
|
+
ear = cureLocalIntersections(filterPoints(ear), triangles);
|
|
159
|
+
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
160
|
+
} else if (pass === 2) {
|
|
161
|
+
splitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function isEar(ear) {
|
|
168
|
+
const a = ear.prev, b = ear, c = ear.next;
|
|
169
|
+
if (area(a, b, c) >= 0) return false;
|
|
170
|
+
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
171
|
+
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
172
|
+
let p = c.next;
|
|
173
|
+
while (p !== a) {
|
|
174
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
175
|
+
p = p.next;
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
function isEarHashed(ear, minX, minY, invSize) {
|
|
180
|
+
const a = ear.prev, b = ear, c = ear.next;
|
|
181
|
+
if (area(a, b, c) >= 0) return false;
|
|
182
|
+
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
183
|
+
const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
184
|
+
const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
185
|
+
let p = ear.prevZ, n = ear.nextZ;
|
|
186
|
+
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
187
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
188
|
+
p = p.prevZ;
|
|
189
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
190
|
+
n = n.nextZ;
|
|
191
|
+
}
|
|
192
|
+
while (p && p.z >= minZ) {
|
|
193
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
194
|
+
p = p.prevZ;
|
|
195
|
+
}
|
|
196
|
+
while (n && n.z <= maxZ) {
|
|
197
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
198
|
+
n = n.nextZ;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
function cureLocalIntersections(start, triangles) {
|
|
203
|
+
let p = start;
|
|
204
|
+
do {
|
|
205
|
+
const a = p.prev, b = p.next.next;
|
|
206
|
+
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
207
|
+
triangles.push(a.i, p.i, b.i);
|
|
208
|
+
removeNode(p);
|
|
209
|
+
removeNode(p.next);
|
|
210
|
+
p = start = b;
|
|
211
|
+
}
|
|
212
|
+
p = p.next;
|
|
213
|
+
} while (p !== start);
|
|
214
|
+
return filterPoints(p);
|
|
215
|
+
}
|
|
216
|
+
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
217
|
+
let a = start;
|
|
218
|
+
do {
|
|
219
|
+
let b = a.next.next;
|
|
220
|
+
while (b !== a.prev) {
|
|
221
|
+
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
222
|
+
let c = splitPolygon(a, b);
|
|
223
|
+
a = filterPoints(a, a.next);
|
|
224
|
+
c = filterPoints(c, c.next);
|
|
225
|
+
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
226
|
+
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
b = b.next;
|
|
230
|
+
}
|
|
231
|
+
a = a.next;
|
|
232
|
+
} while (a !== start);
|
|
233
|
+
}
|
|
234
|
+
function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
235
|
+
const queue = [];
|
|
236
|
+
for (let i = 0, len = holeIndices.length; i < len; i++) {
|
|
237
|
+
const start = holeIndices[i] * dim;
|
|
238
|
+
const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
239
|
+
const list = linkedList(data, start, end, dim, false);
|
|
240
|
+
if (list === list.next) list.steiner = true;
|
|
241
|
+
queue.push(getLeftmost(list));
|
|
242
|
+
}
|
|
243
|
+
queue.sort(compareX);
|
|
244
|
+
for (let i = 0; i < queue.length; i++) {
|
|
245
|
+
outerNode = eliminateHole(queue[i], outerNode);
|
|
246
|
+
}
|
|
247
|
+
return outerNode;
|
|
248
|
+
}
|
|
249
|
+
function compareX(a, b) {
|
|
250
|
+
return a.x - b.x;
|
|
251
|
+
}
|
|
252
|
+
function eliminateHole(hole, outerNode) {
|
|
253
|
+
const bridge = findHoleBridge(hole, outerNode);
|
|
254
|
+
if (!bridge) {
|
|
255
|
+
return outerNode;
|
|
256
|
+
}
|
|
257
|
+
const bridgeReverse = splitPolygon(bridge, hole);
|
|
258
|
+
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
259
|
+
return filterPoints(bridge, bridge.next);
|
|
260
|
+
}
|
|
261
|
+
function findHoleBridge(hole, outerNode) {
|
|
262
|
+
let p = outerNode;
|
|
263
|
+
const hx = hole.x;
|
|
264
|
+
const hy = hole.y;
|
|
265
|
+
let qx = -Infinity;
|
|
266
|
+
let m;
|
|
267
|
+
do {
|
|
268
|
+
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
|
|
269
|
+
const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
|
|
270
|
+
if (x <= hx && x > qx) {
|
|
271
|
+
qx = x;
|
|
272
|
+
m = p.x < p.next.x ? p : p.next;
|
|
273
|
+
if (x === hx) return m;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
p = p.next;
|
|
277
|
+
} while (p !== outerNode);
|
|
278
|
+
if (!m) return null;
|
|
279
|
+
const stop = m;
|
|
280
|
+
const mx = m.x;
|
|
281
|
+
const my = m.y;
|
|
282
|
+
let tanMin = Infinity;
|
|
283
|
+
p = m;
|
|
284
|
+
do {
|
|
285
|
+
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
286
|
+
const tan = Math.abs(hy - p.y) / (hx - p.x);
|
|
287
|
+
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
|
|
288
|
+
m = p;
|
|
289
|
+
tanMin = tan;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
p = p.next;
|
|
293
|
+
} while (p !== stop);
|
|
294
|
+
return m;
|
|
295
|
+
}
|
|
296
|
+
function sectorContainsSector(m, p) {
|
|
297
|
+
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
|
|
298
|
+
}
|
|
299
|
+
function indexCurve(start, minX, minY, invSize) {
|
|
300
|
+
let p = start;
|
|
301
|
+
do {
|
|
302
|
+
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
303
|
+
p.prevZ = p.prev;
|
|
304
|
+
p.nextZ = p.next;
|
|
305
|
+
p = p.next;
|
|
306
|
+
} while (p !== start);
|
|
307
|
+
p.prevZ.nextZ = null;
|
|
308
|
+
p.prevZ = null;
|
|
309
|
+
sortLinked(p);
|
|
310
|
+
}
|
|
311
|
+
function sortLinked(list) {
|
|
312
|
+
let numMerges;
|
|
313
|
+
let inSize = 1;
|
|
314
|
+
do {
|
|
315
|
+
let p = list;
|
|
316
|
+
let e;
|
|
317
|
+
list = null;
|
|
318
|
+
let tail = null;
|
|
319
|
+
numMerges = 0;
|
|
320
|
+
while (p) {
|
|
321
|
+
numMerges++;
|
|
322
|
+
let q = p;
|
|
323
|
+
let pSize = 0;
|
|
324
|
+
for (let i = 0; i < inSize; i++) {
|
|
325
|
+
pSize++;
|
|
326
|
+
q = q.nextZ;
|
|
327
|
+
if (!q) break;
|
|
328
|
+
}
|
|
329
|
+
let qSize = inSize;
|
|
330
|
+
while (pSize > 0 || qSize > 0 && q) {
|
|
331
|
+
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
|
|
332
|
+
e = p;
|
|
333
|
+
p = p.nextZ;
|
|
334
|
+
pSize--;
|
|
335
|
+
} else {
|
|
336
|
+
e = q;
|
|
337
|
+
q = q.nextZ;
|
|
338
|
+
qSize--;
|
|
339
|
+
}
|
|
340
|
+
if (tail) tail.nextZ = e;
|
|
341
|
+
else list = e;
|
|
342
|
+
e.prevZ = tail;
|
|
343
|
+
tail = e;
|
|
344
|
+
}
|
|
345
|
+
p = q;
|
|
346
|
+
}
|
|
347
|
+
tail.nextZ = null;
|
|
348
|
+
inSize *= 2;
|
|
349
|
+
} while (numMerges > 1);
|
|
350
|
+
return list;
|
|
351
|
+
}
|
|
352
|
+
function zOrder(x, y, minX, minY, invSize) {
|
|
353
|
+
x = (x - minX) * invSize | 0;
|
|
354
|
+
y = (y - minY) * invSize | 0;
|
|
355
|
+
x = (x | x << 8) & 16711935;
|
|
356
|
+
x = (x | x << 4) & 252645135;
|
|
357
|
+
x = (x | x << 2) & 858993459;
|
|
358
|
+
x = (x | x << 1) & 1431655765;
|
|
359
|
+
y = (y | y << 8) & 16711935;
|
|
360
|
+
y = (y | y << 4) & 252645135;
|
|
361
|
+
y = (y | y << 2) & 858993459;
|
|
362
|
+
y = (y | y << 1) & 1431655765;
|
|
363
|
+
return x | y << 1;
|
|
364
|
+
}
|
|
365
|
+
function getLeftmost(start) {
|
|
366
|
+
let p = start, leftmost = start;
|
|
367
|
+
do {
|
|
368
|
+
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
|
|
369
|
+
p = p.next;
|
|
370
|
+
} while (p !== start);
|
|
371
|
+
return leftmost;
|
|
372
|
+
}
|
|
373
|
+
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
374
|
+
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
375
|
+
}
|
|
376
|
+
function isValidDiagonal(a, b) {
|
|
377
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
|
|
378
|
+
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
379
|
+
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
380
|
+
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
|
|
381
|
+
}
|
|
382
|
+
function area(p, q, r) {
|
|
383
|
+
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
384
|
+
}
|
|
385
|
+
function equals(p1, p2) {
|
|
386
|
+
return p1.x === p2.x && p1.y === p2.y;
|
|
387
|
+
}
|
|
388
|
+
function intersects(p1, q1, p2, q2) {
|
|
389
|
+
const o1 = sign(area(p1, q1, p2));
|
|
390
|
+
const o2 = sign(area(p1, q1, q2));
|
|
391
|
+
const o3 = sign(area(p2, q2, p1));
|
|
392
|
+
const o4 = sign(area(p2, q2, q1));
|
|
393
|
+
if (o1 !== o2 && o3 !== o4) return true;
|
|
394
|
+
if (o1 === 0 && onSegment(p1, p2, q1)) return true;
|
|
395
|
+
if (o2 === 0 && onSegment(p1, q2, q1)) return true;
|
|
396
|
+
if (o3 === 0 && onSegment(p2, p1, q2)) return true;
|
|
397
|
+
if (o4 === 0 && onSegment(p2, q1, q2)) return true;
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
function onSegment(p, q, r) {
|
|
401
|
+
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
402
|
+
}
|
|
403
|
+
function sign(num) {
|
|
404
|
+
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
405
|
+
}
|
|
406
|
+
function intersectsPolygon(a, b) {
|
|
407
|
+
let p = a;
|
|
408
|
+
do {
|
|
409
|
+
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
|
|
410
|
+
p = p.next;
|
|
411
|
+
} while (p !== a);
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
function locallyInside(a, b) {
|
|
415
|
+
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
|
|
416
|
+
}
|
|
417
|
+
function middleInside(a, b) {
|
|
418
|
+
let p = a;
|
|
419
|
+
let inside = false;
|
|
420
|
+
const px = (a.x + b.x) / 2;
|
|
421
|
+
const py = (a.y + b.y) / 2;
|
|
422
|
+
do {
|
|
423
|
+
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
|
|
424
|
+
inside = !inside;
|
|
425
|
+
p = p.next;
|
|
426
|
+
} while (p !== a);
|
|
427
|
+
return inside;
|
|
428
|
+
}
|
|
429
|
+
function splitPolygon(a, b) {
|
|
430
|
+
const a2 = createNode(a.i, a.x, a.y), b2 = createNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
|
|
431
|
+
a.next = b;
|
|
432
|
+
b.prev = a;
|
|
433
|
+
a2.next = an;
|
|
434
|
+
an.prev = a2;
|
|
435
|
+
b2.next = a2;
|
|
436
|
+
a2.prev = b2;
|
|
437
|
+
bp.next = b2;
|
|
438
|
+
b2.prev = bp;
|
|
439
|
+
return b2;
|
|
440
|
+
}
|
|
441
|
+
function insertNode(i, x, y, last) {
|
|
442
|
+
const p = createNode(i, x, y);
|
|
443
|
+
if (!last) {
|
|
444
|
+
p.prev = p;
|
|
445
|
+
p.next = p;
|
|
446
|
+
} else {
|
|
447
|
+
p.next = last.next;
|
|
448
|
+
p.prev = last;
|
|
449
|
+
last.next.prev = p;
|
|
450
|
+
last.next = p;
|
|
451
|
+
}
|
|
452
|
+
return p;
|
|
453
|
+
}
|
|
454
|
+
function removeNode(p) {
|
|
455
|
+
p.next.prev = p.prev;
|
|
456
|
+
p.prev.next = p.next;
|
|
457
|
+
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
458
|
+
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
459
|
+
}
|
|
460
|
+
function createNode(i, x, y) {
|
|
461
|
+
return {
|
|
462
|
+
i,
|
|
463
|
+
// vertex index in coordinates array
|
|
464
|
+
x,
|
|
465
|
+
y,
|
|
466
|
+
// vertex coordinates
|
|
467
|
+
prev: null,
|
|
468
|
+
// previous and next vertex nodes in a polygon ring
|
|
469
|
+
next: null,
|
|
470
|
+
z: 0,
|
|
471
|
+
// z-order curve value
|
|
472
|
+
prevZ: null,
|
|
473
|
+
// previous and next nodes in z-order
|
|
474
|
+
nextZ: null,
|
|
475
|
+
steiner: false
|
|
476
|
+
// indicates whether this is a steiner point
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
function signedArea(data, start, end, dim) {
|
|
480
|
+
let sum = 0;
|
|
481
|
+
for (let i = start, j = end - dim; i < end; i += dim) {
|
|
482
|
+
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
483
|
+
j = i;
|
|
484
|
+
}
|
|
485
|
+
return sum;
|
|
486
|
+
}
|
|
487
|
+
|
|
512
488
|
// packages/engine/Source/Core/PolygonPipeline.js
|
|
513
|
-
var import_earcut = __toESM(require_earcut(), 1);
|
|
514
489
|
var scaleToGeodeticHeightN = new Cartesian3_default();
|
|
515
490
|
var scaleToGeodeticHeightP = new Cartesian3_default();
|
|
516
491
|
var PolygonPipeline = {};
|
|
@@ -522,22 +497,22 @@ PolygonPipeline.computeArea2D = function(positions) {
|
|
|
522
497
|
3
|
|
523
498
|
);
|
|
524
499
|
const length = positions.length;
|
|
525
|
-
let
|
|
500
|
+
let area2 = 0;
|
|
526
501
|
for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
|
|
527
502
|
const v0 = positions[i0];
|
|
528
503
|
const v1 = positions[i1];
|
|
529
|
-
|
|
504
|
+
area2 += v0.x * v1.y - v1.x * v0.y;
|
|
530
505
|
}
|
|
531
|
-
return
|
|
506
|
+
return area2 * 0.5;
|
|
532
507
|
};
|
|
533
508
|
PolygonPipeline.computeWindingOrder2D = function(positions) {
|
|
534
|
-
const
|
|
535
|
-
return
|
|
509
|
+
const area2 = PolygonPipeline.computeArea2D(positions);
|
|
510
|
+
return area2 > 0 ? WindingOrder_default.COUNTER_CLOCKWISE : WindingOrder_default.CLOCKWISE;
|
|
536
511
|
};
|
|
537
512
|
PolygonPipeline.triangulate = function(positions, holes) {
|
|
538
513
|
Check_default.defined("positions", positions);
|
|
539
514
|
const flattenedPositions = Cartesian2_default.packArray(positions);
|
|
540
|
-
return (
|
|
515
|
+
return earcut(flattenedPositions, holes, 2);
|
|
541
516
|
};
|
|
542
517
|
var subdivisionV0Scratch = new Cartesian3_default();
|
|
543
518
|
var subdivisionV1Scratch = new Cartesian3_default();
|