@arcgis/core 4.33.0-next.20250430 → 4.33.0-next.20250502
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02b38423276536596aba.js +1 -0
- package/assets/esri/core/workers/chunks/{de16b771d2c8d816c738.js → 05c80002c37002ac99e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d40c4783f58af1ae0dc.js → 0e8181e7fc1386d08ffc.js} +1 -1
- package/assets/esri/core/workers/chunks/{96e5d192c8d23c1e324f.js → 13e68c43acc8916520db.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6a5911ea21bef32834b.js → 1bc22af4cc4effcbcf2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b2ab27159500315fbc1.js → 26850ec0917ee355ddb7.js} +1 -1
- package/assets/esri/core/workers/chunks/{1bd4fe77ba6fb25322e7.js → 29e2b105f55adafc3a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d63dfa5a60c88e03b28.js → 2c77a543a174e5bc736a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0ddf4f1c6a351b447c7.js → 30d7d2c7d6e9e5e2ecb9.js} +1 -1
- package/assets/esri/core/workers/chunks/3cee3ff926f47aae476f.js +1 -0
- package/assets/esri/core/workers/chunks/{febae745a29a17ca130a.js → 4480e4b61affb3b2e9d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d4a271351fd288277d2.js → 49085a0b3a74e158f32f.js} +1 -1
- package/assets/esri/core/workers/chunks/{392e64a573f67817db02.js → 4cb199b547e5b97e65fb.js} +1 -1
- package/assets/esri/core/workers/chunks/4df36ee2406861c7afa8.js +1 -0
- package/assets/esri/core/workers/chunks/{ba917175ca2a6681501e.js → 563594357f3648652a5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{abfc5f9ac16c3e885c5f.js → 56db71ea7eb8a5652d98.js} +1 -1
- package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
- package/assets/esri/core/workers/chunks/{235efd948ae470a6f238.js → 60b1365d25581ccf0485.js} +1 -1
- package/assets/esri/core/workers/chunks/{3795793643f4db64af0e.js → 63c25455b9cf1b3df76a.js} +1 -1
- package/assets/esri/core/workers/chunks/{cb25b45a6b385e60c68d.js → 653ff3e631fea8ad393a.js} +122 -121
- package/assets/esri/core/workers/chunks/{909be86782af3deb448e.js → 654fe135d41af81daa13.js} +1 -1
- package/assets/esri/core/workers/chunks/{cd9343c78a7c3acdbbcd.js → 681b2662f6ce936afd7e.js} +1 -1
- package/assets/esri/core/workers/chunks/6d89d42bcba213be2d9d.js +1 -0
- package/assets/esri/core/workers/chunks/6ecc3a3737ae8622dfa4.js +1 -0
- package/assets/esri/core/workers/chunks/6fef5a07f75b2a5736ad.js +1 -0
- package/assets/esri/core/workers/chunks/6ff46126c82354e6c78e.js +1 -0
- package/assets/esri/core/workers/chunks/{65f2b22d8fc12e6d4a87.js → 7000d9158da929a16071.js} +1 -1
- package/assets/esri/core/workers/chunks/71dc9d78dec981078a1a.js +1 -0
- package/assets/esri/core/workers/chunks/{ab6ecd8eeec5ff761b34.js → 73bca519c93920bc8c9f.js} +1 -1
- package/assets/esri/core/workers/chunks/{7551011117c3d36ff3db.js → 743cdbff5c4616ddc2b4.js} +1 -1
- package/assets/esri/core/workers/chunks/7a282674d77875c58acd.js +1 -0
- package/assets/esri/core/workers/chunks/{968956284f44187f0622.js → 8540fb31bd0b29ff1906.js} +1 -1
- package/assets/esri/core/workers/chunks/8c5cea49e48f8858f115.js +1 -0
- package/assets/esri/core/workers/chunks/{237a965bd41ba8903e03.js → 921c040d0497031fd8ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{96d2a0777f5c418055fb.js → 92b48e3365d1cc933113.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d485c07848164099859.js → 95a4da3150ad8e8e36d8.js} +1 -1
- package/assets/esri/core/workers/chunks/9652cfd4668b95036c87.js +39 -0
- package/assets/esri/core/workers/chunks/{46fb6ba8900286d18b6f.js → 9d564f79b82d427fc1da.js} +1 -1
- package/assets/esri/core/workers/chunks/9f07919ade6707b103da.js +1 -0
- package/assets/esri/core/workers/chunks/{00612d6e05b1c8647668.js → 9fff43ffcd5602ccc50f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cc5c566e68f2255d035.js → a6ca68ef6311ffc365b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a51c75a2932d9da001a.js → a8d043b73e087bee7c40.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3174ff4dd5acd16485a.js → c041f4a1d18d42e27ad7.js} +1 -1
- package/assets/esri/core/workers/chunks/{ebfa4a0334401f5e004a.js → c12765e0c8b44e349c2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{afddb94ff4e1a70022c7.js → c3b2b05996e2008adbe3.js} +1 -1
- package/assets/esri/core/workers/chunks/c9a2c4fd169b943db4b4.js +1 -0
- package/assets/esri/core/workers/chunks/{4fb4884d2de42792abe3.js → d1a9e8db5ba403abe721.js} +1 -1
- package/assets/esri/core/workers/chunks/d35cd309ba7bb8968a22.js +1 -0
- package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a8df1225abd54ff68ed.js → db298b292a4e43cba72d.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bda2cfc6e81818d7d33.js → dcaeb57c69d432118604.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb455fd89b74b70a6a2b.js → e613df03ceb39e29befa.js} +1 -1
- package/assets/esri/core/workers/chunks/{05d7d8ff3e4cbad32580.js → e8dcaa7837b6fe7bff20.js} +1 -1
- package/assets/esri/core/workers/chunks/ec1a4b82cbc44ba45f83.js +1 -0
- package/assets/esri/core/workers/chunks/ec778cc7a55068f51937.js +1 -0
- package/assets/esri/core/workers/chunks/{51339193abddfe37745d.js → f2b63597ae956db74eb3.js} +1 -1
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/Envelope2D.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SSAO.glsl.js +43 -42
- package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/containsOperator.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/equalsOperator.js +1 -1
- package/core/NestedMap.js +1 -1
- package/core/deprecate.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/containsOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/interfaces.d.ts +263 -39
- package/layers/MapImageLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/save/mapImageLayerUtils.js +5 -0
- package/package.json +1 -1
- package/portal/support/portalItemUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/glTF/LoaderResult.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/DeconflictAABR.js +5 -0
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
- package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +5 -0
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/ui/DefaultUI.js +1 -1
- package/views/webgl/Sync.js +5 -0
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/css.js +5 -0
- package/widgets/Directions.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +4 -0
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/TableList/ListItemPanel.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather.js +1 -1
- package/assets/esri/core/workers/chunks/11b55e7e76e50fe11bbe.js +0 -1
- package/assets/esri/core/workers/chunks/25142d431dd1e5e82234.js +0 -1
- package/assets/esri/core/workers/chunks/2c92f6f268aa2de5432c.js +0 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +0 -1
- package/assets/esri/core/workers/chunks/7fce62ef3f0b011e0d35.js +0 -1
- package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +0 -1
- package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +0 -1
- package/assets/esri/core/workers/chunks/8c8d812a7f2d29c29676.js +0 -1
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +0 -1
- package/assets/esri/core/workers/chunks/b780c7062b1b18a5ae19.js +0 -1
- package/assets/esri/core/workers/chunks/b8248939373e25a8d6db.js +0 -1
- package/assets/esri/core/workers/chunks/baa9fd23414f03ef90bc.js +0 -1
- package/assets/esri/core/workers/chunks/c819535525e9a27bae1f.js +0 -39
- package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +0 -1
- package/assets/esri/core/workers/chunks/f2bc75a718a10065011d.js +0 -1
package/chunks/SSAO.glsl.js
CHANGED
|
@@ -28,59 +28,60 @@ vec3 v = Q - C;
|
|
|
28
28
|
float vv = dot(v, v);
|
|
29
29
|
float vn = dot(normalize(v), n_C);
|
|
30
30
|
return fallOffFunction(vv, vn, 0.1);
|
|
31
|
-
}`),m.uniforms.add(new u("normalMap",(e=>e.normalTexture)),new u("depthMap",(e=>e.depthTexture)),new c("projScale",(e=>e.projScale)),new u("rnm",(e=>e.noiseTexture)),new n("rnmScale",((r,t)=>e(p,t.camera.fullWidth/r.noiseTexture.descriptor.width,t.camera.fullHeight/r.noiseTexture.descriptor.height))),new c("intensity",(e=>e.intensity)),new i("screenSize",(r=>e(p,r.camera.fullWidth,r.camera.fullHeight))))
|
|
32
|
-
|
|
31
|
+
}`),r.outputs.add("fragOcclusion","float"),m.uniforms.add(new u("normalMap",(e=>e.normalTexture)),new u("depthMap",(e=>e.depthTexture)),new c("projScale",(e=>e.projScale)),new u("rnm",(e=>e.noiseTexture)),new n("rnmScale",((r,t)=>e(p,t.camera.fullWidth/r.noiseTexture.descriptor.width,t.camera.fullHeight/r.noiseTexture.descriptor.height))),new c("intensity",(e=>e.intensity)),new i("screenSize",(r=>e(p,r.camera.fullWidth,r.camera.fullHeight)))).main.add(l`
|
|
32
|
+
float depth = depthFromTexture(depthMap, uv);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// Early out if depth is out of range, such as in the sky
|
|
35
|
+
if (depth >= 1.0 || depth <= 0.0) {
|
|
36
|
+
fragOcclusion = 1.0;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
// get the normal of current fragment
|
|
41
|
+
ivec2 iuv = ivec2(uv * vec2(textureSize(normalMap, 0)));
|
|
42
|
+
vec4 norm4 = texelFetch(normalMap, iuv, 0);
|
|
43
|
+
if(norm4.a != 1.0) {
|
|
44
|
+
fragOcclusion = 1.0;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
vec3 norm = normalize(norm4.xyz * 2.0 - 1.0);
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
float currentPixelDepth = linearizeDepth(depth);
|
|
50
|
+
vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy, currentPixelDepth);
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
float sum = 0.0;
|
|
53
|
+
vec3 tapPixelPos;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
vec3 fres = normalize(2.0 * texture(rnm, uv * rnmScale).xyz - 1.0);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// note: the factor 2.0 should not be necessary, but makes ssao much nicer.
|
|
58
|
+
// bug or deviation from CE somewhere else?
|
|
59
|
+
float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
for(int i = 0; i < ${l.int(d)}; ++i) {
|
|
62
|
+
vec2 unitOffset = reflect(sphere[i], fres).xy;
|
|
63
|
+
vec2 offset = vec2(-unitOffset * radius * ps);
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// don't use current or very nearby samples
|
|
66
|
+
if( abs(offset.x) < 2.0 || abs(offset.y) < 2.0){
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
vec2 tc = vec2(gl_FragCoord.xy + offset);
|
|
71
|
+
if (tc.x < 0.0 || tc.y < 0.0 || tc.x > screenSize.x || tc.y > screenSize.y) continue;
|
|
72
|
+
vec2 tcTap = tc / screenSize;
|
|
73
|
+
float occluderFragmentDepth = linearDepthFromTexture(depthMap, tcTap);
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
tapPixelPos = reconstructPosition(tc, occluderFragmentDepth);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
sum += aoValueFromPositionsAndNormal(currentPixelPos, norm, tapPixelPos);
|
|
78
|
+
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
// output the result
|
|
81
|
+
float A = max(1.0 - sum * intensity / float(${l.int(d)}), 0.0);
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4) / 2.2
|
|
84
|
+
A = (pow(A, 0.2) + 1.2 * A * A * A * A) / 2.2;
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
fragOcclusion = A;
|
|
87
|
+
`),r}function v(e){return Math.max(10,20*e.computeScreenPixelSizeAtDist(Math.abs(4*e.relativeElevation)))}const p=r(),g=Object.freeze(Object.defineProperty({__proto__:null,build:m,getRadius:v},Symbol.toStringTag,{value:"Module"}));export{g as S,m as b,v as g};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{P as e}from"./Point2D.js";import{f as t,G as n,
|
|
5
|
+
import{P as e}from"./Point2D.js";import{f as t,G as n,a as r}from"./Geometry.js";import{Envelope2D as o}from"./Envelope2D.js";import{h as i}from"./ProjectionTransformation.js";function s(){return g(new e,-1,Number.NaN)}function g(e,t,n){return{m_coordinate:e.clone(),m_vertexIndex:t,m_geometryIndex:0,m_distance:n,m_bRightSide:!1,isEmpty:u}}function u(){return Number.isNaN(this.m_distance)}function a(e,r,i=-1,s=-1){if(e.isEmpty())return 3;const g=e.getGeometryType();if(t(g))return c(e,r,i,s);if(g===n.enumPolygon)return f(e,r,i,s);if(g===n.enumPolyline)return m(e,r,i,s);if(g===n.enumEnvelope){const t=new o;return e.queryEnvelope(t),t.contains(r)?t.containsExclusive(r)?1:2:0}return 3}function c(t,n,o,i){if(o>=0||i>=0)return r("");if(t.isDegenerate(0))return t.getStartXY().equals(n)?2:3;if(!t.isCurve()){const r=e.orientationRobust(n,t.getStartXY(),t.getEndXY());return r<0?1:r>0?0:2}const s=t.getClosestCoordinate(n,!1),g=t.getTangent(s),u=t.getCoord2D(s),a=e.orientationRobust(n,u,u.add(g));return a<0?1:a>0?0:2}function f(e,t,n,s){(n>=0||s>=0)&&r("");const g=new o;e.queryEnvelope(g);const u=i(e,t,0);return 0===u?0:1===u?1:2}function m(t,n,o,i){(o<0&&i>=0||o>=0&&i<0)&&r("");const s=t.querySegmentIterator();if(o<0){let t=Number.MAX_VALUE,r=0;for(;s.nextPath();)for(;s.hasNextSegment();){const g=s.nextSegment(),u=g.getClosestCoordinate(n,!1),a=g.getCoord2D(u),c=e.sqrDistance(a,n);c<t?(r=1,o=s.getStartPointIndex(),i=s.getPathIndex(),t=c):c===t&&r++}if(0===r)return 3;if(1===r){s.resetToVertex(o,i);return a(s.nextSegment(),n)}}const g=h(n,s,o,i);if(-1!==g.i1&&-1===g.i2)return g.bRight1?1:0;if(-1!==g.i1&&-1!==g.i2){if(g.bRight1===g.bRight2)return g.bRight1?1:0;{s.resetToVertex(g.i1,-1);const e=s.nextSegment().getTangent(1);s.resetToVertex(g.i2,-1);const t=s.nextSegment().getTangent(0);return e.crossProduct(t)>=0?1:0}}s.resetToVertex(o,i);return a(s.nextSegment(),n)}function x(e,t,n){for(e.resetToVertex(t,n);e.hasNextSegment();){if(!e.nextSegment().isDegenerate(0))return e.getStartPointIndex()}for(e.resetToVertex(t,n);e.hasPreviousSegment();){if(!e.previousSegment().isDegenerate(0))return e.getStartPointIndex()}return-1}function S(e,t){for(e.resetToVertex(t,-1),e.nextSegment();e.hasNextSegment();){if(!e.nextSegment().isDegenerate(0))return e.getStartPointIndex()}return-1}function d(e,t){for(e.resetToVertex(t,-1);e.hasPreviousSegment();){if(!e.previousSegment().isDegenerate(0))return e.getStartPointIndex()}return-1}function h(t,n,r,o){const i={i1:-1,i2:-1,bRight1:!1,bRight2:!1};if(i.i1=x(n,r,o),-1!==i.i1){n.resetToVertex(i.i1,-1);const r=n.nextSegment(),o=r.getClosestCoordinate(t,!1),s=r.getCoord2D(o),g=e.sqrDistance(s,t);{const e=s.clone();e.subThis(r.getStartXY());const n=t.clone();n.subThis(r.getStartXY()),i.bRight1=e.crossProduct(n)<0}if(i.i2=S(n,i.i1),-1!==i.i2){n.resetToVertex(i.i2,-1);const r=n.nextSegment(),o=r.getClosestCoordinate(t,!1),s=r.getCoord2D(o);if(e.sqrDistance(s,t)>g)i.i2=-1;else{const e=s.clone();e.subThis(r.getStartXY());const n=t.clone();n.subThis(r.getStartXY()),i.bRight2=e.crossProduct(n)<0}}if(-1===i.i2&&(i.i2=d(n,i.i1),-1!==i.i2)){n.resetToVertex(i.i2,-1);const r=n.nextSegment(),o=r.getClosestCoordinate(t,!1),s=r.getCoord2D(o);if(e.sqrDistance(s,t)>g)i.i2=-1;else{const e=s.clone();e.subThis(r.getStartXY());const n=t.clone();n.subThis(r.getStartXY()),i.bRight2=e.crossProduct(n)<0;const o=i.i1;i.i1=i.i2,i.i2=o;const g=i.bRight1;i.bRight1=i.bRight2,i.bRight2=g}}}return i}export{g as a,a as c,s as m};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{g as t,t as s,a as o}from"./Geometry.js";import{m as i,P as e,s as h,M as r,a,b as l}from"./Point2D.js";class y{constructor(t,s,o){if(t instanceof y)return this.data=t.data,this.N=t.N,this.M=t.M,t.data=null,t.N=0,void(t.M=0);this.data=t,this.N=s,this.M=o}assignCopy(s){return this===s||(t(this.N*this.M==s.N*s.M),this.data.set(s.data),this.N=s.N,this.M=s.M),this}setZero(){return this.data?.fill(0),this}setIdentity(){const t=0,s=1;for(let o=0;o<this.N;o++)for(let i=0;i<this.M;i++)this.setRowCol(o,i,o===i?s:t);return this}rows(){return this.N}cols(){return this.M}row(s){return t(0),{}}set(t,s){return this.data[t]=s,this}setRowCol(t,s,o){return this.data[t*this.M+s]=o,this}at(t){return this.data[t]}atRowCol(t,s){return this.data[t*this.M+s]}mulScalar(s,o){t(0)}mul(s,o){if(t(this.M===s.rows()),t(this.N===o.rows()),t(s.cols()===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mul(s,i),void o.assignCopy(i)}if(o===s){const t=new Float64Array(s.N*s.M),i=new y(t,s.N,s.M);return this.mul(s,i),void o.assignCopy(i)}const i=s.cols();for(let t=0;t<this.N;t++)for(let e=0;e<i;e++){let i=0;for(let o=0;o<this.M;o++)i+=this.atRowCol(t,o)*s.atRowCol(o,e);o.setRowCol(t,e,i)}}mulTranspose(s,o){if(t(this.M===s.cols()),t(this.N===o.rows()),t(s.rows()===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mulTranspose(s,i),void o.assignCopy(i)}if(o===s){const t=new Float64Array(s.N*s.M),i=new y(t,s.N,s.M);return this.mulTranspose(s,i),void o.assignCopy(i)}const i=s.rows();for(let t=0;t<this.N;t++)for(let e=0;e<i;e++){let i=0;for(let o=0;o<this.M;o++)i+=this.atRowCol(t,o)*s.atRowCol(e,o);o.setRowCol(t,e,i)}}mulLeft(s,o){t(0)}mulLeftTranspose(s,o){t(0)}mulDiag(s,o){if(t(this.M===s.N*s.M),t(this.N===o.rows()),t(this.M===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mulDiag(s,i),void o.assignCopy(i)}const i=this.M;for(let t=0;t<this.N;t++)for(let e=0;e<i;e++)o.setRowCol(t,e,this.atRowCol(t,e)*s.at(e))}transposeInPlace(){if(this.N===this.M){for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++){const o=this.atRowCol(t,s);this.setRowCol(t,s,this.atRowCol(s,t)),this.setRowCol(s,t,o)}return this}const t=new Float64Array(this.N*this.M),s=new y(t,this.N,this.M);return s.assignCopy(this),this.M=l(this.N,this.N=this.M),s.transpose(this),this}transpose(t){if(this!==t){y.checkDims(t,this.M,this.N);for(let s=0;s<this.N;s++)for(let o=0;o<this.M;o++)t.setRowCol(o,s,this.atRowCol(s,o))}else t.transposeInPlace()}add(t,s){}svd(s,o,i,e=!1){if(y.checkDims(s,this.N,this.M),y.checkDims(o,this.M,1),y.checkDims(i,this.M,this.M),e){if(t(this.N===this.M),!this.symmetricEigen(o,i))return!1;for(let t=0;t<this.M;++t)o.at(t)<0&&o.set(t,0);return s.assignCopy(i),!0}let h,r,a,l,n,x,w,u=0,C=0,f=0,R=0,d=0;const c=this.M,M=this.N;s.assignCopy(this);const m=new Float64Array(c),N=new y(m,c,1),b=(t,s)=>s>=0?Math.abs(t):-Math.abs(t),p=(t,s)=>{if((t=Math.abs(t))>(s=Math.abs(s))){const o=s/t;return t*Math.sqrt(o*o+1)}if(s>0){const o=t/s;return s*Math.sqrt(o*o+1)}return 0};for(let t=0;t<c;t++){if(u=t+1,N.set(t,R*f),f=l=R=0,t<M){for(let o=t;o<M;o++)R+=Math.abs(s.atRowCol(o,t));if(R){for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)/R),l+=s.atRowCol(o,t)*s.atRowCol(o,t);r=s.atRowCol(t,t),f=-b(Math.sqrt(l),r),a=r*f-l,s.setRowCol(t,t,r-f);for(let o=u;o<c;o++){l=0;for(let i=t;i<M;i++)l+=s.atRowCol(i,t)*s.atRowCol(i,o);r=l/a;for(let i=t;i<M;i++)s.setRowCol(i,o,s.atRowCol(i,o)+r*s.atRowCol(i,t))}for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)*R)}}if(o.set(t,R*f),f=l=R=0,t<M&&t!==c-1){for(let o=u;o<c;o++)R+=Math.abs(s.atRowCol(t,o));if(R){for(let o=u;o<c;o++)s.setRowCol(t,o,s.atRowCol(t,o)/R),l+=s.atRowCol(t,o)*s.atRowCol(t,o);r=s.atRowCol(t,u),f=-b(Math.sqrt(l),r),a=r*f-l,s.setRowCol(t,u,r-f);for(let o=u;o<c;o++)N.set(o,s.atRowCol(t,o)/a);for(let o=u;o<M;o++){l=0;for(let i=u;i<c;i++)l+=s.atRowCol(o,i)*s.atRowCol(t,i);for(let t=u;t<c;t++)s.setRowCol(o,t,s.atRowCol(o,t)+l*N.at(t))}for(let o=u;o<c;o++)s.setRowCol(t,o,s.atRowCol(t,o)*R)}}const i=Math.abs(o.at(t))+Math.abs(N.at(t));d=i>d?i:d}for(let t=c-1;t>=0;t--){if(t<c-1){if(f){for(let o=u;o<c;o++)i.setRowCol(o,t,s.atRowCol(t,o)/s.atRowCol(t,u)/f);for(let o=u;o<c;o++){l=0;for(let e=u;e<c;e++)l+=s.atRowCol(t,e)*i.atRowCol(e,o);for(let s=u;s<c;s++)i.setRowCol(s,o,i.atRowCol(s,o)+l*i.atRowCol(s,t))}}for(let s=u;s<c;s++)i.setRowCol(t,s,0),i.setRowCol(s,t,0)}i.setRowCol(t,t,1),f=N.at(t),u=t}for(let t=(M<c?M:c)-1;t>=0;t--){u=t+1,f=o.at(t);for(let o=u;o<c;o++)s.setRowCol(t,o,0);if(f){f=1/f;for(let o=u;o<c;o++){l=0;for(let i=u;i<M;i++)l+=s.atRowCol(i,t)*s.atRowCol(i,o);r=l/s.atRowCol(t,t)*f;for(let i=t;i<M;i++)s.setRowCol(i,o,s.atRowCol(i,o)+r*s.atRowCol(i,t))}for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)*f)}else for(let o=t;o<M;o++)s.setRowCol(o,t,0);s.setRowCol(t,t,s.atRowCol(t,t)+1)}for(let t=c-1;t>=0;t--)for(let e=1;;e++){let y=1;for(u=t;u>=0;u--){if(C=u-1,Math.abs(N.at(u))+d===d){y=0;break}if(Math.abs(o.at(C))+d===d)break}if(y){h=0,l=1;for(let i=u;i<=t&&(r=l*N.at(i),N.set(i,N.at(i)*h),Math.abs(r)+d!==d);i++){f=o.at(i),a=p(r,f),o.set(i,a),a=1/a,h=f*a,l=-r*a;for(let t=0;t<M;t++)x=s.atRowCol(t,C),w=s.atRowCol(t,i),s.setRowCol(t,C,x*h+w*l),s.setRowCol(t,i,w*h-x*l)}}if(w=o.at(t),u===t){if(w<0){o.set(t,-w);for(let s=0;s<c;s++)i.setRowCol(s,t,-i.atRowCol(s,t))}break}if(100===e)return!1;n=o.at(u),C=t-1,x=o.at(C),f=N.at(C),a=N.at(t),r=((x-w)*(x+w)+(f-a)*(f+a))/(2*a*x),f=p(r,1),r=((n-w)*(n+w)+a*(x/(r+b(f,r))-a))/n,h=l=1;for(let t=u;t<=C;t++){const e=t+1;f=N.at(e),x=o.at(e),a=l*f,f*=h,w=p(r,a),N.set(t,w),h=r/w,l=a/w,r=n*h+f*l,f=f*h-n*l,a=x*l,x*=h;for(let s=0;s<c;s++)n=i.atRowCol(s,t),w=i.atRowCol(s,e),i.setRowCol(s,t,n*h+w*l),i.setRowCol(s,e,w*h-n*l);w=p(r,a),o.set(t,w),w&&(w=1/w,h=r*w,l=a*w),r=h*f+l*x,n=h*x-l*f;for(let o=0;o<M;o++)x=s.atRowCol(o,t),w=s.atRowCol(o,e),s.setRowCol(o,t,x*h+w*l),s.setRowCol(o,e,w*h-x*l)}N.set(u,0),N.set(t,r),o.set(t,n)}const g=new Float64Array(this.N),v=new Float64Array(this.M),T=new y(g,this.N,1),I=new y(v,this.M,1);let A=1;do{A*=3,A++}while(A<=this.M);do{A/=3,A=Math.trunc(A);for(let t=A;t<this.M;t++){const e=o.at(t);for(let o=0;o<this.N;o++)T.set(o,s.atRowCol(o,t));for(let s=0;s<this.M;s++)I.set(s,i.atRowCol(s,t));let h=t;for(;o.at(h-A)<e;){o.set(h,o.at(h-A));for(let t=0;t<this.N;t++)s.setRowCol(t,h,s.atRowCol(t,h-A));for(let t=0;t<this.M;t++)i.setRowCol(t,h,i.atRowCol(t,h-A));if(h-=A,h<A)break}o.set(h,e);for(let t=0;t<this.N;t++)s.setRowCol(t,h,T.at(t));for(let t=0;t<this.M;t++)i.setRowCol(t,h,I.at(t))}}while(A>1);for(let t=0;t<this.M;t++){let o=0;for(let i=0;i<this.N;i++)s.atRowCol(i,t)<0&&o++;for(let s=0;s<this.M;s++)i.atRowCol(s,t)<0&&o++;if(o>Math.trunc((this.N+this.M)/2)){for(let o=0;o<this.N;o++)s.setRowCol(o,t,-s.atRowCol(o,t));for(let s=0;s<this.M;s++)i.setRowCol(s,t,-i.atRowCol(s,t))}}return!0}isSymmetric(){if(this.N!==this.M)return!1;for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++)if(this.atRowCol(t,s)!==this.atRowCol(s,t))return!1;return!0}isZero(){return t(0),!1}isIdentity(){return t(0),!1}equals(s,o){if(void 0!==o&&t(0),this.N!==s.N||this.M!==s.M)return!1;for(let t=0;t<this.N*this.M;t++)if(this.data[t]!==s.data[t])return!1;return!0}maxElement(){return t(0),0}minElement(){return t(0),0}determinant(){if(t(this.N===this.M),1===this.N)return this.data[0];if(2===this.N)return this.data[0]*this.data[3]-this.data[1]*this.data[2];if(3===this.N){const t=this;return t.atRowCol(0,0)*(t.atRowCol(1,1)*t.atRowCol(2,2)-t.atRowCol(1,2)*t.atRowCol(2,1))-t.atRowCol(0,1)*(t.atRowCol(1,0)*t.atRowCol(2,2)-t.atRowCol(2,0)*t.atRowCol(1,2))+t.atRowCol(0,2)*(t.atRowCol(1,0)*t.atRowCol(2,1)-t.atRowCol(1,1)*t.atRowCol(2,0))}const s=new Float64Array(this.N*this.N),o=new y(s,this.N,this.N),i=new Float64Array(this.N);if(!this.luDecomposition(o,i))return 0;let e=1;for(let t=0;t<this.N;t++)e*=o.atRowCol(t,t),i[t]!==t&&(e=-e);return e}submatrix(s,o,i){t(0)}inverse(s){t(0)}pseudoInverse(t,s=!1,o=2220446049250313e-31){if(t.setZero(),1===this.N&&1===this.M)return 0!==this.atRowCol(0,0)?t.setRowCol(0,0,1/this.atRowCol(0,0)):t.setRowCol(0,0,0),!0;if(2===this.N&&2===this.M){const s=this.atRowCol(0,0)*this.atRowCol(1,1)-this.atRowCol(0,1)*this.atRowCol(1,0),o=1e-5*(Math.abs(this.atRowCol(0,0)*this.atRowCol(1,1))+Math.abs(this.atRowCol(0,1)*this.atRowCol(1,0)));if(Math.abs(s)>o)return t.setRowCol(0,0,this.atRowCol(1,1)/s),t.setRowCol(0,1,-this.atRowCol(0,1)/s),t.setRowCol(1,0,-this.atRowCol(1,0)/s),t.setRowCol(1,1,this.atRowCol(0,0)/s),!0}const i=new Float64Array(this.N*this.M),e=new y(i,this.N,this.M),h=new Float64Array(this.M),r=new y(h,this.M,1),a=new Float64Array(this.M*this.M),l=new y(a,this.M,this.M);if(!this.svd(e,r,l,s))return!1;const n=Math.max(this.N,this.M),x=o*Math.abs(r.at(0))*n;for(let y=0;y<this.M;y++)r.at(y)>x?r.set(y,1/r.at(y)):r.set(y,0);return l.mulDiag(r,t),t.mulTranspose(e,t),!0}luDecomposition(s,o){return t(0),!1}symmetricEigen(s,o){t(this.rows()===this.cols()),t(this.rows()===s.rows()),t(o.rows()===o.cols()&&o.rows()===this.rows()),t(this.isSymmetric());const i=new Float64Array(this.N*this.M),e=new y(i,this.N,this.M);e.assignCopy(this);const h=100/Number.EPSILON,r=this.rows(),a=new Float64Array(r),l=new Float64Array(r),n=new y(a,r,1),x=new y(l,r,1);for(let t=0;t<r;t++)n.set(t,e.atRowCol(t,t)),s.set(t,e.atRowCol(t,t)),x.set(t,0);o.setIdentity();const w=()=>{const t=n;o.transposeInPlace();let i=1;do{i*=3,i++}while(i<=r);do{i/=3,i=Math.trunc(i);for(let e=i;e<r;e++){const h=s.at(e),r=Math.abs(h);for(let s=0;s<this.M;s++)t.set(s,o.atRowCol(s,e));let a=e;for(;Math.abs(s.at(a-i))<r;){s.set(a,s.at(a-i));for(let t=0;t<this.M;t++)o.setRowCol(t,a,o.atRowCol(t,a-i));if(a-=i,a<i)break}if(a!==e){s.set(a,h);for(let s=0;s<this.M;s++)o.setRowCol(s,a,t.at(s))}}}while(i>1)};for(let t=1;;t++){let i=0;for(let t=1;t<r;t++)for(let s=0;s<t;s++)i+=Math.abs(e.atRowCol(t,s));if(0===i)return w(),!0;const a=t<4?.2*i/(r*r):0;for(let l=0;l<r;l++)for(let i=l+1;i<r;i++){let y=h*Math.abs(e.atRowCol(i,l));if(t>4&&y<=Math.abs(s.at(l))&&y<=Math.abs(s.at(i)))e.setRowCol(i,l,0);else if(Math.abs(e.atRowCol(i,l))>a){let t,h=s.at(i)-s.at(l);if(y<Math.abs(h))t=e.atRowCol(i,l)/h;else{const s=.5*h/e.atRowCol(i,l);t=1/(Math.abs(s)+Math.sqrt(1+s*s)),s<0&&(t=-t)}const a=1/Math.sqrt(1+t*t),n=t*a,w=n/(1+a);h=t*e.atRowCol(i,l),x.set(l,x.at(l)-h),x.set(i,x.at(i)+h),s.set(l,s.at(l)-h),s.set(i,s.at(i)+h),e.setRowCol(i,l,0);let u=0;for(;u<l;u++)y=e.atRowCol(l,u),h=e.atRowCol(i,u),e.setRowCol(l,u,y-n*(h+y*w)),e.setRowCol(i,u,h+n*(y-h*w));for(u++;u<i;u++)y=e.atRowCol(u,l),h=e.atRowCol(i,u),e.setRowCol(u,l,y-n*(h+y*w)),e.setRowCol(i,u,h+n*(y-h*w));for(u++;u<r;u++)y=e.atRowCol(u,l),h=e.atRowCol(u,i),e.setRowCol(u,l,y-n*(h+y*w)),e.setRowCol(u,i,h+n*(y-h*w));for(u=0;u<r;u++)y=o.atRowCol(l,u),h=o.atRowCol(i,u),o.setRowCol(l,u,y-n*(h+y*w)),o.setRowCol(i,u,h+n*(y-h*w))}}for(let t=0;t<r;t++)n.set(t,n.at(t)+x.at(t)),s.set(t,n.at(t)),x.set(t,0)}}static checkDims(s,o,i){t(s.rows()===o&&s.cols()===i)}}class n extends y{constructor(t){if(t.copy){const s=new Float64Array(t.copy.N*t.copy.M);return super(s,t.copy.N,t.copy.M),this.buffer=s,void this.assignCopy(t.copy)}const s=new Float64Array(t.NN*t.MM);super(s,t.NN,t.MM),this.buffer=s,t.initializerList&&a(this.buffer,t.initializerList,0,0,t.initializerList.length)}assignCopy(t){return this===t||super.assignCopy(t),this}}class x{constructor(t){this.m_TransformationType=1,void 0===t?this.setIdentity():t instanceof x?this.set(t):this.setScale(t)}set(t){return this.xx=t.xx,this.xy=t.xy,this.xd=t.xd,this.yx=t.yx,this.yy=t.yy,this.yd=t.yd,this}clone(){return(new x).set(this)}setZero(){this.xx=0,this.yy=0,this.xy=0,this.yx=0,this.xd=0,this.yd=0}isEqual(t){return this===t||this.xx===t.xx&&this.xy===t.xy&&this.xd===t.xd&&this.yx===t.yx&&this.yy===t.yy&&this.yd===t.yd}transformInPlace(t){const s=this.xx*t.x+this.xy*t.y+this.xd,o=this.yx*t.x+this.yy*t.y+this.yd;t.x=s,t.y=o}transform(t){const s=t.clone();return this.transformInPlace(s),s}queryTransform(t,s){const o=this.xx*t.x+this.xy*t.y+this.xd,i=this.yx*t.x+this.yy*t.y+this.yd;s.setCoords(o,i)}transformEnvInPlace(t){if(t.isEmpty())return;const s=i(e,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(s,o){t(0)}transformPoints2D(t,s,o){for(let i=0;i<s;++i)this.queryTransform(t[i],o[i])}transformInterleavedPoints(t,s,o){s*=2;const i=e.getNAN();for(let e=0;e<s;e+=2)i.x=t[e],i.y=t[e+1],this.transformInPlace(i),o[e]=i.x,o[e+1]=i.y}multiply(t){return x.st_multiply(this,t,this),this}mulLeft(s){return t(0),this}static st_multiply(t,s,o){const i=t.xx*s.xx+t.yx*s.xy,e=t.xy*s.xx+t.yy*s.xy,h=t.xd*s.xx+t.yd*s.xy+s.xd,r=t.xx*s.yx+t.yx*s.yy,a=t.xy*s.yx+t.yy*s.yy,l=t.xd*s.yx+t.yd*s.yy+s.yd;o.xx=i,o.xy=e,o.xd=h,o.yx=r,o.yy=a,o.yd=l}getCoefficients(s){t(s.length>=6),s[0]=this.xx,s[1]=this.xy,s[2]=this.xd,s[3]=this.yx,s[4]=this.yy,s[5]=this.yd}setCoefficients(s){t(s.length>=6),this.xx=s[0],this.xy=s[1],this.xd=s[2],this.yx=s[3],this.yy=s[4],this.yd=s[5]}copyTo(s){t(0)}initializeFromRect(t,s){t.isEmpty()||s.isEmpty()||!t.width()||!t.height()?this.setZero():(this.xy=this.yx=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xd=s.xmin-t.xmin*this.xx,this.yd=s.ymin-t.ymin*this.yy)}initializeFromRectIsotropic(t,s){if(t.isEmpty()||!t.width()||!t.height()||s.isEmpty())this.setZero();else{this.yx=0,this.xy=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xx>this.yy?this.xx=this.yy:this.yy=this.xx;const o=s.getCenter(),i=t.getCenter();this.xd=o.x-i.x*this.xx,this.yd=o.y-i.y*this.yy}}initializeFromTwoPointsArray(t,o){if(t[0].equals(o[0])&&t[1].equals(o[1]))return void this.setIdentity();if(t[0].equals(t[1])){if(o[0].equals(o[1]))return void this.setShift(o[0].sub(t[0]));s("")}if(!t[0].equals(t[1])&&o[0].equals(o[1]))return this.setZero(),void this.shift(o[0]);this.setShiftCoords(-t[0].x,-t[0].y);const i=e.distance(t[0],t[1]),h=e.distance(o[0],o[1]),r=h/i;this.scale(r,r);const a=t[1].sub(t[0]);a.divThis(i);const l=o[1].sub(o[0]);l.divThis(h);const y=a.crossProduct(l),n=a.dotProduct(l);this.rotate(n,y),this.shiftCoords(o[0].x,o[0].y)}initializeFromTwoPoints(t,s,o,i){const e=[t,s],h=[o,i];this.initializeFromTwoPointsArray(e,h)}transformSizeInPlace(s){t(0)}transformSize(s,o){t(0)}transformTol(s){return t(0),0}transformWithoutTranslateArray(t,s,o){for(let i=0;i<s;++i)this.transformWithoutTranslate(t[i],o[i])}transformWithoutTranslateInPlace(t){const s=this.xx*t.x+this.xy*t.y,o=this.yx*t.x+this.yy*t.y;t.setCoords(s,o)}transformWithoutTranslate(t,s){const o=this.xx*t.x+this.xy*t.y,i=this.yx*t.x+this.yy*t.y;s.setCoords(o,i)}setIdentity(){this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=1,this.yd=0}isIdentity(){return!(1!==this.xx||1!==this.yy||this.xy||this.xd||this.yx||this.yd)}isIdentityTol(t){const s=t*t;return!(h(this.xd)+h(this.yd)>s)&&(!(h(this.xy+this.xd)+h(this.yy+this.yd-1)>s)&&!(h(this.xx+this.xd-1)+h(this.yx+this.yd)>s))}isReflective(){return this.xx*this.yy-this.yx*this.xy<0}isUniform(t){const s=this.xx*this.xx+this.yx*this.yx,o=this.xy*this.xy+this.yy*this.yy,i=(s+o)*t;return Math.abs(s-o)<=i&&Math.abs(this.xx*this.xy+this.yx*this.yy)<=i}isUniformNoRotation(){return 0!==this.xx&&Math.abs(this.xx)===Math.abs(this.yy)&&0===this.xy&&0===this.yx}isTranslate(){return 1===this.xx&&1===this.yy&&!this.xy&&!this.yx}isTranslateTol(t){const s=new e;return s.setCoords(0,1),this.transformWithoutTranslateInPlace(s),s.y-=1,!(s.sqrLength()>t*t)&&(s.setCoords(1,0),this.transformWithoutTranslateInPlace(s),s.x-=1,s.sqrLength()<=t*t)}isOrthonormal(t){const s=new x;return s.xx=this.xx*this.xx+this.xy*this.xy,s.xy=this.xx*this.yx+this.xy*this.yy,s.yx=this.yx*this.xx+this.yy*this.xy,s.yy=this.yx*this.yx+this.yy*this.yy,s.xd=0,s.yd=0,s.isIdentityTol(t)}isDegenerate(t){return Math.abs(this.xx*this.yy-this.yx*this.xy)<=2*t*(Math.abs(this.xx*this.yy)+Math.abs(this.yx*this.xy))}isZero(){return 0===this.xx&&0===this.yy&&0===this.xy&&0===this.yx&&0===this.xd&&0===this.yd}isScaleAndTranslateTol(t){return this.xy*this.xy+this.yx*this.yx<=(this.xx*this.xx+this.yy*this.yy)*t}setTranslate(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShiftCoords(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShift(t){return this.xx=1,this.xy=0,this.xd=t.x,this.yx=0,this.yy=1,this.yd=t.y,this}setScaleCoords(t,s){return this.xx=t,this.xy=0,this.xd=0,this.yx=0,this.yy=s,this.yd=0,this}setScale(t){return this.setScaleCoords(t,t),this}setFlipX(t,s){return this.xx=-1,this.xy=0,this.xd=t+s,this.yx=0,this.yy=1,this.yd=0,this}setFlipY(t,s){return this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=-1,this.yd=t+s,this}setShear(t,s){return this.xx=1,this.xy=t,this.xd=0,this.yx=s,this.yy=1,this.yd=0,this}scale(t,s){return this.xx*=t,this.xy*=t,this.xd*=t,this.yx*=s,this.yy*=s,this.yd*=s,this}setRotateAngle(t){return this.setRotate(Math.cos(t),Math.sin(t))}setRotate(t,s){return this.xx=t,this.xy=-s,this.xd=0,this.yx=s,this.yy=t,this.yd=0,this}setRotateAngleAbout(t,s){return this.setRotateAbout(Math.cos(t),Math.sin(t),s)}setRotateAbout(t,s,o){return this.setTranslate(-o.x,-o.y),this.rotate(t,s),this.translate(o.x,o.y)}setSwapCoordinates(){return this.xx=0,this.xy=1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}setRotateCw90(){return this.xx=0,this.xy=1,this.xd=0,this.yx=-1,this.yy=0,this.yd=0,this}setRotateCcw90(){return this.xx=0,this.xy=-1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}shiftCoords(t,s){return this.xd+=t,this.yd+=s,this}shift(t){return this.xd+=t.x,this.yd+=t.y,this}translate(t,s){return this.xd+=t,this.yd+=s,this}flipX(t,s){return this.xx=-this.xx,this.xy=-this.xy,this.xd=t+s-this.xd,this}flipY(t,s){return this.yx=-this.yx,this.yy=-this.yy,this.yd=t+s-this.yd,this}shear(t,s){const o=new x;return o.setShear(t,s),this.multiply(o)}rotateAngle(t){const s=new x;return s.setRotateAngle(t),this.multiply(s)}rotate(t,s){const o=new x;return o.setRotate(t,s),this.multiply(o)}rotateAbout(t,s,o){return this.translate(-o.x,-o.y),this.rotate(t,s),this.translate(o.x,o.y)}rotateAngleAbout(t,s){return this.rotateAbout(Math.cos(t),Math.sin(t),s)}setInvert(t){return this.set(t),this.invertThis()}invertThis(){let t=this.xx*this.yy-this.xy*this.yx;if(0===t)return this.setZero(),this;t=1/t;const s=(this.xy*this.yd-this.xd*this.yy)*t,o=(this.xd*this.yx-this.xx*this.yd)*t,i=this.yy*t,e=-this.xy*t,h=-this.yx*t,r=this.xx*t;return this.xd=s,this.yd=o,this.xx=i,this.yy=r,this.xy=e,this.yx=h,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=r.constructDouble(this.xy),s=r.constructDouble(this.xx),o=s.mulDouble(this.yy).sub(t.mulDouble(this.yx));if(o.isZero())return this.setZero(),this;const i=o.clone();i.invertThis();const e=r.constructDouble(this.xd),h=t.mulDouble(this.yd).sub(e.mulDouble(this.yy)).mul(i).toDouble(),a=e.mulDouble(this.yx).sub(s.mulDouble(this.yd)).mul(i).toDouble(),l=i.mulDouble(this.yy).toDouble(),y=i.mulDouble(-this.xy).toDouble(),n=i.mulDouble(-this.yx).toDouble(),x=i.mulDouble(this.xx).toDouble();return this.xd=h,this.yd=a,this.xx=l,this.yy=x,this.xy=y,this.yx=n,this}extractScaleTransform(t,s){const o=Math.sqrt(this.xx*this.xx+this.xy*this.xy),i=Math.sqrt(this.yx*this.yx+this.yy*this.yy);s.setScaleCoords(1/o,1/i),s.multiply(this),t.setScaleCoords(o,i)}setFromTwoTriangles(t,s){let o=!0;for(let e=0;e<3;++e)o=o&&t[e].equals(s[e]);if(o)return this.setIdentity(),!0;const i=new e;i.setSub(t[0],t[1]);const h=new e;h.setSub(t[0],t[2]);const r=new e;r.setSub(s[0],s[1]);const a=new e;a.setSub(s[0],s[2]);const l=4*Number.EPSILON*(Math.abs(i.x*h.y)+Math.abs(h.x*i.y));let y=i.x*h.y-i.y*h.x;return Math.abs(y)>l?(y=1/y,this.xx=(r.x*h.y-i.y*a.x)*y,this.xy=(i.x*a.x-r.x*h.x)*y,this.yx=(r.y*h.y-i.y*a.y)*y,this.yy=(i.x*a.y-r.y*h.x)*y,this.xd=s[0].x-(this.xx*t[0].x+this.xy*t[0].y),this.yd=s[0].y-(this.yx*t[0].x+this.yy*t[0].y),!0):(this.setZero(),!1)}initializeFromControlPoints(t,s,o,i,e=null){return 0===s?(this.setIdentity(),void(e&&e.setIdentity())):1===s?(this.setShift(i[0].sub(o[0])),void(e&&e.setShift(o[0].sub(i[0])))):(s<3&&(t=1),void(4===t&&s>2?C(this,s,o,i,e):f(t,this,s,o,i,e)))}calculateErrors(s,o,i,h){t(s>0&&null!==o&&null!==i);let r=0;for(let t=0;t<s;++t){const s=this.transform(o[t]),a=e.sqrDistance(i[t],s);r+=a,h&&(h[t]=Math.sqrt(a))}return Math.sqrt(r/s)}}const w=[43,11,41,9,61];function u(s,o){t(!(2!==o.rows()&&3!==o.rows()||2!==o.cols()&&3!==o.rows())),s.xx=o.atRowCol(0,0),s.xy=o.atRowCol(0,1),s.yx=o.atRowCol(1,0),s.yy=o.atRowCol(1,1),3===o.cols()?(s.xd=o.atRowCol(0,2),s.yd=o.atRowCol(1,2)):(s.xd=0,s.yd=0)}function C(t,s,i,h,r){const a=e.average(i,s),l=e.average(h,s),y=new n({NN:2,MM:2});y.setZero();const x=new n({NN:2,MM:2});x.setZero();for(let o=0;o<s;++o)y.setRowCol(0,0,y.atRowCol(0,0)+(i[o].x-a.x)*(i[o].x-a.x)),y.setRowCol(0,1,y.atRowCol(0,1)+(i[o].x-a.x)*(i[o].y-a.y)),y.setRowCol(1,1,y.atRowCol(1,1)+(i[o].y-a.y)*(i[o].y-a.y)),x.setRowCol(0,0,x.atRowCol(0,0)+(h[o].x-l.x)*(i[o].x-a.x)),x.setRowCol(0,1,x.atRowCol(0,1)+(h[o].x-l.x)*(i[o].y-a.y)),x.setRowCol(1,0,x.atRowCol(1,0)+(h[o].y-l.y)*(i[o].x-a.x)),x.setRowCol(1,1,x.atRowCol(1,1)+(h[o].y-l.y)*(i[o].y-a.y));y.setRowCol(1,0,y.atRowCol(0,1));const w=new n({NN:2,MM:2});y.pseudoInverse(w,!0)||o("Failed to compute pseudo inverse"),x.mul(w,x),u(t,x);const C=a.clone();t.transformInPlace(C),t.xd=l.x-C.x,t.yd=l.y-C.y,r&&(x.pseudoInverse(w,!1)||o("Failed to compute pseudo inverse"),u(r,w),r.transformInPlace(l),r.xd=a.x-l.x,r.yd=a.y-l.y)}function f(s,i,h,r,a,l){t(1===s||0===s||2===s||3===s),i.setIdentity();const y=e.average(r,h),C=e.average(a,h);if(t(s<w.length&&s>0),8&w[s]){const t=new n({NN:2,MM:2});t.setZero();for(let s=0;s<h;++s)t.setRowCol(0,0,t.atRowCol(0,0)+(a[s].x-C.x)*(r[s].x-y.x)),t.setRowCol(1,0,t.atRowCol(1,0)+(a[s].x-C.x)*(r[s].y-y.y)),t.setRowCol(0,1,t.atRowCol(0,1)+(a[s].y-C.y)*(r[s].x-y.x)),t.setRowCol(1,1,t.atRowCol(1,1)+(a[s].y-C.y)*(r[s].y-y.y));const e=new n({NN:2,MM:2}),l=new n({NN:2,MM:1}),f=new n({NN:2,MM:2});t.svd(e,l,f)||o("Failed to compute svd");const R=new n({NN:2,MM:2});e.transpose(R);const d=new n({NN:2,MM:2});if(f.mul(R,d),!(32&w[s])){d.determinant()<0&&(R.setRowCol(1,0,-R.atRowCol(1,0)),R.setRowCol(1,1,-R.atRowCol(1,1)),f.mul(R,d))}const c=new x;u(c,d),i.set(c)}if(2&w[s]){let t=0,s=0;for(let o=0;o<h;++o){const e=r[o].sub(y);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(a[o].sub(C))}if(0===t)0===s?i.setIdentity():i.setZero();else{const o=s/t;i.scale(o,o)}}else t(!(4&w[s]));const f=y.clone();i.transformInPlace(f),i.xd=C.x-f.x,i.yd=C.y-f.y,l&&(l.set(i),l.invertThis(),l.isZero()&&(l.xd=y.x,l.yd=y.y))}export{x as T};
|
|
5
|
+
import{g as t,a as s,b as o}from"./Geometry.js";import{m as i,P as e,a as h,M as r,b as a,c as l}from"./Point2D.js";class y{constructor(t,s,o){if(t instanceof y)return this.data=t.data,this.N=t.N,this.M=t.M,t.data=null,t.N=0,void(t.M=0);this.data=t,this.N=s,this.M=o}assignCopy(s){return this===s||(t(this.N*this.M==s.N*s.M),this.data.set(s.data),this.N=s.N,this.M=s.M),this}setZero(){return this.data?.fill(0),this}setIdentity(){const t=0,s=1;for(let o=0;o<this.N;o++)for(let i=0;i<this.M;i++)this.setRowCol(o,i,o===i?s:t);return this}rows(){return this.N}cols(){return this.M}row(s){return t(0),{}}set(t,s){return this.data[t]=s,this}setRowCol(t,s,o){return this.data[t*this.M+s]=o,this}at(t){return this.data[t]}atRowCol(t,s){return this.data[t*this.M+s]}mulScalar(s,o){t(0)}mul(s,o){if(t(this.M===s.rows()),t(this.N===o.rows()),t(s.cols()===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mul(s,i),void o.assignCopy(i)}if(o===s){const t=new Float64Array(s.N*s.M),i=new y(t,s.N,s.M);return this.mul(s,i),void o.assignCopy(i)}const i=s.cols();for(let t=0;t<this.N;t++)for(let e=0;e<i;e++){let i=0;for(let o=0;o<this.M;o++)i+=this.atRowCol(t,o)*s.atRowCol(o,e);o.setRowCol(t,e,i)}}mulTranspose(s,o){if(t(this.M===s.cols()),t(this.N===o.rows()),t(s.rows()===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mulTranspose(s,i),void o.assignCopy(i)}if(o===s){const t=new Float64Array(s.N*s.M),i=new y(t,s.N,s.M);return this.mulTranspose(s,i),void o.assignCopy(i)}const i=s.rows();for(let t=0;t<this.N;t++)for(let e=0;e<i;e++){let i=0;for(let o=0;o<this.M;o++)i+=this.atRowCol(t,o)*s.atRowCol(e,o);o.setRowCol(t,e,i)}}mulLeft(s,o){t(0)}mulLeftTranspose(s,o){t(0)}mulDiag(s,o){if(t(this.M===s.N*s.M),t(this.N===o.rows()),t(this.M===o.cols()),o===this){const t=new Float64Array(this.N*this.M),i=new y(t,this.N,this.M);return this.mulDiag(s,i),void o.assignCopy(i)}const i=this.M;for(let t=0;t<this.N;t++)for(let e=0;e<i;e++)o.setRowCol(t,e,this.atRowCol(t,e)*s.at(e))}transposeInPlace(){if(this.N===this.M){for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++){const o=this.atRowCol(t,s);this.setRowCol(t,s,this.atRowCol(s,t)),this.setRowCol(s,t,o)}return this}const t=new Float64Array(this.N*this.M),s=new y(t,this.N,this.M);return s.assignCopy(this),this.M=l(this.N,this.N=this.M),s.transpose(this),this}transpose(t){if(this!==t){y.checkDims(t,this.M,this.N);for(let s=0;s<this.N;s++)for(let o=0;o<this.M;o++)t.setRowCol(o,s,this.atRowCol(s,o))}else t.transposeInPlace()}add(t,s){}svd(s,o,i,e=!1){if(y.checkDims(s,this.N,this.M),y.checkDims(o,this.M,1),y.checkDims(i,this.M,this.M),e){if(t(this.N===this.M),!this.symmetricEigen(o,i))return!1;for(let t=0;t<this.M;++t)o.at(t)<0&&o.set(t,0);return s.assignCopy(i),!0}let h,r,a,l,n,x,w,u=0,C=0,f=0,R=0,d=0;const c=this.M,M=this.N;s.assignCopy(this);const m=new Float64Array(c),N=new y(m,c,1),b=(t,s)=>s>=0?Math.abs(t):-Math.abs(t),p=(t,s)=>{if((t=Math.abs(t))>(s=Math.abs(s))){const o=s/t;return t*Math.sqrt(o*o+1)}if(s>0){const o=t/s;return s*Math.sqrt(o*o+1)}return 0};for(let t=0;t<c;t++){if(u=t+1,N.set(t,R*f),f=l=R=0,t<M){for(let o=t;o<M;o++)R+=Math.abs(s.atRowCol(o,t));if(R){for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)/R),l+=s.atRowCol(o,t)*s.atRowCol(o,t);r=s.atRowCol(t,t),f=-b(Math.sqrt(l),r),a=r*f-l,s.setRowCol(t,t,r-f);for(let o=u;o<c;o++){l=0;for(let i=t;i<M;i++)l+=s.atRowCol(i,t)*s.atRowCol(i,o);r=l/a;for(let i=t;i<M;i++)s.setRowCol(i,o,s.atRowCol(i,o)+r*s.atRowCol(i,t))}for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)*R)}}if(o.set(t,R*f),f=l=R=0,t<M&&t!==c-1){for(let o=u;o<c;o++)R+=Math.abs(s.atRowCol(t,o));if(R){for(let o=u;o<c;o++)s.setRowCol(t,o,s.atRowCol(t,o)/R),l+=s.atRowCol(t,o)*s.atRowCol(t,o);r=s.atRowCol(t,u),f=-b(Math.sqrt(l),r),a=r*f-l,s.setRowCol(t,u,r-f);for(let o=u;o<c;o++)N.set(o,s.atRowCol(t,o)/a);for(let o=u;o<M;o++){l=0;for(let i=u;i<c;i++)l+=s.atRowCol(o,i)*s.atRowCol(t,i);for(let t=u;t<c;t++)s.setRowCol(o,t,s.atRowCol(o,t)+l*N.at(t))}for(let o=u;o<c;o++)s.setRowCol(t,o,s.atRowCol(t,o)*R)}}const i=Math.abs(o.at(t))+Math.abs(N.at(t));d=i>d?i:d}for(let t=c-1;t>=0;t--){if(t<c-1){if(f){for(let o=u;o<c;o++)i.setRowCol(o,t,s.atRowCol(t,o)/s.atRowCol(t,u)/f);for(let o=u;o<c;o++){l=0;for(let e=u;e<c;e++)l+=s.atRowCol(t,e)*i.atRowCol(e,o);for(let s=u;s<c;s++)i.setRowCol(s,o,i.atRowCol(s,o)+l*i.atRowCol(s,t))}}for(let s=u;s<c;s++)i.setRowCol(t,s,0),i.setRowCol(s,t,0)}i.setRowCol(t,t,1),f=N.at(t),u=t}for(let t=(M<c?M:c)-1;t>=0;t--){u=t+1,f=o.at(t);for(let o=u;o<c;o++)s.setRowCol(t,o,0);if(f){f=1/f;for(let o=u;o<c;o++){l=0;for(let i=u;i<M;i++)l+=s.atRowCol(i,t)*s.atRowCol(i,o);r=l/s.atRowCol(t,t)*f;for(let i=t;i<M;i++)s.setRowCol(i,o,s.atRowCol(i,o)+r*s.atRowCol(i,t))}for(let o=t;o<M;o++)s.setRowCol(o,t,s.atRowCol(o,t)*f)}else for(let o=t;o<M;o++)s.setRowCol(o,t,0);s.setRowCol(t,t,s.atRowCol(t,t)+1)}for(let t=c-1;t>=0;t--)for(let e=1;;e++){let y=1;for(u=t;u>=0;u--){if(C=u-1,Math.abs(N.at(u))+d===d){y=0;break}if(Math.abs(o.at(C))+d===d)break}if(y){h=0,l=1;for(let i=u;i<=t&&(r=l*N.at(i),N.set(i,N.at(i)*h),Math.abs(r)+d!==d);i++){f=o.at(i),a=p(r,f),o.set(i,a),a=1/a,h=f*a,l=-r*a;for(let t=0;t<M;t++)x=s.atRowCol(t,C),w=s.atRowCol(t,i),s.setRowCol(t,C,x*h+w*l),s.setRowCol(t,i,w*h-x*l)}}if(w=o.at(t),u===t){if(w<0){o.set(t,-w);for(let s=0;s<c;s++)i.setRowCol(s,t,-i.atRowCol(s,t))}break}if(100===e)return!1;n=o.at(u),C=t-1,x=o.at(C),f=N.at(C),a=N.at(t),r=((x-w)*(x+w)+(f-a)*(f+a))/(2*a*x),f=p(r,1),r=((n-w)*(n+w)+a*(x/(r+b(f,r))-a))/n,h=l=1;for(let t=u;t<=C;t++){const e=t+1;f=N.at(e),x=o.at(e),a=l*f,f*=h,w=p(r,a),N.set(t,w),h=r/w,l=a/w,r=n*h+f*l,f=f*h-n*l,a=x*l,x*=h;for(let s=0;s<c;s++)n=i.atRowCol(s,t),w=i.atRowCol(s,e),i.setRowCol(s,t,n*h+w*l),i.setRowCol(s,e,w*h-n*l);w=p(r,a),o.set(t,w),w&&(w=1/w,h=r*w,l=a*w),r=h*f+l*x,n=h*x-l*f;for(let o=0;o<M;o++)x=s.atRowCol(o,t),w=s.atRowCol(o,e),s.setRowCol(o,t,x*h+w*l),s.setRowCol(o,e,w*h-x*l)}N.set(u,0),N.set(t,r),o.set(t,n)}const g=new Float64Array(this.N),v=new Float64Array(this.M),T=new y(g,this.N,1),I=new y(v,this.M,1);let A=1;do{A*=3,A++}while(A<=this.M);do{A/=3,A=Math.trunc(A);for(let t=A;t<this.M;t++){const e=o.at(t);for(let o=0;o<this.N;o++)T.set(o,s.atRowCol(o,t));for(let s=0;s<this.M;s++)I.set(s,i.atRowCol(s,t));let h=t;for(;o.at(h-A)<e;){o.set(h,o.at(h-A));for(let t=0;t<this.N;t++)s.setRowCol(t,h,s.atRowCol(t,h-A));for(let t=0;t<this.M;t++)i.setRowCol(t,h,i.atRowCol(t,h-A));if(h-=A,h<A)break}o.set(h,e);for(let t=0;t<this.N;t++)s.setRowCol(t,h,T.at(t));for(let t=0;t<this.M;t++)i.setRowCol(t,h,I.at(t))}}while(A>1);for(let t=0;t<this.M;t++){let o=0;for(let i=0;i<this.N;i++)s.atRowCol(i,t)<0&&o++;for(let s=0;s<this.M;s++)i.atRowCol(s,t)<0&&o++;if(o>Math.trunc((this.N+this.M)/2)){for(let o=0;o<this.N;o++)s.setRowCol(o,t,-s.atRowCol(o,t));for(let s=0;s<this.M;s++)i.setRowCol(s,t,-i.atRowCol(s,t))}}return!0}isSymmetric(){if(this.N!==this.M)return!1;for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++)if(this.atRowCol(t,s)!==this.atRowCol(s,t))return!1;return!0}isZero(){return t(0),!1}isIdentity(){return t(0),!1}equals(s,o){if(void 0!==o&&t(0),this.N!==s.N||this.M!==s.M)return!1;for(let t=0;t<this.N*this.M;t++)if(this.data[t]!==s.data[t])return!1;return!0}maxElement(){return t(0),0}minElement(){return t(0),0}determinant(){if(t(this.N===this.M),1===this.N)return this.data[0];if(2===this.N)return this.data[0]*this.data[3]-this.data[1]*this.data[2];if(3===this.N){const t=this;return t.atRowCol(0,0)*(t.atRowCol(1,1)*t.atRowCol(2,2)-t.atRowCol(1,2)*t.atRowCol(2,1))-t.atRowCol(0,1)*(t.atRowCol(1,0)*t.atRowCol(2,2)-t.atRowCol(2,0)*t.atRowCol(1,2))+t.atRowCol(0,2)*(t.atRowCol(1,0)*t.atRowCol(2,1)-t.atRowCol(1,1)*t.atRowCol(2,0))}const s=new Float64Array(this.N*this.N),o=new y(s,this.N,this.N),i=new Float64Array(this.N);if(!this.luDecomposition(o,i))return 0;let e=1;for(let t=0;t<this.N;t++)e*=o.atRowCol(t,t),i[t]!==t&&(e=-e);return e}submatrix(s,o,i){t(0)}inverse(s){t(0)}pseudoInverse(t,s=!1,o=2220446049250313e-31){if(t.setZero(),1===this.N&&1===this.M)return 0!==this.atRowCol(0,0)?t.setRowCol(0,0,1/this.atRowCol(0,0)):t.setRowCol(0,0,0),!0;if(2===this.N&&2===this.M){const s=this.atRowCol(0,0)*this.atRowCol(1,1)-this.atRowCol(0,1)*this.atRowCol(1,0),o=1e-5*(Math.abs(this.atRowCol(0,0)*this.atRowCol(1,1))+Math.abs(this.atRowCol(0,1)*this.atRowCol(1,0)));if(Math.abs(s)>o)return t.setRowCol(0,0,this.atRowCol(1,1)/s),t.setRowCol(0,1,-this.atRowCol(0,1)/s),t.setRowCol(1,0,-this.atRowCol(1,0)/s),t.setRowCol(1,1,this.atRowCol(0,0)/s),!0}const i=new Float64Array(this.N*this.M),e=new y(i,this.N,this.M),h=new Float64Array(this.M),r=new y(h,this.M,1),a=new Float64Array(this.M*this.M),l=new y(a,this.M,this.M);if(!this.svd(e,r,l,s))return!1;const n=Math.max(this.N,this.M),x=o*Math.abs(r.at(0))*n;for(let y=0;y<this.M;y++)r.at(y)>x?r.set(y,1/r.at(y)):r.set(y,0);return l.mulDiag(r,t),t.mulTranspose(e,t),!0}luDecomposition(s,o){return t(0),!1}symmetricEigen(s,o){t(this.rows()===this.cols()),t(this.rows()===s.rows()),t(o.rows()===o.cols()&&o.rows()===this.rows()),t(this.isSymmetric());const i=new Float64Array(this.N*this.M),e=new y(i,this.N,this.M);e.assignCopy(this);const h=100/Number.EPSILON,r=this.rows(),a=new Float64Array(r),l=new Float64Array(r),n=new y(a,r,1),x=new y(l,r,1);for(let t=0;t<r;t++)n.set(t,e.atRowCol(t,t)),s.set(t,e.atRowCol(t,t)),x.set(t,0);o.setIdentity();const w=()=>{const t=n;o.transposeInPlace();let i=1;do{i*=3,i++}while(i<=r);do{i/=3,i=Math.trunc(i);for(let e=i;e<r;e++){const h=s.at(e),r=Math.abs(h);for(let s=0;s<this.M;s++)t.set(s,o.atRowCol(s,e));let a=e;for(;Math.abs(s.at(a-i))<r;){s.set(a,s.at(a-i));for(let t=0;t<this.M;t++)o.setRowCol(t,a,o.atRowCol(t,a-i));if(a-=i,a<i)break}if(a!==e){s.set(a,h);for(let s=0;s<this.M;s++)o.setRowCol(s,a,t.at(s))}}}while(i>1)};for(let t=1;;t++){let i=0;for(let t=1;t<r;t++)for(let s=0;s<t;s++)i+=Math.abs(e.atRowCol(t,s));if(0===i)return w(),!0;const a=t<4?.2*i/(r*r):0;for(let l=0;l<r;l++)for(let i=l+1;i<r;i++){let y=h*Math.abs(e.atRowCol(i,l));if(t>4&&y<=Math.abs(s.at(l))&&y<=Math.abs(s.at(i)))e.setRowCol(i,l,0);else if(Math.abs(e.atRowCol(i,l))>a){let t,h=s.at(i)-s.at(l);if(y<Math.abs(h))t=e.atRowCol(i,l)/h;else{const s=.5*h/e.atRowCol(i,l);t=1/(Math.abs(s)+Math.sqrt(1+s*s)),s<0&&(t=-t)}const a=1/Math.sqrt(1+t*t),n=t*a,w=n/(1+a);h=t*e.atRowCol(i,l),x.set(l,x.at(l)-h),x.set(i,x.at(i)+h),s.set(l,s.at(l)-h),s.set(i,s.at(i)+h),e.setRowCol(i,l,0);let u=0;for(;u<l;u++)y=e.atRowCol(l,u),h=e.atRowCol(i,u),e.setRowCol(l,u,y-n*(h+y*w)),e.setRowCol(i,u,h+n*(y-h*w));for(u++;u<i;u++)y=e.atRowCol(u,l),h=e.atRowCol(i,u),e.setRowCol(u,l,y-n*(h+y*w)),e.setRowCol(i,u,h+n*(y-h*w));for(u++;u<r;u++)y=e.atRowCol(u,l),h=e.atRowCol(u,i),e.setRowCol(u,l,y-n*(h+y*w)),e.setRowCol(u,i,h+n*(y-h*w));for(u=0;u<r;u++)y=o.atRowCol(l,u),h=o.atRowCol(i,u),o.setRowCol(l,u,y-n*(h+y*w)),o.setRowCol(i,u,h+n*(y-h*w))}}for(let t=0;t<r;t++)n.set(t,n.at(t)+x.at(t)),s.set(t,n.at(t)),x.set(t,0)}}static checkDims(s,o,i){t(s.rows()===o&&s.cols()===i)}}class n extends y{constructor(t){if(t.copy){const s=new Float64Array(t.copy.N*t.copy.M);return super(s,t.copy.N,t.copy.M),this.buffer=s,void this.assignCopy(t.copy)}const s=new Float64Array(t.NN*t.MM);super(s,t.NN,t.MM),this.buffer=s,t.initializerList&&a(this.buffer,t.initializerList,0,0,t.initializerList.length)}assignCopy(t){return this===t||super.assignCopy(t),this}}class x{constructor(t){this.m_TransformationType=1,void 0===t?this.setIdentity():t instanceof x?this.set(t):this.setScale(t)}set(t){return this.xx=t.xx,this.xy=t.xy,this.xd=t.xd,this.yx=t.yx,this.yy=t.yy,this.yd=t.yd,this}clone(){return(new x).set(this)}setZero(){this.xx=0,this.yy=0,this.xy=0,this.yx=0,this.xd=0,this.yd=0}isEqual(t){return this===t||this.xx===t.xx&&this.xy===t.xy&&this.xd===t.xd&&this.yx===t.yx&&this.yy===t.yy&&this.yd===t.yd}transformInPlace(t){const s=this.xx*t.x+this.xy*t.y+this.xd,o=this.yx*t.x+this.yy*t.y+this.yd;t.x=s,t.y=o}transform(t){const s=t.clone();return this.transformInPlace(s),s}queryTransform(t,s){const o=this.xx*t.x+this.xy*t.y+this.xd,i=this.yx*t.x+this.yy*t.y+this.yd;s.setCoords(o,i)}transformEnvInPlace(t){if(t.isEmpty())return;const s=i(e,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(s,o){t(0)}transformPoints2D(t,s,o){for(let i=0;i<s;++i)this.queryTransform(t[i],o[i])}transformInterleavedPoints(t,s,o){s*=2;const i=e.getNAN();for(let e=0;e<s;e+=2)i.x=t[e],i.y=t[e+1],this.transformInPlace(i),o[e]=i.x,o[e+1]=i.y}multiply(t){return x.st_multiply(this,t,this),this}mulLeft(s){return t(0),this}static st_multiply(t,s,o){const i=t.xx*s.xx+t.yx*s.xy,e=t.xy*s.xx+t.yy*s.xy,h=t.xd*s.xx+t.yd*s.xy+s.xd,r=t.xx*s.yx+t.yx*s.yy,a=t.xy*s.yx+t.yy*s.yy,l=t.xd*s.yx+t.yd*s.yy+s.yd;o.xx=i,o.xy=e,o.xd=h,o.yx=r,o.yy=a,o.yd=l}getCoefficients(s){t(s.length>=6),s[0]=this.xx,s[1]=this.xy,s[2]=this.xd,s[3]=this.yx,s[4]=this.yy,s[5]=this.yd}setCoefficients(s){t(s.length>=6),this.xx=s[0],this.xy=s[1],this.xd=s[2],this.yx=s[3],this.yy=s[4],this.yd=s[5]}copyTo(s){t(0)}initializeFromRect(t,s){t.isEmpty()||s.isEmpty()||!t.width()||!t.height()?this.setZero():(this.xy=this.yx=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xd=s.xmin-t.xmin*this.xx,this.yd=s.ymin-t.ymin*this.yy)}initializeFromRectIsotropic(t,s){if(t.isEmpty()||!t.width()||!t.height()||s.isEmpty())this.setZero();else{this.yx=0,this.xy=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xx>this.yy?this.xx=this.yy:this.yy=this.xx;const o=s.getCenter(),i=t.getCenter();this.xd=o.x-i.x*this.xx,this.yd=o.y-i.y*this.yy}}initializeFromTwoPointsArray(t,o){if(t[0].equals(o[0])&&t[1].equals(o[1]))return void this.setIdentity();if(t[0].equals(t[1])){if(o[0].equals(o[1]))return void this.setShift(o[0].sub(t[0]));s("")}if(!t[0].equals(t[1])&&o[0].equals(o[1]))return this.setZero(),void this.shift(o[0]);this.setShiftCoords(-t[0].x,-t[0].y);const i=e.distance(t[0],t[1]),h=e.distance(o[0],o[1]),r=h/i;this.scale(r,r);const a=t[1].sub(t[0]);a.divThis(i);const l=o[1].sub(o[0]);l.divThis(h);const y=a.crossProduct(l),n=a.dotProduct(l);this.rotate(n,y),this.shiftCoords(o[0].x,o[0].y)}initializeFromTwoPoints(t,s,o,i){const e=[t,s],h=[o,i];this.initializeFromTwoPointsArray(e,h)}transformSizeInPlace(s){t(0)}transformSize(s,o){t(0)}transformTol(s){return t(0),0}transformWithoutTranslateArray(t,s,o){for(let i=0;i<s;++i)this.transformWithoutTranslate(t[i],o[i])}transformWithoutTranslateInPlace(t){const s=this.xx*t.x+this.xy*t.y,o=this.yx*t.x+this.yy*t.y;t.setCoords(s,o)}transformWithoutTranslate(t,s){const o=this.xx*t.x+this.xy*t.y,i=this.yx*t.x+this.yy*t.y;s.setCoords(o,i)}setIdentity(){this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=1,this.yd=0}isIdentity(){return!(1!==this.xx||1!==this.yy||this.xy||this.xd||this.yx||this.yd)}isIdentityTol(t){const s=t*t;return!(h(this.xd)+h(this.yd)>s)&&(!(h(this.xy+this.xd)+h(this.yy+this.yd-1)>s)&&!(h(this.xx+this.xd-1)+h(this.yx+this.yd)>s))}isReflective(){return this.xx*this.yy-this.yx*this.xy<0}isUniform(t){const s=this.xx*this.xx+this.yx*this.yx,o=this.xy*this.xy+this.yy*this.yy,i=(s+o)*t;return Math.abs(s-o)<=i&&Math.abs(this.xx*this.xy+this.yx*this.yy)<=i}isUniformNoRotation(){return 0!==this.xx&&Math.abs(this.xx)===Math.abs(this.yy)&&0===this.xy&&0===this.yx}isTranslate(){return 1===this.xx&&1===this.yy&&!this.xy&&!this.yx}isTranslateTol(t){const s=new e;return s.setCoords(0,1),this.transformWithoutTranslateInPlace(s),s.y-=1,!(s.sqrLength()>t*t)&&(s.setCoords(1,0),this.transformWithoutTranslateInPlace(s),s.x-=1,s.sqrLength()<=t*t)}isOrthonormal(t){const s=new x;return s.xx=this.xx*this.xx+this.xy*this.xy,s.xy=this.xx*this.yx+this.xy*this.yy,s.yx=this.yx*this.xx+this.yy*this.xy,s.yy=this.yx*this.yx+this.yy*this.yy,s.xd=0,s.yd=0,s.isIdentityTol(t)}isDegenerate(t){return Math.abs(this.xx*this.yy-this.yx*this.xy)<=2*t*(Math.abs(this.xx*this.yy)+Math.abs(this.yx*this.xy))}isZero(){return 0===this.xx&&0===this.yy&&0===this.xy&&0===this.yx&&0===this.xd&&0===this.yd}isScaleAndTranslateTol(t){return this.xy*this.xy+this.yx*this.yx<=(this.xx*this.xx+this.yy*this.yy)*t}setTranslate(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShiftCoords(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShift(t){return this.xx=1,this.xy=0,this.xd=t.x,this.yx=0,this.yy=1,this.yd=t.y,this}setScaleCoords(t,s){return this.xx=t,this.xy=0,this.xd=0,this.yx=0,this.yy=s,this.yd=0,this}setScale(t){return this.setScaleCoords(t,t),this}setFlipX(t,s){return this.xx=-1,this.xy=0,this.xd=t+s,this.yx=0,this.yy=1,this.yd=0,this}setFlipY(t,s){return this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=-1,this.yd=t+s,this}setShear(t,s){return this.xx=1,this.xy=t,this.xd=0,this.yx=s,this.yy=1,this.yd=0,this}scale(t,s){return this.xx*=t,this.xy*=t,this.xd*=t,this.yx*=s,this.yy*=s,this.yd*=s,this}setRotateAngle(t){return this.setRotate(Math.cos(t),Math.sin(t))}setRotate(t,s){return this.xx=t,this.xy=-s,this.xd=0,this.yx=s,this.yy=t,this.yd=0,this}setRotateAngleAbout(t,s){return this.setRotateAbout(Math.cos(t),Math.sin(t),s)}setRotateAbout(t,s,o){return this.setTranslate(-o.x,-o.y),this.rotate(t,s),this.translate(o.x,o.y)}setSwapCoordinates(){return this.xx=0,this.xy=1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}setRotateCw90(){return this.xx=0,this.xy=1,this.xd=0,this.yx=-1,this.yy=0,this.yd=0,this}setRotateCcw90(){return this.xx=0,this.xy=-1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}shiftCoords(t,s){return this.xd+=t,this.yd+=s,this}shift(t){return this.xd+=t.x,this.yd+=t.y,this}translate(t,s){return this.xd+=t,this.yd+=s,this}flipX(t,s){return this.xx=-this.xx,this.xy=-this.xy,this.xd=t+s-this.xd,this}flipY(t,s){return this.yx=-this.yx,this.yy=-this.yy,this.yd=t+s-this.yd,this}shear(t,s){const o=new x;return o.setShear(t,s),this.multiply(o)}rotateAngle(t){const s=new x;return s.setRotateAngle(t),this.multiply(s)}rotate(t,s){const o=new x;return o.setRotate(t,s),this.multiply(o)}rotateAbout(t,s,o){return this.translate(-o.x,-o.y),this.rotate(t,s),this.translate(o.x,o.y)}rotateAngleAbout(t,s){return this.rotateAbout(Math.cos(t),Math.sin(t),s)}setInvert(t){return this.set(t),this.invertThis()}invertThis(){let t=this.xx*this.yy-this.xy*this.yx;if(0===t)return this.setZero(),this;t=1/t;const s=(this.xy*this.yd-this.xd*this.yy)*t,o=(this.xd*this.yx-this.xx*this.yd)*t,i=this.yy*t,e=-this.xy*t,h=-this.yx*t,r=this.xx*t;return this.xd=s,this.yd=o,this.xx=i,this.yy=r,this.xy=e,this.yx=h,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=r.constructDouble(this.xy),s=r.constructDouble(this.xx),o=s.mulDouble(this.yy).sub(t.mulDouble(this.yx));if(o.isZero())return this.setZero(),this;const i=o.clone();i.invertThis();const e=r.constructDouble(this.xd),h=t.mulDouble(this.yd).sub(e.mulDouble(this.yy)).mul(i).toDouble(),a=e.mulDouble(this.yx).sub(s.mulDouble(this.yd)).mul(i).toDouble(),l=i.mulDouble(this.yy).toDouble(),y=i.mulDouble(-this.xy).toDouble(),n=i.mulDouble(-this.yx).toDouble(),x=i.mulDouble(this.xx).toDouble();return this.xd=h,this.yd=a,this.xx=l,this.yy=x,this.xy=y,this.yx=n,this}extractScaleTransform(t,s){const o=Math.sqrt(this.xx*this.xx+this.xy*this.xy),i=Math.sqrt(this.yx*this.yx+this.yy*this.yy);s.setScaleCoords(1/o,1/i),s.multiply(this),t.setScaleCoords(o,i)}setFromTwoTriangles(t,s){let o=!0;for(let e=0;e<3;++e)o=o&&t[e].equals(s[e]);if(o)return this.setIdentity(),!0;const i=new e;i.setSub(t[0],t[1]);const h=new e;h.setSub(t[0],t[2]);const r=new e;r.setSub(s[0],s[1]);const a=new e;a.setSub(s[0],s[2]);const l=4*Number.EPSILON*(Math.abs(i.x*h.y)+Math.abs(h.x*i.y));let y=i.x*h.y-i.y*h.x;return Math.abs(y)>l?(y=1/y,this.xx=(r.x*h.y-i.y*a.x)*y,this.xy=(i.x*a.x-r.x*h.x)*y,this.yx=(r.y*h.y-i.y*a.y)*y,this.yy=(i.x*a.y-r.y*h.x)*y,this.xd=s[0].x-(this.xx*t[0].x+this.xy*t[0].y),this.yd=s[0].y-(this.yx*t[0].x+this.yy*t[0].y),!0):(this.setZero(),!1)}initializeFromControlPoints(t,s,o,i,e=null){return 0===s?(this.setIdentity(),void(e&&e.setIdentity())):1===s?(this.setShift(i[0].sub(o[0])),void(e&&e.setShift(o[0].sub(i[0])))):(s<3&&(t=1),void(4===t&&s>2?C(this,s,o,i,e):f(t,this,s,o,i,e)))}calculateErrors(s,o,i,h){t(s>0&&null!==o&&null!==i);let r=0;for(let t=0;t<s;++t){const s=this.transform(o[t]),a=e.sqrDistance(i[t],s);r+=a,h&&(h[t]=Math.sqrt(a))}return Math.sqrt(r/s)}}const w=[43,11,41,9,61];function u(s,o){t(!(2!==o.rows()&&3!==o.rows()||2!==o.cols()&&3!==o.rows())),s.xx=o.atRowCol(0,0),s.xy=o.atRowCol(0,1),s.yx=o.atRowCol(1,0),s.yy=o.atRowCol(1,1),3===o.cols()?(s.xd=o.atRowCol(0,2),s.yd=o.atRowCol(1,2)):(s.xd=0,s.yd=0)}function C(t,s,i,h,r){const a=e.average(i,s),l=e.average(h,s),y=new n({NN:2,MM:2});y.setZero();const x=new n({NN:2,MM:2});x.setZero();for(let o=0;o<s;++o)y.setRowCol(0,0,y.atRowCol(0,0)+(i[o].x-a.x)*(i[o].x-a.x)),y.setRowCol(0,1,y.atRowCol(0,1)+(i[o].x-a.x)*(i[o].y-a.y)),y.setRowCol(1,1,y.atRowCol(1,1)+(i[o].y-a.y)*(i[o].y-a.y)),x.setRowCol(0,0,x.atRowCol(0,0)+(h[o].x-l.x)*(i[o].x-a.x)),x.setRowCol(0,1,x.atRowCol(0,1)+(h[o].x-l.x)*(i[o].y-a.y)),x.setRowCol(1,0,x.atRowCol(1,0)+(h[o].y-l.y)*(i[o].x-a.x)),x.setRowCol(1,1,x.atRowCol(1,1)+(h[o].y-l.y)*(i[o].y-a.y));y.setRowCol(1,0,y.atRowCol(0,1));const w=new n({NN:2,MM:2});y.pseudoInverse(w,!0)||o("Failed to compute pseudo inverse"),x.mul(w,x),u(t,x);const C=a.clone();t.transformInPlace(C),t.xd=l.x-C.x,t.yd=l.y-C.y,r&&(x.pseudoInverse(w,!1)||o("Failed to compute pseudo inverse"),u(r,w),r.transformInPlace(l),r.xd=a.x-l.x,r.yd=a.y-l.y)}function f(s,i,h,r,a,l){t(1===s||0===s||2===s||3===s),i.setIdentity();const y=e.average(r,h),C=e.average(a,h);if(t(s<w.length&&s>0),8&w[s]){const t=new n({NN:2,MM:2});t.setZero();for(let s=0;s<h;++s)t.setRowCol(0,0,t.atRowCol(0,0)+(a[s].x-C.x)*(r[s].x-y.x)),t.setRowCol(1,0,t.atRowCol(1,0)+(a[s].x-C.x)*(r[s].y-y.y)),t.setRowCol(0,1,t.atRowCol(0,1)+(a[s].y-C.y)*(r[s].x-y.x)),t.setRowCol(1,1,t.atRowCol(1,1)+(a[s].y-C.y)*(r[s].y-y.y));const e=new n({NN:2,MM:2}),l=new n({NN:2,MM:1}),f=new n({NN:2,MM:2});t.svd(e,l,f)||o("Failed to compute svd");const R=new n({NN:2,MM:2});e.transpose(R);const d=new n({NN:2,MM:2});if(f.mul(R,d),!(32&w[s])){d.determinant()<0&&(R.setRowCol(1,0,-R.atRowCol(1,0)),R.setRowCol(1,1,-R.atRowCol(1,1)),f.mul(R,d))}const c=new x;u(c,d),i.set(c)}if(2&w[s]){let t=0,s=0;for(let o=0;o<h;++o){const e=r[o].sub(y);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(a[o].sub(C))}if(0===t)0===s?i.setIdentity():i.setZero();else{const o=s/t;i.scale(o,o)}}else t(!(4&w[s]));const f=y.clone();i.transformInPlace(f),i.xd=C.x-f.x,i.yd=C.y-f.y,l&&(l.set(i),l.invertThis(),l.isZero()&&(l.xd=y.x,l.yd=y.y))}export{x as T};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{b as e}from"./ProjectionTransformation.js";import{getSpatialReference as r,fromGeometry as t,fromSpatialReference as o}from"../geometry/operators/support/apiConverter.js";const s=new e;function n(e){const n=r(e);return s.accelerateGeometry(t(e),o(n),1)}function a(e,r){return s.execute(t(e),t(r),o(e.spatialReference),null)}const c=s.supportsCurves(),u=Object.freeze(Object.defineProperty({__proto__:null,accelerateGeometry:n,execute:a,supportsCurves:c},Symbol.toStringTag,{value:"Module"}));export{n as a,u as c,a as e,c as s};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{d as e}from"./ProjectionTransformation.js";import{getSpatialReference as r,fromGeometry as t,fromSpatialReference as o}from"../geometry/operators/support/apiConverter.js";const s=new e;function a(e){const a=r(e);return s.accelerateGeometry(t(e),o(a),1)}function n(e,r){return s.execute(t(e),t(r),o(e.spatialReference))}const c=s.supportsCurves(),p=Object.freeze(Object.defineProperty({__proto__:null,accelerateGeometry:a,execute:n,supportsCurves:c},Symbol.toStringTag,{value:"Module"}));export{a,p as d,n as e,c as s};
|
package/chunks/equalsOperator.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{e,r}from"./ProjectionTransformation.js";import{getSpatialReference as t,fromGeometry as o,fromSpatialReference as s}from"../geometry/operators/support/apiConverter.js";class n extends e{getOperatorType(){return 2}execute(e,t,o,s){return r(e,t,o,3,s)}}const a=new n;function u(e){const r=t(e);return a.accelerateGeometry(o(e),s(r),1)}function c(e,r){return a.execute(o(e),o(r),s(e.spatialReference),null)}const p=a.supportsCurves(),l=Object.freeze(Object.defineProperty({__proto__:null,accelerateGeometry:u,execute:c,supportsCurves:p},Symbol.toStringTag,{value:"Module"}));export{u as a,c as b,l as e,p as s};
|
package/core/NestedMap.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get(t,e){return this._outer.get(t)?.get(e)}getInner(t){return this._outer.get(t)}set(t,e,r){const o=this._outer.get(t);o?o.set(e,r):this._outer.set(t,new Map([[e,r]]))}delete(t,e){const r=this._outer.get(t);r&&(r.delete(e),0===r.size&&this._outer.delete(t))}forEach(t){this._outer.forEach(((e,r)=>t(e,r)))}forAll(t){
|
|
5
|
+
class t{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get outerSize(){return this._outer.size}get(t,e){return this._outer.get(t)?.get(e)}getInner(t){return this._outer.get(t)}set(t,e,r){const o=this._outer.get(t);o?o.set(e,r):this._outer.set(t,new Map([[e,r]]))}delete(t,e){const r=this._outer.get(t);r&&(r.delete(e),0===r.size&&this._outer.delete(t))}forEach(t){this._outer.forEach(((e,r)=>t(e,r)))}forAll(t){this._outer.forEach(((e,r)=>e.forEach(((e,o)=>t(e,r,o)))))}}export{t as NestedMap};
|
package/core/deprecate.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./has.js";const e=new WeakMap;function n(n,t,r=!1){const o=`🛑 DEPRECATED - ${t}`;if(!r)return void n.warn(o);let i=e.get(n);i||(i=new Set,e.set(n,i)),i.has(t)||(i.add(t),n.warn(o))}const t="https://www.esriurl.com/";function r(e,n,r,o={}){has("esri-deprecation-warnings")&&
|
|
5
|
+
import has from"./has.js";const e=new WeakMap;function n(n,t,r=!1){const o=`🛑 DEPRECATED - ${t}`;if(!r)return void n.warn(o);let i=e.get(n);i||(i=new Set,e.set(n,i)),i.has(t)||(i.add(t),n.warn(o))}const t="https://www.esriurl.com/";function r(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This widget is deprecated. Use the ${n} component instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function o(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This view model is deprecated. Use the ${n} component directly instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function i(e,n,t={}){has("esri-deprecation-warnings")&&m(e,`Module: ${n}`,t)}function s(e,n,t={}){if(has("esri-deprecation-warnings")){const{moduleName:r}=t;m(e,`Function: ${(r?r+"::":"")+n+"()"}`,t)}}function c(e,n,t={}){if(has("esri-deprecation-warnings")){const{moduleName:r}=t;m(e,`Property: ${(r?r+"::":"")+n}`,t)}}function a(e,n,t,r={}){if(has("esri-deprecation-warnings")){const{moduleName:o}=r;m(e,`'${(o?o+"::":"")+n}' value: ${t}`,r)}}function p(e,n,t={}){has("esri-deprecation-warnings")&&m(e,`Multiple argument constructor: ${n}`,{warnOnce:!0,replacement:`new ${n}({ <your properties here> })`,...t})}function m(e,t,r={}){if(has("esri-deprecation-warnings")){const{replacement:o,version:i,see:s,warnOnce:c}=r;let a=t;if(o&&(a+=`\n\t🛠️ Replacement: ${o}`),i&&(a+=`\n\t⚙️ Version: ${i}`),s)if(Array.isArray(s)){a+="\n\t🔗 See for more details:";for(const e of s)a+=`\n\t\t${e}`}else a+=`\n\t🔗 See ${s} for more details.`;n(e,a,c)}}export{o as deprecateUnnecessaryViewModel,r as deprecateWidget,m as deprecated,p as deprecatedConstructorSignature,s as deprecatedFunction,i as deprecatedModule,c as deprecatedProperty,a as deprecatedPropertyValue};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{a as e,o as t,G as n,t as r}from"../../chunks/Geometry.js";import{Envelope2D as o}from"../../chunks/Envelope2D.js";import{c as s,P as a,A as i,B as g}from"../../chunks/Envelope.js";import{S as m,f as u}from"../../chunks/QuadraticBezier.js";import{w as c}from"../../chunks/Point2D.js";import{getSpatialReference as l,fromPolyline as p,fromSpatialReference as d,toPolyline as h}from"./support/apiConverter.js";function f(t,n,r,a,i){if(t.isEmpty()||n.isEmpty())return null;if(8&a&&16&a)return null;2&a&&4&a&&e("");const g=new o,m=new o;t.queryEnvelope(g),n.queryEnvelope(m),g.mergeEnvelope2D(m);return P(t,n,s(r,g,!0).total(),a)}function P(e,o,s,i){t(e),t(o);let g,c=!1;const l=e.querySegmentIterator(),p=o.querySegmentIterator();let d=0;const h=new m,f=new a({vd:e.getDescription()}),P=new a({vd:e.getDescription()}),y=[],x=[];for(S(e,y,x);l.nextPath();){let t=!0,o=0;for(;2!==o;){if(0===o){l.nextSegment().getGeometryType()!==n.enumLine&&r(""),o++}else{l.resetToLastSegment();if(l.previousSegment().getGeometryType()!==n.enumLine&&r(""),c&&t){const n=l.getPathIndex();g.addSegmentsFromPath(e,n,0,e.getSegmentCountPath(n),!0),t=!1}o++}let a=!1;if(d<x.length){const e=x[y[d]],t=l.getPathIndex();if(e.m_path===t){const t=1===o?l.getStartPointIndex():l.getEndPointIndex();e.m_pointIndex===t&&(a=!0,d++)}}if(1===o){if(8&i)continue}else if(16&i)continue;if(!a){1===o?l.previousSegment():l.nextSegment();const a=1===o?l.nextSegment():l.previousSegment(),m=a,d=m.calculateLength2D();p.resetToFirstPath();let y=!1,S=Number.NaN;for(;p.nextPath();){for(;p.hasNextSegment();){const e=p.nextSegment();e.getGeometryType()!==n.enumLine&&r("");const t=e,{bIntersect:a,t1:i,t2:g}=u(m,t);if(a){const e=t.calculateLength2D();if(g*e>=-s&&(1-g)*e>=-s)if(1===o){if(i*d<=-s)(Number.isNaN(S)||i>S)&&(S=i);else if(i*d<=s){S=Number.NaN,y=!0;break}}else if((1-i)*d<=-s)(Number.isNaN(S)||i<S)&&(S=i);else if((1-i)*d<=s){S=Number.NaN,y=!0;break}}}if(y)break}if(!Number.isNaN(S)){if(!c){g=e.createInstance();for(let t=0;t<l.getPathIndex();t++)g.addPath(e,t,!0)}if(1===o){a.queryCoord(S,f);const n=l.getPathIndex();if(2&i?e.getPointByVal(e.getPathStart(n),P):4&i&&P.setEmpty(),1&i||(h.create(a.getGeometryType()),a.copyTo(h.get()),h.get().setEnd(f),h.get().reverse(),g.addSegment(h.get(),!0),t=!1),g.addSegmentsFromPath(e,n,0,e.getSegmentCountPath(n),t),1&i){const e=g.getPathStart(n);g.setPointByVal(e,f)}if(2&i||4&i){const e=g.getPathStart(n),t=f.getXY();P.setXY(t),g.setPointByVal(e,P)}c=!0,t=!1}else{const n=l.getPathIndex();if(t&&(g.addSegmentsFromPath(e,n,0,e.getSegmentCountPath(n),!0),t=!1),2&i?e.getPointByVal(e.getPathEnd(n)-1,P):4&i&&P.setEmpty(),a.queryCoord(S,f),1&i){const e=g.getPathEnd(n);g.setPointByVal(e-1,f)}else h.create(a.getGeometryType()),a.copyTo(h.get()),h.get().setEnd(f),g.addSegment(h.get(),!1);if(2&i||4&i){const e=g.getPathEnd(n),t=f.getXY();P.setXY(t),g.setPointByVal(e-1,P)}c=!0}}}}}return c?g:null}function y(e,t){return{m_path:e,m_pointIndex:t}}function S(e,t,n){const r=[],o=[],s=e.querySegmentIterator();for(;s.nextPath();){s.resetToFirstSegment();const e=s.nextSegment().getStartXY(),t=s.getPathIndex(),n=s.getStartPointIndex();r.push(e),o.push(y(t,n)),s.resetToLastSegment();const a=s.previousSegment().getEndXY(),i=s.getPathIndex(),g=s.getEndPointIndex();r.push(a),o.push(y(i,g))}const a=new i(0);for(let i=0;i<r.length;i++)a.add(i);const m={userSort(e,t,n){n.sort(e,t,((e,t)=>r[e].compare(r[t])))},getValue:e=>r[e].y};(new g).sort(a,0,a.size(),m);for(let i=0;i<a.size()-1;i++){const e=r[a.read(i)];if(e.equals(r[a.read(i+1)])){do{const e=o[a.read(i)];n.push(e),i++}while(i<a.size()&&e.equals(r[a.read(i)]));i--}}c(t,n.length,0);for(let i=0;i<n.length;i++)t[i]=i;t.sort(((e,t)=>{const r=n[e],o=n[t];return r.m_path<o.m_path?-1:r.m_path>o.m_path?1:r.m_pointIndex<o.m_pointIndex?-1:1}))}class x{getOperatorType(){return 10007}supportsCurves(){return!1}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}execute(e,t,n,r,o){return f(e,t,n,r)}}const E=new x;function I(e,t,n){let r=0;n&&(n.relocateEnds&&(r|=1),n.keepEndAttributes&&(r|=2),n.noEndAttributes&&(r|=4),n.noExtendAtFrom&&(r|=8),n.noExtendAtTo&&(r|=16));const o=l(e),s=E.execute(p(e),p(t),d(o),r,null);return s?h(s,o):null}const N=E.supportsCurves();export{I as execute,N as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{o as i,d as n,i as s,G as o,t as r,g as h}from"../../../chunks/Geometry.js";import{m as d,P as g,i as a,u as c,n as l,b as u,d as f,v as m}from"../../../chunks/Point2D.js";import{a as p,M as E,r as x,e as P}from"../../../chunks/QuadraticBezier.js";function _(t,e,i,n,s,o){const r=n-e;if(r<=o)return P(t,e,i,n,s),i;const h=w(t,e,n,s,Math.min(Math.max(r>>1,3),100)),d=t[h];t[e]=u(t[h],t[h]=t[e]);let g=e+1,a=!1;for(let c=e+1;c!==n;++c)s(t[c],d)&&(t[g]=u(t[c],t[c]=t[g]),++g,a=!0);if(!a)for(let c=e+1;c<i;++c)s(d,t[c])||(c!==g&&(t[g]=u(t[c],t[c]=t[g])),++g);return--g,t[g]=u(t[e],t[e]=t[g]),g}function F(t,e,i){const n=Math.trunc(e/2);let s=BigInt(n);const o=BigInt(e);for(let h=0;h<i;++h)t.push(Number(s%o)),s=6364136223846793005n*s+1442695040888963407n&0x7fffffffffffffffn,s=BigInt.asUintN(64,s);m(t);const r=c(t,((t,e)=>t===e));t.length=r}function w(t,e,i,n,s){const o=[];F(o,i-e,s);const r=[];for(let d=0,g=o.length;d<g;d++){const i=o[d];r.push(l(t[e+i],i))}const h=Math.trunc(r.length/2);return r.sort(((t,e)=>n(t.first,e.first)?-1:1)),e+r[h].second}function k(){return{p:new g,userData:Number.NaN,edge:null}}class T{constructor(){this.info=0,this.mask=!1,this.p=null,this.a=[null,null],this.twin=null}nextFreeEdge(){return this.twin}setIndex(t){this.info=t,this.mask=!1}getIndex(){return this.info}setMask(){this.mask=!0}getMask(){return this.mask}}function y(t,e){return{first:t,second:e}}function b(t,e){t.first=e.first,t.second=e.second}function C(){return this.i1-this.i0}function D(){return{i0:Number.NaN,i1:Number.NaN,nextFreeEdgeIndex:[-1],box:[y(null,null),y(null,null)],size:C}}function I(){return{k:0,pTask:null,pTask0:null,pTask1:null}}function X(){return{p:[new g,new g],points:[null,null]}}function Y(){return{p:[null,null,null]}}class N{constructor(){this.m_nextFreePairEdge=y(null,null),this.m_points=[],this.m_pointZero=null,this.m_edges=[],this.m_voronoiToEdge=[],this.m_nextFreeEdge=0}clear(){this.m_nextFreePairEdge=y(null,null),this.m_points.length=0,this.m_pointZero=null,this.m_edges.length=0,this.m_voronoiToEdge.length=0,this.m_nextFreeEdge=0}reservePoints(t){h(t>1)}prepare(t){{const e=k();e.p.x=Number.POSITIVE_INFINITY,e.p.y=Number.POSITIVE_INFINITY,e.userData=t,this.m_points.push(e)}}addVertex(t,e){const i=k();i.p.assign(t),i.userData=e,i.edge=null,this.m_points.push(i)}removeDuplicates(){const t=this.m_points.shift();this.m_points.sort(((t,e)=>t.p.compareX(e.p)));const e=c(this.m_points,((t,e)=>t.p.equals(e.p))),i=e!==this.m_points.length;return this.m_points.length=e,this.m_points.unshift(t),i}boundVoronoiCells(t,e){const i=this.m_points.length;if(i<2)return!1;const n=[this.m_points[1].p.clone(),this.m_points[1].p.clone()];for(let d=2;d<i;d++){const t=this.m_points[d].p;t.x<n[0].x&&(n[0].x=t.x),n[1].x<t.x&&(n[1].x=t.x),t.y<n[0].y&&(n[0].y=t.y),n[1].y<t.y&&(n[1].y=t.y)}const s=new g;s.x=.5*(n[0].x+n[1].x),s.y=.5*(n[0].y+n[1].y);let o=0;for(let d=1;d<i;d++){const t=this.m_points[d].p,e=g.sqrDistanceCoords(t.x,t.y,s.x,s.y);o<e&&(o=e)}const r=Math.sqrt(o),h=Math.max(r+2*t,1.5*r);{const t=.8660254037844386,i=.5;let n=1,o=0;for(let r=0;r<12;r++){const r=new g;r.x=s.x+h*n,r.y=s.y+h*o,this.addVertex(r,e);const d=n*i+o*t;n=n*t-o*i,o=d}}return!0}construct(){const t=D();return!!this.constructTask(t)&&(this.solveTask(t),!0)}constructTask(t){if(this.m_pointZero=this.createZeroHandle(),h(void 0!==this.m_pointZero),this.m_points.length<3)return!1;const e=6*(this.m_points.length-2);this.m_edges=d(T,e);for(let i=0;i<e;i++)this.m_edges[i].setIndex(i);return t.i0=1,t.i1=this.m_points.length,t.nextFreeEdgeIndex[0]=0,!0}splitTask(t,e,i,n){const s=t,o=e,r=i,h=n;s.k=this.findMaxSide(h.i0,h.i1);let d=h.i0+h.i1>>1;const g=1250;if(0===s.k){d=_(this.m_points,h.i0,d,h.i1,((t,e)=>t.p[0]!==e.p[0]?t.p[0]<e.p[0]:t.p[1]<e.p[1]),g)}else{d=_(this.m_points,h.i0,d,h.i1,((t,e)=>t.p[1]!==e.p[1]?t.p[1]<e.p[1]:t.p[0]<e.p[0]),g)}o.i0=h.i0,o.i1=d,o.nextFreeEdgeIndex[0]=h.nextFreeEdgeIndex[0],h.nextFreeEdgeIndex[0]+=6*(o.i1-o.i0-1)+2,r.i0=d,r.i1=h.i1,r.nextFreeEdgeIndex[0]=h.nextFreeEdgeIndex[0],h.nextFreeEdgeIndex[0]+=6*(r.i1-r.i0-1)+2,s.pTask=h,s.pTask0=o,s.pTask1=r}solveMergeTask(t){const e=this.newPairEdgeEx(t.pTask.nextFreeEdgeIndex,!1);if(t.pTask.box[t.k]=y(t.pTask0.box[t.k].first,t.pTask1.box[t.k].second),t.pTask.box[1-t.k]=y(A(this.getPointXYFromEdge(t.pTask0.box[1-t.k].first),this.getPointXYFromEdge(t.pTask1.box[1-t.k].first),1-t.k)?t.pTask0.box[1-t.k].first:t.pTask1.box[1-t.k].first,A(this.getPointXYFromEdge(t.pTask0.box[1-t.k].second),this.getPointXYFromEdge(t.pTask1.box[1-t.k].second),1-t.k)?t.pTask1.box[1-t.k].second:t.pTask0.box[1-t.k].second),t.pTask.i0+2===t.pTask.i1){const i=t.pTask0.box[t.k].second,n=i.twin,s=t.pTask1.box[t.k].first,o=s.twin;return this.joinEdges2(n,o),this.joinEdges2(o,n),void this.join(i,s,0,1,e)}const i=[new Array(2),new Array(2)];i[0][0]=i[1][0]=y(t.pTask0.box[t.k].second,t.pTask0.box[t.k].second.twin),i[0][1]=i[1][1]=y(t.pTask1.box[t.k].first,t.pTask1.box[t.k].first.twin);const n=[!1,!1];if(t.pTask0.i0+1===t.pTask0.i1?(this.findEdgeSide(i[0],n,1,0),this.findEdgeSide(i[1],n,1,1)):(this.findEdge(i[0],n,0),this.findEdge(i[1],n,1)),n[0]||n[1]){if(n[0]){const e=this.newPairEdgeEx(t.pTask0.nextFreeEdgeIndex,!1);this.insertEdge(i[0][0].first,e.first,0),this.insertEdge(i[0][0].second,e.second,1)}if(n[1]){const e=this.newPairEdgeEx(t.pTask1.nextFreeEdgeIndex,!1);this.insertEdge(i[0][1].first,e.first,1),this.insertEdge(i[0][1].second,e.second,0)}}else this.getNextDEdge(i[0][0].first,0)!==i[0][0].first&&(i[1][0]=this.newPairEdgeEx(t.pTask0.nextFreeEdgeIndex,!1),this.insertEdge(i[0][0].first,i[1][0].first,0),this.insertEdge(i[0][0].second,i[1][0].second,1)),this.getNextDEdge(i[0][1].first,0)!==i[0][1].first&&(i[1][1]=this.newPairEdgeEx(t.pTask1.nextFreeEdgeIndex,!1),this.insertEdge(i[0][1].first,i[1][1].first,1),this.insertEdge(i[0][1].second,i[1][1].second,0));this.merge(i[1][0],i[0][0],i[0][1],i[1][1],e)}solveTask(t){const e=t;switch(e.i1-e.i0){case 1:{this.insertPoint(e.i0,e.nextFreeEdgeIndex);const t=this.m_points[e.i0].edge;e.box[0]=e.box[1]=l(t,t)}break;case 2:{const t=e.i0,i=t+1;this.insertPoint(t,e.nextFreeEdgeIndex),this.insertPoint(i,e.nextFreeEdgeIndex);const n=this.m_points[t],s=this.m_points[i],o=n.edge,r=s.edge,h=o.twin,d=r.twin;this.joinEdges2(h,d),this.joinEdges2(d,h);const g=this.newPairEdgeEx(e.nextFreeEdgeIndex,!1);this.join(o,r,0,1,g);for(let a=0;a<2;a++)e.box[a]=A(this.getPointXY(n),this.getPointXY(s),a)?y(o,r):y(r,o)}break;case 3:{const t=[e.i0,e.i0+1,e.i0+2];this.insertPoint(t[0],e.nextFreeEdgeIndex),this.insertPoint(t[1],e.nextFreeEdgeIndex),this.insertPoint(t[2],e.nextFreeEdgeIndex);const i=[this.m_points[t[0]],this.m_points[t[1]],this.m_points[t[2]]],n=this.caseFromCompare(i[0].p,i[1].p,i[2].p),s=[i[0].edge,i[1].edge,i[2].edge],o=N.c_aTableDelaunayTriangulationSolution[n],r=v(19*v(1+(7&o))),h=v(19*v(1+(o>>5)));let d=v(o<<3)>>6;const g=3&r,a=r>>6,c=3&h,l=h>>6;e.box[0]=y(s[g],s[a]),e.box[1]=y(s[c],s[l]);const f=[s[0].twin,s[1].twin,s[2].twin],m=[this.newPairEdgeEx(e.nextFreeEdgeIndex,!1),this.newPairEdgeEx(e.nextFreeEdgeIndex,!1),this.newPairEdgeEx(e.nextFreeEdgeIndex,!1)];switch(3===d&&(d=this.orientation(i[0].p,i[1].p,i[2].p)+1),d){case 0:this.joinEdges2(f[0],f[2]),this.joinEdges2(f[2],f[1]),this.joinEdges2(f[1],f[0]),this.join(s[0],s[2],0,1,m[0]),this.join(s[2],s[1],0,1,m[1]),this.join(s[1],s[0],0,1,m[2]);break;case 1:{const t=[0,1,2];t[3-(g+a)]=u(t[1],t[1]=t[3-(g+a)]),this.joinEdges2(f[t[0]],f[t[1]]),this.joinEdges2(f[t[1]],f[t[2]]),this.joinEdges2(f[t[2]],f[t[0]]),this.join(s[t[0]],s[t[1]],0,1,m[0]),this.join(s[t[1]],s[t[2]],0,1,m[1]),this.join(m[1].first,f[t[2]],0,1,m[2])}break;case 2:this.joinEdges2(f[0],f[1]),this.joinEdges2(f[1],f[2]),this.joinEdges2(f[2],f[0]),this.join(s[0],s[1],0,1,m[0]),this.join(s[1],s[2],0,1,m[1]),this.join(s[2],s[0],0,1,m[2])}}break;default:{const e=I(),i=D(),n=D();this.splitTask(e,i,n,t),this.solveTask(i),this.solveTask(n),this.solveMergeTask(e)}}}getOutsideHull(){const t=[],e=this.m_points[0].edge;let i=e;do{t.push(this.getPointFromEdge(this.getTwinEdge(i))),i=this.getNextDEdge(i,0)}while(i!==e);return t}getConvexHull(){const t=[],e=this.m_points[0].edge;let i=e;do{const e=this.getPointFromEdge(this.getTwinEdge(i));t.length<2||!this.insideLine(this.getPointXY(t.at(-2)),this.getPointXY(t.at(-1)),this.getPointXY(e))?t.push(e):t[t.length-1]=e,i=this.getNextDEdge(i,0)}while(i!==e);return 2<t.length&&this.insideLine(this.getPointXY(t[0]),this.getPointXY(t.at(-1)),this.getPointXY(t.at(-2)))&&t.pop(),2<t.length&&this.insideLine(this.getPointXY(t[1]),this.getPointXY(t[0]),this.getPointXY(t.at(-1)))&&(t[0]=t.at(-1),t.pop()),t}getVoronoiPolygon(t,e){t.length=0;const i=this.getEdgeFromPoint(e);let n=i;for(;;){const e=this.calculateCircleCenter(n);t.push(e);const s=this.getNextDEdge(n,1);if(s===i)break;n=s}}getNearestPoint(t){this.isInfinitePointFromPoint(t)&&r("Not supported for the infinite point");const e=this.getPointXY(t);let i=this.m_pointZero,n=Number.MAX_VALUE;const s=this.getEdgeFromPoint(t);let o=s;do{const t=this.getPointFromEdge(this.getTwinEdge(o));if(!this.isInfinitePointFromPoint(t)){const s=g.sqrDistance(e,this.getPointXY(t));s<n&&(i=t,n=s)}o=this.getCounterClockwiseEdge(o)}while(o!==s);return i}addConstraint(t,e){const i=[null],n=[null];if(!this.constraintFindFirstEdge(i,n,t,e))return y(n[0],i[0]);i[0]=this.getTwinEdge(i[0]);const s=this.getPointXY(t),o=this.getPointXY(e),h=[new Array(0),new Array(0)],d=i[0];for(;;){const t=this.getClockwiseEdge(n[0]);t.getMask()&&r("add_constraint");const d=y(t,this.getTwinEdge(t));this.deleteTwinEdges(d,!0);const g=this.getCounterClockwiseEdge(this.getTwinEdge(i[0])),a=this.getTwinEdge(this.getClockwiseEdge(n[0])),c=this.getPointFromEdge(a);if(c===e){h[0].push(i[0]),i[0]=g,h[1].push(n[0]),n[0]=a;break}const l=this.orientation(s,o,this.getPointXY(c));0===l&&r("add_constraint - point on constraint"),0<l?(h[0].push(i[0]),i[0]=g):(h[1].push(n[0]),n[0]=a)}h[0].push(i[0]),h[1].push(n[0]);const g=this.newPairEdge();g.first.setMask(),g.second.setMask(),this.join(n[0],d,1,1,g),this.triangulateConstraint(h[0],1,h[0].length-1,g),h[1].reverse();const a=y(g.second,g.first);return this.triangulateConstraint(h[1],1,h[1].length-1,a),a}verify(){for(let t=0,e=this.m_edges.length;t<e;t++){const e=this.m_edges[t];if(!e.getMask()&&!this.testEdge(e))return!1}return!0}getDelaunayTriangleCount(){return this.m_points.length-2<<1}getVoronoiSegments(t=Number.MAX_VALUE){const e=[];for(let i=0,n=this.m_edges.length;i<n;i+=2){const n=y(null,null);if(n.first=this.m_edges[i],n.second=n.first.twin,this.isInfinitePointFromEdge(n.first)&&(n.second=u(n.first,n.first=n.second)),this.isInfinitePointFromEdge(n.second)){const i=d(g,3);i[0]=this.calculateCircleCenter(this.getNextDEdge(n.first,0).twin,1),i[2]=this.calculateCircleCenter(this.getNextDEdge(n.first,1),1);const s=d(g,2);s[0].assign(i[0]),s[1].assign(i[2]),s[0].rightPerpendicularThis(),s[1].leftPerpendicularThis(),i[1]=i[0].add(s[0]).add(i[2].add(s[1])),i[1].normalize();for(const e of i)e.mulThis(t);const o=X();o.points[0]=n.first.p,o.points[1]=n.second.p;for(let t=0;t<i.length-1;t++){for(let e=0;e<2;e++)o.p[e]=i[t+e];o.p[0].equals(o.p[1])||e.push(o)}}else if(this.isInfinitePointFromEdge(this.getNextDEdge(n.first,0).twin)&&this.isInfinitePointFromEdge(this.getNextDEdge(n.first,1).twin)){const t=d(g,3);t[0]=this.calculateCircleCenter(n.first),t[1]=this.getPointXY(this.getPointFromEdge(n.first)).add(this.getPointXY(this.getPointFromEdge(n.second))).mul(.5),t[2]=this.calculateCircleCenter(n.second);const i=X();i.points[0]=n.first.p,i.points[1]=n.second.p;for(let n=0;n<t.length-1;n++){for(let e=0;e<2;e++)i.p[e]=t[n+e];i.p[0].equals(i.p[1])||e.push(i)}}else{const t=X();t.p[0]=this.calculateCircleCenter(n.first),t.p[1]=this.calculateCircleCenter(n.second),t.points[0]=n.first.p,t.points[1]=n.second.p,t.p[0].equals(t.p[1])||e.push(t)}}return e}startDelaunayTriangles(){return-1}nextDelaunayTriangle(t,e){for(;;){if(++e[0],e[0]===this.m_edges.length)return!1;const i=this.m_edges[e[0]];if(t.p[0]=this.getPointFromEdge(i),this.isInfinitePointFromPoint(t.p[0]))continue;const n=this.getTwinEdge(i);if(t.p[1]=this.getPointFromEdge(n),this.isInfinitePointFromPoint(t.p[1]))continue;if(this.getPointXY(t.p[1]).lt(this.getPointXY(t.p[0])))continue;const s=this.getTwinEdge(this.getNextDEdge(i,1));if(t.p[2]=this.getPointFromEdge(s),!this.isInfinitePointFromPoint(t.p[2])&&!this.getPointXY(t.p[2]).lt(this.getPointXY(t.p[0])))return!0}}getPointCount(){return this.m_points.length-1}getPoint(t){return this.m_points[t+1]}getInfinitePoint(){return this.m_pointZero}isInfinitePointFromPoint(t){return t===this.m_pointZero}getPointXY(t){return t.p}getPointIndex(t){return t.userData}setPointIndex(t,e){t.userData=e}getEdgeFromPoint(t){return t.edge}isInfinitePointFromEdge(t){return t.p===this.m_pointZero}getEdgeCount(){return this.m_edges.length}getEdge(t){return this.m_edges[t]}getEdgeIndex(t){return t.getIndex()}getPointFromEdge(t){return t.p}getPointXYFromEdge(t){return t.p.p}getCounterClockwiseEdge(t){return t.a[0]}getClockwiseEdge(t){return t.a[1]}getTwinEdge(t){return t.twin}getPreviousEdge(t){return this.getTwinEdge(this.getCounterClockwiseEdge(t))}getNextEdge(t){return this.getClockwiseEdge(this.getTwinEdge(t))}getNextDEdge(t,e=1){return t.a[e]}newPairEdge(){const t=y(this.m_nextFreePairEdge.first,this.m_nextFreePairEdge.second);return this.m_nextFreePairEdge.first=this.m_nextFreePairEdge.first.nextFreeEdge(),this.m_nextFreePairEdge.second=this.m_nextFreePairEdge.second.nextFreeEdge(),t.first.twin=t.second,t.second.twin=t.first,t}newPairEdgeEx(t,e){let i;if(e&&null!==this.m_nextFreePairEdge.first)i=y(this.m_nextFreePairEdge.first,this.m_nextFreePairEdge.second),this.m_nextFreePairEdge.first=this.m_nextFreePairEdge.first.nextFreeEdge(),this.m_nextFreePairEdge.second=this.m_nextFreePairEdge.second.nextFreeEdge();else{const e=t[0]++,n=t[0]++;i=y(this.m_edges[e],this.m_edges[n])}return i.first.twin=i.second,i.second.twin=i.first,i}insertEdge(t,e,i){e.p=t.p;const n=t.a[i],s=e.a;s[i]=n,s[1-i]=t,t.a[i]=e,n.a[1-i]=e}insertPoint(t,e){const i=this.m_points[t],n=this.newPairEdgeEx(e,!1),s=n.first,o=n.second;i.edge=n.first,s.p=this.m_points[t],s.a[0]=n.first,s.a[1]=n.first,o.p=this.m_pointZero,o.a[0]=n.second,o.a[1]=n.second,null===this.m_points[0].edge&&(this.m_points[0].edge=n.second)}deleteTwinEdges(t,e){this.deleteEdge(t.first),this.deleteEdge(t.second),e&&(t.first.twin=this.m_nextFreePairEdge.first,t.second.twin=this.m_nextFreePairEdge.second,this.m_nextFreePairEdge=t)}join(t,e,i,n,s){this.insertEdge(t,s.first,i),this.insertEdge(e,s.second,n)}joinEdges2(t,e){t.a[1]=e,e.a[0]=t}checkEdge(t,e,i,n,s){for(;;){const o=y(null,null);if(o.first=this.getNextDEdge(t.first,n),o.second=o.first.twin,this.isInfinitePointFromEdge(o.second))return t;const r=this.getPointXYFromEdge(t.second),h=this.getPointXYFromEdge(o.second);if(this.inCircle(e,i,r,h)<=0)return t;if(this.deleteTwinEdges(t,s),!s){const e=this.getNextDEdge(t.second,n).twin;this.join(o.second,e,n,n,t)}t=o}}calculateCircleCenter(t,e=Number.MAX_VALUE){const i=this.getPointXYFromEdge(t),n=this.getPointXYFromEdge(t.twin),s=this.getNextDEdge(t,0);if(this.isInfinitePointFromEdge(s.twin)){const t=new g;if(Number.isNaN(e))t.setNAN();else{const s=n.sub(i);s.leftPerpendicularThis(),t.assign(s),t.divThis(Math.max(Math.abs(t.x),Math.abs(t.y))),t.normalize(),t.mulThis(e)}return t}const o=this.getPointXYFromEdge(s.twin);return this.calculateCircleCenterFromThreePoints(i,n,o)}createZeroHandle(){return this.m_points[0]}deleteEdge(t){const e=t,i=e.p;i.edge===t&&(i.edge=e.a[0]),e.a[0].a[1]=e.a[1],e.a[1].a[0]=e.a[0]}testEdge(t){if(this.isInfinitePointFromEdge(t))return!0;const e=t.twin;if(this.isInfinitePointFromEdge(e))return!0;const i=this.getNextDEdge(t,0).twin,n=this.getNextDEdge(e,0).twin;if(this.isInfinitePointFromEdge(i)||this.isInfinitePointFromEdge(n))return!0;const s=this.getPointXYFromEdge(t),o=this.getPointXYFromEdge(e),r=this.getPointXYFromEdge(i),h=this.getPointXYFromEdge(n);return!(this.orientation(s,o,r)<=0)&&(!(0<=this.orientation(s,o,h))&&this.inCircle(s,o,r,h)<=0)}findMaxSide(t,e){const i=[this.m_points[t].p.clone(),this.m_points[t].p.clone()];for(t++;t!==e;t++){const e=this.m_points[t].p;e.x<i[0].x&&(i[0].x=e.x),i[1].x<e.x&&(i[1].x=e.x),e.y<i[0].y&&(i[0].y=e.y),i[1].y<e.y&&(i[1].y=e.y)}return i[1].x-i[0].x<i[1].y-i[0].y?1:0}findEdge(t,e,i){let n=!1,s=0;for(;;){const o=y(null,null);if(o.second=this.getNextDEdge(t[s].second,i^s),o.first=o.second.twin,0===i&&this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(o.first))<0||1===i&&0<this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(o.first)))t[s]=o,e[s]=!0,n=!1;else{if(n)return;s^=1,n=!0}}}findEdgeSide(t,e,i,n){for(;;){const s=y(null,null);if(s.second=this.getNextDEdge(t[i].second,n^i),s.first=s.second.twin,!(0===n&&this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(s.first))<0||1===n&&0<this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(s.first))))return;t[i]=s,e[i]=!0}}merge(t,e,i,n,s){const o={...t},r={...n},h={...s};let d={...e},g={...i};const a=d.second,c=g.second;for(;;){if(this.join(d.first,g.first,0,1,h),d.first=this.getNextDEdge(h.first,0),g.first=this.getNextDEdge(h.second,1),d.first===o.first&&g.first===r.first){this.joinEdges2(a,c),this.joinEdges2(r.second,o.second);break}d.second=d.first.twin,g.second=g.first.twin;const t=this.getPointXYFromEdge(h.first),e=this.getPointXYFromEdge(h.second);if(d.first===o.first){let i=y(null,null);i.first=this.getNextDEdge(g.first,1),i.second=i.first.twin,i=this.checkEdge(i,t,e,1,!1),b(d,h),b(h,g),g=y(i.second,i.first)}else if(g.first===r.first){let i=y(null,null);i.first=this.getNextDEdge(d.first,0),i.second=i.first.twin,i=this.checkEdge(i,t,e,0,!1),g=y(h.second,h.first),b(h,d),d=y(i.second,i.first)}else{let i=y(null,null);i.first=this.getNextDEdge(d.first,0),i.second=i.first.twin,i=this.checkEdge(i,t,e,0,!1);let n=y(null,null);n.first=this.getNextDEdge(g.first,1),n.second=n.first.twin,n=this.checkEdge(n,t,e,1,!1);const s=this.getPointXYFromEdge(i.second),o=this.getPointXYFromEdge(n.second);let r=this.inCircle(t,e,s,o);0===r&&(r=this.orientation(t,e,o)),0<r?(b(d,h),b(h,g),g=y(n.second,n.first)):(g=y(h.second,h.first),b(h,d),d=y(i.second,i.first))}this.deleteTwinEdges(h,!1)}}findEdgeClockwise(t,e,i,n,s,o){for(t[0]=n;;){e[0]=t[0],++e[0]===i.length&&(e[0]=0);const n=this.orientation(s,o,this.getPointXYFromEdge(i[e[0]]));if(n<=0)return n<0;t[0]=e[0]}}findEdgeCounterClockwise(t,e,i,n,s,o){for(e[0]=n;;){t[0]=0!==e[0]?e[0]:i.length,t[0]--;const n=this.orientation(s,o,this.getPointXYFromEdge(i[t[0]]));if(0<=n)return 0<n;e[0]=t[0]}}constraintFindFirstEdge(t,e,i,n){const s=[];{const o=this.getEdgeFromPoint(i);let r=o;do{const i=this.getTwinEdge(r);if(this.getPointFromEdge(i)===n)return t[0]=i,e[0]=r,t[0].setMask(),e[0].setMask(),!1;s.push(i),r=this.getClockwiseEdge(r)}while(r!==o)}s.length<3&&r("add_constraint");let o=-1;for(let c=0,l=s.length;c<l;c++)this.isInfinitePointFromEdge(s[c])&&(-1!==o&&r("add_constraint"),o=c);const h=this.getPointXY(i),d=this.getPointXY(n);let g,a;if(-1!==o){x(s,0,o+1,s.length),s.pop();0===this.orientation(h,d,this.getPointXYFromEdge(s[0]))&&r("add_constraint - point on constraint");for(0===this.orientation(h,d,this.getPointXYFromEdge(s.at(-1)))&&r("add_constraint - point on constraint"),g=0,a=s.length-1;g+1!==a;){const t=g+a>>1,e=this.orientation(h,d,this.getPointXYFromEdge(s[t]));0===e&&r("add_constraint - point on constraint"),0<e?g=t:a=t}}else{let t=0,e=this.orientation(h,d,this.getPointXYFromEdge(s[t]));if(0!==e)if(0<e){const e=[0],i=[0];this.findEdgeClockwise(e,i,s,t,h,d)||r("add_constraint"),g=e[0],a=i[0]}else{const e=[0],i=[0];this.findEdgeCounterClockwise(e,i,s,t,h,d)||r("add_constraint"),g=e[0],a=i[0]}else{t++,e=this.orientation(h,d,this.getPointXYFromEdge(s[t])),e<=0&&r("add_constraint");const i=[0],n=[0];this.findEdgeClockwise(i,n,s,t,h,d)||r("add_constraint"),g=i[0],a=n[0]}}return t[0]=s[g],e[0]=s[a],!0}triangulateConstraint(t,e,i,n){if(e===i)return;let s=i;for(let o=e;o!==i;++o)this.inCircle(this.getPointXYFromEdge(n.first),this.getPointXYFromEdge(n.second),this.getPointXYFromEdge(t[s]),this.getPointXYFromEdge(t[o]))<0&&(s=o);if(s!==i){const e=this.newPairEdge();this.join(n.first,t[s],1,1,e),t[s]=e.second,this.triangulateConstraint(t,s+1,i,e)}if(s!==e){const i=this.newPairEdge();this.join(t[s],n.second,1,0,i),this.triangulateConstraint(t,e,s-1,i)}}insideLine(t,e,i){return 0===this.orientation(t,e,i)&&(e.x<t.x!=e.x<i.x||e.y<t.y!=e.y<i.y)}orientation(t,e,i){return g.orientationRobust(t,e,i)}inCircle(t,e,i,n){return g.inCircleRobust(t,e,i,n)}calculateCircleCenterFromThreePoints(t,e,i){return e.lt(t)&&(e=u(t,t=e)),i.lt(e)&&(i=u(e,e=i)),e.lt(t)&&(e=u(t,t=e)),g.calculateCircleCenterFromThreePoints(t,e,i)}compare(t,e){return 3*((j(t[0]<e[0])<<1)+j(t[0]>e[0]))+(j(t[1]<e[1])<<1)+j(t[1]>e[1])-1}caseFromCompare(t,e,i){return(this.compare(t,e)<<6)+(this.compare(t,i)<<3)+this.compare(e,i)}}function j(t){return t?1:0}function A(t,e,i){return t[i]!==e[i]?t[i]<e[i]:t[1-i]<e[1-i]}function v(t){return 255&t}N.c_aTableDelaunayTriangulationSolution=Uint8Array.from([41,74,0,0,0,0,0,0,0,206,0,0,0,0,0,0,0,0,0,0,65,0,0,0,0,0,33,33,65,0,0,0,0,0,0,0,193,0,0,0,0,0,0,0,0,0,0,214,0,0,0,0,0,86,54,86,0,0,0,0,0,0,0,214,173,0,0,0,0,0,0,0,107,239,0,0,0,0,0,0,0,0,0,181,0,0,0,0,0,0,0,181,0,0,0,0,0,0,117,117,245,0,0,0,0,0,0,0,0,0,103,0,0,0,0,0,0,0,167,0,0,0,0,0,0,231,103,231,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,198,0,0,41,0,0,74,0,0,49,0,0,49,0,0,50,0,0,194,0,0,193,0,0,194,0,0,0,0,0,206,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,198,0,0,0,0,0,82,50,82,0,0,0,0,0,0,0,198,0,66,0,0,65,0,0,66,49,66,33,57,65,82,50,90,0,194,0,0,193,0,0,194,0,0,0,0,0,0,0,214,0,0,0,0,0,86,54,86,0,0,0,0,0,0,0,222,0,0,0,0,0,0,178,0,0,0,0,0,0,230,102,230,177,0,0,177,0,0,178,0,177,0,0,177,0,0,178,0,113,226,113,113,249,226,122,226,0,0,0,0,0,0,102,0,0,0,0,0,0,0,190,0,0,0,0,0,0,230,102,230,0,0,0,165,0,0,0,0,0,0,0,0,243,0,0,0,0,0,173,0,0,0,0,0,0,0,0,165,0,0,0,0,0,0,0,0,245,0,0,0,0,0,107,0,0,239,0,0,163,0,0,163,0,0,167,0,0,247,0,0,243,0,0,247,0,0,37,37,69,0,0,0,0,0,0,0,211,0,0,0,0,0,0,0,69,0,0,0,0,0,37,37,69,0,0,0,0,0,0,0,221,0,0,0,0,215,0,0,211,0,0,215,35,87,35,35,91,87,63,87,0,215,0,0,211,0,0,215,0,0,0,165,0,0,0,0,0,0,115,115,243,0,0,0,0,0,0,181,0,0,0,0,0,0,0,189,0,0,0,0,0,0,117,117,245,0,0,0,99,0,0,99,0,0,103,0,163,0,0,163,0,0,167,0,99,247,115,123,243,231,103,255]);class M{constructor(t){this.m_numberOfSets=t,this.m_elements=Array.from({length:t},((t,e)=>e)),this.m_sizes=f(t,1)}getNumberOfSets(){return this.m_numberOfSets}connected(t,e){return this.findRoot(t)===this.findRoot(e)}connect(t,e){const i=this.findRoot(t),n=this.findRoot(e);return i!==n&&(this.m_sizes[i]<this.m_sizes[n]?(this.m_sizes[n]+=this.m_sizes[i],this.m_elements[i]=n):(this.m_sizes[i]+=this.m_sizes[n],this.m_elements[n]=i),--this.m_numberOfSets,!0)}connectRange(t,e,i){if(e!==i)for(let n=e;n<i;++n)this.connect(t[e],t[n])}size(){return this.m_elements.length}size1(t){return h(0),0}findRoot(t){let e=t;if(this.m_elements[e]!==e)do{this.m_elements[e]=this.m_elements[this.m_elements[e]],e=this.m_elements[e]}while(this.m_elements[e]!==e);return e}}function S(){return l(Number.NaN,l([0,0,0],[0,0,0]))}function G(t,e){if(t.first!==e.first)return t.first-e.first;let i=t.second.first,n=e.second.first;for(let s=0;s<3;++s)if(i[s]!==n[s])return i[s]-n[s];i=t.second.second,n=e.second.second;for(let s=0;s<3;++s)if(i[s]!==n[s])return i[s]-n[s];return 0}class q{getOperatorType(){return 10112}accelerateGeometry(t,e,i){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!1}executeMany(t,e,i,n){return new z(t,e,i,n)}execute(t,e,i,n=null){const s=new z(null,e,!1,i);s.addGeometry(t);return s.buildAlphaShape(n)}}class z extends t{alphaShapeConstruct(t,e){const i=t.getEdgeCount(),n=new p({vd:this.m_vertexDescription});if(!n)throw new Error("alphaShapeConstruct");for(let s=0;s<i;++s){if(2!==e[s])continue;const i=y(null,null);i.first=t.getEdge(s),i.second=t.getTwinEdge(i.first);if(1!==e[t.getEdgeIndex(i.second)])continue;t.getPointXYFromEdge(i.first),n.startPath(t.getPointXYFromEdge(i.first));let o=s,r=i.second;for(;;){for(e[o]=3,r=t.getCounterClockwiseEdge(r);1===e[t.getEdgeIndex(r)];)r=t.getCounterClockwiseEdge(r);if(r===i.first)break;n.lineTo(t.getPointXYFromEdge(r)),o=t.getEdgeIndex(r),r=t.getTwinEdge(r)}}return n}alphaShape(t,e){const i=t.getEdgeCount(),n=new Uint8Array(i);for(let s=0;s<i;++s){if(0!==n[s])continue;const i=Y(),o=t.getEdge(s);i.p[0]=t.getPointFromEdge(o);const r=t.getClockwiseEdge(t.getTwinEdge(o));i.p[1]=t.getPointFromEdge(r);const h=t.getEdgeIndex(r),a=t.getClockwiseEdge(t.getTwinEdge(r));i.p[2]=t.getPointFromEdge(a);const c=t.getEdgeIndex(a);let l=1;for(let e=0;e<3;++e)if(t.isInfinitePointFromPoint(i.p[e])){l=2;break}if(1===l){const n=d(g,3);for(let e=0;e<3;++e)n[e]=t.getPointXY(i.p[e]);const s=g.sqrDistance(n[0],n[1]),o=g.sqrDistance(n[1],n[2]),r=g.sqrDistance(n[2],n[0]),h=2*n[1].sub(n[0]).crossProduct(n[2].sub(n[0]));e<s*o*r/(h*h)&&(l=2)}n[s]=n[h]=n[c]=l}return this.alphaShapeConstruct(t,n)}alphaShapeAlphaOut(t,e){const i=t.getEdgeCount(),n=new Uint8Array(i),s=[],o=new M(t.getPointCount());for(let h=0;h<i;++h){if(0!==n[h])continue;const e=Y(),i=t.getEdge(h);e.p[0]=t.getPointFromEdge(i);const o=t.getClockwiseEdge(t.getTwinEdge(i));e.p[1]=t.getPointFromEdge(o);const r=t.getEdgeIndex(o),d=t.getClockwiseEdge(t.getTwinEdge(o));e.p[2]=t.getPointFromEdge(d);const a=t.getEdgeIndex(d);let c=1;for(let n=0;n<3;++n)if(t.isInfinitePointFromPoint(e.p[n])){c=2;break}if(1===c){const i=new Array(3);for(let s=0;s<3;++s)i[s]=t.getPointXY(e.p[s]);const n=g.sqrDistance(i[0],i[1]),o=g.sqrDistance(i[1],i[2]),d=g.sqrDistance(i[2],i[0]),l=i[1].sub(i[0]).crossProduct(i[2].sub(i[0])),u=S();u.first=n*o*d/(l*l),u.second.first[0]=h,u.second.first[1]=r,u.second.first[2]=a,u.second.second[0]=t.getPointIndex(e.p[0]),u.second.second[1]=t.getPointIndex(e.p[1]),u.second.second[2]=t.getPointIndex(e.p[2]),s.push(u),c=2}n[h]=n[r]=n[a]=c}s.sort(((t,e)=>G(t,e)));let r=0;for(const h of s){if(1===o.getNumberOfSets()&&h.first!==r)break;n[h.second.first[0]]=n[h.second.first[1]]=n[h.second.first[2]]=1;const t=[h.second.second[0],h.second.second[1],h.second.second[2]];o.connectRange(t,0,3),r=h.first}return e&&(e[0]=.25*r),this.alphaShapeConstruct(t,n)}constructor(t,e,i,n){super(),this.m_multiPointForAttributes=null,this.m_inputGeometryCursor=null,this.m_index=-1,this.m_nDelaunayPoints=0,this.m_cDelaunay=new N,this.m_vertexDescription=null,this.m_progressTracker=n,this.m_alpha=Number.isNaN(e)||!Number.isFinite(e)||e<0?-1:e<Number.MIN_VALUE?0:e,this.m_bMerge=i,this.m_bDone=!1,this.m_inputGeometryCursor=t,this.prepareDelaunay()}prepareDelaunay(){this.m_nDelaunayPoints=0,this.m_cDelaunay.clear(),0!==this.m_alpha&&this.m_cDelaunay.prepare(a())}next(){if(this.m_bMerge){if(!this.m_bDone){const t=this.calculateAlphaShapeMerging(this.m_inputGeometryCursor,this.m_progressTracker);return this.m_bDone=!0,t}return null}if(!this.m_bDone){const t=this.m_inputGeometryCursor.next();if(null!==t)return i(t),n(t),this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.calculateAlphaShape(t,this.m_progressTracker);this.m_bDone=!0}return null}tock(){return!0}getRank(){return 1}getGeometryID(){return this.m_index}calculateAlphaShapeMerging(t,e){let s;for(;s=t.next();)i(s),n(s),this.addGeometry(s);return this.buildAlphaShape()}calculateAlphaShape(t,e){return t.isEmpty()?new p({vd:t.getDescription()}):(this.prepareDelaunay(),this.addGeometry(t),this.buildAlphaShape())}buildAlphaShape(t=null){if(t&&(t[0]=this.m_alpha),0===this.m_alpha)return this.m_vertexDescription?new p({vd:this.m_vertexDescription}):new p;if(this.m_cDelaunay.removeDuplicates())for(let e=0,i=this.m_cDelaunay.getPointCount();e<i;++e)this.m_cDelaunay.setPointIndex(this.m_cDelaunay.getPoint(e),e);if(!this.m_cDelaunay.construct())return this.m_vertexDescription?new p({vd:this.m_vertexDescription}):new p;return this.m_alpha<0?this.alphaShapeAlphaOut(this.m_cDelaunay,t):this.alphaShape(this.m_cDelaunay,this.m_alpha)}addGeometry(t){if(i(t),n(t),0===this.m_alpha)return;if(this.m_vertexDescription&&this.m_bMerge||(this.m_vertexDescription=t.getDescription(),this.m_vertexDescription.getAttributeCount()>1?this.m_multiPointForAttributes=new E({vd:this.m_vertexDescription}):this.m_multiPointForAttributes=null),t.isEmpty())return;const e=t.getGeometryType();if(s(e)){const e=t,i=new g;for(let t=0,n=e.getPointCount();t<n;t++)e.queryXY(t,i),this.m_cDelaunay.addVertex(i,this.m_nDelaunayPoints++);this.m_multiPointForAttributes&&this.m_multiPointForAttributes.addPoints(e,0,-1)}else if(e===o.enumPoint){const e=t,i=e.getXY();this.m_cDelaunay.addVertex(i,this.m_nDelaunayPoints++),this.m_multiPointForAttributes&&this.m_multiPointForAttributes.add(e)}else r("bad geometry type")}}const V=new q;function O(t,e,i){return V.execute(t,e,null,i)}function Z(t,i,n){const s=V.executeMany(new e(t),i,n,null);return Array.from(s)}function R(){return V.supportsCurves()}export{O as execute,Z as executeMany,R as supportsCurves};
|
|
5
|
+
import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{o as i,d as n,i as s,G as o,a as r,g as h}from"../../../chunks/Geometry.js";import{m as d,P as g,i as a,u as c,k as l,c as u,d as f,v as m}from"../../../chunks/Point2D.js";import{a as p,M as E,r as x,e as P}from"../../../chunks/QuadraticBezier.js";function _(t,e,i,n,s,o){const r=n-e;if(r<=o)return P(t,e,i,n,s),i;const h=w(t,e,n,s,Math.min(Math.max(r>>1,3),100)),d=t[h];t[e]=u(t[h],t[h]=t[e]);let g=e+1,a=!1;for(let c=e+1;c!==n;++c)s(t[c],d)&&(t[g]=u(t[c],t[c]=t[g]),++g,a=!0);if(!a)for(let c=e+1;c<i;++c)s(d,t[c])||(c!==g&&(t[g]=u(t[c],t[c]=t[g])),++g);return--g,t[g]=u(t[e],t[e]=t[g]),g}function F(t,e,i){const n=Math.trunc(e/2);let s=BigInt(n);const o=BigInt(e);for(let h=0;h<i;++h)t.push(Number(s%o)),s=6364136223846793005n*s+1442695040888963407n&0x7fffffffffffffffn,s=BigInt.asUintN(64,s);m(t);const r=c(t,((t,e)=>t===e));t.length=r}function w(t,e,i,n,s){const o=[];F(o,i-e,s);const r=[];for(let d=0,g=o.length;d<g;d++){const i=o[d];r.push(l(t[e+i],i))}const h=Math.trunc(r.length/2);return r.sort(((t,e)=>n(t.first,e.first)?-1:1)),e+r[h].second}function k(){return{p:new g,userData:Number.NaN,edge:null}}class T{constructor(){this.info=0,this.mask=!1,this.p=null,this.a=[null,null],this.twin=null}nextFreeEdge(){return this.twin}setIndex(t){this.info=t,this.mask=!1}getIndex(){return this.info}setMask(){this.mask=!0}getMask(){return this.mask}}function y(t,e){return{first:t,second:e}}function C(t,e){t.first=e.first,t.second=e.second}function b(){return this.i1-this.i0}function D(){return{i0:Number.NaN,i1:Number.NaN,nextFreeEdgeIndex:[-1],box:[y(null,null),y(null,null)],size:b}}function I(){return{k:0,pTask:null,pTask0:null,pTask1:null}}function X(){return{p:[new g,new g],points:[null,null]}}function Y(){return{p:[null,null,null]}}class N{constructor(){this.m_nextFreePairEdge=y(null,null),this.m_points=[],this.m_pointZero=null,this.m_edges=[],this.m_voronoiToEdge=[],this.m_nextFreeEdge=0}clear(){this.m_nextFreePairEdge=y(null,null),this.m_points.length=0,this.m_pointZero=null,this.m_edges.length=0,this.m_voronoiToEdge.length=0,this.m_nextFreeEdge=0}reservePoints(t){h(t>1)}prepare(t){{const e=k();e.p.x=Number.POSITIVE_INFINITY,e.p.y=Number.POSITIVE_INFINITY,e.userData=t,this.m_points.push(e)}}addVertex(t,e){const i=k();i.p.assign(t),i.userData=e,i.edge=null,this.m_points.push(i)}removeDuplicates(){const t=this.m_points.shift();this.m_points.sort(((t,e)=>t.p.compareX(e.p)));const e=c(this.m_points,((t,e)=>t.p.equals(e.p))),i=e!==this.m_points.length;return this.m_points.length=e,this.m_points.unshift(t),i}boundVoronoiCells(t,e){const i=this.m_points.length;if(i<2)return!1;const n=[this.m_points[1].p.clone(),this.m_points[1].p.clone()];for(let d=2;d<i;d++){const t=this.m_points[d].p;t.x<n[0].x&&(n[0].x=t.x),n[1].x<t.x&&(n[1].x=t.x),t.y<n[0].y&&(n[0].y=t.y),n[1].y<t.y&&(n[1].y=t.y)}const s=new g;s.x=.5*(n[0].x+n[1].x),s.y=.5*(n[0].y+n[1].y);let o=0;for(let d=1;d<i;d++){const t=this.m_points[d].p,e=g.sqrDistanceCoords(t.x,t.y,s.x,s.y);o<e&&(o=e)}const r=Math.sqrt(o),h=Math.max(r+2*t,1.5*r);{const t=.8660254037844386,i=.5;let n=1,o=0;for(let r=0;r<12;r++){const r=new g;r.x=s.x+h*n,r.y=s.y+h*o,this.addVertex(r,e);const d=n*i+o*t;n=n*t-o*i,o=d}}return!0}construct(){const t=D();return!!this.constructTask(t)&&(this.solveTask(t),!0)}constructTask(t){if(this.m_pointZero=this.createZeroHandle(),h(void 0!==this.m_pointZero),this.m_points.length<3)return!1;const e=6*(this.m_points.length-2);this.m_edges=d(T,e);for(let i=0;i<e;i++)this.m_edges[i].setIndex(i);return t.i0=1,t.i1=this.m_points.length,t.nextFreeEdgeIndex[0]=0,!0}splitTask(t,e,i,n){const s=t,o=e,r=i,h=n;s.k=this.findMaxSide(h.i0,h.i1);let d=h.i0+h.i1>>1;const g=1250;if(0===s.k){d=_(this.m_points,h.i0,d,h.i1,((t,e)=>t.p[0]!==e.p[0]?t.p[0]<e.p[0]:t.p[1]<e.p[1]),g)}else{d=_(this.m_points,h.i0,d,h.i1,((t,e)=>t.p[1]!==e.p[1]?t.p[1]<e.p[1]:t.p[0]<e.p[0]),g)}o.i0=h.i0,o.i1=d,o.nextFreeEdgeIndex[0]=h.nextFreeEdgeIndex[0],h.nextFreeEdgeIndex[0]+=6*(o.i1-o.i0-1)+2,r.i0=d,r.i1=h.i1,r.nextFreeEdgeIndex[0]=h.nextFreeEdgeIndex[0],h.nextFreeEdgeIndex[0]+=6*(r.i1-r.i0-1)+2,s.pTask=h,s.pTask0=o,s.pTask1=r}solveMergeTask(t){const e=this.newPairEdgeEx(t.pTask.nextFreeEdgeIndex,!1);if(t.pTask.box[t.k]=y(t.pTask0.box[t.k].first,t.pTask1.box[t.k].second),t.pTask.box[1-t.k]=y(A(this.getPointXYFromEdge(t.pTask0.box[1-t.k].first),this.getPointXYFromEdge(t.pTask1.box[1-t.k].first),1-t.k)?t.pTask0.box[1-t.k].first:t.pTask1.box[1-t.k].first,A(this.getPointXYFromEdge(t.pTask0.box[1-t.k].second),this.getPointXYFromEdge(t.pTask1.box[1-t.k].second),1-t.k)?t.pTask1.box[1-t.k].second:t.pTask0.box[1-t.k].second),t.pTask.i0+2===t.pTask.i1){const i=t.pTask0.box[t.k].second,n=i.twin,s=t.pTask1.box[t.k].first,o=s.twin;return this.joinEdges2(n,o),this.joinEdges2(o,n),void this.join(i,s,0,1,e)}const i=[new Array(2),new Array(2)];i[0][0]=i[1][0]=y(t.pTask0.box[t.k].second,t.pTask0.box[t.k].second.twin),i[0][1]=i[1][1]=y(t.pTask1.box[t.k].first,t.pTask1.box[t.k].first.twin);const n=[!1,!1];if(t.pTask0.i0+1===t.pTask0.i1?(this.findEdgeSide(i[0],n,1,0),this.findEdgeSide(i[1],n,1,1)):(this.findEdge(i[0],n,0),this.findEdge(i[1],n,1)),n[0]||n[1]){if(n[0]){const e=this.newPairEdgeEx(t.pTask0.nextFreeEdgeIndex,!1);this.insertEdge(i[0][0].first,e.first,0),this.insertEdge(i[0][0].second,e.second,1)}if(n[1]){const e=this.newPairEdgeEx(t.pTask1.nextFreeEdgeIndex,!1);this.insertEdge(i[0][1].first,e.first,1),this.insertEdge(i[0][1].second,e.second,0)}}else this.getNextDEdge(i[0][0].first,0)!==i[0][0].first&&(i[1][0]=this.newPairEdgeEx(t.pTask0.nextFreeEdgeIndex,!1),this.insertEdge(i[0][0].first,i[1][0].first,0),this.insertEdge(i[0][0].second,i[1][0].second,1)),this.getNextDEdge(i[0][1].first,0)!==i[0][1].first&&(i[1][1]=this.newPairEdgeEx(t.pTask1.nextFreeEdgeIndex,!1),this.insertEdge(i[0][1].first,i[1][1].first,1),this.insertEdge(i[0][1].second,i[1][1].second,0));this.merge(i[1][0],i[0][0],i[0][1],i[1][1],e)}solveTask(t){const e=t;switch(e.i1-e.i0){case 1:{this.insertPoint(e.i0,e.nextFreeEdgeIndex);const t=this.m_points[e.i0].edge;e.box[0]=e.box[1]=l(t,t)}break;case 2:{const t=e.i0,i=t+1;this.insertPoint(t,e.nextFreeEdgeIndex),this.insertPoint(i,e.nextFreeEdgeIndex);const n=this.m_points[t],s=this.m_points[i],o=n.edge,r=s.edge,h=o.twin,d=r.twin;this.joinEdges2(h,d),this.joinEdges2(d,h);const g=this.newPairEdgeEx(e.nextFreeEdgeIndex,!1);this.join(o,r,0,1,g);for(let a=0;a<2;a++)e.box[a]=A(this.getPointXY(n),this.getPointXY(s),a)?y(o,r):y(r,o)}break;case 3:{const t=[e.i0,e.i0+1,e.i0+2];this.insertPoint(t[0],e.nextFreeEdgeIndex),this.insertPoint(t[1],e.nextFreeEdgeIndex),this.insertPoint(t[2],e.nextFreeEdgeIndex);const i=[this.m_points[t[0]],this.m_points[t[1]],this.m_points[t[2]]],n=this.caseFromCompare(i[0].p,i[1].p,i[2].p),s=[i[0].edge,i[1].edge,i[2].edge],o=N.c_aTableDelaunayTriangulationSolution[n],r=v(19*v(1+(7&o))),h=v(19*v(1+(o>>5)));let d=v(o<<3)>>6;const g=3&r,a=r>>6,c=3&h,l=h>>6;e.box[0]=y(s[g],s[a]),e.box[1]=y(s[c],s[l]);const f=[s[0].twin,s[1].twin,s[2].twin],m=[this.newPairEdgeEx(e.nextFreeEdgeIndex,!1),this.newPairEdgeEx(e.nextFreeEdgeIndex,!1),this.newPairEdgeEx(e.nextFreeEdgeIndex,!1)];switch(3===d&&(d=this.orientation(i[0].p,i[1].p,i[2].p)+1),d){case 0:this.joinEdges2(f[0],f[2]),this.joinEdges2(f[2],f[1]),this.joinEdges2(f[1],f[0]),this.join(s[0],s[2],0,1,m[0]),this.join(s[2],s[1],0,1,m[1]),this.join(s[1],s[0],0,1,m[2]);break;case 1:{const t=[0,1,2];t[3-(g+a)]=u(t[1],t[1]=t[3-(g+a)]),this.joinEdges2(f[t[0]],f[t[1]]),this.joinEdges2(f[t[1]],f[t[2]]),this.joinEdges2(f[t[2]],f[t[0]]),this.join(s[t[0]],s[t[1]],0,1,m[0]),this.join(s[t[1]],s[t[2]],0,1,m[1]),this.join(m[1].first,f[t[2]],0,1,m[2])}break;case 2:this.joinEdges2(f[0],f[1]),this.joinEdges2(f[1],f[2]),this.joinEdges2(f[2],f[0]),this.join(s[0],s[1],0,1,m[0]),this.join(s[1],s[2],0,1,m[1]),this.join(s[2],s[0],0,1,m[2])}}break;default:{const e=I(),i=D(),n=D();this.splitTask(e,i,n,t),this.solveTask(i),this.solveTask(n),this.solveMergeTask(e)}}}getOutsideHull(){const t=[],e=this.m_points[0].edge;let i=e;do{t.push(this.getPointFromEdge(this.getTwinEdge(i))),i=this.getNextDEdge(i,0)}while(i!==e);return t}getConvexHull(){const t=[],e=this.m_points[0].edge;let i=e;do{const e=this.getPointFromEdge(this.getTwinEdge(i));t.length<2||!this.insideLine(this.getPointXY(t.at(-2)),this.getPointXY(t.at(-1)),this.getPointXY(e))?t.push(e):t[t.length-1]=e,i=this.getNextDEdge(i,0)}while(i!==e);return 2<t.length&&this.insideLine(this.getPointXY(t[0]),this.getPointXY(t.at(-1)),this.getPointXY(t.at(-2)))&&t.pop(),2<t.length&&this.insideLine(this.getPointXY(t[1]),this.getPointXY(t[0]),this.getPointXY(t.at(-1)))&&(t[0]=t.at(-1),t.pop()),t}getVoronoiPolygon(t,e){t.length=0;const i=this.getEdgeFromPoint(e);let n=i;for(;;){const e=this.calculateCircleCenter(n);t.push(e);const s=this.getNextDEdge(n,1);if(s===i)break;n=s}}getNearestPoint(t){this.isInfinitePointFromPoint(t)&&r("Not supported for the infinite point");const e=this.getPointXY(t);let i=this.m_pointZero,n=Number.MAX_VALUE;const s=this.getEdgeFromPoint(t);let o=s;do{const t=this.getPointFromEdge(this.getTwinEdge(o));if(!this.isInfinitePointFromPoint(t)){const s=g.sqrDistance(e,this.getPointXY(t));s<n&&(i=t,n=s)}o=this.getCounterClockwiseEdge(o)}while(o!==s);return i}addConstraint(t,e){const i=[null],n=[null];if(!this.constraintFindFirstEdge(i,n,t,e))return y(n[0],i[0]);i[0]=this.getTwinEdge(i[0]);const s=this.getPointXY(t),o=this.getPointXY(e),h=[new Array(0),new Array(0)],d=i[0];for(;;){const t=this.getClockwiseEdge(n[0]);t.getMask()&&r("add_constraint");const d=y(t,this.getTwinEdge(t));this.deleteTwinEdges(d,!0);const g=this.getCounterClockwiseEdge(this.getTwinEdge(i[0])),a=this.getTwinEdge(this.getClockwiseEdge(n[0])),c=this.getPointFromEdge(a);if(c===e){h[0].push(i[0]),i[0]=g,h[1].push(n[0]),n[0]=a;break}const l=this.orientation(s,o,this.getPointXY(c));0===l&&r("add_constraint - point on constraint"),0<l?(h[0].push(i[0]),i[0]=g):(h[1].push(n[0]),n[0]=a)}h[0].push(i[0]),h[1].push(n[0]);const g=this.newPairEdge();g.first.setMask(),g.second.setMask(),this.join(n[0],d,1,1,g),this.triangulateConstraint(h[0],1,h[0].length-1,g),h[1].reverse();const a=y(g.second,g.first);return this.triangulateConstraint(h[1],1,h[1].length-1,a),a}verify(){for(let t=0,e=this.m_edges.length;t<e;t++){const e=this.m_edges[t];if(!e.getMask()&&!this.testEdge(e))return!1}return!0}getDelaunayTriangleCount(){return this.m_points.length-2<<1}getVoronoiSegments(t=Number.MAX_VALUE){const e=[];for(let i=0,n=this.m_edges.length;i<n;i+=2){const n=y(null,null);if(n.first=this.m_edges[i],n.second=n.first.twin,this.isInfinitePointFromEdge(n.first)&&(n.second=u(n.first,n.first=n.second)),this.isInfinitePointFromEdge(n.second)){const i=d(g,3);i[0]=this.calculateCircleCenter(this.getNextDEdge(n.first,0).twin,1),i[2]=this.calculateCircleCenter(this.getNextDEdge(n.first,1),1);const s=d(g,2);s[0].assign(i[0]),s[1].assign(i[2]),s[0].rightPerpendicularThis(),s[1].leftPerpendicularThis(),i[1]=i[0].add(s[0]).add(i[2].add(s[1])),i[1].normalize();for(const e of i)e.mulThis(t);const o=X();o.points[0]=n.first.p,o.points[1]=n.second.p;for(let t=0;t<i.length-1;t++){for(let e=0;e<2;e++)o.p[e]=i[t+e];o.p[0].equals(o.p[1])||e.push(o)}}else if(this.isInfinitePointFromEdge(this.getNextDEdge(n.first,0).twin)&&this.isInfinitePointFromEdge(this.getNextDEdge(n.first,1).twin)){const t=d(g,3);t[0]=this.calculateCircleCenter(n.first),t[1]=this.getPointXY(this.getPointFromEdge(n.first)).add(this.getPointXY(this.getPointFromEdge(n.second))).mul(.5),t[2]=this.calculateCircleCenter(n.second);const i=X();i.points[0]=n.first.p,i.points[1]=n.second.p;for(let n=0;n<t.length-1;n++){for(let e=0;e<2;e++)i.p[e]=t[n+e];i.p[0].equals(i.p[1])||e.push(i)}}else{const t=X();t.p[0]=this.calculateCircleCenter(n.first),t.p[1]=this.calculateCircleCenter(n.second),t.points[0]=n.first.p,t.points[1]=n.second.p,t.p[0].equals(t.p[1])||e.push(t)}}return e}startDelaunayTriangles(){return-1}nextDelaunayTriangle(t,e){for(;;){if(++e[0],e[0]===this.m_edges.length)return!1;const i=this.m_edges[e[0]];if(t.p[0]=this.getPointFromEdge(i),this.isInfinitePointFromPoint(t.p[0]))continue;const n=this.getTwinEdge(i);if(t.p[1]=this.getPointFromEdge(n),this.isInfinitePointFromPoint(t.p[1]))continue;if(this.getPointXY(t.p[1]).lt(this.getPointXY(t.p[0])))continue;const s=this.getTwinEdge(this.getNextDEdge(i,1));if(t.p[2]=this.getPointFromEdge(s),!this.isInfinitePointFromPoint(t.p[2])&&!this.getPointXY(t.p[2]).lt(this.getPointXY(t.p[0])))return!0}}getPointCount(){return this.m_points.length-1}getPoint(t){return this.m_points[t+1]}getInfinitePoint(){return this.m_pointZero}isInfinitePointFromPoint(t){return t===this.m_pointZero}getPointXY(t){return t.p}getPointIndex(t){return t.userData}setPointIndex(t,e){t.userData=e}getEdgeFromPoint(t){return t.edge}isInfinitePointFromEdge(t){return t.p===this.m_pointZero}getEdgeCount(){return this.m_edges.length}getEdge(t){return this.m_edges[t]}getEdgeIndex(t){return t.getIndex()}getPointFromEdge(t){return t.p}getPointXYFromEdge(t){return t.p.p}getCounterClockwiseEdge(t){return t.a[0]}getClockwiseEdge(t){return t.a[1]}getTwinEdge(t){return t.twin}getPreviousEdge(t){return this.getTwinEdge(this.getCounterClockwiseEdge(t))}getNextEdge(t){return this.getClockwiseEdge(this.getTwinEdge(t))}getNextDEdge(t,e=1){return t.a[e]}newPairEdge(){const t=y(this.m_nextFreePairEdge.first,this.m_nextFreePairEdge.second);return this.m_nextFreePairEdge.first=this.m_nextFreePairEdge.first.nextFreeEdge(),this.m_nextFreePairEdge.second=this.m_nextFreePairEdge.second.nextFreeEdge(),t.first.twin=t.second,t.second.twin=t.first,t}newPairEdgeEx(t,e){let i;if(e&&null!==this.m_nextFreePairEdge.first)i=y(this.m_nextFreePairEdge.first,this.m_nextFreePairEdge.second),this.m_nextFreePairEdge.first=this.m_nextFreePairEdge.first.nextFreeEdge(),this.m_nextFreePairEdge.second=this.m_nextFreePairEdge.second.nextFreeEdge();else{const e=t[0]++,n=t[0]++;i=y(this.m_edges[e],this.m_edges[n])}return i.first.twin=i.second,i.second.twin=i.first,i}insertEdge(t,e,i){e.p=t.p;const n=t.a[i],s=e.a;s[i]=n,s[1-i]=t,t.a[i]=e,n.a[1-i]=e}insertPoint(t,e){const i=this.m_points[t],n=this.newPairEdgeEx(e,!1),s=n.first,o=n.second;i.edge=n.first,s.p=this.m_points[t],s.a[0]=n.first,s.a[1]=n.first,o.p=this.m_pointZero,o.a[0]=n.second,o.a[1]=n.second,null===this.m_points[0].edge&&(this.m_points[0].edge=n.second)}deleteTwinEdges(t,e){this.deleteEdge(t.first),this.deleteEdge(t.second),e&&(t.first.twin=this.m_nextFreePairEdge.first,t.second.twin=this.m_nextFreePairEdge.second,this.m_nextFreePairEdge=t)}join(t,e,i,n,s){this.insertEdge(t,s.first,i),this.insertEdge(e,s.second,n)}joinEdges2(t,e){t.a[1]=e,e.a[0]=t}checkEdge(t,e,i,n,s){for(;;){const o=y(null,null);if(o.first=this.getNextDEdge(t.first,n),o.second=o.first.twin,this.isInfinitePointFromEdge(o.second))return t;const r=this.getPointXYFromEdge(t.second),h=this.getPointXYFromEdge(o.second);if(this.inCircle(e,i,r,h)<=0)return t;if(this.deleteTwinEdges(t,s),!s){const e=this.getNextDEdge(t.second,n).twin;this.join(o.second,e,n,n,t)}t=o}}calculateCircleCenter(t,e=Number.MAX_VALUE){const i=this.getPointXYFromEdge(t),n=this.getPointXYFromEdge(t.twin),s=this.getNextDEdge(t,0);if(this.isInfinitePointFromEdge(s.twin)){const t=new g;if(Number.isNaN(e))t.setNAN();else{const s=n.sub(i);s.leftPerpendicularThis(),t.assign(s),t.divThis(Math.max(Math.abs(t.x),Math.abs(t.y))),t.normalize(),t.mulThis(e)}return t}const o=this.getPointXYFromEdge(s.twin);return this.calculateCircleCenterFromThreePoints(i,n,o)}createZeroHandle(){return this.m_points[0]}deleteEdge(t){const e=t,i=e.p;i.edge===t&&(i.edge=e.a[0]),e.a[0].a[1]=e.a[1],e.a[1].a[0]=e.a[0]}testEdge(t){if(this.isInfinitePointFromEdge(t))return!0;const e=t.twin;if(this.isInfinitePointFromEdge(e))return!0;const i=this.getNextDEdge(t,0).twin,n=this.getNextDEdge(e,0).twin;if(this.isInfinitePointFromEdge(i)||this.isInfinitePointFromEdge(n))return!0;const s=this.getPointXYFromEdge(t),o=this.getPointXYFromEdge(e),r=this.getPointXYFromEdge(i),h=this.getPointXYFromEdge(n);return!(this.orientation(s,o,r)<=0)&&(!(0<=this.orientation(s,o,h))&&this.inCircle(s,o,r,h)<=0)}findMaxSide(t,e){const i=[this.m_points[t].p.clone(),this.m_points[t].p.clone()];for(t++;t!==e;t++){const e=this.m_points[t].p;e.x<i[0].x&&(i[0].x=e.x),i[1].x<e.x&&(i[1].x=e.x),e.y<i[0].y&&(i[0].y=e.y),i[1].y<e.y&&(i[1].y=e.y)}return i[1].x-i[0].x<i[1].y-i[0].y?1:0}findEdge(t,e,i){let n=!1,s=0;for(;;){const o=y(null,null);if(o.second=this.getNextDEdge(t[s].second,i^s),o.first=o.second.twin,0===i&&this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(o.first))<0||1===i&&0<this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(o.first)))t[s]=o,e[s]=!0,n=!1;else{if(n)return;s^=1,n=!0}}}findEdgeSide(t,e,i,n){for(;;){const s=y(null,null);if(s.second=this.getNextDEdge(t[i].second,n^i),s.first=s.second.twin,!(0===n&&this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(s.first))<0||1===n&&0<this.orientation(this.getPointXYFromEdge(t[0].first),this.getPointXYFromEdge(t[1].first),this.getPointXYFromEdge(s.first))))return;t[i]=s,e[i]=!0}}merge(t,e,i,n,s){const o={...t},r={...n},h={...s};let d={...e},g={...i};const a=d.second,c=g.second;for(;;){if(this.join(d.first,g.first,0,1,h),d.first=this.getNextDEdge(h.first,0),g.first=this.getNextDEdge(h.second,1),d.first===o.first&&g.first===r.first){this.joinEdges2(a,c),this.joinEdges2(r.second,o.second);break}d.second=d.first.twin,g.second=g.first.twin;const t=this.getPointXYFromEdge(h.first),e=this.getPointXYFromEdge(h.second);if(d.first===o.first){let i=y(null,null);i.first=this.getNextDEdge(g.first,1),i.second=i.first.twin,i=this.checkEdge(i,t,e,1,!1),C(d,h),C(h,g),g=y(i.second,i.first)}else if(g.first===r.first){let i=y(null,null);i.first=this.getNextDEdge(d.first,0),i.second=i.first.twin,i=this.checkEdge(i,t,e,0,!1),g=y(h.second,h.first),C(h,d),d=y(i.second,i.first)}else{let i=y(null,null);i.first=this.getNextDEdge(d.first,0),i.second=i.first.twin,i=this.checkEdge(i,t,e,0,!1);let n=y(null,null);n.first=this.getNextDEdge(g.first,1),n.second=n.first.twin,n=this.checkEdge(n,t,e,1,!1);const s=this.getPointXYFromEdge(i.second),o=this.getPointXYFromEdge(n.second);let r=this.inCircle(t,e,s,o);0===r&&(r=this.orientation(t,e,o)),0<r?(C(d,h),C(h,g),g=y(n.second,n.first)):(g=y(h.second,h.first),C(h,d),d=y(i.second,i.first))}this.deleteTwinEdges(h,!1)}}findEdgeClockwise(t,e,i,n,s,o){for(t[0]=n;;){e[0]=t[0],++e[0]===i.length&&(e[0]=0);const n=this.orientation(s,o,this.getPointXYFromEdge(i[e[0]]));if(n<=0)return n<0;t[0]=e[0]}}findEdgeCounterClockwise(t,e,i,n,s,o){for(e[0]=n;;){t[0]=0!==e[0]?e[0]:i.length,t[0]--;const n=this.orientation(s,o,this.getPointXYFromEdge(i[t[0]]));if(0<=n)return 0<n;e[0]=t[0]}}constraintFindFirstEdge(t,e,i,n){const s=[];{const o=this.getEdgeFromPoint(i);let r=o;do{const i=this.getTwinEdge(r);if(this.getPointFromEdge(i)===n)return t[0]=i,e[0]=r,t[0].setMask(),e[0].setMask(),!1;s.push(i),r=this.getClockwiseEdge(r)}while(r!==o)}s.length<3&&r("add_constraint");let o=-1;for(let c=0,l=s.length;c<l;c++)this.isInfinitePointFromEdge(s[c])&&(-1!==o&&r("add_constraint"),o=c);const h=this.getPointXY(i),d=this.getPointXY(n);let g,a;if(-1!==o){x(s,0,o+1,s.length),s.pop();0===this.orientation(h,d,this.getPointXYFromEdge(s[0]))&&r("add_constraint - point on constraint");for(0===this.orientation(h,d,this.getPointXYFromEdge(s.at(-1)))&&r("add_constraint - point on constraint"),g=0,a=s.length-1;g+1!==a;){const t=g+a>>1,e=this.orientation(h,d,this.getPointXYFromEdge(s[t]));0===e&&r("add_constraint - point on constraint"),0<e?g=t:a=t}}else{let t=0,e=this.orientation(h,d,this.getPointXYFromEdge(s[t]));if(0!==e)if(0<e){const e=[0],i=[0];this.findEdgeClockwise(e,i,s,t,h,d)||r("add_constraint"),g=e[0],a=i[0]}else{const e=[0],i=[0];this.findEdgeCounterClockwise(e,i,s,t,h,d)||r("add_constraint"),g=e[0],a=i[0]}else{t++,e=this.orientation(h,d,this.getPointXYFromEdge(s[t])),e<=0&&r("add_constraint");const i=[0],n=[0];this.findEdgeClockwise(i,n,s,t,h,d)||r("add_constraint"),g=i[0],a=n[0]}}return t[0]=s[g],e[0]=s[a],!0}triangulateConstraint(t,e,i,n){if(e===i)return;let s=i;for(let o=e;o!==i;++o)this.inCircle(this.getPointXYFromEdge(n.first),this.getPointXYFromEdge(n.second),this.getPointXYFromEdge(t[s]),this.getPointXYFromEdge(t[o]))<0&&(s=o);if(s!==i){const e=this.newPairEdge();this.join(n.first,t[s],1,1,e),t[s]=e.second,this.triangulateConstraint(t,s+1,i,e)}if(s!==e){const i=this.newPairEdge();this.join(t[s],n.second,1,0,i),this.triangulateConstraint(t,e,s-1,i)}}insideLine(t,e,i){return 0===this.orientation(t,e,i)&&(e.x<t.x!=e.x<i.x||e.y<t.y!=e.y<i.y)}orientation(t,e,i){return g.orientationRobust(t,e,i)}inCircle(t,e,i,n){return g.inCircleRobust(t,e,i,n)}calculateCircleCenterFromThreePoints(t,e,i){return e.lt(t)&&(e=u(t,t=e)),i.lt(e)&&(i=u(e,e=i)),e.lt(t)&&(e=u(t,t=e)),g.calculateCircleCenterFromThreePoints(t,e,i)}compare(t,e){return 3*((j(t[0]<e[0])<<1)+j(t[0]>e[0]))+(j(t[1]<e[1])<<1)+j(t[1]>e[1])-1}caseFromCompare(t,e,i){return(this.compare(t,e)<<6)+(this.compare(t,i)<<3)+this.compare(e,i)}}function j(t){return t?1:0}function A(t,e,i){return t[i]!==e[i]?t[i]<e[i]:t[1-i]<e[1-i]}function v(t){return 255&t}N.c_aTableDelaunayTriangulationSolution=Uint8Array.from([41,74,0,0,0,0,0,0,0,206,0,0,0,0,0,0,0,0,0,0,65,0,0,0,0,0,33,33,65,0,0,0,0,0,0,0,193,0,0,0,0,0,0,0,0,0,0,214,0,0,0,0,0,86,54,86,0,0,0,0,0,0,0,214,173,0,0,0,0,0,0,0,107,239,0,0,0,0,0,0,0,0,0,181,0,0,0,0,0,0,0,181,0,0,0,0,0,0,117,117,245,0,0,0,0,0,0,0,0,0,103,0,0,0,0,0,0,0,167,0,0,0,0,0,0,231,103,231,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,198,0,0,41,0,0,74,0,0,49,0,0,49,0,0,50,0,0,194,0,0,193,0,0,194,0,0,0,0,0,206,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,198,0,0,0,0,0,82,50,82,0,0,0,0,0,0,0,198,0,66,0,0,65,0,0,66,49,66,33,57,65,82,50,90,0,194,0,0,193,0,0,194,0,0,0,0,0,0,0,214,0,0,0,0,0,86,54,86,0,0,0,0,0,0,0,222,0,0,0,0,0,0,178,0,0,0,0,0,0,230,102,230,177,0,0,177,0,0,178,0,177,0,0,177,0,0,178,0,113,226,113,113,249,226,122,226,0,0,0,0,0,0,102,0,0,0,0,0,0,0,190,0,0,0,0,0,0,230,102,230,0,0,0,165,0,0,0,0,0,0,0,0,243,0,0,0,0,0,173,0,0,0,0,0,0,0,0,165,0,0,0,0,0,0,0,0,245,0,0,0,0,0,107,0,0,239,0,0,163,0,0,163,0,0,167,0,0,247,0,0,243,0,0,247,0,0,37,37,69,0,0,0,0,0,0,0,211,0,0,0,0,0,0,0,69,0,0,0,0,0,37,37,69,0,0,0,0,0,0,0,221,0,0,0,0,215,0,0,211,0,0,215,35,87,35,35,91,87,63,87,0,215,0,0,211,0,0,215,0,0,0,165,0,0,0,0,0,0,115,115,243,0,0,0,0,0,0,181,0,0,0,0,0,0,0,189,0,0,0,0,0,0,117,117,245,0,0,0,99,0,0,99,0,0,103,0,163,0,0,163,0,0,167,0,99,247,115,123,243,231,103,255]);class M{constructor(t){this.m_numberOfSets=t,this.m_elements=Array.from({length:t},((t,e)=>e)),this.m_sizes=f(t,1)}getNumberOfSets(){return this.m_numberOfSets}connected(t,e){return this.findRoot(t)===this.findRoot(e)}connect(t,e){const i=this.findRoot(t),n=this.findRoot(e);return i!==n&&(this.m_sizes[i]<this.m_sizes[n]?(this.m_sizes[n]+=this.m_sizes[i],this.m_elements[i]=n):(this.m_sizes[i]+=this.m_sizes[n],this.m_elements[n]=i),--this.m_numberOfSets,!0)}connectRange(t,e,i){if(e!==i)for(let n=e;n<i;++n)this.connect(t[e],t[n])}size(){return this.m_elements.length}size1(t){return h(0),0}findRoot(t){let e=t;if(this.m_elements[e]!==e)do{this.m_elements[e]=this.m_elements[this.m_elements[e]],e=this.m_elements[e]}while(this.m_elements[e]!==e);return e}}function S(){return l(Number.NaN,l([0,0,0],[0,0,0]))}function G(t,e){if(t.first!==e.first)return t.first-e.first;let i=t.second.first,n=e.second.first;for(let s=0;s<3;++s)if(i[s]!==n[s])return i[s]-n[s];i=t.second.second,n=e.second.second;for(let s=0;s<3;++s)if(i[s]!==n[s])return i[s]-n[s];return 0}class q{getOperatorType(){return 10112}accelerateGeometry(t,e,i){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!1}executeMany(t,e,i,n){return new z(t,e,i,n)}execute(t,e,i,n=null){const s=new z(null,e,!1,i);s.addGeometry(t);return s.buildAlphaShape(n)}}class z extends t{alphaShapeConstruct(t,e){const i=t.getEdgeCount(),n=new p({vd:this.m_vertexDescription});if(!n)throw new Error("alphaShapeConstruct");for(let s=0;s<i;++s){if(2!==e[s])continue;const i=y(null,null);i.first=t.getEdge(s),i.second=t.getTwinEdge(i.first);if(1!==e[t.getEdgeIndex(i.second)])continue;t.getPointXYFromEdge(i.first),n.startPath(t.getPointXYFromEdge(i.first));let o=s,r=i.second;for(;;){for(e[o]=3,r=t.getCounterClockwiseEdge(r);1===e[t.getEdgeIndex(r)];)r=t.getCounterClockwiseEdge(r);if(r===i.first)break;n.lineTo(t.getPointXYFromEdge(r)),o=t.getEdgeIndex(r),r=t.getTwinEdge(r)}}return n}alphaShape(t,e){const i=t.getEdgeCount(),n=new Uint8Array(i);for(let s=0;s<i;++s){if(0!==n[s])continue;const i=Y(),o=t.getEdge(s);i.p[0]=t.getPointFromEdge(o);const r=t.getClockwiseEdge(t.getTwinEdge(o));i.p[1]=t.getPointFromEdge(r);const h=t.getEdgeIndex(r),a=t.getClockwiseEdge(t.getTwinEdge(r));i.p[2]=t.getPointFromEdge(a);const c=t.getEdgeIndex(a);let l=1;for(let e=0;e<3;++e)if(t.isInfinitePointFromPoint(i.p[e])){l=2;break}if(1===l){const n=d(g,3);for(let e=0;e<3;++e)n[e]=t.getPointXY(i.p[e]);const s=g.sqrDistance(n[0],n[1]),o=g.sqrDistance(n[1],n[2]),r=g.sqrDistance(n[2],n[0]),h=2*n[1].sub(n[0]).crossProduct(n[2].sub(n[0]));e<s*o*r/(h*h)&&(l=2)}n[s]=n[h]=n[c]=l}return this.alphaShapeConstruct(t,n)}alphaShapeAlphaOut(t,e){const i=t.getEdgeCount(),n=new Uint8Array(i),s=[],o=new M(t.getPointCount());for(let h=0;h<i;++h){if(0!==n[h])continue;const e=Y(),i=t.getEdge(h);e.p[0]=t.getPointFromEdge(i);const o=t.getClockwiseEdge(t.getTwinEdge(i));e.p[1]=t.getPointFromEdge(o);const r=t.getEdgeIndex(o),d=t.getClockwiseEdge(t.getTwinEdge(o));e.p[2]=t.getPointFromEdge(d);const a=t.getEdgeIndex(d);let c=1;for(let n=0;n<3;++n)if(t.isInfinitePointFromPoint(e.p[n])){c=2;break}if(1===c){const i=new Array(3);for(let s=0;s<3;++s)i[s]=t.getPointXY(e.p[s]);const n=g.sqrDistance(i[0],i[1]),o=g.sqrDistance(i[1],i[2]),d=g.sqrDistance(i[2],i[0]),l=i[1].sub(i[0]).crossProduct(i[2].sub(i[0])),u=S();u.first=n*o*d/(l*l),u.second.first[0]=h,u.second.first[1]=r,u.second.first[2]=a,u.second.second[0]=t.getPointIndex(e.p[0]),u.second.second[1]=t.getPointIndex(e.p[1]),u.second.second[2]=t.getPointIndex(e.p[2]),s.push(u),c=2}n[h]=n[r]=n[a]=c}s.sort(((t,e)=>G(t,e)));let r=0;for(const h of s){if(1===o.getNumberOfSets()&&h.first!==r)break;n[h.second.first[0]]=n[h.second.first[1]]=n[h.second.first[2]]=1;const t=[h.second.second[0],h.second.second[1],h.second.second[2]];o.connectRange(t,0,3),r=h.first}return e&&(e[0]=.25*r),this.alphaShapeConstruct(t,n)}constructor(t,e,i,n){super(),this.m_multiPointForAttributes=null,this.m_inputGeometryCursor=null,this.m_index=-1,this.m_nDelaunayPoints=0,this.m_cDelaunay=new N,this.m_vertexDescription=null,this.m_progressTracker=n,this.m_alpha=Number.isNaN(e)||!Number.isFinite(e)||e<0?-1:e<Number.MIN_VALUE?0:e,this.m_bMerge=i,this.m_bDone=!1,this.m_inputGeometryCursor=t,this.prepareDelaunay()}prepareDelaunay(){this.m_nDelaunayPoints=0,this.m_cDelaunay.clear(),0!==this.m_alpha&&this.m_cDelaunay.prepare(a())}next(){if(this.m_bMerge){if(!this.m_bDone){const t=this.calculateAlphaShapeMerging(this.m_inputGeometryCursor,this.m_progressTracker);return this.m_bDone=!0,t}return null}if(!this.m_bDone){const t=this.m_inputGeometryCursor.next();if(null!==t)return i(t),n(t),this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.calculateAlphaShape(t,this.m_progressTracker);this.m_bDone=!0}return null}tock(){return!0}getRank(){return 1}getGeometryID(){return this.m_index}calculateAlphaShapeMerging(t,e){let s;for(;s=t.next();)i(s),n(s),this.addGeometry(s);return this.buildAlphaShape()}calculateAlphaShape(t,e){return t.isEmpty()?new p({vd:t.getDescription()}):(this.prepareDelaunay(),this.addGeometry(t),this.buildAlphaShape())}buildAlphaShape(t=null){if(t&&(t[0]=this.m_alpha),0===this.m_alpha)return this.m_vertexDescription?new p({vd:this.m_vertexDescription}):new p;if(this.m_cDelaunay.removeDuplicates())for(let e=0,i=this.m_cDelaunay.getPointCount();e<i;++e)this.m_cDelaunay.setPointIndex(this.m_cDelaunay.getPoint(e),e);if(!this.m_cDelaunay.construct())return this.m_vertexDescription?new p({vd:this.m_vertexDescription}):new p;return this.m_alpha<0?this.alphaShapeAlphaOut(this.m_cDelaunay,t):this.alphaShape(this.m_cDelaunay,this.m_alpha)}addGeometry(t){if(i(t),n(t),0===this.m_alpha)return;if(this.m_vertexDescription&&this.m_bMerge||(this.m_vertexDescription=t.getDescription(),this.m_vertexDescription.getAttributeCount()>1?this.m_multiPointForAttributes=new E({vd:this.m_vertexDescription}):this.m_multiPointForAttributes=null),t.isEmpty())return;const e=t.getGeometryType();if(s(e)){const e=t,i=new g;for(let t=0,n=e.getPointCount();t<n;t++)e.queryXY(t,i),this.m_cDelaunay.addVertex(i,this.m_nDelaunayPoints++);this.m_multiPointForAttributes&&this.m_multiPointForAttributes.addPoints(e,0,-1)}else if(e===o.enumPoint){const e=t,i=e.getXY();this.m_cDelaunay.addVertex(i,this.m_nDelaunayPoints++),this.m_multiPointForAttributes&&this.m_multiPointForAttributes.add(e)}else r("bad geometry type")}}const V=new q;function O(t,e,i){return V.execute(t,e,null,i)}function Z(t,i,n){const s=V.executeMany(new e(t),i,n,null);return Array.from(s)}function R(){return V.supportsCurves()}export{O as execute,Z as executeMany,R as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{E as r,n as s}from"../../../chunks/QuadraticBezier.js";import{G as o,k as n}from"../../../chunks/Geometry.js";import{Envelope2D as m}from"../../../chunks/Envelope2D.js";import{
|
|
5
|
+
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{E as r,n as s}from"../../../chunks/QuadraticBezier.js";import{G as o,k as n}from"../../../chunks/Geometry.js";import{Envelope2D as m}from"../../../chunks/Envelope2D.js";import{c as i}from"../../../chunks/Envelope.js";import{j as u,al as l}from"../../../chunks/ProjectionTransformation.js";class p{getOperatorType(){return 10008}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,r,s){const o=(new u).executeMany(e,r,s);return new c(o,t,r,s)}}class c extends e{constructor(e,t,r,s){super(),this.m_resultPolygons=null,this.m_polygons=e,this.m_polylines=t,this.m_sr=r,this.m_progressTracker=s,this.m_bFirst=!0}tock(){return!0}getRank(){return 1}next(){return this.m_bFirst&&(this.performOperation(),this.m_bFirst=!1),this.m_resultPolygons?this.m_resultPolygons.next():null}getGeometryID(){return null!=this.m_resultPolygons?this.m_resultPolygons.getGeometryID():-1}performOperation(){const e=new m,t=new r;let u,p=s;for(;u=this.m_polylines.next();){if(u.getGeometryType()!==o.enumPolyline||u.isEmpty())continue;p===s?p=t.addGeometry(u):t.appendGeometry(p,u);const r=new m;u.queryEnvelope(r),e.mergeEnvelope2D(r)}if(0===t.getTotalPointCount())return;for(;u=this.m_polygons.next();){if(!n(u.getGeometryType())||u.isEmpty())continue;const r=new m;u.queryEnvelope(r),e.mergeEnvelope2D(r),t.addGeometry(u)}const c=i(this.m_sr,e,!0);this.m_resultPolygons=l(t,p,c,this.m_progressTracker)}}const a=new p;function y(e,r,s){const o=a.execute(new t(e),new t(r),s,null);return Array.from(o)}function h(){return a.supportsCurves()}export{y as execute,h as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{S as e,G as t}from"../../../chunks/SimpleGeometryCursor.js";import{
|
|
5
|
+
import{S as e,G as t}from"../../../chunks/SimpleGeometryCursor.js";import{a as r,c as n,d as s}from"../../../chunks/Geometry.js";import{j as i}from"../../../chunks/ProjectionTransformation.js";import{Envelope2D as u}from"../../../chunks/Envelope2D.js";import{B as o}from"../../../chunks/Bufferer-CicaNej1.js";class m{getOperatorType(){return 10004}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,n,s){return this.executeManyEx(e,t,r,Number.NaN,96,n,s)}execute(t,s,i,u){Number.isFinite(i)||r("Invalid distance for buffer operation");const o=new e([t]),m=[i],a=this.executeMany(o,s,m,!1,u).next();return a||n("null buffer output"),a}executeManyEx(e,t,n,s,u,o,m){if(void 0!==n.find((e=>!Number.isFinite(e)))&&r("Invalid distance for buffer operation"),o){const r=new a(e,t,n,s,u,!1,m);return(new i).executeMany(r,t,m,2)}return new a(e,t,n,s,u,!1,m)}}class a extends t{constructor(e,t,r,n,s,i,m){super(),this.m_currentUnionEnvelope2D=new u,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=m,this.m_bufferer=new o(m),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_distances=r,this.m_maxDeviation=n,this.m_maxVerticesInFullCircle=s}tock(){return!0}getRank(){return 1}next(){{let e;for(;e=this.m_inputGeoms.next();)return s(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.buffer(e,this.m_distances[this.m_dindex]);return null}}getGeometryID(){return this.m_index}buffer(e,t){return this.m_bufferer.buffer(e,t,this.m_spatialReference,0,0,4,this.m_maxDeviation,this.m_maxVerticesInFullCircle)}}const c=new m;function f(e,t,r){return c.execute(e,t,r,null)}function h(t,r,n,s){const i=c.executeMany(new e(t),r,n,s,null);return Array.from(i)}function l(t,r,n,s,i,u){const o=c.executeManyEx(new e(t),r,n,s,i,u,null);return Array.from(o)}function x(){return c.supportsCurves()}export{f as execute,h as executeMany,l as executeManyEx,x as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{S as n}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import{
|
|
5
|
+
import{S as n}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import{f as r}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/Point2D.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope2D.js";import"../../../chunks/Envelope.js";const o=new r;function e(n,r,e){return o.execute(n,r,e,null)}function t(r,e,t){const s=o.executeMany(new n(r),new n([e]),t,null);return Array.from(s)}function s(){return o.supportsCurves()}export{e as execute,t as executeMany,s as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{d as r}from"../../../chunks/Geometry.js";import{
|
|
5
|
+
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{d as r}from"../../../chunks/Geometry.js";import{j as s}from"../../../chunks/ProjectionTransformation.js";import{Envelope2D as i}from"../../../chunks/Envelope2D.js";import{B as n}from"../../../chunks/Bufferer-CicaNej1.js";class m{getOperatorType(){return 10111}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,i,n,m,u,c,a,h,_){if(a){const a=new o(e,t,r,i,n,m,u,c,_);return(new s).executeMany(a,t,_,2)}return new o(e,t,r,i,n,m,u,c,_)}}class o extends e{constructor(e,t,r,s,m,o,u,c,a){super(),this.m_currentUnionEnvelope2D=new i,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=a,this.m_bufferer=new n(a),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_distances=r,this.m_maxDeviation=u,this.m_maxVerticesInFullCircle=c,this.m_joins=s,this.m_caps=m,this.m_miterLimit=o}tock(){return!0}getRank(){return 1}next(){{let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.buffer(e,this.m_distances[this.m_dindex]);return null}}getGeometryID(){return this.m_index}buffer(e,t){return this.m_bufferer.buffer(e,t,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_maxDeviation,this.m_maxVerticesInFullCircle)}}const u=new m;function c(e,r,s,i,n,m,o,c,a){const h=u.executeMany(new t(e),r,s,i,n,m,o,c,a,0,null);return Array.from(h)}function a(){return u.supportsCurves()}export{c as executeMany,a as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{r as s,G as r,d as i}from"../../../chunks/Geometry.js";import{E as m,n as o}from"../../../chunks/QuadraticBezier.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{
|
|
5
|
+
import{G as e,S as t}from"../../../chunks/SimpleGeometryCursor.js";import{r as s,G as r,d as i}from"../../../chunks/Geometry.js";import{E as m,n as o}from"../../../chunks/QuadraticBezier.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{c as h,P as a}from"../../../chunks/Envelope.js";import{am as _,an as p,ao as u,k as l,s as c,l as y,ap as G,aq as g,C as d,ar as f}from"../../../chunks/ProjectionTransformation.js";class x{getOperatorType(){return 10009}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,r=0){return new T(e,t,s,r)}}class T extends e{constructor(e,t,r,i){super(),this.m_shape=new m,this.m_currentGeom=o,this.m_progressCounter=0,this.m_geomIndex=-1,this.m_geomTypeIndex=-1,this.m_index=-1,this.m_bBuilt=!1,this.m_bOutputOnlyModified=!1,this.m_bSimplifyPolygons=!1,this.m_bSnapToSr=!1,this.m_progressTracker=r,this.m_inputGeometries=e,this.m_sr=t,this.m_options=i,1===i||2===i?(this.m_bOutputOnlyModified=!0,this.m_options=0,this.m_bSimplifyPolygons=!0,this.m_bSnapToSr=null!=t&&2===i,this.m_bSnapToSr&&!_()&&s("PE is required for snapping to spatial reference operation")):0===i&&(this.m_bSimplifyPolygons=!0)}progress_(e=!1){}tock(){return!0}getRank(){return 1}moveToNextGeom(){for(;;){if(this.m_bBuilt?this.m_currentGeom=this.m_shape.getNextGeometry(this.m_currentGeom):(this.m_currentGeom=this.m_shape.getFirstGeometry(),this.m_bBuilt=!0),this.m_currentGeom!==o){let e=!1;if(this.m_bSimplifyPolygons&&this.m_shape.getGeometryType(this.m_currentGeom)===r.enumPolygon&&(e=p(this.m_shape,this.m_currentGeom,-1,!1,o,this.m_progressTracker)),this.m_bOutputOnlyModified&&!e&&!this.m_shape.getGeometryModified(this.m_currentGeom))continue}break}}next(){if(this.m_bBuilt)this.moveToNextGeom();else{this.m_geomIndex=this.m_shape.createGeometryUserIndex();const e=new n;for(let o=this.m_inputGeometries.next();null!=o;o=this.m_inputGeometries.next()){this.progress_(),i(o);let t=!1;this.m_bSnapToSr&&(o=o.clone(),t=u(this.m_sr,o));const s=this.m_shape.addGeometry(o);this.m_shape.setGeometryUserIndex(s,this.m_geomIndex,this.m_inputGeometries.getGeometryID());const m=o.getGeometryType();m===r.enumPoint&&(-1===this.m_geomTypeIndex&&(this.m_geomTypeIndex=this.m_shape.createGeometryUserIndex()),this.m_shape.setGeometryUserIndex(s,this.m_geomTypeIndex,m));const h=new n;o.queryLooseEnvelope(h),e.mergeEnvelope2D(h),t&&this.m_shape.setGeometryModified(s,!0)}const t=h(this.m_sr,e,!0),s=h(this.m_sr,e,!1);e.inflate(10*t.total()),this.m_shape.forceSetEnvelope2D(e);let m=null,a=0,_=0;if(this.m_shape.hasCurves()){m=new d;const s=l(t.total(),e);a=c(t.total()),_=f(s,a),y(this.m_shape,s,t.total(),12e3,m,null,this.m_progressTracker)}if(G(this.m_shape,s,this.m_progressTracker)){if(g(this.m_shape,t.add(_),this.m_progressTracker,0===this.m_options,this.m_bOutputOnlyModified),null!==m){if(this.m_bSimplifyPolygons){for(let e=this.m_shape.getFirstGeometry();e!==o;e=this.m_shape.getNextGeometry(e))if(this.m_shape.getGeometryType(e)===r.enumPolygon){p(this.m_shape,e,-1,!1,o,this.m_progressTracker)&&this.m_shape.setGeometryModified(e,!0)}this.m_bSimplifyPolygons=!1}m.stitchCurves(this.m_shape,o,a,!0),m.clearStitcher(this.m_shape)}}else this.m_bSimplifyPolygons=!1,null!==m&&(m.stitchCurves(this.m_shape,o,a,!0),m.clearStitcher(this.m_shape));this.moveToNextGeom()}if(this.m_currentGeom!==o){if(this.m_index=this.m_shape.getGeometryUserIndex(this.m_currentGeom,this.m_geomIndex),-1!==this.m_geomTypeIndex&&this.m_shape.getGeometryUserIndex(this.m_currentGeom,this.m_geomTypeIndex)===r.enumPoint){const e=new a({vd:this.m_shape.getVertexDescription()});return this.m_shape.queryPointGeometryOnly(this.m_currentGeom,e),this.m_bSnapToSr&&u(this.m_sr,e),e}{const e=this.m_shape.getGeometry(this.m_currentGeom);return this.m_bSnapToSr&&u(this.m_sr,e),e}}return null}getGeometryID(){return this.m_index}}const S=new x;function b(e,s,r){const i=S.executeMany(new t(e),s,null,r);return Array.from(i)}function I(){return S.supportsCurves()}export{b as executeMany,I as supportsCurves};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{S as r}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import{
|
|
5
|
+
import{S as r}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import{g as e}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope.js";const n=new e;function t(r,e){return n.accelerateGeometry(r,e,1)}function o(r,e,t){return n.execute(r,e,t,null)}function u(e,t,o,u){const s=n.executeMany(new r(e),new r([t]),o,null,u);return Array.from(s)}function s(){return n.supportsCurves()}export{t as accelerateGeometry,o as execute,u as executeMany,s as supportsCurves};
|