@itwin/core-geometry 5.3.0-dev.2 → 5.3.0-dev.23
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/CHANGELOG.md +21 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +15 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +36 -9
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +25 -8
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +51 -55
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +2 -5
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js +2 -5
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +50 -15
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +102 -84
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +44 -25
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +74 -39
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +8 -8
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +102 -92
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +10 -6
- package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js +36 -19
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.d.ts +7 -6
- package/lib/cjs/curve/spiral/CubicEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js +29 -14
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +47 -53
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +112 -104
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +143 -117
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +99 -66
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +36 -29
- package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js +62 -40
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +50 -33
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +45 -34
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +56 -38
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts +27 -21
- package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js +23 -18
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +98 -99
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +123 -111
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +137 -143
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +167 -161
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +51 -34
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js +16 -6
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +87 -93
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +41 -38
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +2 -2
- package/lib/cjs/geometry3d/PolylineOps.js +2 -2
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BandedSystem.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js +2 -2
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +15 -7
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +15 -10
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/Voronoi.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +15 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +36 -9
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +25 -8
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +51 -55
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +2 -5
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js +2 -5
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +50 -15
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +102 -84
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +44 -25
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +72 -37
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +8 -8
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +102 -92
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.d.ts +10 -6
- package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js +36 -19
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.d.ts +7 -6
- package/lib/esm/curve/spiral/CubicEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js +29 -14
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +47 -53
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +112 -104
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +143 -117
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +99 -66
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.d.ts +36 -29
- package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js +62 -40
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
- package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js +50 -33
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +45 -34
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +56 -38
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts +27 -21
- package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js +23 -18
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +98 -99
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +124 -112
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +137 -143
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +167 -161
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts +51 -34
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js +14 -5
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +87 -93
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +41 -38
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +2 -2
- package/lib/esm/geometry3d/PolylineOps.js +2 -2
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BandedSystem.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js +2 -2
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +15 -7
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +15 -10
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/Voronoi.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeLengthData.js","sourceRoot":"","sources":["../../../src/polyface/RangeLengthData.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,+CAA8C;AAC9C,qDAAkD;AAElD;;;;;;;;;;;GAWG;AACH,MAAa,eAAe;IAC1B,kEAAkE;IAC3D,KAAK,CAAU;IACtB,MAAM;IACC,KAAK,CAAY;IACjB,KAAK,CAAY;IACjB,KAAK,CAAY;IACxB;QACE,IAAI,CAAC,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;IACO,UAAU,CAAU;IAC5B,2EAA2E;IACpE,+BAA+B,CAAC,MAAwB;QAC7D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;CACF;AAvBD,0CAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { UsageSums } from \"../numerics/UsageSums\";\n\n/**\n * Accumulated data for x,y,z length statistics in ranges.\n * * Usage pattern:\n * * create a enw RangeLengthData:\n * * `myData = new RangeLengthData ();`\n * * announce ranges to be accumulated:\n * * (many times) `myData.accumulateRowableXYZArrayRange (points);\n * * access data in public members:\n * * `myData.range` -- the composite range.\n * * `myData.xLength`, `myData.yLength`, `myData.zLength` -- mean, minMax, count, and standardDeviation of range lengths in x,y,z directions.\n * @public\n */\nexport class RangeLengthData {\n /** Overall range of all data observed by `accumulate` methods. */\n public range: Range3d;\n /** */\n public xSums: UsageSums;\n public ySums: UsageSums;\n public zSums: UsageSums;\n public constructor() {\n this.range = Range3d.createNull();\n this.xSums = new UsageSums();\n this.ySums = new UsageSums();\n this.zSums = new UsageSums();\n this._workRange = Range3d.createNull();\n }\n private _workRange: Range3d;\n /** Extend the range and length sums by the range of points in an array. */\n public accumulateGrowableXYZArrayRange(points: GrowableXYZArray) {\n points.setRange(this._workRange);\n this.range.extendRange(this._workRange);\n this.xSums.accumulate(this._workRange.xLength());\n this.ySums.accumulate(this._workRange.yLength());\n this.zSums.accumulate(this._workRange.zLength());\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RangeLengthData.js","sourceRoot":"","sources":["../../../src/polyface/RangeLengthData.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,+CAA8C;AAC9C,qDAAkD;AAElD;;;;;;;;;;;GAWG;AACH,MAAa,eAAe;IAC1B,kEAAkE;IAC3D,KAAK,CAAU;IACtB,MAAM;IACC,KAAK,CAAY;IACjB,KAAK,CAAY;IACjB,KAAK,CAAY;IACxB;QACE,IAAI,CAAC,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;IACO,UAAU,CAAU;IAC5B,2EAA2E;IACpE,+BAA+B,CAAC,MAAwB;QAC7D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;CACF;AAvBD,0CAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { UsageSums } from \"../numerics/UsageSums\";\r\n\r\n/**\r\n * Accumulated data for x,y,z length statistics in ranges.\r\n * * Usage pattern:\r\n * * create a enw RangeLengthData:\r\n * * `myData = new RangeLengthData ();`\r\n * * announce ranges to be accumulated:\r\n * * (many times) `myData.accumulateRowableXYZArrayRange (points);\r\n * * access data in public members:\r\n * * `myData.range` -- the composite range.\r\n * * `myData.xLength`, `myData.yLength`, `myData.zLength` -- mean, minMax, count, and standardDeviation of range lengths in x,y,z directions.\r\n * @public\r\n */\r\nexport class RangeLengthData {\r\n /** Overall range of all data observed by `accumulate` methods. */\r\n public range: Range3d;\r\n /** */\r\n public xSums: UsageSums;\r\n public ySums: UsageSums;\r\n public zSums: UsageSums;\r\n public constructor() {\r\n this.range = Range3d.createNull();\r\n this.xSums = new UsageSums();\r\n this.ySums = new UsageSums();\r\n this.zSums = new UsageSums();\r\n this._workRange = Range3d.createNull();\r\n }\r\n private _workRange: Range3d;\r\n /** Extend the range and length sums by the range of points in an array. */\r\n public accumulateGrowableXYZArrayRange(points: GrowableXYZArray) {\r\n points.setRange(this._workRange);\r\n this.range.extendRange(this._workRange);\r\n this.xSums.accumulate(this._workRange.xLength());\r\n this.ySums.accumulate(this._workRange.yLength());\r\n this.zSums.accumulate(this._workRange.zLength());\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineString3dRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/LineString3dRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2DAAwD;AACxD,6CAA0C;AAE1C,kDAAiD;AACjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4B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O,CAAC,CAAC;QAC9G,6BAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AA3ED,oEA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\nimport { LineString3d } from \"../../curve/LineString3d\";\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport {\n SingleTreeSearchHandlerForClosestPointOnLineString3d, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach,\n} from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing the segments of a linestring.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class LineString3dRangeTreeContext {\n /** Polyline points being searched, indexed by the range tree */\n public lineString: LineString3d;\n\n /** Diagnostic: number of range tests that have returned true */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests that have returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of points tested */\n public numPointTest: number;\n /** Diagnostic: number of searches. */\n public numSearch: number;\n\n /** Range tree, whose appData are indices into the linestring points array */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: LineString3d) {\n this.lineString = points;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numPointTest = 0;\n this.numSearch = 0;\n }\n /**\n * Create a range tree context for the polyline points:\n * * initialize with segment ranges\n * * appData are segment indices\n * @param linestring captured if LineString3d, otherwise copied\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum segment indices per leaf node (default 4)\n */\n public static createCapture(points: Point3d[] | LineString3d, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4): LineString3dRangeTreeContext | undefined {\n const linestring = points instanceof LineString3d ? points : LineString3d.createPoints(points);\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n ((index: number): Range3d => { return Range3d.create(linestring.pointAt(index)!, linestring.pointAt(index + 1)!); }),\n ((index: number): number => { return index; }),\n linestring.numPoints() - 1, // number of segments\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new LineString3dRangeTreeContext(rangeTreeRoot, linestring) : undefined;\n }\n /**\n * Search the range tree for closest point(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\n */\n public searchForClosestPoint(spacePoint: Point3d, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointOnLineString3d(spacePoint, this, maxDist);\n this.numSearch++;\n // seed the search with a few segments -- this reduces early trips deep into ranges that are far from spacePoint.\n const numTest = Geometry.clamp(Math.floor(this.lineString.numPoints() / 20), 2, 7);\n const testStep = Math.floor(this.lineString.numPoints() / numTest);\n handler.processAppData(0);\n handler.processAppData(this.lineString.numPoints() - 2);\n for (let i = testStep; i + 1 < this.lineString.numPoints(); i += testStep)\n handler.processAppData(i);\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the polylines.\n * @param contextA first polyline context\n * @param contextB second polyline context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\n */\n public static searchForClosestApproach(contextA: LineString3dRangeTreeContext, contextB: LineString3dRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach(contextA, contextB, maxDist);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LineString3dRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/LineString3dRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2DAAwD;AACxD,6CAA0C;AAE1C,kDAAiD;AACjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,gEAAgE;IACzD,UAAU,CAAe;IAEhC,gEAAgE;IACzD,gBAAgB,CAAS;IAChC,iEAAiE;IAC1D,iBAAiB,CAAS;IACjC,0CAA0C;IACnC,YAAY,CAAS;IAC5B,sCAAsC;IAC/B,SAAS,CAAS;IAEzB,6EAA6E;IACrE,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,MAAoB;QAC5E,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,CAAC,CA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C,CAAC;QACnE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAC1B,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;QACxD,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,QAAQ;YACvE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;IACD;;;;;;MAME;IACK,MAAM,CAAC,wBAAwB,CAAC,QAAsC,EAAE,QAAsC,EAAE,OAAgB;QACrI,MAAM,OAAO,GAAG,IAAI,sFAA4D,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9G,6BAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AA3ED,oEA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\r\nimport { LineString3d } from \"../../curve/LineString3d\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\r\nimport {\r\n SingleTreeSearchHandlerForClosestPointOnLineString3d, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach,\r\n} from \"./RangeTreeSearchHandlers\";\r\n\r\n/**\r\n * Handler class for searching a range tree containing the segments of a linestring.\r\n * * Facilitates multiple searches for closest point and close approach calculations.\r\n * @public\r\n */\r\nexport class LineString3dRangeTreeContext {\r\n /** Polyline points being searched, indexed by the range tree */\r\n public lineString: LineString3d;\r\n\r\n /** Diagnostic: number of range tests that have returned true */\r\n public numRangeTestTrue: number;\r\n /** Diagnostic: number of range tests that have returned false */\r\n public numRangeTestFalse: number;\r\n /** Diagnostic: number of points tested */\r\n public numPointTest: number;\r\n /** Diagnostic: number of searches. */\r\n public numSearch: number;\r\n\r\n /** Range tree, whose appData are indices into the linestring points array */\r\n private _rangeTreeRoot: RangeTreeNode<number>;\r\n\r\n /** Constructor: capture inputs, initialize debug counters */\r\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: LineString3d) {\r\n this.lineString = points;\r\n this._rangeTreeRoot = rangeTreeRoot;\r\n this.numRangeTestTrue = 0;\r\n this.numRangeTestFalse = 0;\r\n this.numPointTest = 0;\r\n this.numSearch = 0;\r\n }\r\n /**\r\n * Create a range tree context for the polyline points:\r\n * * initialize with segment ranges\r\n * * appData are segment indices\r\n * @param linestring captured if LineString3d, otherwise copied\r\n * @param maxChildPerNode maximum children per range tree node (default 4)\r\n * @param maxAppDataPerLeaf maximum segment indices per leaf node (default 4)\r\n */\r\n public static createCapture(points: Point3d[] | LineString3d, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4): LineString3dRangeTreeContext | undefined {\r\n const linestring = points instanceof LineString3d ? points : LineString3d.createPoints(points);\r\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\r\n ((index: number): Range3d => { return Range3d.create(linestring.pointAt(index)!, linestring.pointAt(index + 1)!); }),\r\n ((index: number): number => { return index; }),\r\n linestring.numPoints() - 1, // number of segments\r\n maxChildPerNode,\r\n maxAppDataPerLeaf,\r\n );\r\n return rangeTreeRoot ? new LineString3dRangeTreeContext(rangeTreeRoot, linestring) : undefined;\r\n }\r\n /**\r\n * Search the range tree for closest point(s) to spacePoint.\r\n * @param spacePoint point to test\r\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\r\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\r\n */\r\n public searchForClosestPoint(spacePoint: Point3d, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\r\n const handler = new SingleTreeSearchHandlerForClosestPointOnLineString3d(spacePoint, this, maxDist);\r\n this.numSearch++;\r\n // seed the search with a few segments -- this reduces early trips deep into ranges that are far from spacePoint.\r\n const numTest = Geometry.clamp(Math.floor(this.lineString.numPoints() / 20), 2, 7);\r\n const testStep = Math.floor(this.lineString.numPoints() / numTest);\r\n handler.processAppData(0);\r\n handler.processAppData(this.lineString.numPoints() - 2);\r\n for (let i = testStep; i + 1 < this.lineString.numPoints(); i += testStep)\r\n handler.processAppData(i);\r\n this._rangeTreeRoot.searchTopDown(handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n /**\r\n * Search the range trees for closest approach(es) between the polylines.\r\n * @param contextA first polyline context\r\n * @param contextB second polyline context\r\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\r\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\r\n */\r\n public static searchForClosestApproach(contextA: LineString3dRangeTreeContext, contextB: LineString3dRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\r\n const handler = new TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach(contextA, contextB, maxDist);\r\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimumValueTester.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/MinimumValueTester.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;GAMG;AACH,MAAa,kBAAkB;IACtB,cAAc,CAAgB;IAC9B,QAAQ,CAAqB;IAC7B,uBAAuB,CAAqB;IAC5C,UAAU,GAAQ,EAAE,CAAC;IACrB,WAAW,GAAa,EAAE,CAAC;IAClC;;OAEG;IACH,YAAoB,wBAAiC;QACnD,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,iCAAiC,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAI,wBAAiC;QACvD,OAAO,IAAI,kBAAkB,CAAI,wBAAwB,CAAC,CAAC;IAC7D,CAAC;IACD;;;;;OAKG;IACI,oBAAoB,CAAC,OAAsB,SAAS,EAAE,QAA4B,SAAS;QAChG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IACD;;;;OAIG;IACI,iCAAiC,CAAC,KAAyB,EAAE,qBAA8B,KAAK;QACrG,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;QACrC,IAAI,kBAAkB,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IACD;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,IAAO,EAAE,KAAa;QACvC,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4EAA4E;IACrE,gBAAgB,CAAC,KAAa;QACnC,OAAO,IAAI,CAAC,uBAAuB,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,uBAAuB,CAAC;IAC7F,CAAC;IACD,+EAA+E;IACxE,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC9D,CAAC;IACD,qGAAqG;IAC9F,iBAAiB,CAAC,KAAa;QACpC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC;CACF;AA/ED,gDA+EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\n/**\n * Data carrier for use when repeatedly testing items (of parameterized type T) to determine the one with a minimum associated value.\n * * Optionally pushes to arrays of items and values when the value does not exceed a given trigger.\n * * * The item at minimum value is still recorded, even if the minimum value exceeds the trigger value.\n * * When comparing a potential minimum value to an undefined value, the number is always accepted as the new minimum.\n * @internal\n */\nexport class MinimumValueTester<T>{\n public itemAtMinValue: T | undefined;\n public minValue: number | undefined;\n public triggerForSavingToArray: number | undefined;\n public savedItems: T[] = [];\n public savedValues: number[] = [];\n /**\n * Capture the given item with undefined item and value, and optional maxValueForSavingToArray.\n */\n private constructor(maxValueForSavingToArray?: number) {\n this.resetMinValueAndItem(undefined, undefined);\n this.resetTriggerValueForSavingToArray(maxValueForSavingToArray, false);\n }\n /**\n * Static method to create a tester.\n * @param maxValueForSavingToArray optional numeric value limiting items to save to the optional array.\n * @returns new tester.\n */\n public static create<T>(maxValueForSavingToArray?: number): MinimumValueTester<T> {\n return new MinimumValueTester<T>(maxValueForSavingToArray);\n }\n /**\n * Install new minimum value and associated item, both possibly undefined.\n * * The existing arrays of saved items and values, and the trigger value, are unaffected.\n * @param item object to associate with the new minimum value\n * @param value new minimum value\n */\n public resetMinValueAndItem(item: T | undefined = undefined, value: number | undefined = undefined) {\n this.itemAtMinValue = item;\n this.minValue = value;\n }\n /**\n * Set the trigger value.\n * @param value new trigger value\n * @param reinitializeArrays whether to clear the arrays of saved items and values\n */\n public resetTriggerValueForSavingToArray(value: number | undefined, reinitializeArrays: boolean = false) {\n this.triggerForSavingToArray = value;\n if (reinitializeArrays) {\n this.savedItems = [];\n this.savedValues = [];\n }\n }\n /**\n * Test a new item with value.\n * * Push the new item and value to the saved arrays if both:\n * * `this.triggerForSavingToArray` is defined\n * * the new value is less than or equal to `this.triggerForSavingToArray`.\n * * Save the new item and value if either:\n * * `this.minValue` is undefined\n * * new value is less than `this.minValue`.\n * @param item item to be saved (captured!) if value conditions are met\n * @param value numeric value being minimized.\n * @returns true if and only if the input value is the new minimum value.\n */\n public testAndSave(item: T, value: number): boolean {\n if (this.doesValueTrigger(value)) {\n this.savedValues.push(value);\n this.savedItems.push(item);\n }\n if (this.isNewMinValue(value)) {\n this.minValue = value;\n this.itemAtMinValue = item;\n return true;\n }\n return false;\n }\n /** Whether the input value is small enough to be saved to this instance. */\n public doesValueTrigger(value: number): boolean {\n return this.triggerForSavingToArray !== undefined && value <= this.triggerForSavingToArray;\n }\n /** Whether the input value is smaller than the last recorded minimum value. */\n public isNewMinValue(value: number): boolean {\n return this.minValue === undefined || value < this.minValue;\n }\n /** Whether the input value is small enough to be the new minimum or to be saved to this instance. */\n public isNewMinOrTrigger(value: number): boolean {\n return this.isNewMinValue(value) || this.doesValueTrigger(value);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MinimumValueTester.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/MinimumValueTester.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;GAMG;AACH,MAAa,kBAAkB;IACtB,cAAc,CAAgB;IAC9B,QAAQ,CAAqB;IAC7B,uBAAuB,CAAqB;IAC5C,UAAU,GAAQ,EAAE,CAAC;IACrB,WAAW,GAAa,EAAE,CAAC;IAClC;;OAEG;IACH,YAAoB,wBAAiC;QACnD,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,iCAAiC,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAI,wBAAiC;QACvD,OAAO,IAAI,kBAAkB,CAAI,wBAAwB,CAAC,CAAC;IAC7D,CAAC;IACD;;;;;OAKG;IACI,oBAAoB,CAAC,OAAsB,SAAS,EAAE,QAA4B,SAAS;QAChG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IACD;;;;OAIG;IACI,iCAAiC,CAAC,KAAyB,EAAE,qBAA8B,KAAK;QACrG,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;QACrC,IAAI,kBAAkB,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IACD;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,IAAO,EAAE,KAAa;QACvC,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4EAA4E;IACrE,gBAAgB,CAAC,KAAa;QACnC,OAAO,IAAI,CAAC,uBAAuB,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC,uBAAuB,CAAC;IAC7F,CAAC;IACD,+EAA+E;IACxE,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC9D,CAAC;IACD,qGAAqG;IAC9F,iBAAiB,CAAC,KAAa;QACpC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC;CACF;AA/ED,gDA+EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n/**\r\n * Data carrier for use when repeatedly testing items (of parameterized type T) to determine the one with a minimum associated value.\r\n * * Optionally pushes to arrays of items and values when the value does not exceed a given trigger.\r\n * * * The item at minimum value is still recorded, even if the minimum value exceeds the trigger value.\r\n * * When comparing a potential minimum value to an undefined value, the number is always accepted as the new minimum.\r\n * @internal\r\n */\r\nexport class MinimumValueTester<T>{\r\n public itemAtMinValue: T | undefined;\r\n public minValue: number | undefined;\r\n public triggerForSavingToArray: number | undefined;\r\n public savedItems: T[] = [];\r\n public savedValues: number[] = [];\r\n /**\r\n * Capture the given item with undefined item and value, and optional maxValueForSavingToArray.\r\n */\r\n private constructor(maxValueForSavingToArray?: number) {\r\n this.resetMinValueAndItem(undefined, undefined);\r\n this.resetTriggerValueForSavingToArray(maxValueForSavingToArray, false);\r\n }\r\n /**\r\n * Static method to create a tester.\r\n * @param maxValueForSavingToArray optional numeric value limiting items to save to the optional array.\r\n * @returns new tester.\r\n */\r\n public static create<T>(maxValueForSavingToArray?: number): MinimumValueTester<T> {\r\n return new MinimumValueTester<T>(maxValueForSavingToArray);\r\n }\r\n /**\r\n * Install new minimum value and associated item, both possibly undefined.\r\n * * The existing arrays of saved items and values, and the trigger value, are unaffected.\r\n * @param item object to associate with the new minimum value\r\n * @param value new minimum value\r\n */\r\n public resetMinValueAndItem(item: T | undefined = undefined, value: number | undefined = undefined) {\r\n this.itemAtMinValue = item;\r\n this.minValue = value;\r\n }\r\n /**\r\n * Set the trigger value.\r\n * @param value new trigger value\r\n * @param reinitializeArrays whether to clear the arrays of saved items and values\r\n */\r\n public resetTriggerValueForSavingToArray(value: number | undefined, reinitializeArrays: boolean = false) {\r\n this.triggerForSavingToArray = value;\r\n if (reinitializeArrays) {\r\n this.savedItems = [];\r\n this.savedValues = [];\r\n }\r\n }\r\n /**\r\n * Test a new item with value.\r\n * * Push the new item and value to the saved arrays if both:\r\n * * `this.triggerForSavingToArray` is defined\r\n * * the new value is less than or equal to `this.triggerForSavingToArray`.\r\n * * Save the new item and value if either:\r\n * * `this.minValue` is undefined\r\n * * new value is less than `this.minValue`.\r\n * @param item item to be saved (captured!) if value conditions are met\r\n * @param value numeric value being minimized.\r\n * @returns true if and only if the input value is the new minimum value.\r\n */\r\n public testAndSave(item: T, value: number): boolean {\r\n if (this.doesValueTrigger(value)) {\r\n this.savedValues.push(value);\r\n this.savedItems.push(item);\r\n }\r\n if (this.isNewMinValue(value)) {\r\n this.minValue = value;\r\n this.itemAtMinValue = item;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Whether the input value is small enough to be saved to this instance. */\r\n public doesValueTrigger(value: number): boolean {\r\n return this.triggerForSavingToArray !== undefined && value <= this.triggerForSavingToArray;\r\n }\r\n /** Whether the input value is smaller than the last recorded minimum value. */\r\n public isNewMinValue(value: number): boolean {\r\n return this.minValue === undefined || value < this.minValue;\r\n }\r\n /** Whether the input value is small enough to be the new minimum or to be saved to this instance. */\r\n public isNewMinOrTrigger(value: number): boolean {\r\n return this.isNewMinValue(value) || this.doesValueTrigger(value);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point3dArrayRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/Point3dArrayRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,kDAAiD;AAEjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,gEAAgE;IACzD,MAAM,CAAW;IAExB,sDAAsD;IAC/C,gBAAgB,CAAS;IAChC,uDAAuD;IAChD,iBAAiB,CAAS;IACjC,iDAAiD;IAC1C,YAAY,CAAS;IAC5B,qCAAqC;IAC9B,SAAS,CAAS;IACzB,yEAAyE;IAClE,MAAM,CAAW;IAExB,kEAAkE;IAC1D,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,MAAgB,EAAE,MAAe;QACzF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG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AAE,QAAsC,EAAE,OAAgB;QACrI,MAAM,OAAO,GAAG,IAAI,sFAA4D,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9G,6BAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AA7ED,oEA6EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport {\n SingleTreeSearchHandlerForClosestPointInArray, TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach,\n} from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing unordered Point3d data.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class Point3dArrayRangeTreeContext {\n /** Array of points being searched, indexed by the range tree */\n public points: XYAndZ[];\n\n /** Diagnostic: number of range tests returned true */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of point distance tests */\n public numPointTest: number;\n /** Diagnostic: number of searches */\n public numSearch: number;\n /** Whether to compute xy-distances, ignoring z-coordinates of points. */\n public xyOnly?: boolean;\n\n /** range tree, whose appData are indices into the points array */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: XYAndZ[], xyOnly: boolean) {\n this.points = points;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numPointTest = 0;\n this.numSearch = 0;\n this.xyOnly = xyOnly;\n }\n /**\n * Create a range tree context with given points:\n * * initialize with single-point ranges\n * * appData are point indices\n * @param points reference captured\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)\n * @param xyOnly whether to compute xy-distances, ignoring z-coordinates of points\n */\n public static createCapture(points: XYAndZ[], maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, xyOnly: boolean = false): Point3dArrayRangeTreeContext | undefined {\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n ((index: number): Range3d => { return Range3d.create(points[index]); }),\n ((index: number): number => { return index; }),\n points.length,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points, xyOnly) : undefined;\n }\n /**\n * Search the range tree for closest point(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\n * @return closest point detail(s) with following fields set:\n * * detail.point = the closest point\n * * detail.fraction = the index of the closest point in the points array\n * * detail.a = distance from spacePoint to closest point\n */\n public searchForClosestPoint(spacePoint: XAndY | XYAndZ, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointInArray(spacePoint, this, maxDist);\n this.numSearch++;\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the point arrays.\n * @param contextA first point array context\n * @param contextB second point array context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @return closest approach detail pair(s), one per context, each with the following fields set:\n * * detail.point = the point at closest approach\n * * detail.fraction = the index of detail.point in the points array\n * * detail.a = the closest approach distance\n */\n public static searchForClosestApproach(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach(contextA, contextB, maxDist);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"Point3dArrayRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/Point3dArrayRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,kDAAiD;AAEjD,mDAA8D;AAC9D,uEAEmC;AAEnC;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,gEAAgE;IACzD,MAAM,CAAW;IAExB,sDAAsD;IAC/C,gBAAgB,CAAS;IAChC,uDAAuD;IAChD,iBAAiB,CAAS;IACjC,iDAAiD;IAC1C,YAAY,CAAS;IAC5B,qCAAqC;IAC9B,SAAS,CAAS;IACzB,yEAAyE;IAClE,MAAM,CAAW;IAExB,kEAAkE;IAC1D,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,MAAgB,EAAE,MAAe;QACzF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB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QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AA7ED,oEA6EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\r\nimport {\r\n SingleTreeSearchHandlerForClosestPointInArray, TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach,\r\n} from \"./RangeTreeSearchHandlers\";\r\n\r\n/**\r\n * Handler class for searching a range tree containing unordered Point3d data.\r\n * * Facilitates multiple searches for closest point and close approach calculations.\r\n * @public\r\n */\r\nexport class Point3dArrayRangeTreeContext {\r\n /** Array of points being searched, indexed by the range tree */\r\n public points: XYAndZ[];\r\n\r\n /** Diagnostic: number of range tests returned true */\r\n public numRangeTestTrue: number;\r\n /** Diagnostic: number of range tests returned false */\r\n public numRangeTestFalse: number;\r\n /** Diagnostic: number of point distance tests */\r\n public numPointTest: number;\r\n /** Diagnostic: number of searches */\r\n public numSearch: number;\r\n /** Whether to compute xy-distances, ignoring z-coordinates of points. */\r\n public xyOnly?: boolean;\r\n\r\n /** range tree, whose appData are indices into the points array */\r\n private _rangeTreeRoot: RangeTreeNode<number>;\r\n\r\n /** Constructor: capture inputs, initialize debug counters */\r\n private constructor(rangeTreeRoot: RangeTreeNode<number>, points: XYAndZ[], xyOnly: boolean) {\r\n this.points = points;\r\n this._rangeTreeRoot = rangeTreeRoot;\r\n this.numRangeTestTrue = 0;\r\n this.numRangeTestFalse = 0;\r\n this.numPointTest = 0;\r\n this.numSearch = 0;\r\n this.xyOnly = xyOnly;\r\n }\r\n /**\r\n * Create a range tree context with given points:\r\n * * initialize with single-point ranges\r\n * * appData are point indices\r\n * @param points reference captured\r\n * @param maxChildPerNode maximum children per range tree node (default 4)\r\n * @param maxAppDataPerLeaf maximum point indices per leaf node (default 4)\r\n * @param xyOnly whether to compute xy-distances, ignoring z-coordinates of points\r\n */\r\n public static createCapture(points: XYAndZ[], maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, xyOnly: boolean = false): Point3dArrayRangeTreeContext | undefined {\r\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\r\n ((index: number): Range3d => { return Range3d.create(points[index]); }),\r\n ((index: number): number => { return index; }),\r\n points.length,\r\n maxChildPerNode,\r\n maxAppDataPerLeaf,\r\n );\r\n return rangeTreeRoot ? new Point3dArrayRangeTreeContext(rangeTreeRoot, points, xyOnly) : undefined;\r\n }\r\n /**\r\n * Search the range tree for closest point(s) to spacePoint.\r\n * @param spacePoint point to test\r\n * @param maxDist collect points at no more than this distance from spacePoint. If undefined, return only the closest point.\r\n * @return closest point detail(s) with following fields set:\r\n * * detail.point = the closest point\r\n * * detail.fraction = the index of the closest point in the points array\r\n * * detail.a = distance from spacePoint to closest point\r\n */\r\n public searchForClosestPoint(spacePoint: XAndY | XYAndZ, maxDist?: number): CurveLocationDetail | CurveLocationDetail[] | undefined {\r\n const handler = new SingleTreeSearchHandlerForClosestPointInArray(spacePoint, this, maxDist);\r\n this.numSearch++;\r\n this._rangeTreeRoot.searchTopDown(handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n /**\r\n * Search the range trees for closest approach(es) between the point arrays.\r\n * @param contextA first point array context\r\n * @param contextB second point array context\r\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\r\n * @return closest approach detail pair(s), one per context, each with the following fields set:\r\n * * detail.point = the point at closest approach\r\n * * detail.fraction = the index of detail.point in the points array\r\n * * detail.a = the closest approach distance\r\n */\r\n public static searchForClosestApproach(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number): CurveLocationDetailPair | CurveLocationDetailPair[] | undefined {\r\n const handler = new TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach(contextA, contextB, maxDist);\r\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolyfaceRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/PolyfaceRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAI1C,0CAAwD;AACxD,oDAAiD;AACjD,mDAA8D;AAC9D,uEAA6I;AAE7I;;;;GAIG;AACH,MAAa,wBAAwB;IACnC,8CAA8C;IACvC,OAAO,CAAkB;IAChC,0DAA0D;IACnD,YAAY,CAAU;IAE7B,iEAAiE;IAC1D,gBAAgB,CAAS;IAChC,sEAAsE;IAC/D,iBAAiB,CAAS;IACjC,yCAAyC;IAClC,YAAY,CAAS;IAC5B,gDAAgD;IACzC,SAAS,CAAS;IAEzB,yDAAyD;IACjD,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aAAoC,EAAE,OAAwB,EAAE,eAAwB,KAAK;QAC/G,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,a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AAC;CACF;AApFD,4DAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { FacetLocationDetail, FacetLocationDetailPair } from \"../FacetLocationDetail\";\nimport { Polyface, PolyfaceVisitor } from \"../Polyface\";\nimport { PolyfaceQuery } from \"../PolyfaceQuery\";\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\nimport { SingleTreeSearchHandlerForClosestPointOnPolyface, TwoTreeSearchHandlerForFacetFacetCloseApproach } from \"./RangeTreeSearchHandlers\";\n\n/**\n * Handler class for searching a range tree containing the facets of a polyface.\n * * Facilitates multiple searches for closest point and close approach calculations.\n * @public\n */\nexport class PolyfaceRangeTreeContext {\n /** Visitor for the polyface being searched */\n public visitor: PolyfaceVisitor;\n /** Whether all facets to visit are known to be convex. */\n public convexFacets: boolean;\n\n /** Diagnostic: number of range tests that have returned true. */\n public numRangeTestTrue: number;\n /** Diagnostic: number of range tests that have been returned false */\n public numRangeTestFalse: number;\n /** Diagnostic: number of facet tests. */\n public numFacetTest: number;\n /** Diagnostic: number of searches performed. */\n public numSearch: number;\n\n /** Range tree, whose appData are facet (read) indices */\n private _rangeTreeRoot: RangeTreeNode<number>;\n\n /** Constructor: capture inputs, initialize debug counters */\n private constructor(rangeTreeRoot: RangeTreeNode<number>, visitor: PolyfaceVisitor, convexFacets: boolean = false) {\n this.visitor = visitor;\n this.convexFacets = convexFacets;\n this._rangeTreeRoot = rangeTreeRoot;\n this.numRangeTestTrue = 0;\n this.numRangeTestFalse = 0;\n this.numFacetTest = 0;\n this.numSearch = 0;\n }\n /**\n * Create a range tree context for the Polyface facets.\n * * This is a very simple construction that splits \"right and left parts\" of the facet sequence.\n * * Facets with any recognizable \"left to right\" or \"top to bottom\" sequencing will have very effective search structures.\n * @param visitor access to facets, captured if PolyfaceVisitor\n * @param maxChildPerNode maximum children per range tree node (default 4)\n * @param maxAppDataPerLeaf maximum facet indices per leaf node (default 4)\n * @param convexFacets whether all facets are known to be convex (cf. [[PolyfaceQuery.areFacetsConvex]]) (default false)\n */\n public static createCapture(visitor: Polyface | PolyfaceVisitor, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, convexFacets: boolean = false): PolyfaceRangeTreeContext | undefined {\n if (visitor instanceof Polyface)\n return this.createCapture(visitor.createVisitor(0), maxChildPerNode, maxAppDataPerLeaf, convexFacets);\n const numFacet = PolyfaceQuery.visitorClientFacetCount(visitor);\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\n (index: number): Range3d => { visitor.moveToReadIndex(index); return visitor.range(); },\n (index: number): number => { return index; },\n numFacet,\n maxChildPerNode,\n maxAppDataPerLeaf,\n );\n return rangeTreeRoot ? new PolyfaceRangeTreeContext(rangeTreeRoot, visitor, convexFacets) : undefined;\n }\n /**\n * Search the range tree for closest facet(s) to spacePoint.\n * @param spacePoint point to test\n * @param maxDist collect facet locations at no more than this distance from spacePoint. If undefined, return only the closest facet location.\n * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\n */\n public searchForClosestPoint(spacePoint: XYAndZ | XAndY, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetail | FacetLocationDetail[] | undefined {\n const handler = new SingleTreeSearchHandlerForClosestPointOnPolyface(spacePoint, this, maxDist, searchFacetInterior);\n this.numSearch++;\n const numFacet = PolyfaceQuery.visitorClientFacetCount(this.visitor);\n // seed the search with a few points -- this reduces early trips deep into early ranges that are far from spacePoint.\n const numTest = Geometry.clamp(Math.floor(numFacet / 20), 2, 7);\n const testStep = Math.floor(numFacet / numTest);\n handler.processAppData(0);\n handler.processAppData(numFacet - 1);\n for (let i = testStep; i + 1 < numFacet; i += testStep)\n handler.processAppData(i);\n this._rangeTreeRoot.searchTopDown(handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n /**\n * Search the range trees for closest approach(es) between the polyfaces.\n * @param contextA first polyface context\n * @param contextB second polyface context\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\n * @param searchFacetInterior whether to include facet interiors in search (`context.convexFacets` must be true for both contexts). Default is false: just consider facet boundaries.\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\n */\n public static searchForClosestApproach(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetailPair | FacetLocationDetailPair[] | undefined {\n const handler = new TwoTreeSearchHandlerForFacetFacetCloseApproach(contextA, contextB, maxDist, searchFacetInterior);\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PolyfaceRangeTreeContext.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/PolyfaceRangeTreeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAI1C,0CAAwD;AACxD,oDAAiD;AACjD,mDAA8D;AAC9D,uEAA6I;AAE7I;;;;GAIG;AACH,MAAa,wBAAwB;IACnC,8CAA8C;IACvC,OAAO,CAAkB;IAChC,0DAA0D;IACnD,YAAY,CAAU;IAE7B,iEAAiE;IAC1D,gBAAgB,CAAS;IAChC,sEAAsE;IAC/D,iBAAiB,CAAS;IACjC,yCAAyC;IAClC,YAAY,CAAS;IAC5B,gDAAgD;IACzC,SAAS,CAAS;IAEzB,yDAAyD;IACjD,cAAc,CAAwB;IAE9C,6DAA6D;IAC7D,YAAoB,aA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O,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpG,CAAC;CACF;AApFD,4DAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { FacetLocationDetail, FacetLocationDetailPair } from \"../FacetLocationDetail\";\r\nimport { Polyface, PolyfaceVisitor } from \"../Polyface\";\r\nimport { PolyfaceQuery } from \"../PolyfaceQuery\";\r\nimport { RangeTreeNode, RangeTreeOps } from \"./RangeTreeNode\";\r\nimport { SingleTreeSearchHandlerForClosestPointOnPolyface, TwoTreeSearchHandlerForFacetFacetCloseApproach } from \"./RangeTreeSearchHandlers\";\r\n\r\n/**\r\n * Handler class for searching a range tree containing the facets of a polyface.\r\n * * Facilitates multiple searches for closest point and close approach calculations.\r\n * @public\r\n */\r\nexport class PolyfaceRangeTreeContext {\r\n /** Visitor for the polyface being searched */\r\n public visitor: PolyfaceVisitor;\r\n /** Whether all facets to visit are known to be convex. */\r\n public convexFacets: boolean;\r\n\r\n /** Diagnostic: number of range tests that have returned true. */\r\n public numRangeTestTrue: number;\r\n /** Diagnostic: number of range tests that have been returned false */\r\n public numRangeTestFalse: number;\r\n /** Diagnostic: number of facet tests. */\r\n public numFacetTest: number;\r\n /** Diagnostic: number of searches performed. */\r\n public numSearch: number;\r\n\r\n /** Range tree, whose appData are facet (read) indices */\r\n private _rangeTreeRoot: RangeTreeNode<number>;\r\n\r\n /** Constructor: capture inputs, initialize debug counters */\r\n private constructor(rangeTreeRoot: RangeTreeNode<number>, visitor: PolyfaceVisitor, convexFacets: boolean = false) {\r\n this.visitor = visitor;\r\n this.convexFacets = convexFacets;\r\n this._rangeTreeRoot = rangeTreeRoot;\r\n this.numRangeTestTrue = 0;\r\n this.numRangeTestFalse = 0;\r\n this.numFacetTest = 0;\r\n this.numSearch = 0;\r\n }\r\n /**\r\n * Create a range tree context for the Polyface facets.\r\n * * This is a very simple construction that splits \"right and left parts\" of the facet sequence.\r\n * * Facets with any recognizable \"left to right\" or \"top to bottom\" sequencing will have very effective search structures.\r\n * @param visitor access to facets, captured if PolyfaceVisitor\r\n * @param maxChildPerNode maximum children per range tree node (default 4)\r\n * @param maxAppDataPerLeaf maximum facet indices per leaf node (default 4)\r\n * @param convexFacets whether all facets are known to be convex (cf. [[PolyfaceQuery.areFacetsConvex]]) (default false)\r\n */\r\n public static createCapture(visitor: Polyface | PolyfaceVisitor, maxChildPerNode: number = 4, maxAppDataPerLeaf: number = 4, convexFacets: boolean = false): PolyfaceRangeTreeContext | undefined {\r\n if (visitor instanceof Polyface)\r\n return this.createCapture(visitor.createVisitor(0), maxChildPerNode, maxAppDataPerLeaf, convexFacets);\r\n const numFacet = PolyfaceQuery.visitorClientFacetCount(visitor);\r\n const rangeTreeRoot = RangeTreeOps.createByIndexSplits<number>(\r\n (index: number): Range3d => { visitor.moveToReadIndex(index); return visitor.range(); },\r\n (index: number): number => { return index; },\r\n numFacet,\r\n maxChildPerNode,\r\n maxAppDataPerLeaf,\r\n );\r\n return rangeTreeRoot ? new PolyfaceRangeTreeContext(rangeTreeRoot, visitor, convexFacets) : undefined;\r\n }\r\n /**\r\n * Search the range tree for closest facet(s) to spacePoint.\r\n * @param spacePoint point to test\r\n * @param maxDist collect facet locations at no more than this distance from spacePoint. If undefined, return only the closest facet location.\r\n * @param searchFacetInterior whether to include facet interiors in search. Default is false: just consider facet boundaries.\r\n * @return closest point detail(s) with detail.a set to the distance from spacePoint to detail.point\r\n */\r\n public searchForClosestPoint(spacePoint: XYAndZ | XAndY, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetail | FacetLocationDetail[] | undefined {\r\n const handler = new SingleTreeSearchHandlerForClosestPointOnPolyface(spacePoint, this, maxDist, searchFacetInterior);\r\n this.numSearch++;\r\n const numFacet = PolyfaceQuery.visitorClientFacetCount(this.visitor);\r\n // seed the search with a few points -- this reduces early trips deep into early ranges that are far from spacePoint.\r\n const numTest = Geometry.clamp(Math.floor(numFacet / 20), 2, 7);\r\n const testStep = Math.floor(numFacet / numTest);\r\n handler.processAppData(0);\r\n handler.processAppData(numFacet - 1);\r\n for (let i = testStep; i + 1 < numFacet; i += testStep)\r\n handler.processAppData(i);\r\n this._rangeTreeRoot.searchTopDown(handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n /**\r\n * Search the range trees for closest approach(es) between the polyfaces.\r\n * @param contextA first polyface context\r\n * @param contextB second polyface context\r\n * @param maxDist collect close approaches separated by no more than this distance. If undefined, return only the closest approach.\r\n * @param searchFacetInterior whether to include facet interiors in search (`context.convexFacets` must be true for both contexts). Default is false: just consider facet boundaries.\r\n * @return closest approach detail pair(s), one per context, with detail.a set to the approach distance\r\n */\r\n public static searchForClosestApproach(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false): FacetLocationDetailPair | FacetLocationDetailPair[] | undefined {\r\n const handler = new TwoTreeSearchHandlerForFacetFacetCloseApproach(contextA, contextB, maxDist, searchFacetInterior);\r\n RangeTreeNode.searchTwoTreesTopDown(contextA._rangeTreeRoot, contextB._rangeTreeRoot, handler);\r\n return handler.searchState.savedItems.length <= 1 ? handler.getResult() : handler.getSavedItems();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeTreeNode.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeNode.ts"],"names":[],"mappings":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AG,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;gBACxH,MAAM,KAAK,GAAG,IAAI,CAAC,4BAA4B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;gBAClI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;oBACvC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrG,CAAC;IACD;;;;;;;;;;OAUG;IACI,MAAM,CAAC,mBAAmB,CAC/B,MAA4B,EAC5B,OAAiC,EACjC,WAAmB,EACnB,qBAA6B,CAAC,EAC9B,oBAA4B,CAAC;QAE7B,iBAAiB;QACjB,6CAA6C;QAC7C,4BAA4B;QAC5B,IAAI,WAAW,IAAI,CAAC;eACf,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;eACxD,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC;YAC7D,OAAO,SAAS,CAAC;QACnB,IAAI,kBAAkB,GAAG,CAAC;YACxB,kBAAkB,GAAG,CAAC,CAAC;QACzB,OAAO,YAAY,CAAC,4BAA4B,CAAc,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IACrJ,CAAC;CACF;AAtHD,oCAsHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Range3d } from \"../../geometry3d/Range\";\n\n/** Type name FlexData is shorthand for a member or parameter which can be:\n * * undefined\n * * an array of values of type T\n * * a singleton of type T\n */\ntype FlexData<T> = undefined | T[] | T;\n/**\n * Type name IndexToType is shorthand for a member or parameter which can be:\n * * an array of values of type T\n * * a function from integers to type T.\n */\ntype IndexToType<T> = T[] | ((index: number) => T);\n\n/**\n * Map an (unchecked) integer to a parameterized type T, where the data argument can be either:\n * * an array of type T\n * * a function which takes an index and returns type T\n * @internal\n */\nfunction evaluateIndexToType<T>(data: IndexToType<T>, index: number): T {\n if (Array.isArray(data))\n return data[index];\n return data(index);\n}\n/**\n * Get data by index from a source that may be undefined, an array of item of type T, or a singleton of the item type.\n * @internal\n */\nfunction getByIndex<T>(index: number, data: FlexData<T>): T | undefined {\n if (data !== undefined) {\n if (Array.isArray(data)) {\n if (index < data.length)\n return data[index];\n } else {\n return data;\n }\n }\n return undefined;\n}\n/**\n * Return the number of items in an object that can be undefined, an array of item of type T, or a singleton of the item type.\n * @internal\n */\nfunction getFlexDataCount<T>(data: FlexData<T>): number {\n if (data !== undefined) {\n if (Array.isArray(data)) {\n return data.length;\n } else {\n return 1;\n }\n }\n return 0;\n}\n/**\n * Abstract class for handler objects called during traversal of a single range tree.\n * @internal\n */\nexport abstract class SingleTreeSearchHandler<AppDataType> {\n /** Return true if appData within the range should be offered to `processAppData`. */\n public abstract isRangeActive(range: Range3d): boolean;\n /**\n * Called for a (single) child referenced by a tree.\n * * This is only called when range checks on the path from root have been passed.\n * @param item child (of type AppDataType) in the tree.\n */\n public abstract processAppData(item: AppDataType): void;\n /**\n * Query to see if the active search has been aborted.\n * * Default implementation returns false so query runs to completion.\n * * Search processes check this after range tests and child processing.\n */\n public getIsAborted(): boolean { return false; }\n}\n/**\n * Abstract class for handler objects called during traversal of two range trees.\n * @internal\n */\nexport abstract class TwoTreeSearchHandler<AppDataType> {\n /** Return true if appData within the ranges should be offered to `processAppDataPair`. */\n public abstract isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean;\n /**\n * Called with AppDataType items from left tree and right tree.\n * * This is only called when range tests have been passed.\n * @param leftItem\n * @param rightItem\n */\n public abstract processAppDataPair(leftItem: AppDataType, rightItem: AppDataType): void;\n /**\n * Query to see if the active search has been aborted.\n * * Default implementation returns false so query runs to completion.\n * * Search processes check this after range tests and child processing.\n */\n public getIsAborted(): boolean { return false; }\n /** Whether to ignore z-coordinates in distance computations. */\n public getXYOnly(): boolean { return false; }\n}\n/**\n * This class refines the TwoTreeSearchHandler with an implementation of `isRangePairActive` appropriate for computing the minimum distance between trees.\n * * The concrete class must implement `getCurrentDistance()` method to provide the best-so-far distance.\n * * The implementation of `isRangePairActive` returns true if the distance between ranges is less than or equal to the `getCurrentDistance()` value.\n * @internal\n */\nexport abstract class TwoTreeDistanceMinimizationSearchHandler<AppDataType> extends TwoTreeSearchHandler<AppDataType>{\n /**\n * Provides the allowable distance between ranges.\n * * Range pairs with more than this distance separation are rejected.\n * * The implementation may alter (probably reduce) the getCurrentDistance() value as the search progresses.\n */\n public abstract getCurrentDistance(): number;\n /**\n * Method called to decide whether to process subtrees and immediate child appData items from a left tree node and right tree node.\n * @param leftRange range from a node in the left tree\n * @param rightRange range from a node in the right tree.\n * @returns true if the smallest distance from leftRange to rightRange is less than or equal to getCurrentDistance()\n */\n public override isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean {\n const currentDistance = this.getCurrentDistance();\n const distanceBetweenRanges = this.getXYOnly() ? leftRange.distanceToRangeXY(rightRange) : leftRange.distanceToRange(rightRange);\n return distanceBetweenRanges <= currentDistance;\n }\n}\n\nlet numNodeCreated = 0;\n\n/**\n * * TREE STRUCTURE\n * * A RangeTreeNode is part of a range tree.\n * * TREE is used here in a strictly _structural_ sense, which has no broad promises about data members.\n * * Each RangeNode points to 0, 1 or many children.\n * * Each child has (but does not point back to) a single parent.\n * * The overall tree has a single root.\n * * Each node is effectively the root of the tree of its children.\n * * NON-TREE DATA MEMBERS\n * * Data members in each node (in addition to children) are\n * * _range = the union of ranges below in the heap\n * * _appData = application data associated with the node.\n * * Construction methods may place multiple _appData items in each node.\n * * In common use, only the leaves will have _appData. However, the class definitions allow _appData at all nodes, and search algorithms must include them.\n * * CONSTRUCTION\n * * The RangeTreeNode.createByIndexSplits method constructs the tree with simple right-left splits within an array of input items.\n * * The appData is placed entirely in the leaves.\n * * The caller can specify:\n * * the number of _appData items per leaf\n * * the number of children per node within the tree.\n * * Compared to \"shallow\" trees with many children per node and many appData per leaf, \"deep\" trees with 2 children per node and 1 appData per leaf may have:\n * * faster search because lower nodes have smaller ranges that will be skipped by search algorithms.\n * * larger memory use because of more nodes\n * * For future construction methods:\n * * _appData \"above the leaves\" may allow nodes below to have smaller ranges, but add complexity to search.\n * @internal\n */\nexport class RangeTreeNode<AppDataType> {\n private _range: Range3d;\n private _appData: FlexData<AppDataType>;\n private _children: FlexData<RangeTreeNode<AppDataType>>;\n /** an id assigned sequentially as nodes are created. For debugging use only. */\n private _id: number;\n /**\n * CONSTRUCTOR\n * CAPTURE (not copy)\n * * range = range for search algorithms\n * * appData = application data relevant to this node.\n * * children = child node reference(s).\n */\n private constructor(range: Range3d, appData: FlexData<AppDataType>, children: FlexData<RangeTreeNode<AppDataType>>) {\n this._range = range;\n this._appData = appData;\n this._children = children;\n this._id = numNodeCreated++;\n // const childIds: number[] = [];\n // if (Array.isArray(this._children))\n // for (const c of this._children) childIds.push(c._id);\n // else if (this._children instanceof RangeTreeNode)\n // childIds.push(this._children._id);\n // const numAppData = getFlexDataCount(appData);\n // console.log({ id: this._id, childIds, numAppData });\n }\n /** Simplest public create: capture the range, appData, and children. */\n public static createCapture<AppDataType>(\n range: Range3d,\n appData: FlexData<AppDataType>,\n children: FlexData<RangeTreeNode<AppDataType>>): RangeTreeNode<AppDataType> {\n return new RangeTreeNode<AppDataType>(range, appData, children);\n }\n /** copy (not capture) from given data into the range in this RangeEntry */\n public setRange(data: Range3d) {\n this._range.setFrom(data);\n }\n /** return (a copy of) the range in this RangeEntry */\n public getRange(data?: Range3d): Range3d {\n return this._range.clone(data);\n }\n /** return (a reference to) the range in this RangeEntry */\n public getRangeRef(): Range3d {\n return this._range;\n }\n /**\n * Access a child by index.\n * * If the child data is an array, this dereferences the array.\n * * If the child data is a singleton, treat it as index 0.\n * * return undefined if there are no children.\n * @param index index of item to access.\n */\n public getChildByIndex(index: number): RangeTreeNode<AppDataType> | undefined {\n return getByIndex<RangeTreeNode<AppDataType>>(index, this._children);\n }\n /**\n * * Access an appData by index.\n * * If the appData data is an array, this dereferences the array.\n * * If the appData data is a singleton, treat it as if it is at index 0 in an array\n * * return undefined if there are no appData or for any index out of range.\n * @param index index of item to access.\n */\n public getAppDataByIndex(index: number): AppDataType | undefined {\n return getByIndex<AppDataType>(index, this._appData);\n }\n /** Access the children or child (does not clone). */\n public getAllChildren(): FlexData<RangeTreeNode<AppDataType>> {\n return this._children;\n }\n /** Access the appData array or singleton (does not clone). */\n public getAllAppData(): FlexData<AppDataType> {\n return this._appData;\n }\n /**\n * Count the direct children in this node of the tree.\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveNodeCount`.\n */\n public getNumChildren(): number {\n return getFlexDataCount(this._children);\n }\n /**\n * Count the appData items in this node of the tree.\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveAppDataCount`.\n */\n public getNumAppData(): number {\n return getFlexDataCount(this._appData);\n }\n /**\n * Depth-first tree iteration, calling `announceNode` on each node.\n * @param announceNode callback that returns true to recurse into children\n */\n public recurseIntoTree(announceNode: (node: RangeTreeNode<AppDataType>) => boolean) {\n const doChildren = announceNode(this);\n if (doChildren) {\n if (Array.isArray(this._children)) {\n for (const child of this._children)\n child.recurseIntoTree(announceNode);\n } else if (this._children !== undefined) {\n this._children.recurseIntoTree(announceNode);\n }\n }\n }\n /**\n * Depth-first tree iteration via handler.\n * * if handler decides the instance range is active, process appData, then recurse on children\n * * if handler decides to abort after processing an appData, skip processing rest of appData and children\n */\n public searchTopDown(handler: SingleTreeSearchHandler<AppDataType>) {\n if (handler.isRangeActive(this._range)) {\n let itemToProcess: AppDataType | undefined;\n for (let i = 0; undefined !== (itemToProcess = this.getAppDataByIndex(i)); i++) {\n // console.log(itemToProcess);\n handler.processAppData(itemToProcess);\n if (handler.getIsAborted())\n return;\n }\n let child: RangeTreeNode<AppDataType> | undefined;\n for (let i = 0; undefined !== (child = this.getChildByIndex(i)); i++) {\n child.searchTopDown(handler);\n }\n }\n }\n\n /**\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightStack.\n * @param leftAppData singleton or array with data \"from left\"\n * @param rightStack stack of nodes to process from right path.\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\n * @param handler search handler\n */\n private static processAppDataAndAppDataStack<AppDataType>(\n leftAppData: FlexData<AppDataType>,\n rightStack: RangeTreeNode<AppDataType>[],\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n if (leftAppData !== undefined) {\n let leftItem: AppDataType | undefined;\n let rightItem: AppDataType | undefined;\n // hmm.. we ASSUME that if the tip ranges passed, then all parent ranges would pass without further test.\n for (let rangeIndex = rightStack.length; rangeIndex-- > 0;) {\n const rightAppData = rightStack[rangeIndex]._appData;\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\n if (!reverseArgs)\n handler.processAppDataPair(leftItem, rightItem);\n else\n handler.processAppDataPair(rightItem, leftItem);\n if (handler.getIsAborted())\n return;\n }\n }\n }\n }\n }\n\n /**\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightAppData.\n * @param leftAppData singleton or array with data \"from left\"\n * @param rightAppData singleton or array with data \"from right\"\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\n * @param handler search handler\n */\n private static processAppDataAndAppData<AppDataType>(\n leftAppData: FlexData<AppDataType>,\n rightAppData: FlexData<AppDataType>,\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n if (leftAppData !== undefined && rightAppData !== undefined) {\n let leftItem: AppDataType | undefined;\n let rightItem: AppDataType | undefined;\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\n if (!reverseArgs)\n handler.processAppDataPair(leftItem, rightItem);\n else\n handler.processAppDataPair(rightItem, leftItem);\n if (handler.getIsAborted())\n return;\n }\n }\n }\n }\n /**\n * Push the tip node to stack(s).\n * @param tip new node (to be pushed)\n * @param fullPath complete path, which is always extended\n * @param partialPath partial path, which is only extended if the tip has _appData.\n */\n private static pushPaths<AppDataType>(\n tip: RangeTreeNode<AppDataType>,\n fullPath: RangeTreeNode<AppDataType>[],\n partialPath: RangeTreeNode<AppDataType>[],\n ) {\n fullPath.push(tip);\n if (tip._appData !== undefined) {\n partialPath.push(tip);\n }\n }\n /**\n * Pop the tip node from stack(s).\n * @param tip should match the fullPath tip.\n * @param fullPath complete path, which is always popped\n * @param partialPath partial path, which is only popped if the tip has _appData.\n */\n private static popPaths<AppDataType>(\n tip: RangeTreeNode<AppDataType>,\n fullPath: RangeTreeNode<AppDataType>[],\n partialPath: RangeTreeNode<AppDataType>[],\n ) {\n assert(fullPath[fullPath.length - 1] === tip);\n fullPath.pop();\n if (tip._appData !== undefined) {\n partialPath.pop();\n }\n }\n /**\n * Process nodes from left and right trees of dual search.\n * * The separate stacks for nodes that have appData is for efficiency.\n * * If data is entirely in the leaves (or just in a few nodes), the stacks will all be empty (or very small) and no time will be wasted looking up the stacks for appData to process with the other tip.\n * @param leftTip tip node being explored on left\n * @param leftStack stack of prior left nodes\n * @param leftStackWithAppData stack of prior left nodes which have appData.\n * @param rightTip tip node being explored on right.\n * @param rightStack stack of prior right nodes.\n * @param rightStackWithAppData stack of prior right nodes which have appData.\n * @param handler search handler\n */\n private static recursivePairSearch<AppDataType>(\n leftTip: RangeTreeNode<AppDataType>,\n leftStack: RangeTreeNode<AppDataType>[],\n leftStackWithAppData: RangeTreeNode<AppDataType>[],\n rightTip: RangeTreeNode<AppDataType>,\n rightStack: RangeTreeNode<AppDataType>[],\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n // console.log({ leftId: leftTip._id, rightId: rightTip._id });\n const leftTipHasAppData = leftTip._appData !== undefined;\n const rightTipHasAppData = rightTip._appData !== undefined;\n let leftChild: RangeTreeNode<AppDataType> | undefined;\n let rightChild: RangeTreeNode<AppDataType> | undefined;\n\n // process immediate appData from each tip node with the entire prior path of the other side (each stack currently lacks the tip).\n if (leftTipHasAppData && rightStackWithAppData.length > 0) {\n this.processAppDataAndAppDataStack<AppDataType>(leftTip._appData, rightStackWithAppData, false, handler);\n }\n if (leftStackWithAppData.length > 0 && rightTipHasAppData) {\n this.processAppDataAndAppDataStack<AppDataType>(rightTip._appData, leftStackWithAppData, true, handler);\n }\n\n if (handler.isRangePairActive(leftTip._range, rightTip._range)) {\n this.processAppDataAndAppData<AppDataType>(leftTip._appData, rightTip._appData, false, handler);\n\n if (leftTip._children !== undefined && rightTip._children !== undefined) {\n this.pushPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\n this.pushPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\n for (let rightIndex = 0; undefined !== (rightChild = getByIndex<RangeTreeNode<AppDataType>>(rightIndex, rightTip._children)); rightIndex++) {\n this.recursivePairSearch(\n leftChild, leftStack, leftStackWithAppData,\n rightChild, rightStack, rightStackWithAppData,\n handler);\n }\n }\n this.popPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\n this.popPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\n } else if (leftTip._children !== undefined) {\n this.leftRecursivePairSearch<AppDataType>(leftTip, rightTip, rightStackWithAppData, false, handler);\n } else if (rightTip._children !== undefined) {\n this.leftRecursivePairSearch<AppDataType>(rightTip, leftTip, leftStackWithAppData, true, handler);\n }\n }\n }\n /**\n * Recurse below the tip of leftTip, offering each level's appData to the appData of rightTip and rightStackWithAppData.\n * @param leftTip tip node being explored on left. Its appData is not processed.\n * @param rightTip tip node being explored on right. It has no children.\n * @param rightStackWithAppData stack of prior right nodes which have appData.\n * @param reverseArgs true if the caller is exchanging the sense of left and right\n * @param handler search handler\n */\n private static leftRecursivePairSearch<AppDataType>(\n leftTip: RangeTreeNode<AppDataType>,\n rightTip: RangeTreeNode<AppDataType>,\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\n reverseArgs: boolean,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n assert(rightTip._children === undefined);\n // The (possibly deep) left children appData needs to be offered to the right path (including tip)\n // Note that there are no stack push/pop operations -- the right stack is already reaching to leaf level, so there are no range or appData nodes to add.\n let leftChild: RangeTreeNode<AppDataType> | undefined;\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\n if (handler.isRangePairActive(leftChild._range, rightTip._range)) {\n this.processAppDataAndAppData<AppDataType>(leftChild._appData, rightTip._appData, reverseArgs, handler);\n this.processAppDataAndAppDataStack<AppDataType>(leftChild._appData, rightStackWithAppData, reverseArgs, handler);\n this.leftRecursivePairSearch<AppDataType>(leftChild, rightTip, rightStackWithAppData, reverseArgs, handler);\n }\n }\n }\n /**\n * Recursive search down two trees, with range tests and child processing under control of a handler.\n * @param leftRoot root of left tree\n * @param rightRoot root of right tree\n * @param handler handler for range tests and child process\n */\n public static searchTwoTreesTopDown<AppDataType>(\n leftRoot: RangeTreeNode<AppDataType>,\n rightRoot: RangeTreeNode<AppDataType>,\n handler: TwoTreeSearchHandler<AppDataType>,\n ) {\n this.recursivePairSearch(leftRoot, [], [], rightRoot, [], [], handler);\n }\n}\n/**\n * Utilities for various operations on RangeTree\n * @internal\n */\nexport class RangeTreeOps {\n /** Count nodes in this tree. */\n public static getRecursiveNodeCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\n let count = 0;\n root.recurseIntoTree((_node: RangeTreeNode<AppDataType>): boolean => { count++; return true; });\n return count;\n }\n /** Count appData in this tree. */\n public static getRecursiveAppDataCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\n let count = 0;\n root.recurseIntoTree(\n (node: RangeTreeNode<AppDataType>): boolean => { count += node.getNumAppData(); return true; });\n return count;\n }\n /**\n * Create a leaf referencing appData items indexed index0<=index<index1 and with combined range of the same indices\n * @param ranges access to ranges\n * @param appData access to AppDataType items\n * @param index0 first index for block of items\n * @param index1 upper limit index for block of items.\n * @param arrayLength one more than the largest range/appData index\n * @returns newly created node.\n */\n private static createLeafInIndexRange<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n index0: number,\n index1: number,\n arrayLength: number): RangeTreeNode<AppDataType> {\n const appDataBlock: AppDataType[] = [];\n const range = Range3d.createNull();\n index1 = Math.min(index1, arrayLength);\n // console.log({ case: \"LEAF\", index0, index1 });\n for (let i = index0; i < index1; i++) {\n appDataBlock.push(evaluateIndexToType(appData, i));\n range.extendRange(evaluateIndexToType(ranges, i));\n }\n return RangeTreeNode.createCapture(range, appDataBlock, undefined);\n }\n /**\n * Split the array entries appData[index0 <= i < index1] into blocks of at most maxChildPerNode * maxAppDataPerLeaf and assemble into a tree structure.\n * @param ranges access to ranges\n * @param appData access to AppDataType items\n * @param index0 start index of the block to access\n * @param index1 terminal index for the block (one after final)\n * @param arrayLength one more than the largest range/appData index\n * @param maxChildPerNode max number of child nodes in each interior node\n * @param maxAppDataPerLeaf max number of appData items in each leaf.\n * @returns\n */\n private static createRecursiveByIndexSplits<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n index0: number,\n index1: number,\n arrayLength: number,\n maxChildPerNode: number,\n maxAppDataPerLeaf: number,\n ): RangeTreeNode<AppDataType> | undefined {\n if (index1 > arrayLength)\n index1 = arrayLength;\n\n const range = Range3d.createNull();\n const children: RangeTreeNode<AppDataType>[] = [];\n const maxChildrenAppData = maxChildPerNode * maxAppDataPerLeaf;\n // console.log({ name: \"createRecursive\", index0, index1, maxChildrenAppData });\n\n if (index1 <= index0 + maxChildrenAppData) { // index range is small enough to hold the appData in leaf children\n // console.log({ case: \"LEAF GROUP\", index0, index1 });\n for (let indexA = index0 + maxAppDataPerLeaf; index0 < index1; index0 = indexA, indexA = Math.min(indexA + maxAppDataPerLeaf, index1)) {\n const leaf = RangeTreeOps.createLeafInIndexRange(ranges, appData, index0, indexA, arrayLength);\n if (leaf !== undefined) {\n range.extendRange(leaf.getRangeRef());\n children.push(leaf);\n }\n }\n } else { // split the appData among interior and leaf children\n // console.log({ case: \"INTERIOR\", index0, index1 });\n const numPerGulp = Math.ceil((index1 - index0) / maxChildPerNode);\n for (let indexA = index0 + numPerGulp; index0 < index1; index0 = indexA, indexA = Math.min(indexA + numPerGulp, index1)) {\n const child = this.createRecursiveByIndexSplits(ranges, appData, index0, indexA, arrayLength, maxChildPerNode, maxAppDataPerLeaf);\n if (child !== undefined) {\n range.extendRange(child.getRangeRef());\n children.push(child);\n }\n }\n }\n return (children.length > 0) ? RangeTreeNode.createCapture(range, undefined, children) : undefined;\n }\n /**\n * Create a range tree by simple left-right split of given ranges.\n * * Leaves carry the inputs in left-to-right order.\n * * Each leaf range is labeled by its corresponding object(s) in the appData array.\n * @param ranges access to ranges.\n * @param appData access to AppDataType items (for leaves).\n * @param arrayLength one more than the largest range/appData index\n * @param maxChildrenPerNode max number of child nodes allowed for each interior node.\n * @param maxAppDataPerLeaf max number of appData items allowed in each leaf.\n * @returns the root of the new tree, or undefined if array lengths differ or are zero.\n */\n public static createByIndexSplits<AppDataType>(\n ranges: IndexToType<Range3d>,\n appData: IndexToType<AppDataType>,\n arrayLength: number,\n maxChildrenPerNode: number = 2,\n maxAppDataPerLeaf: number = 2,\n ): RangeTreeNode<AppDataType> | undefined {\n // console.log();\n // const numData = getFlexDataCount(appData);\n // console.log({ numData });\n if (arrayLength <= 0\n || (Array.isArray(ranges) && ranges.length !== arrayLength)\n || (Array.isArray(appData) && appData.length !== arrayLength))\n return undefined;\n if (maxChildrenPerNode < 2)\n maxChildrenPerNode = 2;\n return RangeTreeOps.createRecursiveByIndexSplits<AppDataType>(ranges, appData, 0, arrayLength, arrayLength, maxChildrenPerNode, maxAppDataPerLeaf);\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"RangeTreeNode.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeNode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,kDAAiD;AAejD;;;;;GAKG;AACH,SAAS,mBAAmB,CAAI,IAAoB,EAAE,KAAa;IACjE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AACD;;;GAGG;AACH,SAAS,UAAU,CAAI,KAAa,EAAE,IAAiB;IACrD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;Y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AAC;IACrG,CAAC;IACD;;;;;;;;;;OAUG;IACI,MAAM,CAAC,mBAAmB,CAC/B,MAA4B,EAC5B,OAAiC,EACjC,WAAmB,EACnB,qBAA6B,CAAC,EAC9B,oBAA4B,CAAC;QAE7B,iBAAiB;QACjB,6CAA6C;QAC7C,4BAA4B;QAC5B,IAAI,WAAW,IAAI,CAAC;eACf,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;eACxD,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC;YAC7D,OAAO,SAAS,CAAC;QACnB,IAAI,kBAAkB,GAAG,CAAC;YACxB,kBAAkB,GAAG,CAAC,CAAC;QACzB,OAAO,YAAY,CAAC,4BAA4B,CAAc,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IACrJ,CAAC;CACF;AAtHD,oCAsHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\n\r\n/** Type name FlexData is shorthand for a member or parameter which can be:\r\n * * undefined\r\n * * an array of values of type T\r\n * * a singleton of type T\r\n */\r\ntype FlexData<T> = undefined | T[] | T;\r\n/**\r\n * Type name IndexToType is shorthand for a member or parameter which can be:\r\n * * an array of values of type T\r\n * * a function from integers to type T.\r\n */\r\ntype IndexToType<T> = T[] | ((index: number) => T);\r\n\r\n/**\r\n * Map an (unchecked) integer to a parameterized type T, where the data argument can be either:\r\n * * an array of type T\r\n * * a function which takes an index and returns type T\r\n * @internal\r\n */\r\nfunction evaluateIndexToType<T>(data: IndexToType<T>, index: number): T {\r\n if (Array.isArray(data))\r\n return data[index];\r\n return data(index);\r\n}\r\n/**\r\n * Get data by index from a source that may be undefined, an array of item of type T, or a singleton of the item type.\r\n * @internal\r\n */\r\nfunction getByIndex<T>(index: number, data: FlexData<T>): T | undefined {\r\n if (data !== undefined) {\r\n if (Array.isArray(data)) {\r\n if (index < data.length)\r\n return data[index];\r\n } else {\r\n return data;\r\n }\r\n }\r\n return undefined;\r\n}\r\n/**\r\n * Return the number of items in an object that can be undefined, an array of item of type T, or a singleton of the item type.\r\n * @internal\r\n */\r\nfunction getFlexDataCount<T>(data: FlexData<T>): number {\r\n if (data !== undefined) {\r\n if (Array.isArray(data)) {\r\n return data.length;\r\n } else {\r\n return 1;\r\n }\r\n }\r\n return 0;\r\n}\r\n/**\r\n * Abstract class for handler objects called during traversal of a single range tree.\r\n * @internal\r\n */\r\nexport abstract class SingleTreeSearchHandler<AppDataType> {\r\n /** Return true if appData within the range should be offered to `processAppData`. */\r\n public abstract isRangeActive(range: Range3d): boolean;\r\n /**\r\n * Called for a (single) child referenced by a tree.\r\n * * This is only called when range checks on the path from root have been passed.\r\n * @param item child (of type AppDataType) in the tree.\r\n */\r\n public abstract processAppData(item: AppDataType): void;\r\n /**\r\n * Query to see if the active search has been aborted.\r\n * * Default implementation returns false so query runs to completion.\r\n * * Search processes check this after range tests and child processing.\r\n */\r\n public getIsAborted(): boolean { return false; }\r\n}\r\n/**\r\n * Abstract class for handler objects called during traversal of two range trees.\r\n * @internal\r\n */\r\nexport abstract class TwoTreeSearchHandler<AppDataType> {\r\n /** Return true if appData within the ranges should be offered to `processAppDataPair`. */\r\n public abstract isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean;\r\n /**\r\n * Called with AppDataType items from left tree and right tree.\r\n * * This is only called when range tests have been passed.\r\n * @param leftItem\r\n * @param rightItem\r\n */\r\n public abstract processAppDataPair(leftItem: AppDataType, rightItem: AppDataType): void;\r\n /**\r\n * Query to see if the active search has been aborted.\r\n * * Default implementation returns false so query runs to completion.\r\n * * Search processes check this after range tests and child processing.\r\n */\r\n public getIsAborted(): boolean { return false; }\r\n /** Whether to ignore z-coordinates in distance computations. */\r\n public getXYOnly(): boolean { return false; }\r\n}\r\n/**\r\n * This class refines the TwoTreeSearchHandler with an implementation of `isRangePairActive` appropriate for computing the minimum distance between trees.\r\n * * The concrete class must implement `getCurrentDistance()` method to provide the best-so-far distance.\r\n * * The implementation of `isRangePairActive` returns true if the distance between ranges is less than or equal to the `getCurrentDistance()` value.\r\n * @internal\r\n */\r\nexport abstract class TwoTreeDistanceMinimizationSearchHandler<AppDataType> extends TwoTreeSearchHandler<AppDataType>{\r\n /**\r\n * Provides the allowable distance between ranges.\r\n * * Range pairs with more than this distance separation are rejected.\r\n * * The implementation may alter (probably reduce) the getCurrentDistance() value as the search progresses.\r\n */\r\n public abstract getCurrentDistance(): number;\r\n /**\r\n * Method called to decide whether to process subtrees and immediate child appData items from a left tree node and right tree node.\r\n * @param leftRange range from a node in the left tree\r\n * @param rightRange range from a node in the right tree.\r\n * @returns true if the smallest distance from leftRange to rightRange is less than or equal to getCurrentDistance()\r\n */\r\n public override isRangePairActive(leftRange: Range3d, rightRange: Range3d): boolean {\r\n const currentDistance = this.getCurrentDistance();\r\n const distanceBetweenRanges = this.getXYOnly() ? leftRange.distanceToRangeXY(rightRange) : leftRange.distanceToRange(rightRange);\r\n return distanceBetweenRanges <= currentDistance;\r\n }\r\n}\r\n\r\nlet numNodeCreated = 0;\r\n\r\n/**\r\n * * TREE STRUCTURE\r\n * * A RangeTreeNode is part of a range tree.\r\n * * TREE is used here in a strictly _structural_ sense, which has no broad promises about data members.\r\n * * Each RangeNode points to 0, 1 or many children.\r\n * * Each child has (but does not point back to) a single parent.\r\n * * The overall tree has a single root.\r\n * * Each node is effectively the root of the tree of its children.\r\n * * NON-TREE DATA MEMBERS\r\n * * Data members in each node (in addition to children) are\r\n * * _range = the union of ranges below in the heap\r\n * * _appData = application data associated with the node.\r\n * * Construction methods may place multiple _appData items in each node.\r\n * * In common use, only the leaves will have _appData. However, the class definitions allow _appData at all nodes, and search algorithms must include them.\r\n * * CONSTRUCTION\r\n * * The RangeTreeNode.createByIndexSplits method constructs the tree with simple right-left splits within an array of input items.\r\n * * The appData is placed entirely in the leaves.\r\n * * The caller can specify:\r\n * * the number of _appData items per leaf\r\n * * the number of children per node within the tree.\r\n * * Compared to \"shallow\" trees with many children per node and many appData per leaf, \"deep\" trees with 2 children per node and 1 appData per leaf may have:\r\n * * faster search because lower nodes have smaller ranges that will be skipped by search algorithms.\r\n * * larger memory use because of more nodes\r\n * * For future construction methods:\r\n * * _appData \"above the leaves\" may allow nodes below to have smaller ranges, but add complexity to search.\r\n * @internal\r\n */\r\nexport class RangeTreeNode<AppDataType> {\r\n private _range: Range3d;\r\n private _appData: FlexData<AppDataType>;\r\n private _children: FlexData<RangeTreeNode<AppDataType>>;\r\n /** an id assigned sequentially as nodes are created. For debugging use only. */\r\n private _id: number;\r\n /**\r\n * CONSTRUCTOR\r\n * CAPTURE (not copy)\r\n * * range = range for search algorithms\r\n * * appData = application data relevant to this node.\r\n * * children = child node reference(s).\r\n */\r\n private constructor(range: Range3d, appData: FlexData<AppDataType>, children: FlexData<RangeTreeNode<AppDataType>>) {\r\n this._range = range;\r\n this._appData = appData;\r\n this._children = children;\r\n this._id = numNodeCreated++;\r\n // const childIds: number[] = [];\r\n // if (Array.isArray(this._children))\r\n // for (const c of this._children) childIds.push(c._id);\r\n // else if (this._children instanceof RangeTreeNode)\r\n // childIds.push(this._children._id);\r\n // const numAppData = getFlexDataCount(appData);\r\n // console.log({ id: this._id, childIds, numAppData });\r\n }\r\n /** Simplest public create: capture the range, appData, and children. */\r\n public static createCapture<AppDataType>(\r\n range: Range3d,\r\n appData: FlexData<AppDataType>,\r\n children: FlexData<RangeTreeNode<AppDataType>>): RangeTreeNode<AppDataType> {\r\n return new RangeTreeNode<AppDataType>(range, appData, children);\r\n }\r\n /** copy (not capture) from given data into the range in this RangeEntry */\r\n public setRange(data: Range3d) {\r\n this._range.setFrom(data);\r\n }\r\n /** return (a copy of) the range in this RangeEntry */\r\n public getRange(data?: Range3d): Range3d {\r\n return this._range.clone(data);\r\n }\r\n /** return (a reference to) the range in this RangeEntry */\r\n public getRangeRef(): Range3d {\r\n return this._range;\r\n }\r\n /**\r\n * Access a child by index.\r\n * * If the child data is an array, this dereferences the array.\r\n * * If the child data is a singleton, treat it as index 0.\r\n * * return undefined if there are no children.\r\n * @param index index of item to access.\r\n */\r\n public getChildByIndex(index: number): RangeTreeNode<AppDataType> | undefined {\r\n return getByIndex<RangeTreeNode<AppDataType>>(index, this._children);\r\n }\r\n /**\r\n * * Access an appData by index.\r\n * * If the appData data is an array, this dereferences the array.\r\n * * If the appData data is a singleton, treat it as if it is at index 0 in an array\r\n * * return undefined if there are no appData or for any index out of range.\r\n * @param index index of item to access.\r\n */\r\n public getAppDataByIndex(index: number): AppDataType | undefined {\r\n return getByIndex<AppDataType>(index, this._appData);\r\n }\r\n /** Access the children or child (does not clone). */\r\n public getAllChildren(): FlexData<RangeTreeNode<AppDataType>> {\r\n return this._children;\r\n }\r\n /** Access the appData array or singleton (does not clone). */\r\n public getAllAppData(): FlexData<AppDataType> {\r\n return this._appData;\r\n }\r\n /**\r\n * Count the direct children in this node of the tree.\r\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveNodeCount`.\r\n */\r\n public getNumChildren(): number {\r\n return getFlexDataCount(this._children);\r\n }\r\n /**\r\n * Count the appData items in this node of the tree.\r\n * * This is not recursive. For a recursive count, use `RangeTreeOps.getRecursiveAppDataCount`.\r\n */\r\n public getNumAppData(): number {\r\n return getFlexDataCount(this._appData);\r\n }\r\n /**\r\n * Depth-first tree iteration, calling `announceNode` on each node.\r\n * @param announceNode callback that returns true to recurse into children\r\n */\r\n public recurseIntoTree(announceNode: (node: RangeTreeNode<AppDataType>) => boolean) {\r\n const doChildren = announceNode(this);\r\n if (doChildren) {\r\n if (Array.isArray(this._children)) {\r\n for (const child of this._children)\r\n child.recurseIntoTree(announceNode);\r\n } else if (this._children !== undefined) {\r\n this._children.recurseIntoTree(announceNode);\r\n }\r\n }\r\n }\r\n /**\r\n * Depth-first tree iteration via handler.\r\n * * if handler decides the instance range is active, process appData, then recurse on children\r\n * * if handler decides to abort after processing an appData, skip processing rest of appData and children\r\n */\r\n public searchTopDown(handler: SingleTreeSearchHandler<AppDataType>) {\r\n if (handler.isRangeActive(this._range)) {\r\n let itemToProcess: AppDataType | undefined;\r\n for (let i = 0; undefined !== (itemToProcess = this.getAppDataByIndex(i)); i++) {\r\n // console.log(itemToProcess);\r\n handler.processAppData(itemToProcess);\r\n if (handler.getIsAborted())\r\n return;\r\n }\r\n let child: RangeTreeNode<AppDataType> | undefined;\r\n for (let i = 0; undefined !== (child = this.getChildByIndex(i)); i++) {\r\n child.searchTopDown(handler);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightStack.\r\n * @param leftAppData singleton or array with data \"from left\"\r\n * @param rightStack stack of nodes to process from right path.\r\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\r\n * @param handler search handler\r\n */\r\n private static processAppDataAndAppDataStack<AppDataType>(\r\n leftAppData: FlexData<AppDataType>,\r\n rightStack: RangeTreeNode<AppDataType>[],\r\n reverseArgs: boolean,\r\n handler: TwoTreeSearchHandler<AppDataType>,\r\n ) {\r\n if (leftAppData !== undefined) {\r\n let leftItem: AppDataType | undefined;\r\n let rightItem: AppDataType | undefined;\r\n // hmm.. we ASSUME that if the tip ranges passed, then all parent ranges would pass without further test.\r\n for (let rangeIndex = rightStack.length; rangeIndex-- > 0;) {\r\n const rightAppData = rightStack[rangeIndex]._appData;\r\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\r\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\r\n if (!reverseArgs)\r\n handler.processAppDataPair(leftItem, rightItem);\r\n else\r\n handler.processAppDataPair(rightItem, leftItem);\r\n if (handler.getIsAborted())\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Apply the handler.processAppDataPair method to each pair of appData items from leftAppData and rightAppData.\r\n * @param leftAppData singleton or array with data \"from left\"\r\n * @param rightAppData singleton or array with data \"from right\"\r\n * @param reverseArgs true if the caller is exchanging the sense of left and right and this should be undone in the actual call to handler.processAppDataPair.\r\n * @param handler search handler\r\n */\r\n private static processAppDataAndAppData<AppDataType>(\r\n leftAppData: FlexData<AppDataType>,\r\n rightAppData: FlexData<AppDataType>,\r\n reverseArgs: boolean,\r\n handler: TwoTreeSearchHandler<AppDataType>,\r\n ) {\r\n if (leftAppData !== undefined && rightAppData !== undefined) {\r\n let leftItem: AppDataType | undefined;\r\n let rightItem: AppDataType | undefined;\r\n for (let rightIndex = 0; undefined !== (rightItem = getByIndex<AppDataType>(rightIndex, rightAppData)); rightIndex++) {\r\n for (let leftIndex = 0; undefined !== (leftItem = getByIndex<AppDataType>(leftIndex, leftAppData)); leftIndex++) {\r\n if (!reverseArgs)\r\n handler.processAppDataPair(leftItem, rightItem);\r\n else\r\n handler.processAppDataPair(rightItem, leftItem);\r\n if (handler.getIsAborted())\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Push the tip node to stack(s).\r\n * @param tip new node (to be pushed)\r\n * @param fullPath complete path, which is always extended\r\n * @param partialPath partial path, which is only extended if the tip has _appData.\r\n */\r\n private static pushPaths<AppDataType>(\r\n tip: RangeTreeNode<AppDataType>,\r\n fullPath: RangeTreeNode<AppDataType>[],\r\n partialPath: RangeTreeNode<AppDataType>[],\r\n ) {\r\n fullPath.push(tip);\r\n if (tip._appData !== undefined) {\r\n partialPath.push(tip);\r\n }\r\n }\r\n /**\r\n * Pop the tip node from stack(s).\r\n * @param tip should match the fullPath tip.\r\n * @param fullPath complete path, which is always popped\r\n * @param partialPath partial path, which is only popped if the tip has _appData.\r\n */\r\n private static popPaths<AppDataType>(\r\n tip: RangeTreeNode<AppDataType>,\r\n fullPath: RangeTreeNode<AppDataType>[],\r\n partialPath: RangeTreeNode<AppDataType>[],\r\n ) {\r\n assert(fullPath[fullPath.length - 1] === tip);\r\n fullPath.pop();\r\n if (tip._appData !== undefined) {\r\n partialPath.pop();\r\n }\r\n }\r\n /**\r\n * Process nodes from left and right trees of dual search.\r\n * * The separate stacks for nodes that have appData is for efficiency.\r\n * * If data is entirely in the leaves (or just in a few nodes), the stacks will all be empty (or very small) and no time will be wasted looking up the stacks for appData to process with the other tip.\r\n * @param leftTip tip node being explored on left\r\n * @param leftStack stack of prior left nodes\r\n * @param leftStackWithAppData stack of prior left nodes which have appData.\r\n * @param rightTip tip node being explored on right.\r\n * @param rightStack stack of prior right nodes.\r\n * @param rightStackWithAppData stack of prior right nodes which have appData.\r\n * @param handler search handler\r\n */\r\n private static recursivePairSearch<AppDataType>(\r\n leftTip: RangeTreeNode<AppDataType>,\r\n leftStack: RangeTreeNode<AppDataType>[],\r\n leftStackWithAppData: RangeTreeNode<AppDataType>[],\r\n rightTip: RangeTreeNode<AppDataType>,\r\n rightStack: RangeTreeNode<AppDataType>[],\r\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\r\n handler: TwoTreeSearchHandler<AppDataType>,\r\n ) {\r\n // console.log({ leftId: leftTip._id, rightId: rightTip._id });\r\n const leftTipHasAppData = leftTip._appData !== undefined;\r\n const rightTipHasAppData = rightTip._appData !== undefined;\r\n let leftChild: RangeTreeNode<AppDataType> | undefined;\r\n let rightChild: RangeTreeNode<AppDataType> | undefined;\r\n\r\n // process immediate appData from each tip node with the entire prior path of the other side (each stack currently lacks the tip).\r\n if (leftTipHasAppData && rightStackWithAppData.length > 0) {\r\n this.processAppDataAndAppDataStack<AppDataType>(leftTip._appData, rightStackWithAppData, false, handler);\r\n }\r\n if (leftStackWithAppData.length > 0 && rightTipHasAppData) {\r\n this.processAppDataAndAppDataStack<AppDataType>(rightTip._appData, leftStackWithAppData, true, handler);\r\n }\r\n\r\n if (handler.isRangePairActive(leftTip._range, rightTip._range)) {\r\n this.processAppDataAndAppData<AppDataType>(leftTip._appData, rightTip._appData, false, handler);\r\n\r\n if (leftTip._children !== undefined && rightTip._children !== undefined) {\r\n this.pushPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\r\n this.pushPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\r\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\r\n for (let rightIndex = 0; undefined !== (rightChild = getByIndex<RangeTreeNode<AppDataType>>(rightIndex, rightTip._children)); rightIndex++) {\r\n this.recursivePairSearch(\r\n leftChild, leftStack, leftStackWithAppData,\r\n rightChild, rightStack, rightStackWithAppData,\r\n handler);\r\n }\r\n }\r\n this.popPaths<AppDataType>(leftTip, leftStack, leftStackWithAppData);\r\n this.popPaths<AppDataType>(rightTip, rightStack, rightStackWithAppData);\r\n } else if (leftTip._children !== undefined) {\r\n this.leftRecursivePairSearch<AppDataType>(leftTip, rightTip, rightStackWithAppData, false, handler);\r\n } else if (rightTip._children !== undefined) {\r\n this.leftRecursivePairSearch<AppDataType>(rightTip, leftTip, leftStackWithAppData, true, handler);\r\n }\r\n }\r\n }\r\n /**\r\n * Recurse below the tip of leftTip, offering each level's appData to the appData of rightTip and rightStackWithAppData.\r\n * @param leftTip tip node being explored on left. Its appData is not processed.\r\n * @param rightTip tip node being explored on right. It has no children.\r\n * @param rightStackWithAppData stack of prior right nodes which have appData.\r\n * @param reverseArgs true if the caller is exchanging the sense of left and right\r\n * @param handler search handler\r\n */\r\n private static leftRecursivePairSearch<AppDataType>(\r\n leftTip: RangeTreeNode<AppDataType>,\r\n rightTip: RangeTreeNode<AppDataType>,\r\n rightStackWithAppData: RangeTreeNode<AppDataType>[],\r\n reverseArgs: boolean,\r\n handler: TwoTreeSearchHandler<AppDataType>,\r\n ) {\r\n assert(rightTip._children === undefined);\r\n // The (possibly deep) left children appData needs to be offered to the right path (including tip)\r\n // Note that there are no stack push/pop operations -- the right stack is already reaching to leaf level, so there are no range or appData nodes to add.\r\n let leftChild: RangeTreeNode<AppDataType> | undefined;\r\n for (let leftIndex = 0; undefined !== (leftChild = getByIndex<RangeTreeNode<AppDataType>>(leftIndex, leftTip._children)); leftIndex++) {\r\n if (handler.isRangePairActive(leftChild._range, rightTip._range)) {\r\n this.processAppDataAndAppData<AppDataType>(leftChild._appData, rightTip._appData, reverseArgs, handler);\r\n this.processAppDataAndAppDataStack<AppDataType>(leftChild._appData, rightStackWithAppData, reverseArgs, handler);\r\n this.leftRecursivePairSearch<AppDataType>(leftChild, rightTip, rightStackWithAppData, reverseArgs, handler);\r\n }\r\n }\r\n }\r\n /**\r\n * Recursive search down two trees, with range tests and child processing under control of a handler.\r\n * @param leftRoot root of left tree\r\n * @param rightRoot root of right tree\r\n * @param handler handler for range tests and child process\r\n */\r\n public static searchTwoTreesTopDown<AppDataType>(\r\n leftRoot: RangeTreeNode<AppDataType>,\r\n rightRoot: RangeTreeNode<AppDataType>,\r\n handler: TwoTreeSearchHandler<AppDataType>,\r\n ) {\r\n this.recursivePairSearch(leftRoot, [], [], rightRoot, [], [], handler);\r\n }\r\n}\r\n/**\r\n * Utilities for various operations on RangeTree\r\n * @internal\r\n */\r\nexport class RangeTreeOps {\r\n /** Count nodes in this tree. */\r\n public static getRecursiveNodeCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\r\n let count = 0;\r\n root.recurseIntoTree((_node: RangeTreeNode<AppDataType>): boolean => { count++; return true; });\r\n return count;\r\n }\r\n /** Count appData in this tree. */\r\n public static getRecursiveAppDataCount<AppDataType>(root: RangeTreeNode<AppDataType>): number {\r\n let count = 0;\r\n root.recurseIntoTree(\r\n (node: RangeTreeNode<AppDataType>): boolean => { count += node.getNumAppData(); return true; });\r\n return count;\r\n }\r\n /**\r\n * Create a leaf referencing appData items indexed index0<=index<index1 and with combined range of the same indices\r\n * @param ranges access to ranges\r\n * @param appData access to AppDataType items\r\n * @param index0 first index for block of items\r\n * @param index1 upper limit index for block of items.\r\n * @param arrayLength one more than the largest range/appData index\r\n * @returns newly created node.\r\n */\r\n private static createLeafInIndexRange<AppDataType>(\r\n ranges: IndexToType<Range3d>,\r\n appData: IndexToType<AppDataType>,\r\n index0: number,\r\n index1: number,\r\n arrayLength: number): RangeTreeNode<AppDataType> {\r\n const appDataBlock: AppDataType[] = [];\r\n const range = Range3d.createNull();\r\n index1 = Math.min(index1, arrayLength);\r\n // console.log({ case: \"LEAF\", index0, index1 });\r\n for (let i = index0; i < index1; i++) {\r\n appDataBlock.push(evaluateIndexToType(appData, i));\r\n range.extendRange(evaluateIndexToType(ranges, i));\r\n }\r\n return RangeTreeNode.createCapture(range, appDataBlock, undefined);\r\n }\r\n /**\r\n * Split the array entries appData[index0 <= i < index1] into blocks of at most maxChildPerNode * maxAppDataPerLeaf and assemble into a tree structure.\r\n * @param ranges access to ranges\r\n * @param appData access to AppDataType items\r\n * @param index0 start index of the block to access\r\n * @param index1 terminal index for the block (one after final)\r\n * @param arrayLength one more than the largest range/appData index\r\n * @param maxChildPerNode max number of child nodes in each interior node\r\n * @param maxAppDataPerLeaf max number of appData items in each leaf.\r\n * @returns\r\n */\r\n private static createRecursiveByIndexSplits<AppDataType>(\r\n ranges: IndexToType<Range3d>,\r\n appData: IndexToType<AppDataType>,\r\n index0: number,\r\n index1: number,\r\n arrayLength: number,\r\n maxChildPerNode: number,\r\n maxAppDataPerLeaf: number,\r\n ): RangeTreeNode<AppDataType> | undefined {\r\n if (index1 > arrayLength)\r\n index1 = arrayLength;\r\n\r\n const range = Range3d.createNull();\r\n const children: RangeTreeNode<AppDataType>[] = [];\r\n const maxChildrenAppData = maxChildPerNode * maxAppDataPerLeaf;\r\n // console.log({ name: \"createRecursive\", index0, index1, maxChildrenAppData });\r\n\r\n if (index1 <= index0 + maxChildrenAppData) { // index range is small enough to hold the appData in leaf children\r\n // console.log({ case: \"LEAF GROUP\", index0, index1 });\r\n for (let indexA = index0 + maxAppDataPerLeaf; index0 < index1; index0 = indexA, indexA = Math.min(indexA + maxAppDataPerLeaf, index1)) {\r\n const leaf = RangeTreeOps.createLeafInIndexRange(ranges, appData, index0, indexA, arrayLength);\r\n if (leaf !== undefined) {\r\n range.extendRange(leaf.getRangeRef());\r\n children.push(leaf);\r\n }\r\n }\r\n } else { // split the appData among interior and leaf children\r\n // console.log({ case: \"INTERIOR\", index0, index1 });\r\n const numPerGulp = Math.ceil((index1 - index0) / maxChildPerNode);\r\n for (let indexA = index0 + numPerGulp; index0 < index1; index0 = indexA, indexA = Math.min(indexA + numPerGulp, index1)) {\r\n const child = this.createRecursiveByIndexSplits(ranges, appData, index0, indexA, arrayLength, maxChildPerNode, maxAppDataPerLeaf);\r\n if (child !== undefined) {\r\n range.extendRange(child.getRangeRef());\r\n children.push(child);\r\n }\r\n }\r\n }\r\n return (children.length > 0) ? RangeTreeNode.createCapture(range, undefined, children) : undefined;\r\n }\r\n /**\r\n * Create a range tree by simple left-right split of given ranges.\r\n * * Leaves carry the inputs in left-to-right order.\r\n * * Each leaf range is labeled by its corresponding object(s) in the appData array.\r\n * @param ranges access to ranges.\r\n * @param appData access to AppDataType items (for leaves).\r\n * @param arrayLength one more than the largest range/appData index\r\n * @param maxChildrenPerNode max number of child nodes allowed for each interior node.\r\n * @param maxAppDataPerLeaf max number of appData items allowed in each leaf.\r\n * @returns the root of the new tree, or undefined if array lengths differ or are zero.\r\n */\r\n public static createByIndexSplits<AppDataType>(\r\n ranges: IndexToType<Range3d>,\r\n appData: IndexToType<AppDataType>,\r\n arrayLength: number,\r\n maxChildrenPerNode: number = 2,\r\n maxAppDataPerLeaf: number = 2,\r\n ): RangeTreeNode<AppDataType> | undefined {\r\n // console.log();\r\n // const numData = getFlexDataCount(appData);\r\n // console.log({ numData });\r\n if (arrayLength <= 0\r\n || (Array.isArray(ranges) && ranges.length !== arrayLength)\r\n || (Array.isArray(appData) && appData.length !== arrayLength))\r\n return undefined;\r\n if (maxChildrenPerNode < 2)\r\n maxChildrenPerNode = 2;\r\n return RangeTreeOps.createRecursiveByIndexSplits<AppDataType>(ranges, appData, 0, arrayLength, arrayLength, maxChildrenPerNode, maxAppDataPerLeaf);\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeTreeSearchHandlers.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeSearchHandlers.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yEAA+F;AAC/F,6DAA0D;AAC1D,2DAAwD;AACxD,6CAA0C;AAC1C,sEAA2D;AAC3D,4DAAgF;AAGhF,gEAA+I;AAE/I,6DAA0D;AAG1D,mDAAoG;AAEpG;;;;GAIG;AACH,MAAa,6CAA8C,SAAQ,uCAA+B;IAChG,0BAA0B;IACnB,OAAO,CAA+B;IAC7C,4BAA4B;IACrB,WAAW,CAA6B;IAC/C,kCAAkC;IAC3B,UAAU,CAAU;IAE3B;;;;;OAKG;IACH,YAAmB,UAA0B,EAAE,OAAqC,EAAE,OAAgB;QACpG,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC;YACtC,OAAO,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,uCAAkB,CAAC,MAAM,CAAS,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,UAAU,GAAG,yBAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IACD,uCAAuC;IAChC,SAAS;QACd,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,cAAc,KAAK,SAA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,CAAC,CAAC,CAAC,CAAC,kDAA4B,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,EAC3L,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,+CAAyB,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,kDAA4B,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAC5L,CAAC;gBACF,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA/DD,wGA+DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RangeSearch\n */\n\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\nimport { LineSegment3d } from \"../../curve/LineSegment3d\";\nimport { LineString3d } from \"../../curve/LineString3d\";\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { PolygonLocationDetail, PolygonOps } from \"../../geometry3d/PolygonOps\";\nimport { Range3d } from \"../../geometry3d/Range\";\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { ConvexFacetLocationDetail, FacetLocationDetail, FacetLocationDetailPair, NonConvexFacetLocationDetail } from \"../FacetLocationDetail\";\nimport { LineString3dRangeTreeContext } from \"./LineString3dRangeTreeContext\";\nimport { MinimumValueTester } from \"./MinimumValueTester\";\nimport { Point3dArrayRangeTreeContext } from \"./Point3dArrayRangeTreeContext\";\nimport { PolyfaceRangeTreeContext } from \"./PolyfaceRangeTreeContext\";\nimport { SingleTreeSearchHandler, TwoTreeDistanceMinimizationSearchHandler } from \"./RangeTreeNode\";\n\n/**\n * Helper class for searching for the closest point in a set of points.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\n * @internal\n */\nexport class SingleTreeSearchHandlerForClosestPointInArray extends SingleTreeSearchHandler<number> {\n /** The calling context */\n public context: Point3dArrayRangeTreeContext;\n /** Evolving search state */\n public searchState: MinimumValueTester<number>;\n /** Space point for the search */\n public spacePoint: Point3d;\n\n /**\n * Constructor\n * @param spacePoint cloned\n * @param context captured\n * @param maxDist collect points at no more than this distance from spacePoint\n */\n public constructor(spacePoint: XAndY | XYAndZ, context: Point3dArrayRangeTreeContext, maxDist?: number) {\n super();\n this.context = context;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<number>(maxDist);\n this.spacePoint = Point3d.createFrom(spacePoint);\n }\n /** Return the current closest point */\n public getResult(): CurveLocationDetail | undefined {\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\n const iPoint = this.searchState.itemAtMinValue;\n const cld = CurveLocationDetail.createCurveFractionPoint(undefined, iPoint, this.context.points[iPoint]);\n cld.a = this.searchState.minValue;\n return cld;\n }\n return undefined;\n }\n /** Return the collected closest points (if collecting) */\n public getSavedItems(): CurveLocationDetail[] | undefined {\n if (this.searchState.savedItems.length === 0)\n return undefined;\n const cldArray: CurveLocationDetail[] = [];\n for (let i = 0; i < this.searchState.savedItems.length; ++i) {\n const iPoint = this.searchState.savedItems[i];\n const cld = CurveLocationDetail.createCurveFractionPoint(undefined, iPoint, this.context.points[iPoint]);\n cld.a = this.searchState.savedValues[i];\n cldArray.push(cld);\n }\n return cldArray;\n }\n /**\n * Return true if appData within the range should be offered to `processAppData`.\n * @param range range containing items to be tested.\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\n */\n public override isRangeActive(range: Range3d): boolean {\n const dMin = this.context.xyOnly ? range.distanceToPointXY(this.spacePoint) : range.distanceToPoint(this.spacePoint);\n if (this.searchState.isNewMinValue(dMin)) {\n this.context.numRangeTestTrue++;\n return true;\n }\n this.context.numRangeTestFalse++;\n return false;\n }\n /** Test a point indexed in the range tree as candidate for \"closest\" */\n public override processAppData(candidateIndex: number): void {\n const d = this.context.xyOnly ? this.spacePoint.distanceXY(this.context.points[candidateIndex]) : this.spacePoint.distance(this.context.points[candidateIndex]);\n this.context.numPointTest++;\n this.searchState.testAndSave(candidateIndex, d);\n }\n}\n\n/**\n * Helper class for searching for the closest approach between sets of points.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\n * @internal\n */\nexport class TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\n /** Context for first set of points */\n public contextA: Point3dArrayRangeTreeContext;\n /** Context for second set of points */\n public contextB: Point3dArrayRangeTreeContext;\n /** Search state with current min distance point pair */\n public searchState: MinimumValueTester<CurveLocationDetailPair>;\n\n /** True if and only if both contexts specify xy-only. */\n private _xyOnly?: boolean;\n\n /**\n * Constructor\n * @param contextA captured\n * @param contextB captured\n * @param maxDist collect points at no more than this separation distance\n */\n public constructor(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number) {\n super();\n this.contextA = contextA;\n this.contextB = contextB;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<CurveLocationDetailPair>(maxDist);\n this._xyOnly = contextA.xyOnly && contextB.xyOnly;\n }\n /** Return the current closest approach */\n public getResult(): CurveLocationDetailPair | undefined {\n if (this.searchState.minValue !== undefined) {\n return this.searchState.itemAtMinValue;\n }\n return undefined;\n }\n /** Return the collected close approaches (if collecting) */\n public getSavedItems(): CurveLocationDetailPair[] | undefined {\n if (this.searchState.savedItems.length > 0) {\n return this.searchState.savedItems;\n }\n return undefined;\n }\n /** Get current min distance */\n public override getCurrentDistance(): number {\n const d = this.searchState.minValue;\n return d === undefined ? Number.MAX_VALUE : d;\n }\n /** Whether to ignore z-coordinates in distance computations. */\n public override getXYOnly(): boolean { return this._xyOnly ?? false; }\n\n /** Compute and test the distance between two points, given their indices. */\n public override processAppDataPair(indexA: number, indexB: number): void {\n this.contextA.numPointTest++;\n const pointA = this.contextA.points[indexA];\n const pointB = this.contextB.points[indexB];\n const d = this._xyOnly ? Geometry.distanceXYXY(pointA.x, pointA.y, pointB.x, pointB.y) : Geometry.distanceXYZXYZ(pointA.x, pointA.y, pointA.z, pointB.x, pointB.y, pointB.z);\n if (this.searchState.isNewMinOrTrigger(d)) {\n const cldPair = CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveFractionPoint(undefined, indexA, pointA),\n CurveLocationDetail.createCurveFractionPoint(undefined, indexB, pointB),\n );\n cldPair.detailA.a = cldPair.detailB.a = d;\n this.searchState.testAndSave(cldPair, d);\n }\n }\n}\n\n/**\n * Helper class for searching for the closest point in a linestring.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\n * @internal\n */\nexport class SingleTreeSearchHandlerForClosestPointOnLineString3d extends SingleTreeSearchHandler<number> {\n /** The calling context */\n public context: LineString3dRangeTreeContext;\n /** Evolving search state */\n public searchState: MinimumValueTester<CurveLocationDetail>;\n /** Space point for the search */\n public spacePoint: Point3d;\n\n /**\n * Constructor\n * @param spacePoint cloned\n * @param context captured\n * @param maxDist collect points at no more than this distance from spacePoint\n */\n public constructor(spacePoint: Point3d, context: LineString3dRangeTreeContext, maxDist?: number) {\n super();\n this.context = context;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<CurveLocationDetail>(maxDist);\n this.spacePoint = spacePoint.clone();\n }\n /** Return the current closest point */\n public getResult(): CurveLocationDetail | undefined {\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\n return this.searchState.itemAtMinValue;\n }\n return undefined;\n }\n /** Return the collected closest points (if collecting) */\n public getSavedItems(): CurveLocationDetail[] | undefined {\n if (this.searchState.savedItems.length > 0) {\n return this.searchState.savedItems;\n }\n return undefined;\n }\n /**\n * Return true if appData within the range should be offered to `processAppData`.\n * @param range range containing items to be tested.\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\n */\n public override isRangeActive(range: Range3d): boolean {\n const dMin = range.distanceToPoint(this.spacePoint);\n if (this.searchState.isNewMinValue(dMin)) {\n this.context.numRangeTestTrue++;\n return true;\n }\n this.context.numRangeTestFalse++;\n return false;\n }\n private _workSegment?: LineSegment3d;\n /** Test a segment indexed in the range tree as candidate for \"closest\" */\n public override processAppData(candidateIndex: number): void {\n const segment = this._workSegment = this.context.lineString.getIndexedSegment(candidateIndex, this._workSegment)!;\n if (segment) {\n const cld = segment.closestPoint(this.spacePoint, false);\n LineString3d.convertLocalToGlobalDetail(cld, candidateIndex, this.context.lineString.numEdges(), this.context.lineString);\n this.context.numPointTest++;\n this.searchState.testAndSave(cld, cld.a);\n }\n }\n}\n\n/**\n * Helper class for searching for the closest approach between linestrings.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\n * @internal\n */\nexport class TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\n /** Context for first polyline */\n public contextA: LineString3dRangeTreeContext;\n /** Context for second polyline */\n public contextB: LineString3dRangeTreeContext;\n /** Search state with current min distance point pair */\n public searchState: MinimumValueTester<CurveLocationDetailPair>;\n\n /**\n * Constructor\n * @param contextA captured\n * @param contextB captured\n * @param maxDist collect points at no more than this separation distance\n */\n public constructor(contextA: LineString3dRangeTreeContext, contextB: LineString3dRangeTreeContext, maxDist?: number) {\n super();\n this.contextA = contextA;\n this.contextB = contextB;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<CurveLocationDetailPair>(maxDist);\n }\n /**\n * Return the current closest approach.\n * * Details contain linestring *and* segment data, cf. [[LineString3d.convertLocalToGlobalDetail]]\n */\n public getResult(): CurveLocationDetailPair | undefined {\n if (this.searchState.minValue !== undefined) {\n return this.searchState.itemAtMinValue;\n }\n return undefined;\n }\n /** Return the collected close approaches (if collecting) */\n public getSavedItems(): CurveLocationDetailPair[] | undefined {\n if (this.searchState.savedItems.length > 0) {\n return this.searchState.savedItems;\n }\n return undefined;\n }\n /** Get current min distance */\n public override getCurrentDistance(): number {\n const d = this.searchState.minValue;\n return d === undefined ? Number.MAX_VALUE : d;\n }\n private static _workSegmentA?: LineSegment3d;\n private static _workSegmentB?: LineSegment3d;\n /** Compute and test the closest approach between two segments, given their indices. */\n public override processAppDataPair(indexA: number, indexB: number): void {\n this.contextA.numPointTest++;\n const segA = TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentA =\n this.contextA.lineString.getIndexedSegment(indexA, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentA)!;\n const segB = TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentB =\n this.contextB.lineString.getIndexedSegment(indexB, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentB)!;\n const cldPair = LineSegment3d.closestApproach(segA, false, segB, false);\n if (cldPair && this.searchState.isNewMinOrTrigger(cldPair.detailA.a)) {\n LineString3d.convertLocalToGlobalDetail(cldPair.detailA, indexA, this.contextA.lineString.numEdges(), this.contextA.lineString);\n LineString3d.convertLocalToGlobalDetail(cldPair.detailB, indexB, this.contextB.lineString.numEdges(), this.contextB.lineString);\n this.searchState.testAndSave(cldPair, cldPair.detailA.a);\n }\n }\n}\n\n/**\n * Helper class for searching for the closest point in a polyface.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring FacetLocationDetail).\n * @internal\n */\nexport class SingleTreeSearchHandlerForClosestPointOnPolyface extends SingleTreeSearchHandler<number> {\n /** The calling context */\n public context: PolyfaceRangeTreeContext;\n /** Evolving search state */\n public searchState: MinimumValueTester<FacetLocationDetail>;\n /** Space point for the search */\n public spacePoint: Point3d;\n /** Whether to include facet interior in search */\n public searchFacetInterior: boolean;\n\n /**\n * Constructor\n * @param spacePoint point to test\n * @param context captured\n * @param maxDist collect points at no more than this distance from spacePoint\n * @param searchFacetInterior true: search facet interior + boundary; false: just boundary\n */\n public constructor(spacePoint: XYAndZ | XAndY, context: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false) {\n super();\n this.context = context;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<FacetLocationDetail>(maxDist);\n this.spacePoint = Point3d.createFrom(spacePoint);\n this.searchFacetInterior = searchFacetInterior;\n }\n /** Return the current closest point */\n public getResult(): FacetLocationDetail | undefined {\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\n return this.searchState.itemAtMinValue;\n }\n return undefined;\n }\n /** Return the collected closest points (if collecting) */\n public getSavedItems(): FacetLocationDetail[] | undefined {\n if (this.searchState.savedItems.length > 0) {\n return this.searchState.savedItems;\n }\n return undefined;\n }\n /**\n * Return true if appData within the range should be offered to `processAppData`.\n * @param range range containing items to be tested.\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\n */\n public override isRangeActive(range: Range3d): boolean {\n const dMin = range.distanceToPoint(this.spacePoint);\n if (this.searchState.isNewMinValue(dMin)) {\n this.context.numRangeTestTrue++;\n return true;\n }\n this.context.numRangeTestFalse++;\n return false;\n }\n /** Test a facet indexed in the range tree as candidate for \"closest\" */\n public override processAppData(candidateIndex: number): void {\n this.context.visitor.setNumWrap(0); // so edgeCount === pointCount; closure point unnecessary for closestPoint[OnBoundary]\n if (this.context.visitor.moveToReadIndex(candidateIndex)) {\n let pld: PolygonLocationDetail | undefined;\n if (this.searchFacetInterior)\n pld = PolygonOps.closestPoint(this.context.visitor.point, this.spacePoint);\n else\n pld = PolygonOps.closestPointOnBoundary(this.context.visitor.point, this.spacePoint);\n this.context.numFacetTest++;\n if (pld && this.searchState.isNewMinOrTrigger(pld.a)) {\n const edgeCount = this.context.visitor.pointCount;\n const fld = this.context.convexFacets\n ? ConvexFacetLocationDetail.createCapture(this.context.visitor.currentReadIndex(), edgeCount, pld)\n : NonConvexFacetLocationDetail.createCapture(this.context.visitor.currentReadIndex(), edgeCount, pld);\n this.searchState.testAndSave(fld, pld.a);\n }\n }\n }\n}\n/**\n * Helper class for searching for the closest approach between polyfaces.\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring FacetLocationDetail).\n * @internal\n */\nexport class TwoTreeSearchHandlerForFacetFacetCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\n /** Context for first polyface */\n public contextA: PolyfaceRangeTreeContext;\n /** Context for second polyface */\n public contextB: PolyfaceRangeTreeContext;\n /** Search state with current min distance and facet pair */\n public searchState: MinimumValueTester<FacetLocationDetailPair>;\n /** Whether to include facet interior in search */\n public searchFacetInterior: boolean;\n\n /** Constructor\n * @param contextA captured\n * @param contextB captured\n * @param maxDist collect points at no more than this separation distance\n * @param searchFacetInterior true: search facet interior + boundary; false: just boundary\n */\n public constructor(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false) {\n super();\n this.contextA = contextA;\n this.contextB = contextB;\n if (maxDist !== undefined && maxDist < 0)\n maxDist = undefined;\n this.searchState = MinimumValueTester.create<FacetLocationDetailPair>(maxDist);\n this.searchFacetInterior = searchFacetInterior && contextA.convexFacets && contextB.convexFacets;\n }\n /** Return the facets with closest approach */\n public getResult(): FacetLocationDetailPair | undefined {\n if (this.searchState.minValue !== undefined) {\n return this.searchState.itemAtMinValue;\n }\n return undefined;\n }\n /** Return the collected close approaches (if collecting) */\n public getSavedItems(): FacetLocationDetailPair[] | undefined {\n if (this.searchState.savedItems.length > 0) {\n return this.searchState.savedItems;\n }\n return undefined;\n }\n /** Get current min distance */\n public override getCurrentDistance(): number {\n const d = this.searchState.minValue;\n return d === undefined ? Number.MAX_VALUE : d;\n }\n /** Compute and test the closest approach between two facets, given their indices. */\n public override processAppDataPair(indexA: number, indexB: number): void {\n this.contextA.visitor.setNumWrap(1); // closed polygons are more efficient for PolygonOps.closestApproach\n this.contextB.visitor.setNumWrap(1);\n if (this.contextA.visitor.moveToReadIndex(indexA) && this.contextB.visitor.moveToReadIndex(indexB)) {\n // ASSUME: not worth sending in maxDist here...\n const pldPair = PolygonOps.closestApproach(this.contextA.visitor.point, this.contextB.visitor.point, undefined, this.searchFacetInterior);\n this.contextA.numFacetTest++;\n if (pldPair && this.searchState.isNewMinOrTrigger(pldPair.detailA.a)) {\n const edgeCountA = this.contextA.visitor.pointCount - 1;\n const edgeCountB = this.contextB.visitor.pointCount - 1;\n const fldPair = FacetLocationDetailPair.create(\n this.contextA.convexFacets ? ConvexFacetLocationDetail.createCapture(indexA, edgeCountA, pldPair.detailA) : NonConvexFacetLocationDetail.createCapture(indexA, edgeCountA, pldPair.detailA),\n this.contextB.convexFacets ? ConvexFacetLocationDetail.createCapture(indexB, edgeCountB, pldPair.detailB) : NonConvexFacetLocationDetail.createCapture(indexB, edgeCountB, pldPair.detailB),\n );\n this.searchState.testAndSave(fldPair, fldPair.detailA.a);\n }\n }\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"RangeTreeSearchHandlers.js","sourceRoot":"","sources":["../../../../src/polyface/RangeTree/RangeTreeSearchHandlers.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yEAA+F;AAC/F,6DAA0D;AAC1D,2DAAwD;AACxD,6CAA0C;AAC1C,sEAA2D;AAC3D,4DAAgF;AAGhF,gEAA+I;AAE/I,6DAA0D;AAG1D,mDAAoG;AAEpG;;;;GAIG;AACH,MAAa,6CAA8C,SAAQ,uCAA+B;IAChG,0BAA0B;IACnB,OAAO,CAA+B;IAC7C,4BAA4B;IACrB,WAAW,CAA6B;IAC/C,kCAAkC;IAC3B,UAAU,CAAU;IAE3B;;;;;OAKG;IACH,YAAmB,UAA0B,EAAE,OAA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C7B,IAAI,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,CAAC,CAAC;gBACxD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,CAAC,CAAC;gBACxD,MAAM,OAAO,GAAG,6CAAuB,CAAC,MAAM,CAC5C,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,+CAAyB,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,kDAA4B,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,EAC3L,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,+CAAyB,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,kDAA4B,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAC5L,CAAC;gBACF,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA/DD,wGA+DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RangeSearch\r\n */\r\n\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../../curve/CurveLocationDetail\";\r\nimport { LineSegment3d } from \"../../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../../curve/LineString3d\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { PolygonLocationDetail, PolygonOps } from \"../../geometry3d/PolygonOps\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { XAndY, XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { ConvexFacetLocationDetail, FacetLocationDetail, FacetLocationDetailPair, NonConvexFacetLocationDetail } from \"../FacetLocationDetail\";\r\nimport { LineString3dRangeTreeContext } from \"./LineString3dRangeTreeContext\";\r\nimport { MinimumValueTester } from \"./MinimumValueTester\";\r\nimport { Point3dArrayRangeTreeContext } from \"./Point3dArrayRangeTreeContext\";\r\nimport { PolyfaceRangeTreeContext } from \"./PolyfaceRangeTreeContext\";\r\nimport { SingleTreeSearchHandler, TwoTreeDistanceMinimizationSearchHandler } from \"./RangeTreeNode\";\r\n\r\n/**\r\n * Helper class for searching for the closest point in a set of points.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\r\n * @internal\r\n */\r\nexport class SingleTreeSearchHandlerForClosestPointInArray extends SingleTreeSearchHandler<number> {\r\n /** The calling context */\r\n public context: Point3dArrayRangeTreeContext;\r\n /** Evolving search state */\r\n public searchState: MinimumValueTester<number>;\r\n /** Space point for the search */\r\n public spacePoint: Point3d;\r\n\r\n /**\r\n * Constructor\r\n * @param spacePoint cloned\r\n * @param context captured\r\n * @param maxDist collect points at no more than this distance from spacePoint\r\n */\r\n public constructor(spacePoint: XAndY | XYAndZ, context: Point3dArrayRangeTreeContext, maxDist?: number) {\r\n super();\r\n this.context = context;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<number>(maxDist);\r\n this.spacePoint = Point3d.createFrom(spacePoint);\r\n }\r\n /** Return the current closest point */\r\n public getResult(): CurveLocationDetail | undefined {\r\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\r\n const iPoint = this.searchState.itemAtMinValue;\r\n const cld = CurveLocationDetail.createCurveFractionPoint(undefined, iPoint, this.context.points[iPoint]);\r\n cld.a = this.searchState.minValue;\r\n return cld;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected closest points (if collecting) */\r\n public getSavedItems(): CurveLocationDetail[] | undefined {\r\n if (this.searchState.savedItems.length === 0)\r\n return undefined;\r\n const cldArray: CurveLocationDetail[] = [];\r\n for (let i = 0; i < this.searchState.savedItems.length; ++i) {\r\n const iPoint = this.searchState.savedItems[i];\r\n const cld = CurveLocationDetail.createCurveFractionPoint(undefined, iPoint, this.context.points[iPoint]);\r\n cld.a = this.searchState.savedValues[i];\r\n cldArray.push(cld);\r\n }\r\n return cldArray;\r\n }\r\n /**\r\n * Return true if appData within the range should be offered to `processAppData`.\r\n * @param range range containing items to be tested.\r\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\r\n */\r\n public override isRangeActive(range: Range3d): boolean {\r\n const dMin = this.context.xyOnly ? range.distanceToPointXY(this.spacePoint) : range.distanceToPoint(this.spacePoint);\r\n if (this.searchState.isNewMinValue(dMin)) {\r\n this.context.numRangeTestTrue++;\r\n return true;\r\n }\r\n this.context.numRangeTestFalse++;\r\n return false;\r\n }\r\n /** Test a point indexed in the range tree as candidate for \"closest\" */\r\n public override processAppData(candidateIndex: number): void {\r\n const d = this.context.xyOnly ? this.spacePoint.distanceXY(this.context.points[candidateIndex]) : this.spacePoint.distance(this.context.points[candidateIndex]);\r\n this.context.numPointTest++;\r\n this.searchState.testAndSave(candidateIndex, d);\r\n }\r\n}\r\n\r\n/**\r\n * Helper class for searching for the closest approach between sets of points.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\r\n * @internal\r\n */\r\nexport class TwoTreeSearchHandlerForPoint3dArrayPoint3dArrayCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\r\n /** Context for first set of points */\r\n public contextA: Point3dArrayRangeTreeContext;\r\n /** Context for second set of points */\r\n public contextB: Point3dArrayRangeTreeContext;\r\n /** Search state with current min distance point pair */\r\n public searchState: MinimumValueTester<CurveLocationDetailPair>;\r\n\r\n /** True if and only if both contexts specify xy-only. */\r\n private _xyOnly?: boolean;\r\n\r\n /**\r\n * Constructor\r\n * @param contextA captured\r\n * @param contextB captured\r\n * @param maxDist collect points at no more than this separation distance\r\n */\r\n public constructor(contextA: Point3dArrayRangeTreeContext, contextB: Point3dArrayRangeTreeContext, maxDist?: number) {\r\n super();\r\n this.contextA = contextA;\r\n this.contextB = contextB;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<CurveLocationDetailPair>(maxDist);\r\n this._xyOnly = contextA.xyOnly && contextB.xyOnly;\r\n }\r\n /** Return the current closest approach */\r\n public getResult(): CurveLocationDetailPair | undefined {\r\n if (this.searchState.minValue !== undefined) {\r\n return this.searchState.itemAtMinValue;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected close approaches (if collecting) */\r\n public getSavedItems(): CurveLocationDetailPair[] | undefined {\r\n if (this.searchState.savedItems.length > 0) {\r\n return this.searchState.savedItems;\r\n }\r\n return undefined;\r\n }\r\n /** Get current min distance */\r\n public override getCurrentDistance(): number {\r\n const d = this.searchState.minValue;\r\n return d === undefined ? Number.MAX_VALUE : d;\r\n }\r\n /** Whether to ignore z-coordinates in distance computations. */\r\n public override getXYOnly(): boolean { return this._xyOnly ?? false; }\r\n\r\n /** Compute and test the distance between two points, given their indices. */\r\n public override processAppDataPair(indexA: number, indexB: number): void {\r\n this.contextA.numPointTest++;\r\n const pointA = this.contextA.points[indexA];\r\n const pointB = this.contextB.points[indexB];\r\n const d = this._xyOnly ? Geometry.distanceXYXY(pointA.x, pointA.y, pointB.x, pointB.y) : Geometry.distanceXYZXYZ(pointA.x, pointA.y, pointA.z, pointB.x, pointB.y, pointB.z);\r\n if (this.searchState.isNewMinOrTrigger(d)) {\r\n const cldPair = CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createCurveFractionPoint(undefined, indexA, pointA),\r\n CurveLocationDetail.createCurveFractionPoint(undefined, indexB, pointB),\r\n );\r\n cldPair.detailA.a = cldPair.detailB.a = d;\r\n this.searchState.testAndSave(cldPair, d);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper class for searching for the closest point in a linestring.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\r\n * @internal\r\n */\r\nexport class SingleTreeSearchHandlerForClosestPointOnLineString3d extends SingleTreeSearchHandler<number> {\r\n /** The calling context */\r\n public context: LineString3dRangeTreeContext;\r\n /** Evolving search state */\r\n public searchState: MinimumValueTester<CurveLocationDetail>;\r\n /** Space point for the search */\r\n public spacePoint: Point3d;\r\n\r\n /**\r\n * Constructor\r\n * @param spacePoint cloned\r\n * @param context captured\r\n * @param maxDist collect points at no more than this distance from spacePoint\r\n */\r\n public constructor(spacePoint: Point3d, context: LineString3dRangeTreeContext, maxDist?: number) {\r\n super();\r\n this.context = context;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<CurveLocationDetail>(maxDist);\r\n this.spacePoint = spacePoint.clone();\r\n }\r\n /** Return the current closest point */\r\n public getResult(): CurveLocationDetail | undefined {\r\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\r\n return this.searchState.itemAtMinValue;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected closest points (if collecting) */\r\n public getSavedItems(): CurveLocationDetail[] | undefined {\r\n if (this.searchState.savedItems.length > 0) {\r\n return this.searchState.savedItems;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return true if appData within the range should be offered to `processAppData`.\r\n * @param range range containing items to be tested.\r\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\r\n */\r\n public override isRangeActive(range: Range3d): boolean {\r\n const dMin = range.distanceToPoint(this.spacePoint);\r\n if (this.searchState.isNewMinValue(dMin)) {\r\n this.context.numRangeTestTrue++;\r\n return true;\r\n }\r\n this.context.numRangeTestFalse++;\r\n return false;\r\n }\r\n private _workSegment?: LineSegment3d;\r\n /** Test a segment indexed in the range tree as candidate for \"closest\" */\r\n public override processAppData(candidateIndex: number): void {\r\n const segment = this._workSegment = this.context.lineString.getIndexedSegment(candidateIndex, this._workSegment)!;\r\n if (segment) {\r\n const cld = segment.closestPoint(this.spacePoint, false);\r\n LineString3d.convertLocalToGlobalDetail(cld, candidateIndex, this.context.lineString.numEdges(), this.context.lineString);\r\n this.context.numPointTest++;\r\n this.searchState.testAndSave(cld, cld.a);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper class for searching for the closest approach between linestrings.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring CurveLocationDetail).\r\n * @internal\r\n */\r\nexport class TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\r\n /** Context for first polyline */\r\n public contextA: LineString3dRangeTreeContext;\r\n /** Context for second polyline */\r\n public contextB: LineString3dRangeTreeContext;\r\n /** Search state with current min distance point pair */\r\n public searchState: MinimumValueTester<CurveLocationDetailPair>;\r\n\r\n /**\r\n * Constructor\r\n * @param contextA captured\r\n * @param contextB captured\r\n * @param maxDist collect points at no more than this separation distance\r\n */\r\n public constructor(contextA: LineString3dRangeTreeContext, contextB: LineString3dRangeTreeContext, maxDist?: number) {\r\n super();\r\n this.contextA = contextA;\r\n this.contextB = contextB;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<CurveLocationDetailPair>(maxDist);\r\n }\r\n /**\r\n * Return the current closest approach.\r\n * * Details contain linestring *and* segment data, cf. [[LineString3d.convertLocalToGlobalDetail]]\r\n */\r\n public getResult(): CurveLocationDetailPair | undefined {\r\n if (this.searchState.minValue !== undefined) {\r\n return this.searchState.itemAtMinValue;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected close approaches (if collecting) */\r\n public getSavedItems(): CurveLocationDetailPair[] | undefined {\r\n if (this.searchState.savedItems.length > 0) {\r\n return this.searchState.savedItems;\r\n }\r\n return undefined;\r\n }\r\n /** Get current min distance */\r\n public override getCurrentDistance(): number {\r\n const d = this.searchState.minValue;\r\n return d === undefined ? Number.MAX_VALUE : d;\r\n }\r\n private static _workSegmentA?: LineSegment3d;\r\n private static _workSegmentB?: LineSegment3d;\r\n /** Compute and test the closest approach between two segments, given their indices. */\r\n public override processAppDataPair(indexA: number, indexB: number): void {\r\n this.contextA.numPointTest++;\r\n const segA = TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentA =\r\n this.contextA.lineString.getIndexedSegment(indexA, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentA)!;\r\n const segB = TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentB =\r\n this.contextB.lineString.getIndexedSegment(indexB, TwoTreeSearchHandlerForLineString3dLineString3dCloseApproach._workSegmentB)!;\r\n const cldPair = LineSegment3d.closestApproach(segA, false, segB, false);\r\n if (cldPair && this.searchState.isNewMinOrTrigger(cldPair.detailA.a)) {\r\n LineString3d.convertLocalToGlobalDetail(cldPair.detailA, indexA, this.contextA.lineString.numEdges(), this.contextA.lineString);\r\n LineString3d.convertLocalToGlobalDetail(cldPair.detailB, indexB, this.contextB.lineString.numEdges(), this.contextB.lineString);\r\n this.searchState.testAndSave(cldPair, cldPair.detailA.a);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper class for searching for the closest point in a polyface.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring FacetLocationDetail).\r\n * @internal\r\n */\r\nexport class SingleTreeSearchHandlerForClosestPointOnPolyface extends SingleTreeSearchHandler<number> {\r\n /** The calling context */\r\n public context: PolyfaceRangeTreeContext;\r\n /** Evolving search state */\r\n public searchState: MinimumValueTester<FacetLocationDetail>;\r\n /** Space point for the search */\r\n public spacePoint: Point3d;\r\n /** Whether to include facet interior in search */\r\n public searchFacetInterior: boolean;\r\n\r\n /**\r\n * Constructor\r\n * @param spacePoint point to test\r\n * @param context captured\r\n * @param maxDist collect points at no more than this distance from spacePoint\r\n * @param searchFacetInterior true: search facet interior + boundary; false: just boundary\r\n */\r\n public constructor(spacePoint: XYAndZ | XAndY, context: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false) {\r\n super();\r\n this.context = context;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<FacetLocationDetail>(maxDist);\r\n this.spacePoint = Point3d.createFrom(spacePoint);\r\n this.searchFacetInterior = searchFacetInterior;\r\n }\r\n /** Return the current closest point */\r\n public getResult(): FacetLocationDetail | undefined {\r\n if (this.searchState.minValue !== undefined && this.searchState.itemAtMinValue !== undefined) {\r\n return this.searchState.itemAtMinValue;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected closest points (if collecting) */\r\n public getSavedItems(): FacetLocationDetail[] | undefined {\r\n if (this.searchState.savedItems.length > 0) {\r\n return this.searchState.savedItems;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return true if appData within the range should be offered to `processAppData`.\r\n * @param range range containing items to be tested.\r\n * @returns true if the spacePoint is within the range or close enough that a point in the range could be the closest.\r\n */\r\n public override isRangeActive(range: Range3d): boolean {\r\n const dMin = range.distanceToPoint(this.spacePoint);\r\n if (this.searchState.isNewMinValue(dMin)) {\r\n this.context.numRangeTestTrue++;\r\n return true;\r\n }\r\n this.context.numRangeTestFalse++;\r\n return false;\r\n }\r\n /** Test a facet indexed in the range tree as candidate for \"closest\" */\r\n public override processAppData(candidateIndex: number): void {\r\n this.context.visitor.setNumWrap(0); // so edgeCount === pointCount; closure point unnecessary for closestPoint[OnBoundary]\r\n if (this.context.visitor.moveToReadIndex(candidateIndex)) {\r\n let pld: PolygonLocationDetail | undefined;\r\n if (this.searchFacetInterior)\r\n pld = PolygonOps.closestPoint(this.context.visitor.point, this.spacePoint);\r\n else\r\n pld = PolygonOps.closestPointOnBoundary(this.context.visitor.point, this.spacePoint);\r\n this.context.numFacetTest++;\r\n if (pld && this.searchState.isNewMinOrTrigger(pld.a)) {\r\n const edgeCount = this.context.visitor.pointCount;\r\n const fld = this.context.convexFacets\r\n ? ConvexFacetLocationDetail.createCapture(this.context.visitor.currentReadIndex(), edgeCount, pld)\r\n : NonConvexFacetLocationDetail.createCapture(this.context.visitor.currentReadIndex(), edgeCount, pld);\r\n this.searchState.testAndSave(fld, pld.a);\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Helper class for searching for the closest approach between polyfaces.\r\n * * Future optimization: avoid sqrt by using squared distance throughout (would require refactoring FacetLocationDetail).\r\n * @internal\r\n */\r\nexport class TwoTreeSearchHandlerForFacetFacetCloseApproach extends TwoTreeDistanceMinimizationSearchHandler<number> {\r\n /** Context for first polyface */\r\n public contextA: PolyfaceRangeTreeContext;\r\n /** Context for second polyface */\r\n public contextB: PolyfaceRangeTreeContext;\r\n /** Search state with current min distance and facet pair */\r\n public searchState: MinimumValueTester<FacetLocationDetailPair>;\r\n /** Whether to include facet interior in search */\r\n public searchFacetInterior: boolean;\r\n\r\n /** Constructor\r\n * @param contextA captured\r\n * @param contextB captured\r\n * @param maxDist collect points at no more than this separation distance\r\n * @param searchFacetInterior true: search facet interior + boundary; false: just boundary\r\n */\r\n public constructor(contextA: PolyfaceRangeTreeContext, contextB: PolyfaceRangeTreeContext, maxDist?: number, searchFacetInterior: boolean = false) {\r\n super();\r\n this.contextA = contextA;\r\n this.contextB = contextB;\r\n if (maxDist !== undefined && maxDist < 0)\r\n maxDist = undefined;\r\n this.searchState = MinimumValueTester.create<FacetLocationDetailPair>(maxDist);\r\n this.searchFacetInterior = searchFacetInterior && contextA.convexFacets && contextB.convexFacets;\r\n }\r\n /** Return the facets with closest approach */\r\n public getResult(): FacetLocationDetailPair | undefined {\r\n if (this.searchState.minValue !== undefined) {\r\n return this.searchState.itemAtMinValue;\r\n }\r\n return undefined;\r\n }\r\n /** Return the collected close approaches (if collecting) */\r\n public getSavedItems(): FacetLocationDetailPair[] | undefined {\r\n if (this.searchState.savedItems.length > 0) {\r\n return this.searchState.savedItems;\r\n }\r\n return undefined;\r\n }\r\n /** Get current min distance */\r\n public override getCurrentDistance(): number {\r\n const d = this.searchState.minValue;\r\n return d === undefined ? Number.MAX_VALUE : d;\r\n }\r\n /** Compute and test the closest approach between two facets, given their indices. */\r\n public override processAppDataPair(indexA: number, indexB: number): void {\r\n this.contextA.visitor.setNumWrap(1); // closed polygons are more efficient for PolygonOps.closestApproach\r\n this.contextB.visitor.setNumWrap(1);\r\n if (this.contextA.visitor.moveToReadIndex(indexA) && this.contextB.visitor.moveToReadIndex(indexB)) {\r\n // ASSUME: not worth sending in maxDist here...\r\n const pldPair = PolygonOps.closestApproach(this.contextA.visitor.point, this.contextB.visitor.point, undefined, this.searchFacetInterior);\r\n this.contextA.numFacetTest++;\r\n if (pldPair && this.searchState.isNewMinOrTrigger(pldPair.detailA.a)) {\r\n const edgeCountA = this.contextA.visitor.pointCount - 1;\r\n const edgeCountB = this.contextB.visitor.pointCount - 1;\r\n const fldPair = FacetLocationDetailPair.create(\r\n this.contextA.convexFacets ? ConvexFacetLocationDetail.createCapture(indexA, edgeCountA, pldPair.detailA) : NonConvexFacetLocationDetail.createCapture(indexA, edgeCountA, pldPair.detailA),\r\n this.contextB.convexFacets ? ConvexFacetLocationDetail.createCapture(indexB, edgeCountB, pldPair.detailB) : NonConvexFacetLocationDetail.createCapture(indexB, edgeCountB, pldPair.detailB),\r\n );\r\n this.searchState.testAndSave(fldPair, fldPair.detailA.a);\r\n }\r\n }\r\n }\r\n}\r\n\r\n"]}
|