@itwin/core-geometry 4.2.0-dev.9 → 4.3.0-dev.1
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 +36 -1
- package/lib/cjs/Geometry.d.ts +4 -4
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +2 -2
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +2 -1
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +17 -11
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +14 -8
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +6 -5
- package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +3 -2
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -3
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -3
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +4 -4
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +93 -91
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +171 -152
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +19 -19
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +20 -22
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +47 -30
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +81 -46
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -5
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +14 -2
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +1 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +2 -2
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -0
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +3 -3
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +2 -2
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +54 -5
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +154 -3
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +20 -11
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +22 -11
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +3 -3
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +2 -2
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +104 -115
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts +28 -11
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +57 -45
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +15 -26
- package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js +23 -32
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +3 -6
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -2
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -3
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +1 -1
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +4 -3
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +4 -6
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.d.ts +14 -8
- package/lib/cjs/geometry4d/Map4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js +38 -16
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +4 -2
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +2 -2
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +2 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +55 -25
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +16 -7
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +38 -7
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +5 -39
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +7 -41
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -8
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +64 -18
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +6 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +68 -2
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +35 -26
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +84 -100
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +29 -11
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +45 -26
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.d.ts +2 -2
- package/lib/cjs/topology/HalfEdgeMarkSet.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js +4 -4
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +3 -0
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +19 -5
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +15 -7
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +89 -47
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +4 -4
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +2 -2
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +2 -1
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +17 -11
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +14 -8
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +6 -5
- package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +3 -2
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -3
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -3
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +4 -4
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +93 -91
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +171 -152
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +19 -19
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +19 -20
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +47 -30
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +81 -46
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +17 -5
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +12 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +1 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +2 -2
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.d.ts +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
- package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -0
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +3 -3
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +2 -2
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +54 -5
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +153 -3
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +20 -11
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +22 -11
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +3 -3
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +2 -2
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +103 -113
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts +28 -11
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +57 -45
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +15 -26
- package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js +23 -32
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +3 -6
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -2
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -3
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +1 -1
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +4 -3
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +4 -6
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.d.ts +14 -8
- package/lib/esm/geometry4d/Map4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Map4d.js +38 -16
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +4 -2
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +2 -2
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +2 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +55 -25
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +16 -7
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +38 -7
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +5 -39
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +7 -41
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -8
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +64 -18
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +6 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +68 -2
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +35 -26
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +84 -100
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +29 -11
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +45 -26
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.d.ts +2 -2
- package/lib/esm/topology/HalfEdgeMarkSet.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js +2 -2
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +3 -0
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +19 -5
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +15 -7
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +89 -47
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
- package/lib/cjs/curve/CurveChain.js.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -175
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
- package/lib/esm/curve/CurveChain.d.ts.map +0 -1
- package/lib/esm/curve/CurveChain.js.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -175
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveChainWithDistanceIndex.js","sourceRoot":"","sources":["../../../src/curve/CurveChainWithDistanceIndex.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,4DAAyD;AACzD,kEAA+D;AAC/D,0CAAuC;AAIvC,mEAAkE;AAClE,+CAAuD;AAGvD,uDAA+C;AAC/C,uDAAqG;AACrG,+DAA4D;AAE5D,4FAAyF;AAEzF,mDAAgD;AAChD,iCAA8B;AAG9B;;;;;;GAMG;AACH,MAAa,YAAY;IAevB,yEAAyE;IACzE,YACE,cAAsB,EAAE,cAAsB,EAC9C,SAAiB,EAAE,SAAiB,EACpC,UAA0B,EAAE,KAAe;QAE3C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,C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AC,AAAJ,CAAK;AACf,wCAAY,GAAG,CAAC,AAAJ,CAAK;AACjB,yCAAa,GAAG,CAAC,AAAJ,CAAK;AAtctB,kEAA2B","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\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { OffsetOptions } from \"./OffsetOptions\";\r\nimport { Path } from \"./Path\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Annotation of an interval of a curve.\r\n * * The interval is marked with two pairs of numbers:\r\n * * * fraction0, fraction1 = fraction parameters along the child curve\r\n * * * distance0,distance1 = distances within containing CurveChainWithDistanceIndex\r\n * @public\r\n */\r\nexport class PathFragment {\r\n /** Distance along parent to this fragment start */\r\n public chainDistance0: number;\r\n /** Distance along parent to this fragment end */\r\n public chainDistance1: number;\r\n /** Fractional position of this fragment start within its curve primitive. */\r\n public childFraction0: number;\r\n /** Fractional position of this fragment end within its curve primitive.. */\r\n public childFraction1: number;\r\n /** Curve primitive of this fragment, as presented in stroker. Note that this might have become a proxy. */\r\n public childCurve: CurvePrimitive;\r\n /** Optional range */\r\n public range?: Range3d;\r\n /** Working var for use in searches. */\r\n public a: number;\r\n /** Create a fragment with complete fraction, distance and child data. */\r\n public constructor(\r\n childFraction0: number, childFraction1: number,\r\n distance0: number, distance1: number,\r\n childCurve: CurvePrimitive, range?: Range3d,\r\n ) {\r\n this.childFraction0 = childFraction0;\r\n this.childFraction1 = childFraction1;\r\n this.chainDistance0 = distance0;\r\n this.chainDistance1 = distance1;\r\n this.childCurve = childCurve;\r\n this.range = range;\r\n this.a = 0;\r\n }\r\n /**\r\n * Return true if the distance is within the distance limits of this fragment.\r\n * @param distance\r\n */\r\n public containsChainDistance(distance: number): boolean {\r\n return distance >= this.chainDistance0 && distance <= this.chainDistance1;\r\n }\r\n /** Return a quick distance to the curve. This may be SMALLER than true distance but may not be larger */\r\n public quickMinDistanceToChildCurve(spacePoint: Point3d): number {\r\n if (this.range) {\r\n return this.range.distanceToPoint(spacePoint);\r\n }\r\n // ugh. have to do real computation ..\r\n const detail = this.childCurve.closestPoint(spacePoint, false);\r\n if (detail)\r\n return detail.a;\r\n return 0;\r\n }\r\n /**\r\n * Return an array with (references to) all the path fragments, sorted smallest to largest on the \"a\" value\r\n * equal to the quick min distance to the fragment\r\n */\r\n public static collectSortedQuickMinDistances(fragments: PathFragment[], spacePoint: Point3d): PathFragment[] {\r\n const sortedFragments: PathFragment[] = [];\r\n for (const f of fragments) {\r\n f.a = f.quickMinDistanceToChildCurve(spacePoint);\r\n sortedFragments.push(f);\r\n }\r\n sortedFragments.sort((a: PathFragment, b: PathFragment) => a.a - b.a);\r\n return sortedFragments;\r\n }\r\n /**\r\n * Return true if this fragment addresses `curve` and brackets `fraction`\r\n * @param distance\r\n */\r\n public containsChildCurveAndChildFraction(curve: CurvePrimitive, fraction: number): boolean {\r\n return this.childCurve === curve && fraction >= this.childFraction0 && fraction <= this.childFraction1;\r\n }\r\n /**\r\n * Convert distance to local fraction, and apply that to interpolate between the stored curve fractions.\r\n * Note that proportional calculation does NOT account for nonuniform parameterization in the child curve.\r\n */\r\n public chainDistanceToInterpolatedChildFraction(distance: number): number {\r\n return Geometry.inverseInterpolate(\r\n this.childFraction0, this.chainDistance0,\r\n this.childFraction1, this.chainDistance1,\r\n distance, this.childFraction0)!; // the interval \"must\" have nonzero length, division should be safe . ..\r\n }\r\n /** Convert chainDistance to true chidFraction, using detailed moveSignedDistanceFromFraction */\r\n public chainDistanceToAccurateChildFraction(chainDistance: number, allowExtrapolation?: boolean): number {\r\n // The fragments are really expected to do good mappings in their distance range ...\r\n const childDetail = this.childCurve.moveSignedDistanceFromFraction(\r\n this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation ?? false);\r\n return childDetail.fraction;\r\n }\r\n /**\r\n * Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives\r\n * @param globalDistance total length of the global curve.\r\n */\r\n public fractionScaleFactor(globalDistance: number): number {\r\n return globalDistance * (this.childFraction1 - this.childFraction0) / (this.chainDistance1 - this.chainDistance0);\r\n }\r\n /**\r\n * Reverse the fraction and distance data.\r\n * * each child fraction `f` is replaced by `1-f`\r\n * * each `chainDistance` is replaced by `totalDistance-chainDistance`\r\n */\r\n public reverseFractionsAndDistances(totalDistance: number) {\r\n const f0 = this.childFraction0;\r\n const f1 = this.childFraction1;\r\n const d0 = this.chainDistance0;\r\n const d1 = this.chainDistance1;\r\n this.childFraction0 = 1.0 - f1;\r\n this.childFraction1 = 1.0 - f0;\r\n this.chainDistance0 = totalDistance - d1;\r\n this.chainDistance1 = totalDistance - d0;\r\n }\r\n /** @deprecated in 3.x. Use childFractionToChainDistance */\r\n public childFractionTChainDistance(fraction: number): number {\r\n return this.childFractionToChainDistance(fraction);\r\n }\r\n /**\r\n * Convert a fractional position on the childCurve to distance in the chain space.\r\n * * Return value is SIGNED -- will be negative when fraction < this.childFraction0.\r\n * @param fraction fraction along the curve within this fragment\r\n */\r\n public childFractionToChainDistance(fraction: number): number {\r\n let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);\r\n if (fraction < this.childFraction0)\r\n d = -d;\r\n return this.chainDistance0 + d;\r\n }\r\n}\r\n\r\n/** Non-instantiable class to build a distance index for a path. */\r\nclass DistanceIndexConstructionContext implements IStrokeHandler {\r\n private _fragments: PathFragment[];\r\n private _accumulatedDistance: number;\r\n private constructor() {\r\n this._accumulatedDistance = 0;\r\n this._fragments = [];\r\n }\r\n // ignore curve announcements -- they are repeated in stroke announcements\r\n public startParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public startCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endCurvePrimitive(_cp: CurvePrimitive) { }\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d) { }\r\n /** Announce numPoints interpolated between point0 and point1, with associated fractions */\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n const fragmentPoint0 = point0.clone();\r\n const fragmentPoint1 = point1.clone();\r\n let d0 = this._accumulatedDistance;\r\n if (numStrokes <= 1) {\r\n this._accumulatedDistance += point0.distance(point1);\r\n this._fragments.push(new PathFragment(fraction0, fraction1, d0, this._accumulatedDistance, cp,\r\n Range3d.create(fragmentPoint0, fragmentPoint1)));\r\n } else {\r\n let f1;\r\n for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {\r\n f1 = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n point0.interpolate(f1, point1, fragmentPoint1);\r\n d0 = this._accumulatedDistance;\r\n this._accumulatedDistance += (Math.abs(f1 - f0) * point0.distance(point1));\r\n this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp,\r\n Range3d.create(fragmentPoint0, fragmentPoint1)));\r\n fragmentPoint0.setFrom(fragmentPoint1);\r\n }\r\n }\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let f1, d, d0;\r\n for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {\r\n f1 = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n d = cp.curveLengthBetweenFractions(f0, f1);\r\n d0 = this._accumulatedDistance;\r\n this._accumulatedDistance += d;\r\n const range = cp.rangeBetweenFractions(f0, f1);\r\n this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, range));\r\n }\r\n }\r\n public needPrimaryGeometryForStrokes?(): boolean { return true; }\r\n public static createPathFragmentIndex(path: CurveChain, options?: StrokeOptions): PathFragment[] {\r\n const handler = new DistanceIndexConstructionContext();\r\n for (const curve of path.children) {\r\n curve.emitStrokableParts(handler, options);\r\n }\r\n const fragments = handler._fragments;\r\n return fragments;\r\n }\r\n}\r\n/**\r\n * `CurveChainWithDistanceIndex` is a CurvePrimitive whose fractional parameterization is proportional to true\r\n * distance along a CurveChain.\r\n * * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`\r\n * to `t1` is easily computed as `L*(t1-t0)`.\r\n * * The curve chain can be any type derived from CurveChain.\r\n * * * i.e. either a `Path` or a `Loop`\r\n * @public\r\n */\r\nexport class CurveChainWithDistanceIndex extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"curveChainWithDistanceIndex\";\r\n private readonly _path: CurveChain;\r\n private readonly _fragments: PathFragment[];\r\n private readonly _totalLength: number; // matches final fragment distance1.\r\n /** Test if other is a `CurveChainWithDistanceIndex` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof CurveChainWithDistanceIndex;\r\n }\r\n // final assembly of CurveChainWithDistanceIndex -- caller must create valid fragment index.\r\n private constructor(path: CurveChain, fragments: PathFragment[]) {\r\n super();\r\n this._path = path;\r\n this._fragments = fragments;\r\n this._totalLength = fragments.length > 0 ? fragments[fragments.length - 1].chainDistance1 : 0;\r\n }\r\n /**\r\n * Create a clone, transformed and with its own distance index.\r\n * @param transform transform to apply in the clone.\r\n */\r\n public cloneTransformed(transform: Transform): CurveChainWithDistanceIndex | undefined {\r\n const c = this._path.clone();\r\n if (c instanceof CurveChain && c.tryTransformInPlace(transform))\r\n return CurveChainWithDistanceIndex.createCapture(c);\r\n return undefined;\r\n }\r\n /**\r\n * Reference to the contained path.\r\n * * Do not modify the path. The distance index will be wrong.\r\n */\r\n public get path(): CurveChain {\r\n return this._path;\r\n }\r\n /**\r\n * Reference to the fragments array.\r\n * * Do not modify.\r\n */\r\n public get fragments(): PathFragment[] {\r\n return this._fragments;\r\n }\r\n /** Return a deep clone */\r\n public clone(): CurveChainWithDistanceIndex {\r\n const c = this._path.clone() as CurveChain;\r\n return CurveChainWithDistanceIndex.createCapture(c);\r\n }\r\n /** Return a deep clone */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): CurveChainWithDistanceIndex | undefined {\r\n if (fractionA === fractionB)\r\n return undefined;\r\n let fracA = fractionA;\r\n let fracB = fractionB;\r\n const reversed = fractionA > fractionB;\r\n if (reversed) {\r\n fracA = fractionB;\r\n fracB = fractionA;\r\n }\r\n const chainDistanceA = fracA * this._totalLength;\r\n const chainDistanceB = fracB * this._totalLength;\r\n const fragmentA = this.chainDistanceToFragment(chainDistanceA, true);\r\n if (undefined === fragmentA)\r\n return undefined;\r\n const fragmentB = this.chainDistanceToFragment(chainDistanceB, true);\r\n if (undefined === fragmentB)\r\n return undefined;\r\n const childCurveIndexA = this._path.childIndex(fragmentA.childCurve, true);\r\n if (undefined === childCurveIndexA)\r\n return undefined;\r\n const childCurveIndexB = this._path.childIndex(fragmentB.childCurve, true);\r\n if (undefined === childCurveIndexB)\r\n return undefined;\r\n const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);\r\n const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);\r\n\r\n // add a (possibly reversed) partial clone to newPath\r\n const newPath = Path.create();\r\n const addPartialChild = (\r\n childCurve: CurvePrimitive, childFraction0: number, childFraction1: number, reversedClone: boolean,\r\n ): boolean => {\r\n if (childFraction0 === childFraction1)\r\n return false;\r\n let newCurve;\r\n if (childFraction0 === 0.0 && childFraction1 === 1.0) {\r\n newCurve = childCurve.clone();\r\n if (reversedClone)\r\n newCurve.reverseInPlace();\r\n } else {\r\n newCurve = reversedClone ?\r\n childCurve.clonePartialCurve(childFraction1, childFraction0)\r\n : childCurve.clonePartialCurve(childFraction0, childFraction1);\r\n }\r\n if (newCurve) {\r\n newPath.children.push(newCurve);\r\n return true;\r\n }\r\n return false;\r\n };\r\n if (fragmentA.childCurve === fragmentB.childCurve) {\r\n // the two distances are within the same curve.\r\n if (addPartialChild(fragmentA.childCurve, childFractionA, childFractionB, reversed))\r\n return CurveChainWithDistanceIndex.createCapture(newPath); // singleton -- children[] does not need to be reversed.\r\n return undefined;\r\n }\r\n addPartialChild(this._path.children[childCurveIndexA], childFractionA, 1.0, reversed);\r\n // at least two distinct children are impacted ....\r\n for (let childIndex = childCurveIndexA + 1; childIndex < childCurveIndexB; childIndex++) {\r\n addPartialChild(this._path.children[childIndex], 0.0, 1.0, reversed);\r\n }\r\n addPartialChild(this._path.children[childCurveIndexB], 0.0, childFractionB, reversed);\r\n // This reverses array entries but not orientation within each curve ...\r\n if (reversed)\r\n newPath.children.reverse();\r\n return CurveChainWithDistanceIndex.createCapture(newPath);\r\n }\r\n /**\r\n * Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n for (const c of this._path.children) {\r\n if (!c.isInPlane(plane))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /** Return the start point of the primitive. The default implementation returns fractionToPoint (0.0) */\r\n public override startPoint(result?: Point3d): Point3d {\r\n const c = this._path.cyclicCurvePrimitive(0);\r\n if (c)\r\n return c.startPoint(result);\r\n return Point3d.createZero(result);\r\n }\r\n /** Return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */\r\n public override endPoint(result?: Point3d): Point3d {\r\n const c = this._path.cyclicCurvePrimitive(-1);\r\n if (c)\r\n return c.endPoint(result);\r\n return Point3d.createZero(result);\r\n }\r\n /** Add strokes to caller-supplied linestring */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n for (const c of this._path.children) {\r\n c.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n for (const c of this._path.children) {\r\n c.emitStrokableParts(dest, options);\r\n }\r\n }\r\n /**\r\n * Return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke = 0;\r\n for (const c of this._path.children) {\r\n numStroke += c.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if true, recurse on the (otherwise hidden) children. If false, only push `this`.\r\n * @param explodeLinestrings (if smallestPossiblePrimitives is true) whether to push a [[LineSegment3d]] for each\r\n * segment of a [[LineString3d]] child. If false, push only the [[LineString3d]].\r\n */\r\n public override collectCurvePrimitivesGo(\r\n collectorArray: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): void {\r\n if (smallestPossiblePrimitives) {\r\n for (const c of this._path.children) {\r\n c.collectCurvePrimitivesGo(collectorArray, smallestPossiblePrimitives, explodeLineStrings);\r\n }\r\n } else {\r\n collectorArray.push(this);\r\n }\r\n }\r\n /**\r\n * Construct StrokeCountMap for each child, accumulating data to stroke count map for this primitive.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const myMap = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap);\r\n for (const c of this._path.children) {\r\n c.computeAndAttachRecursiveStrokeCounts(options, myMap);\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myMap, parentStrokeMap);\r\n }\r\n /**\r\n * Second step of double dispatch: call `this._path.dispatchToGeometryHandler (handler)`\r\n * * Note that this exposes the children individually to the handler.\r\n */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return this._path.dispatchToGeometryHandler(handler);\r\n }\r\n /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this._path.extendRange(rangeToExtend, transform);\r\n }\r\n /**\r\n * Curve length is always positive.\r\n * @returns Returns a (high accuracy) length of the curve between fractional positions\r\n * @returns Returns the length of the curve.\r\n */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n return Math.abs(fraction1 - fraction0) * this._totalLength;\r\n }\r\n /**\r\n * Capture (not clone) a path into a new `CurveChainWithDistanceIndex`\r\n * @param path primitive array to be CAPTURED (not cloned)\r\n */\r\n public static createCapture(path: CurveChain, options?: StrokeOptions): CurveChainWithDistanceIndex {\r\n const fragments = DistanceIndexConstructionContext.createPathFragmentIndex(path, options);\r\n const result = new CurveChainWithDistanceIndex(path, fragments);\r\n return result;\r\n }\r\n /**\r\n * Resolve a fraction of the CurveChain to a PathFragment\r\n * @param distance\r\n * @param allowExtrapolation\r\n */\r\n public chainDistanceToFragment(distance: number, allowExtrapolation: boolean = false): PathFragment | undefined {\r\n const i = this.chainDistanceToFragmentIndex(distance, allowExtrapolation);\r\n if (undefined !== i)\r\n return this._fragments[i];\r\n return undefined;\r\n }\r\n /**\r\n * Resolve a fraction of the CurveChain to a PathFragment index\r\n * @param distance\r\n * @param allowExtrapolation\r\n */\r\n protected chainDistanceToFragmentIndex(distance: number, allowExtrapolation: boolean = false): number | undefined {\r\n const numFragments = this._fragments.length;\r\n const fragments = this._fragments;\r\n if (numFragments > 0) {\r\n if (distance < 0.0)\r\n return allowExtrapolation ? 0 : undefined;\r\n if (distance > this._totalLength)\r\n return allowExtrapolation ? (numFragments - 1) : undefined;\r\n // humbug, linear search\r\n for (let i = 0; i < numFragments; i++) {\r\n if (fragments[i].containsChainDistance(distance)) return i;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Convert distance along the chain to fraction along the chain.\r\n * @param distance distance along the chain\r\n */\r\n public chainDistanceToChainFraction(distance: number): number {\r\n return distance / this._totalLength;\r\n }\r\n /**\r\n * Resolve a fraction within a specific curve to a fragment.\r\n * @param curve\r\n * @param fraction\r\n */\r\n public curveAndChildFractionToFragment(curve: CurvePrimitive, fraction: number): PathFragment | undefined {\r\n const numFragments = this._fragments.length;\r\n const fragments = this._fragments;\r\n if (numFragments > 0) {\r\n // humbug, linear search\r\n for (const fragment of fragments) {\r\n if (fragment.containsChildCurveAndChildFraction(curve, fraction))\r\n return fragment;\r\n }\r\n if (fraction <= 0)\r\n return fragments[0];\r\n if (fraction > 1.0)\r\n return fragments[numFragments - 1];\r\n }\r\n return undefined;\r\n }\r\n /** Returns the total length of curves. */\r\n public override curveLength(): number {\r\n return this._totalLength;\r\n }\r\n /**\r\n * Returns the total length of the path.\r\n * * This is exact (and simple property lookup) because the true lengths were summed at construction time.\r\n */\r\n public quickLength(): number {\r\n return this._totalLength;\r\n }\r\n /**\r\n * Return the point (x,y,z) on the curve at fractional position along the chain.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a point on the curve.\r\n */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n const chainDistance = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(chainDistance, true);\r\n if (fragment) {\r\n const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance, true);\r\n return fragment.childCurve.fractionToPoint(childFraction, result);\r\n }\r\n // no fragment found. Use _fragments[0]\r\n // fragment = this.chainDistanceToFragment(chainDistance, true);\r\n return this._fragments[0].childCurve.fractionToPoint(0.0, result);\r\n }\r\n /**\r\n * Return the point (x,y,z) and derivative on the curve at fractional position.\r\n * * Note that this derivative is \"derivative of xyz with respect to fraction.\"\r\n * * this derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);\r\n // Fractional arc length parameterization for the curve C is f=f(t)=s(t)/L, where\r\n // L is total length of C, f'=||C'||/L, and inverse t=t(f), t'=1/f'=L/||C'||.\r\n // Then d/df(C(t(f)))=C't'=C'L/||C'||. The fragment gave us C', so the\r\n // derivative we seek is just a scale away.\r\n const a = this._totalLength / result.direction.magnitude();\r\n result.direction.scaleInPlace(a);\r\n return result;\r\n }\r\n /**\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n * @param fraction fractional position on the curve\r\n * @param result optional receiver for the result.\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n */\r\n public override fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);\r\n result.direction.normalizeInPlace();\r\n return result;\r\n }\r\n /**\r\n * Return a plane with\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to\r\n * the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(\r\n fraction: number, result?: Plane3dByOriginAndVectors,\r\n ): Plane3dByOriginAndVectors | undefined {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAnd2Derivatives(curveFraction, result);\r\n if (!result)\r\n return undefined;\r\n // See fractionToPointAndDerivative for derivation of d/df(C(t(f)))=L C'/||C'||.\r\n // For the 2nd deriv, use quotient rule, d/dt||x(t)||=x.x'/||x|| and ||x||^2=x.x :\r\n // d/df(C'(t(f))) = L d/df(C'/||C'||)\r\n // = L (||C'|| d/df(C') - C' d/df||C'||) / ||C'||^2\r\n // = L (||C'|| C\" L/||C'|| - C' C'.C\"/||C'|| L/||C'||) / ||C'||^2\r\n // = (L/||C'||)^2 (C\" - C' C'.C\"/C'.C' )\r\n // We have C' and C\" from the fragment.\r\n const magU = result.vectorU.magnitude();\r\n const dotUU = magU * magU;\r\n const dotUV = result.vectorU.dotProduct(result.vectorV);\r\n result.vectorV.addScaledInPlace(result.vectorU, -dotUV / dotUU);\r\n const scale = this._totalLength / magU;\r\n result.vectorU.scaleInPlace(scale);\r\n result.vectorV.scaleInPlace(scale * scale);\r\n return result;\r\n }\r\n /**\r\n * Attempt to transform in place.\r\n * * Warning: If any child fails, this object becomes invalid. But that should never happen.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n let numFail = 0;\r\n for (const c of this._path.children) {\r\n if (!c.tryTransformInPlace(transform))\r\n numFail++;\r\n }\r\n return numFail === 0;\r\n }\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n this._path.reverseChildrenInPlace();\r\n const totalLength = this._totalLength;\r\n for (const fragment of this._fragments) {\r\n fragment.reverseFractionsAndDistances(totalLength);\r\n }\r\n this._fragments.reverse();\r\n }\r\n /**\r\n * Test for equality conditions:\r\n * * Mismatched totalLength is a quick exit condition\r\n * * If totalLength matches, recurse to the path for matching primitives.\r\n * @param other\r\n */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof CurveChainWithDistanceIndex) {\r\n return Geometry.isSameCoordinate(this._totalLength, other._totalLength)\r\n && this._path.isAlmostEqual(other._path);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Implement moveSignedDistanceFromFraction.\r\n * * See `CurvePrimitive` for parameter details.\r\n * * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex, and\r\n * has pointer to an additional detail for the child curve.\r\n */\r\n public override moveSignedDistanceFromFraction(\r\n startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n const distanceA = startFraction * this._totalLength;\r\n const distanceB = distanceA + signedDistance;\r\n const fragmentB = this.chainDistanceToFragment(distanceB, true)!;\r\n const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result);\r\n const endFraction = startFraction + (signedDistance / this._totalLength);\r\n const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, endFraction, signedDistance, result);\r\n chainDetail.childDetail = childDetail;\r\n return chainDetail;\r\n }\r\n /**\r\n * The returned object has\r\n * * numCalls = number of times closestPoint was called.\r\n * * numCurvesTested = number of curves tested with full closestPoint\r\n * * numAssigned = number of times a new minimum value was recorded\r\n * * numCandidate = number of curves that would be tested in worst case.\r\n * return an object summarizing closest point test counts\r\n * @param clear if true, counts are cleared after the return object is formed.\r\n */\r\n public static getClosestPointTestCounts(\r\n clear: boolean = true,\r\n ): { numCalls: number, numTested: number, numAssigned: number, numCandidate: number } {\r\n const a = {\r\n numCalls: this._numCalls,\r\n numTested: this._numTested,\r\n numAssigned: this._numAssigned,\r\n numCandidate: this._numCandidate,\r\n };\r\n if (clear) {\r\n this._numTested = this._numAssigned = this._numCandidate = 0;\r\n }\r\n return a;\r\n }\r\n private static _numCalls = 0;\r\n private static _numTested = 0;\r\n private static _numAssigned = 0;\r\n private static _numCandidate = 0;\r\n /**\r\n * Search for the curve point that is closest to the spacePoint.\r\n * * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which\r\n * (via a handler) determines a CurveLocation detail among the children.\r\n * * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex, and\r\n * has pointer to an additional detail for the child curve.\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter,\r\n ): CurveLocationDetail | undefined {\r\n let childDetail: CurveLocationDetail | undefined;\r\n let aMin = Number.MAX_VALUE;\r\n const numChildren = this.path.children.length;\r\n if (numChildren === 1) {\r\n childDetail = this.path.children[0].closestPoint(spacePoint, extend);\r\n } else {\r\n const sortedFragments = PathFragment.collectSortedQuickMinDistances(this._fragments, spacePoint);\r\n const extend0 = [CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0), CurveExtendMode.None];\r\n const extend1 = [CurveExtendMode.None, CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1)];\r\n const fragment0 = this._fragments[0];\r\n const fragment1 = this._fragments[this._fragments.length - 1];\r\n CurveChainWithDistanceIndex._numCalls++;\r\n CurveChainWithDistanceIndex._numCandidate += sortedFragments.length;\r\n for (const f of sortedFragments) {\r\n if (f.a > aMin)\r\n break;\r\n CurveChainWithDistanceIndex._numTested++;\r\n const child = f.childCurve;\r\n const detailA = child.closestPoint(spacePoint,\r\n f === fragment0 ? extend0 : f === fragment1 ? extend1 : false);\r\n if (detailA && detailA.a < aMin) {\r\n aMin = detailA.a;\r\n childDetail = CurveLocationDetail.createCurveFractionPoint(detailA.curve, detailA.fraction, detailA.point, childDetail)!;\r\n childDetail.a = detailA.a;\r\n CurveChainWithDistanceIndex._numAssigned++;\r\n }\r\n }\r\n }\r\n if (!childDetail)\r\n return undefined;\r\n const fragment = this.curveAndChildFractionToFragment(childDetail.curve!, childDetail.fraction);\r\n if (fragment) {\r\n const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);\r\n const chainFraction = this.chainDistanceToChainFraction(chainDistance);\r\n const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);\r\n chainDetail.childDetail = childDetail;\r\n chainDetail.a = childDetail.a;\r\n return chainDetail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct an offset of each child as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset() to return a fully\r\n * joined offset.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(\r\n offsetDistanceOrOptions: number | OffsetOptions,\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const offsets: CurvePrimitive[] = [];\r\n for (const prim of this.collectCurvePrimitives(undefined, true, true)) {\r\n const offset = prim.constructOffsetXY(options);\r\n if (offset !== undefined) {\r\n if (offset instanceof CurvePrimitive)\r\n offsets.push(offset);\r\n else if (Array.isArray(offset))\r\n offset.forEach((cp) => offsets.push(cp));\r\n }\r\n }\r\n return offsets;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of\r\n * projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveChainWithDistanceIndex.js","sourceRoot":"","sources":["../../../src/curve/CurveChainWithDistanceIndex.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,sDAA6C;AAC7C,4DAAyD;AACzD,kEAA+D;AAC/D,0CAAuC;AAIvC,mEAAkE;AAClE,+CAAuD;AAGvD,uDAA+C;AAC/C,uDAAqG;AACrG,+DAA4D;AAE5D,4FAAyF;AAEzF,mDAAgD;AAChD,iCAA8B;AAG9B;;;;;;GAMG;AACH,MAAa,YAAY;IAevB,0EAA0E;IAC1E,YACE,cAAsB,EACtB,cAAsB,EACtB,SAAiB,EACjB,SAAiB,EACjB,UAA0B,EAC1B,KAAe;QAEf,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,kFAAkF;IAC3E,qBAAqB,CAAC,QAAgB;QAC3C,OAAO,QAAQ,IAAI,IAAI,CAAC,cAAc,IAAI,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC;IAC5E,CAAC;IACD;;;;OAIG;IACI,4BAA4B,CAAC,UAAmB;QACrD,IAAI,IA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tB,kEAA2B","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\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { OffsetOptions } from \"./OffsetOptions\";\r\nimport { Path } from \"./Path\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Annotation of a fragment, i.e. an interval of a curve.\r\n * * The interval is marked with two pairs of numbers:\r\n * * * fraction0, fraction1 = fraction parameters along the child curve.\r\n * * * distance0, distance1 = distances within containing CurveChainWithDistanceIndex.\r\n * @public\r\n */\r\nexport class PathFragment {\r\n /** Distance along parent to this fragment start. */\r\n public chainDistance0: number;\r\n /** Distance along parent to this fragment end. */\r\n public chainDistance1: number;\r\n /** The start of this `PathFragment`, as a local fractional parameter of `this.childCurve`. */\r\n public childFraction0: number;\r\n /** The end of this `PathFragment`, as a local fractional parameter of `this.childCurve`. */\r\n public childFraction1: number;\r\n /** Curve primitive of this fragment, as presented in stroker. Note that this might have become a proxy. */\r\n public childCurve: CurvePrimitive;\r\n /** Optional range */\r\n public range?: Range3d;\r\n /** Working var for use in searches. */\r\n public a: number;\r\n /** Create a fragment with complete fraction, distance, and child data. */\r\n public constructor(\r\n childFraction0: number,\r\n childFraction1: number,\r\n distance0: number,\r\n distance1: number,\r\n childCurve: CurvePrimitive,\r\n range?: Range3d,\r\n ) {\r\n this.childFraction0 = childFraction0;\r\n this.childFraction1 = childFraction1;\r\n this.chainDistance0 = distance0;\r\n this.chainDistance1 = distance1;\r\n this.childCurve = childCurve;\r\n this.range = range;\r\n this.a = 0;\r\n }\r\n /** Return true if the distance is within the distance limits of this fragment. */\r\n public containsChainDistance(distance: number): boolean {\r\n return distance >= this.chainDistance0 && distance <= this.chainDistance1;\r\n }\r\n /**\r\n * Return a quick minimum distance from spacePoint to the curve.\r\n * * The returned distance is to the curve's range box if defined; otherwise, the true distance is computed.\r\n * * Thus the returned distance may be SMALLER than the true distance to the curve, but not larger.\r\n */\r\n public quickMinDistanceToChildCurve(spacePoint: Point3d): number {\r\n if (this.range)\r\n return this.range.distanceToPoint(spacePoint);\r\n const detail = this.childCurve.closestPoint(spacePoint, false);\r\n if (detail)\r\n return detail.a;\r\n return 0;\r\n }\r\n /**\r\n * Return an array with (references to) all the input path fragments, sorted smallest to largest on the \"a\" value,\r\n * initialized with `quickMinDistanceToChildCurve`\r\n */\r\n public static collectSortedQuickMinDistances(fragments: PathFragment[], spacePoint: Point3d): PathFragment[] {\r\n const sortedFragments: PathFragment[] = [];\r\n for (const frag of fragments) {\r\n frag.a = frag.quickMinDistanceToChildCurve(spacePoint);\r\n sortedFragments.push(frag);\r\n }\r\n sortedFragments.sort((frag1: PathFragment, frag2: PathFragment) => frag1.a - frag2.a);\r\n return sortedFragments;\r\n }\r\n /** Return true if `this` fragment addresses `curve` and brackets `fraction`. */\r\n public containsChildCurveAndChildFraction(curve: CurvePrimitive, fraction: number): boolean {\r\n return this.childCurve === curve && fraction >= this.childFraction0 && fraction <= this.childFraction1;\r\n }\r\n /**\r\n * Convert distance to local fraction and apply that to interpolate between the stored curve fractions.\r\n * Note that proportional calculation does NOT account for non-uniform parameterization in the child curve.\r\n */\r\n public chainDistanceToInterpolatedChildFraction(distance: number): number {\r\n return Geometry.inverseInterpolate(\r\n this.childFraction0,\r\n this.chainDistance0,\r\n this.childFraction1,\r\n this.chainDistance1,\r\n distance,\r\n this.childFraction0,\r\n )!; // the interval must have nonzero length so division should be safe\r\n }\r\n /** Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`. */\r\n public chainDistanceToAccurateChildFraction(chainDistance: number, allowExtrapolation?: boolean): number {\r\n const childDetail = this.childCurve.moveSignedDistanceFromFraction(\r\n this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation ?? false,\r\n );\r\n return childDetail.fraction;\r\n }\r\n /**\r\n * Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives.\r\n * @param globalDistance total length of the global curve\r\n */\r\n public fractionScaleFactor(globalDistance: number): number {\r\n return globalDistance * (this.childFraction1 - this.childFraction0) / (this.chainDistance1 - this.chainDistance0);\r\n }\r\n /**\r\n * Reverse the fraction and distance data.\r\n * * Each child fraction `f` is replaced by `1-f`\r\n * * Each `chainDistance` is replaced by `totalDistance - chainDistance`\r\n * @param totalDistance the total distance\r\n */\r\n public reverseFractionsAndDistances(totalDistance: number) {\r\n const f0 = this.childFraction0;\r\n const f1 = this.childFraction1;\r\n const d0 = this.chainDistance0;\r\n const d1 = this.chainDistance1;\r\n this.childFraction0 = 1.0 - f1;\r\n this.childFraction1 = 1.0 - f0;\r\n this.chainDistance0 = totalDistance - d1;\r\n this.chainDistance1 = totalDistance - d0;\r\n }\r\n /** @deprecated in 3.x. Use `PathFragment.childFractionToChainDistance`. */\r\n public childFractionTChainDistance(fraction: number): number {\r\n return this.childFractionToChainDistance(fraction);\r\n }\r\n /**\r\n * Convert a fractional position on the childCurve of this fragment to distance on the curve chain.\r\n * * Return value is SIGNED and will be negative when `fraction < this.childFraction0`.\r\n * @param fraction the fractional position on the childCurve of this fragment\r\n */\r\n public childFractionToChainDistance(fraction: number): number {\r\n let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);\r\n if (fraction < this.childFraction0)\r\n d = -d;\r\n return this.chainDistance0 + d;\r\n }\r\n}\r\n\r\n/** Non-instantiable class to build a distance index for a curve chain. */\r\nclass DistanceIndexConstructionContext implements IStrokeHandler {\r\n private _fragments: PathFragment[];\r\n private _accumulatedDistance: number;\r\n private constructor() {\r\n this._accumulatedDistance = 0;\r\n this._fragments = [];\r\n }\r\n // ignore curve announcements -- they are repeated in stroke announcements\r\n public startParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public startCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endCurvePrimitive(_cp: CurvePrimitive) { }\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d) { }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n const fragmentPoint0 = point0.clone();\r\n const fragmentPoint1 = point1.clone();\r\n let d0 = this._accumulatedDistance;\r\n if (numStrokes <= 1) {\r\n this._accumulatedDistance += point0.distance(point1);\r\n this._fragments.push(new PathFragment(fraction0, fraction1, d0, this._accumulatedDistance, cp,\r\n Range3d.create(fragmentPoint0, fragmentPoint1)));\r\n } else {\r\n let f1;\r\n for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {\r\n f1 = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n point0.interpolate(f1, point1, fragmentPoint1);\r\n d0 = this._accumulatedDistance;\r\n this._accumulatedDistance += (Math.abs(f1 - f0) * point0.distance(point1));\r\n this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp,\r\n Range3d.create(fragmentPoint0, fragmentPoint1)));\r\n fragmentPoint0.setFrom(fragmentPoint1);\r\n }\r\n }\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let f1, d, d0;\r\n for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {\r\n f1 = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n d = cp.curveLengthBetweenFractions(f0, f1);\r\n d0 = this._accumulatedDistance;\r\n this._accumulatedDistance += d;\r\n const range = cp.rangeBetweenFractions(f0, f1);\r\n this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, range));\r\n }\r\n }\r\n public needPrimaryGeometryForStrokes?(): boolean {\r\n return true;\r\n }\r\n /** Create an array of PathFragment from input curve chain. */\r\n public static createPathFragmentIndex(path: CurveChain, options?: StrokeOptions): PathFragment[] {\r\n const handler = new DistanceIndexConstructionContext();\r\n for (const curve of path.children) {\r\n curve.emitStrokableParts(handler, options);\r\n }\r\n const fragments = handler._fragments;\r\n return fragments;\r\n }\r\n}\r\n/**\r\n * `CurveChainWithDistanceIndex` is a CurvePrimitive whose fractional parameterization is proportional to true\r\n * distance along a CurveChain.\r\n * * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`\r\n * to `t1` is easily computed as `L*(t1-t0)`.\r\n * * The curve chain can be any type derived from `CurveChain`, i.e., either a `Path` or a `Loop`.\r\n * @public\r\n */\r\nexport class CurveChainWithDistanceIndex extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"curveChainWithDistanceIndex\";\r\n private readonly _path: CurveChain;\r\n private readonly _fragments: PathFragment[];\r\n private readonly _totalLength: number; // matches final fragment distance1.\r\n private static _numCalls = 0;\r\n private static _numTested = 0;\r\n private static _numAssigned = 0;\r\n private static _numCandidate = 0;\r\n /** Test if `other` is a `CurveChainWithDistanceIndex` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof CurveChainWithDistanceIndex;\r\n }\r\n // final assembly of CurveChainWithDistanceIndex -- caller must create valid fragment index.\r\n private constructor(path: CurveChain, fragments: PathFragment[]) {\r\n super();\r\n this._path = path;\r\n this._fragments = fragments;\r\n this._totalLength = fragments.length > 0 ? fragments[fragments.length - 1].chainDistance1 : 0;\r\n }\r\n /**\r\n * Create a clone, transformed and with its own distance index.\r\n * @param transform transform to apply in the clone.\r\n */\r\n public cloneTransformed(transform: Transform): CurveChainWithDistanceIndex | undefined {\r\n const c = this._path.clone();\r\n if (c instanceof CurveChain && c.tryTransformInPlace(transform))\r\n return CurveChainWithDistanceIndex.createCapture(c);\r\n return undefined;\r\n }\r\n /**\r\n * Reference to the contained path.\r\n * * Do not modify the path. The distance index will be wrong.\r\n */\r\n public get path(): CurveChain {\r\n return this._path;\r\n }\r\n /**\r\n * Reference to the fragments array.\r\n * * Do not modify.\r\n */\r\n public get fragments(): PathFragment[] {\r\n return this._fragments;\r\n }\r\n /** Return a deep clone */\r\n public clone(): CurveChainWithDistanceIndex {\r\n const c = this._path.clone() as CurveChain;\r\n return CurveChainWithDistanceIndex.createCapture(c);\r\n }\r\n /** Return a deep clone */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): CurveChainWithDistanceIndex | undefined {\r\n if (fractionA === fractionB)\r\n return undefined;\r\n let fracA = fractionA;\r\n let fracB = fractionB;\r\n const reversed = fractionA > fractionB;\r\n if (reversed) {\r\n fracA = fractionB;\r\n fracB = fractionA;\r\n }\r\n const chainDistanceA = fracA * this._totalLength;\r\n const chainDistanceB = fracB * this._totalLength;\r\n const fragmentA = this.chainDistanceToFragment(chainDistanceA, true);\r\n if (undefined === fragmentA)\r\n return undefined;\r\n const fragmentB = this.chainDistanceToFragment(chainDistanceB, true);\r\n if (undefined === fragmentB)\r\n return undefined;\r\n const childCurveIndexA = this._path.childIndex(fragmentA.childCurve, true);\r\n if (undefined === childCurveIndexA)\r\n return undefined;\r\n const childCurveIndexB = this._path.childIndex(fragmentB.childCurve, true);\r\n if (undefined === childCurveIndexB)\r\n return undefined;\r\n const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);\r\n const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);\r\n // add a (possibly reversed) partial clone to newPath\r\n const newPath = Path.create();\r\n const addPartialChild = (\r\n childCurve: CurvePrimitive, childFraction0: number, childFraction1: number, reversedClone: boolean,\r\n ): boolean => {\r\n if (childFraction0 === childFraction1)\r\n return false;\r\n let newCurve;\r\n if (childFraction0 === 0.0 && childFraction1 === 1.0) {\r\n newCurve = childCurve.clone();\r\n if (reversedClone)\r\n newCurve.reverseInPlace();\r\n } else {\r\n newCurve = reversedClone ?\r\n childCurve.clonePartialCurve(childFraction1, childFraction0)\r\n : childCurve.clonePartialCurve(childFraction0, childFraction1);\r\n }\r\n if (newCurve) {\r\n newPath.children.push(newCurve);\r\n return true;\r\n }\r\n return false;\r\n };\r\n if (fragmentA.childCurve === fragmentB.childCurve) {\r\n // the two distances are within the same curve.\r\n if (addPartialChild(fragmentA.childCurve, childFractionA, childFractionB, reversed))\r\n return CurveChainWithDistanceIndex.createCapture(newPath); // singleton -- children[] does not need to be reversed.\r\n return undefined;\r\n }\r\n addPartialChild(this._path.children[childCurveIndexA], childFractionA, 1.0, reversed);\r\n // at least two distinct children are impacted ....\r\n for (let childIndex = childCurveIndexA + 1; childIndex < childCurveIndexB; childIndex++) {\r\n addPartialChild(this._path.children[childIndex], 0.0, 1.0, reversed);\r\n }\r\n addPartialChild(this._path.children[childCurveIndexB], 0.0, childFractionB, reversed);\r\n // This reverses array entries but not orientation within each curve ...\r\n if (reversed)\r\n newPath.children.reverse();\r\n return CurveChainWithDistanceIndex.createCapture(newPath);\r\n }\r\n /**\r\n * Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n for (const c of this._path.children) {\r\n if (!c.isInPlane(plane))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /** Return the start point of `this` curve. */\r\n public override startPoint(result?: Point3d): Point3d {\r\n const c = this._path.cyclicCurvePrimitive(0);\r\n if (c)\r\n return c.startPoint(result);\r\n return Point3d.createZero(result);\r\n }\r\n /** Return the end point of of `this` curve. */\r\n public override endPoint(result?: Point3d): Point3d {\r\n const c = this._path.cyclicCurvePrimitive(-1);\r\n if (c)\r\n return c.endPoint(result);\r\n return Point3d.createZero(result);\r\n }\r\n /** Add strokes to caller-supplied linestring */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n for (const c of this._path.children) {\r\n c.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n for (const c of this._path.children) {\r\n c.emitStrokableParts(dest, options);\r\n }\r\n }\r\n /**\r\n * Return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke = 0;\r\n for (const c of this._path.children) {\r\n numStroke += c.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if true, recurse on the children. If false, only push `this`.\r\n * @param explodeLinestrings (if smallestPossiblePrimitives is true) whether to push a [[LineSegment3d]] for each\r\n * segment of a [[LineString3d]] child. If false, push only the [[LineString3d]].\r\n */\r\n public override collectCurvePrimitivesGo(\r\n collectorArray: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): void {\r\n if (smallestPossiblePrimitives) {\r\n for (const c of this._path.children) {\r\n c.collectCurvePrimitivesGo(collectorArray, smallestPossiblePrimitives, explodeLineStrings);\r\n }\r\n } else {\r\n collectorArray.push(this);\r\n }\r\n }\r\n /**\r\n * Construct StrokeCountMap for each child, accumulating data to stroke count map for this primitive.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const myMap = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap);\r\n for (const c of this._path.children) {\r\n c.computeAndAttachRecursiveStrokeCounts(options, myMap);\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myMap, parentStrokeMap);\r\n }\r\n /**\r\n * Second step of double dispatch: call `this._path.dispatchToGeometryHandler (handler)`\r\n * * Note that this exposes the children individually to the handler.\r\n */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleCurveChainWithDistanceIndex(this);\r\n }\r\n /** Extend `rangeToExtend` as needed to include these curves (optionally transformed) */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this._path.extendRange(rangeToExtend, transform);\r\n }\r\n /** Return a (high accuracy and positive) length of the curve between fractional positions */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n return Math.abs(fraction1 - fraction0) * this._totalLength;\r\n }\r\n /**\r\n * Capture (not clone) a path into a new `CurveChainWithDistanceIndex`\r\n * @param path primitive array to be CAPTURED (not cloned)\r\n */\r\n public static createCapture(path: CurveChain, options?: StrokeOptions): CurveChainWithDistanceIndex {\r\n const fragments = DistanceIndexConstructionContext.createPathFragmentIndex(path, options);\r\n const result = new CurveChainWithDistanceIndex(path, fragments);\r\n return result;\r\n }\r\n /**\r\n * Return the PathFragment object at the given `distance` along the chain.\r\n * @param distance distance along the chain.\r\n * @param allowExtrapolation if `true`, returns first fragment for negative distances and returns last fragment\r\n * for distances larger than curve length. If `false` returns `undefined` for those out of bound distances.\r\n */\r\n public chainDistanceToFragment(distance: number, allowExtrapolation: boolean = false): PathFragment | undefined {\r\n const i = this.chainDistanceToFragmentIndex(distance, allowExtrapolation);\r\n if (undefined !== i)\r\n return this._fragments[i];\r\n return undefined;\r\n }\r\n /**\r\n * Return the index of the PathFragment at the given `distance` along the chain.\r\n * @param distance distance along the chain.\r\n * @param allowExtrapolation if `true`, returns 0 for negative distances and returns last fragment index for\r\n * distances larger than curve length. If `false` returns `undefined` for those out of bound distances.\r\n */\r\n protected chainDistanceToFragmentIndex(distance: number, allowExtrapolation: boolean = false): number | undefined {\r\n const numFragments = this._fragments.length;\r\n const fragments = this._fragments;\r\n if (numFragments > 0) {\r\n if (distance < 0.0)\r\n return allowExtrapolation ? 0 : undefined;\r\n if (distance > this._totalLength)\r\n return allowExtrapolation ? (numFragments - 1) : undefined;\r\n // linear search (opportunity for improvement)\r\n for (let i = 0; i < numFragments; i++) {\r\n if (fragments[i].containsChainDistance(distance))\r\n return i;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Convert distance along the chain to fraction along the chain.\r\n * @param distance distance along the chain.\r\n */\r\n public chainDistanceToChainFraction(distance: number): number {\r\n return distance / this._totalLength;\r\n }\r\n /** Return the PathFragment object containing the point at the given `fraction` of the given child curve. */\r\n public curveAndChildFractionToFragment(curve: CurvePrimitive, fraction: number): PathFragment | undefined {\r\n const numFragments = this._fragments.length;\r\n const fragments = this._fragments;\r\n if (numFragments > 0) {\r\n if (fraction < 0)\r\n return fragments[0];\r\n if (fraction > 1.0)\r\n return fragments[numFragments - 1];\r\n // linear search (opportunity for improvement)\r\n for (const fragment of fragments) {\r\n if (fragment.containsChildCurveAndChildFraction(curve, fraction))\r\n return fragment;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Returns the total length of `this` curve. */\r\n public override curveLength(): number {\r\n return this._totalLength;\r\n }\r\n /**\r\n * Returns the total length of the path.\r\n * * This is exact (and simple property lookup) because the true lengths were summed at construction time.\r\n */\r\n public quickLength(): number {\r\n return this._totalLength;\r\n }\r\n /**\r\n * Return the point (x,y,z) on the curve at fractional position along the chain.\r\n * @param fraction fractional position along the curve.\r\n * @returns a point on the curve.\r\n */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true);\r\n if (fragment) {\r\n const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n return fragment.childCurve.fractionToPoint(childFraction, result);\r\n }\r\n assert(false); // we never expect to get here\r\n // no fragment found. just return the first point on the curve.\r\n return this._fragments[0].childCurve.fractionToPoint(0.0, result);\r\n }\r\n /**\r\n * Return the point (x,y,z) and derivative on the curve at fractional position.\r\n * * Note that the derivative is \"derivative of xyz with respect to fraction\".\r\n * * The derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * The derivative is not generally a unit vector. Use `fractionToPointAndUnitTangent` for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @param result optional receiver for the result.\r\n * @returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);\r\n // Recall the standard arclength formula s(t) for the curve C = C(t), with derivative s'(t) = ||C'||.\r\n // Define fractional arclength for C by f = f(t) = s(t)/L, where L is the total length of C. Then f' = ||C'||/L.\r\n // Denote the inverse of f by t = t(f). Then C = C(t(f)) is a parameterization of C by its fractional arclength f.\r\n // Since the derivative of t is t'=1/f'=L/||C'||, the derivative we seek is d/df(C(t(f))) = C' t' = C' L/||C'||.\r\n // The fragment gives us C', so we're just a scale away.\r\n // Math details can be found at core/geometry/internaldocs/Curve.md\r\n const a = this._totalLength / result.direction.magnitude(); // L/||C'||\r\n result.direction.scaleInPlace(a);\r\n return result;\r\n }\r\n /**\r\n * Return the point (x,y,z) and normalized derivative on the curve at fractional position.\r\n * * Note that the derivative is \"derivative of xyz with respect to fraction\".\r\n * * The un-normalized derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * To find the un-normalized derivative, use `fractionToPointAndDerivative`.\r\n * @param fraction fractional position on the curve\r\n * @param result optional receiver for the result.\r\n * @returns a ray whose origin is the curve point and direction is the normalized derivative with respect to\r\n * the fraction.\r\n */\r\n public override fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);\r\n result.direction.normalizeInPlace();\r\n return result;\r\n }\r\n /**\r\n * Return a plane with\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to\r\n * the fraction.\r\n * * vectorV is the second derivative, i.e. derivative of vectorU which points in the direction of the curve's\r\n * derivative's change.\r\n */\r\n public fractionToPointAnd2Derivatives(\r\n fraction: number, result?: Plane3dByOriginAndVectors,\r\n ): Plane3dByOriginAndVectors | undefined {\r\n const distanceAlongPath = fraction * this._totalLength;\r\n const fragment = this.chainDistanceToFragment(distanceAlongPath, true)!;\r\n const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);\r\n result = fragment.childCurve.fractionToPointAnd2Derivatives(childFraction, result);\r\n if (!result)\r\n return undefined;\r\n // See fractionToPointAndDerivative, where we show d/df(C(t(f))) = L C'/||C'||.\r\n // Here we seek the 2nd derivative. We'll use the quotient rule, and the identities\r\n // d/dt||x(t)|| = x.x'/||x|| and ||x||^2 = x.x, where \".\" is the dot product.\r\n // d2/df2(C(t(f))) = L d/df(C'/||C'||) = L (||C'|| d/df(C') - C' d/df||C'||) / ||C'||^2\r\n // = L (||C'|| C\" L/||C'|| - C' C'.C\"/||C'|| L/||C'||) / ||C'||^2\r\n // = (L/||C'||)^2 (C\" - C' C'.C\"/C'.C' ), where C' and C\" are given by the fragment.\r\n // The second derivative that fractionToPointAnd2Derivatives returns is C\", so the second\r\n // derivative we seek is just few scales away.\r\n // Math details can be found at core/geometry/internaldocs/Curve.md\r\n const magU = result.vectorU.magnitude(); // ||C'||\r\n const dotUU = magU * magU; // ||C'||^2\r\n const dotUV = result.vectorU.dotProduct(result.vectorV); // C'.C\"\r\n result.vectorV.addScaledInPlace(result.vectorU, -dotUV / dotUU); // add -(C'*C'.C\")/(||C'||^2) to vectorV\r\n const scale = this._totalLength / magU; // L/||C'||\r\n result.vectorU.scaleInPlace(scale); // scale vectorU by L/||C'||\r\n result.vectorV.scaleInPlace(scale * scale); // scale vectorV by (L/||C'(t)||)^2\r\n return result;\r\n }\r\n /**\r\n * Attempt to transform in place.\r\n * * Warning: If any child transform fails, `this` object becomes invalid but that should never happen.\r\n * @param transform the transform to be applied.\r\n * @returns true if all of child transforms succeed and false otherwise.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n let numFail = 0;\r\n for (const c of this._path.children) {\r\n if (!c.tryTransformInPlace(transform))\r\n numFail++;\r\n }\r\n return numFail === 0;\r\n }\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n this._path.reverseChildrenInPlace();\r\n for (const fragment of this._fragments) {\r\n fragment.reverseFractionsAndDistances(this._totalLength);\r\n }\r\n this._fragments.reverse();\r\n }\r\n /**\r\n * Test for equality conditions.\r\n * * Mismatched total length is a quick exit condition.\r\n * * If total length matches, recurse to the path for matching primitives.\r\n */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof CurveChainWithDistanceIndex) {\r\n return Geometry.isSameCoordinate(this._totalLength, other._totalLength) && this._path.isAlmostEqual(other._path);\r\n }\r\n return false;\r\n }\r\n /**\r\n * (Attempt to) find a position on the curve at a signed distance from start fraction.\r\n * * See `CurvePrimitive.moveSignedDistanceFromFraction` for parameter details.\r\n * * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex and\r\n * has pointer to an additional detail for the child curve.\r\n */\r\n public override moveSignedDistanceFromFraction(\r\n startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n const distanceA = startFraction * this._totalLength;\r\n const distanceB = distanceA + signedDistance;\r\n const fragmentB = this.chainDistanceToFragment(distanceB, true)!;\r\n const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(\r\n fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result,\r\n ); // local detail related to the child curve\r\n const endFraction = startFraction + (signedDistance / this._totalLength);\r\n const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(\r\n allowExtension, this, startFraction, endFraction, signedDistance, result,\r\n ); // global detail related to the curve chain\r\n chainDetail.childDetail = childDetail;\r\n return chainDetail;\r\n }\r\n /**\r\n * Return an object summarizing closest point test counts.\r\n * The returned object has\r\n * * numCalls = number of times closestPoint was called.\r\n * * numCurvesTested = number of curves tested with full closestPoint.\r\n * * numAssigned = number of times a new minimum value was recorded.\r\n * * numCandidate = number of curves that would be tested in worst case.\r\n * @param clear if true, counts are cleared after the return object is formed.\r\n */\r\n public static getClosestPointTestCounts(\r\n clear: boolean = true,\r\n ): { numCalls: number, numTested: number, numAssigned: number, numCandidate: number } {\r\n const a = {\r\n numCalls: this._numCalls,\r\n numTested: this._numTested,\r\n numAssigned: this._numAssigned,\r\n numCandidate: this._numCandidate,\r\n };\r\n if (clear) {\r\n this._numTested = this._numAssigned = this._numCandidate = 0;\r\n }\r\n return a;\r\n }\r\n /**\r\n * Search for the curve point that is closest to the spacePoint.\r\n * * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which (via a handler)\r\n * determines a CurveLocation detail among the children.\r\n * * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex and\r\n * has pointer to an additional detail for the child curve.\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve\r\n * @returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter): CurveLocationDetail | undefined {\r\n let childDetail: CurveLocationDetail | undefined;\r\n let aMin = Number.MAX_VALUE;\r\n const numChildren = this.path.children.length;\r\n if (numChildren === 1) {\r\n childDetail = this.path.children[0].closestPoint(spacePoint, extend);\r\n } else {\r\n const sortedFragments = PathFragment.collectSortedQuickMinDistances(this._fragments, spacePoint);\r\n const extend0 = [\r\n CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0),\r\n CurveExtendMode.None,\r\n ];\r\n const extend1 = [\r\n CurveExtendMode.None,\r\n CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1),\r\n ];\r\n const fragment0 = this._fragments[0];\r\n const fragment1 = this._fragments[this._fragments.length - 1];\r\n CurveChainWithDistanceIndex._numCalls++;\r\n CurveChainWithDistanceIndex._numCandidate += sortedFragments.length;\r\n let detailA: CurveLocationDetail | undefined;\r\n for (const sortedFragment of sortedFragments) {\r\n if (sortedFragment.a > aMin)\r\n // sortedFragments help early exit because it is likely that one of the first few fragments\r\n // in sortedFragments is the fragment with minimum distance from space point to the curve.\r\n break;\r\n CurveChainWithDistanceIndex._numTested++;\r\n const child = sortedFragment.childCurve;\r\n detailA = child.closestPoint(\r\n spacePoint, sortedFragment === fragment0 ? extend0 : sortedFragment === fragment1 ? extend1 : false, detailA,\r\n );\r\n if (detailA && detailA.a < aMin) {\r\n aMin = detailA.a;\r\n childDetail = detailA.clone(childDetail);\r\n CurveChainWithDistanceIndex._numAssigned++;\r\n }\r\n }\r\n }\r\n if (!childDetail)\r\n return undefined;\r\n return this.computeChainDetail(childDetail);\r\n }\r\n /**\r\n * Construct an offset of each child as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset to return a fully\r\n * joined offset.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve) or offset options object.\r\n */\r\n public override constructOffsetXY(\r\n offsetDistanceOrOptions: number | OffsetOptions,\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const offsets: CurvePrimitive[] = [];\r\n for (const prim of this.collectCurvePrimitives(undefined, true, true)) {\r\n const offset = prim.constructOffsetXY(options);\r\n if (offset !== undefined) {\r\n if (offset instanceof CurvePrimitive)\r\n offsets.push(offset);\r\n else if (Array.isArray(offset))\r\n offset.forEach((cp) => offsets.push(cp));\r\n }\r\n }\r\n return offsets;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of\r\n * projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output.\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n /**\r\n * Compute the global chain detail corresponding to a local child detail.\r\n * @param childDetail the local detail, with respect to a child of this chain.\r\n * @returns the global detail, with respect to this chain.\r\n */\r\n public computeChainDetail(childDetail: CurveLocationDetail): CurveLocationDetail | undefined {\r\n if (!childDetail.curve)\r\n return undefined;\r\n const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);\r\n if (fragment) {\r\n const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);\r\n const chainFraction = this.chainDistanceToChainFraction(chainDistance);\r\n const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);\r\n chainDetail.childDetail = childDetail;\r\n chainDetail.a = childDetail.a;\r\n return chainDetail;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -4,12 +4,15 @@ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
|
4
4
|
import { Range1d, Range3d } from "../geometry3d/Range";
|
|
5
5
|
import { Ray3d } from "../geometry3d/Ray3d";
|
|
6
6
|
import { Transform } from "../geometry3d/Transform";
|
|
7
|
-
import { AnyCurve } from "./CurveChain";
|
|
8
7
|
import { CurveLocationDetail } from "./CurveLocationDetail";
|
|
9
8
|
import { CurvePrimitive } from "./CurvePrimitive";
|
|
10
9
|
import { RecursiveCurveProcessor } from "./CurveProcessor";
|
|
10
|
+
import { AnyCurve, type AnyRegion } from "./CurveTypes";
|
|
11
11
|
import { GeometryQuery } from "./GeometryQuery";
|
|
12
12
|
import { StrokeOptions } from "./StrokeOptions";
|
|
13
|
+
import type { Path } from "./Path";
|
|
14
|
+
import type { Loop } from "./Loop";
|
|
15
|
+
/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */
|
|
13
16
|
/**
|
|
14
17
|
* Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be
|
|
15
18
|
* used in conditional statements for type-switching.
|
|
@@ -86,17 +89,28 @@ export declare abstract class CurveCollection extends GeometryQuery {
|
|
|
86
89
|
* * `Loop`
|
|
87
90
|
* * `ParityRegion`
|
|
88
91
|
* * `UnionRegion`
|
|
92
|
+
* @see isAnyRegion
|
|
89
93
|
*/
|
|
90
94
|
get isAnyRegionType(): boolean;
|
|
91
|
-
/**
|
|
95
|
+
/** Type guard for AnyRegion */
|
|
96
|
+
isAnyRegion(): this is AnyRegion;
|
|
97
|
+
/**
|
|
98
|
+
* Return true for a `Path`, i.e. a chain of curves joined head-to-tail
|
|
99
|
+
* @see isPath
|
|
100
|
+
*/
|
|
92
101
|
get isOpenPath(): boolean;
|
|
102
|
+
/** Type guard for Path */
|
|
103
|
+
isPath(): this is Path;
|
|
93
104
|
/**
|
|
94
105
|
* Return true for a single-loop planar region type, i.e. `Loop`.
|
|
95
106
|
* * This is NOT a test for physical closure of a `Path`.
|
|
107
|
+
* @see isLoop
|
|
96
108
|
*/
|
|
97
109
|
get isClosedPath(): boolean;
|
|
110
|
+
/** Type guard for Loop */
|
|
111
|
+
isLoop(): this is Loop;
|
|
98
112
|
/** Return a CurveCollection with the same structure but all curves replaced by strokes. */
|
|
99
|
-
abstract cloneStroked(options?: StrokeOptions):
|
|
113
|
+
abstract cloneStroked(options?: StrokeOptions): CurveCollection;
|
|
100
114
|
/** Support method for ICurvePrimitive ... one line call to specific announce method . . */
|
|
101
115
|
abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;
|
|
102
116
|
/** Clone an empty collection. */
|
|
@@ -140,7 +154,7 @@ export declare abstract class CurveCollection extends GeometryQuery {
|
|
|
140
154
|
/**
|
|
141
155
|
* Shared base class for use by both open and closed paths.
|
|
142
156
|
* * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.
|
|
143
|
-
* * The specific derived classes are `Path` and `Loop
|
|
157
|
+
* * The specific derived classes are `Path` and `Loop`.
|
|
144
158
|
* * `CurveChain` is an intermediate class. It is not instantiable on its own.
|
|
145
159
|
* * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings
|
|
146
160
|
* from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.
|
|
@@ -166,7 +180,7 @@ export declare abstract class CurveChain extends CurveCollection {
|
|
|
166
180
|
*/
|
|
167
181
|
getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined;
|
|
168
182
|
/** Return a structural clone, with CurvePrimitive objects stroked. */
|
|
169
|
-
abstract cloneStroked(options?: StrokeOptions):
|
|
183
|
+
abstract cloneStroked(options?: StrokeOptions): CurveChain;
|
|
170
184
|
/**
|
|
171
185
|
* Add a child curve.
|
|
172
186
|
* * Returns false if the given child is not a CurvePrimitive.
|
|
@@ -225,18 +239,4 @@ export declare class BagOfCurves extends CurveCollection {
|
|
|
225
239
|
/** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */
|
|
226
240
|
dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
227
241
|
}
|
|
228
|
-
/**
|
|
229
|
-
* * Options to control method `RegionOps.consolidateAdjacentPrimitives`
|
|
230
|
-
* @public
|
|
231
|
-
*/
|
|
232
|
-
export declare class ConsolidateAdjacentCurvePrimitivesOptions {
|
|
233
|
-
/** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */
|
|
234
|
-
consolidateLinearGeometry: boolean;
|
|
235
|
-
/** True to consolidate contiguous arcs */
|
|
236
|
-
consolidateCompatibleArcs: boolean;
|
|
237
|
-
/** Tolerance for collapsing identical points */
|
|
238
|
-
duplicatePointTolerance: number;
|
|
239
|
-
/** Tolerance for removing interior colinear points. */
|
|
240
|
-
colinearPointTolerance: number;
|
|
241
|
-
}
|
|
242
242
|
//# sourceMappingURL=CurveCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CurveCollection.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eA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MAAM,CAAC,EAAE,mBAAmB,GACrF,mBAAmB,GAAG,SAAS;CAOnC;AAED;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAC9C,wCAAwC;IACxC,SAAgB,mBAAmB,iBAAiB;IACpD,sDAAsD;IAC/C,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAGzD;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC;IAChC,uCAAuC;;IAKvC,kDAAkD;IAClD,IAAoB,QAAQ,IAAI,QAAQ,EAAE,CAEzC;IACD,gCAAgC;WAClB,MAAM,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW;IAOtD,gFAAgF;IACzE,eAAe,IAAI,MAAM;IAGhC,mEAAmE;IAC5D,wBAAwB,CAAC,SAAS,EAAE,uBAAuB,EAAE,aAAa,GAAE,MAAW,GAAG,IAAI;IAGrG,0CAA0C;IACnC,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,WAAW;IAiBzD,oCAAoC;IAC7B,cAAc,IAAI,WAAW;IAGpC,mBAAmB;IACZ,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAKxD,2BAA2B;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAKhD,8EAA8E;IACvE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.BagOfCurves = exports.CurveChain = exports.CurveCollection = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Curve
|
|
10
10
|
*/
|
|
@@ -130,21 +130,38 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
130
130
|
* * `Loop`
|
|
131
131
|
* * `ParityRegion`
|
|
132
132
|
* * `UnionRegion`
|
|
133
|
+
* @see isAnyRegion
|
|
133
134
|
*/
|
|
134
135
|
get isAnyRegionType() {
|
|
135
136
|
return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;
|
|
136
137
|
}
|
|
137
|
-
/**
|
|
138
|
+
/** Type guard for AnyRegion */
|
|
139
|
+
isAnyRegion() {
|
|
140
|
+
return this.isAnyRegionType;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Return true for a `Path`, i.e. a chain of curves joined head-to-tail
|
|
144
|
+
* @see isPath
|
|
145
|
+
*/
|
|
138
146
|
get isOpenPath() {
|
|
139
147
|
return this.dgnBoundaryType() === 1;
|
|
140
148
|
}
|
|
149
|
+
/** Type guard for Path */
|
|
150
|
+
isPath() {
|
|
151
|
+
return this.isOpenPath;
|
|
152
|
+
}
|
|
141
153
|
/**
|
|
142
154
|
* Return true for a single-loop planar region type, i.e. `Loop`.
|
|
143
155
|
* * This is NOT a test for physical closure of a `Path`.
|
|
156
|
+
* @see isLoop
|
|
144
157
|
*/
|
|
145
158
|
get isClosedPath() {
|
|
146
159
|
return this.dgnBoundaryType() === 2;
|
|
147
160
|
}
|
|
161
|
+
/** Type guard for Loop */
|
|
162
|
+
isLoop() {
|
|
163
|
+
return this.isClosedPath;
|
|
164
|
+
}
|
|
148
165
|
/**
|
|
149
166
|
* Extend (increase) the given range as needed to encompass all curves in the curve collection.
|
|
150
167
|
* @param rangeToExtend the given range.
|
|
@@ -194,7 +211,7 @@ exports.CurveCollection = CurveCollection;
|
|
|
194
211
|
/**
|
|
195
212
|
* Shared base class for use by both open and closed paths.
|
|
196
213
|
* * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.
|
|
197
|
-
* * The specific derived classes are `Path` and `Loop
|
|
214
|
+
* * The specific derived classes are `Path` and `Loop`.
|
|
198
215
|
* * `CurveChain` is an intermediate class. It is not instantiable on its own.
|
|
199
216
|
* * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings
|
|
200
217
|
* from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.
|
|
@@ -209,8 +226,6 @@ class CurveChain extends CurveCollection {
|
|
|
209
226
|
}
|
|
210
227
|
/** Return the array of `CurvePrimitive` */
|
|
211
228
|
get children() {
|
|
212
|
-
if (this._curves === undefined)
|
|
213
|
-
this._curves = [];
|
|
214
229
|
return this._curves;
|
|
215
230
|
}
|
|
216
231
|
/**
|
|
@@ -390,21 +405,4 @@ class BagOfCurves extends CurveCollection {
|
|
|
390
405
|
}
|
|
391
406
|
}
|
|
392
407
|
exports.BagOfCurves = BagOfCurves;
|
|
393
|
-
/**
|
|
394
|
-
* * Options to control method `RegionOps.consolidateAdjacentPrimitives`
|
|
395
|
-
* @public
|
|
396
|
-
*/
|
|
397
|
-
class ConsolidateAdjacentCurvePrimitivesOptions {
|
|
398
|
-
constructor() {
|
|
399
|
-
/** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */
|
|
400
|
-
this.consolidateLinearGeometry = true;
|
|
401
|
-
/** True to consolidate contiguous arcs */
|
|
402
|
-
this.consolidateCompatibleArcs = true;
|
|
403
|
-
/** Tolerance for collapsing identical points */
|
|
404
|
-
this.duplicatePointTolerance = Geometry_1.Geometry.smallMetricDistance;
|
|
405
|
-
/** Tolerance for removing interior colinear points. */
|
|
406
|
-
this.colinearPointTolerance = Geometry_1.Geometry.smallMetricDistance;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
exports.ConsolidateAdjacentCurvePrimitivesOptions = ConsolidateAdjacentCurvePrimitivesOptions;
|
|
410
408
|
//# sourceMappingURL=CurveCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"m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AAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3ED,kCA2EC;AAED;;;GAGG;AACH,MAAa,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA;AATD,8FASC","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\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the\r\n * same plane).\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to\r\n * be on the same plane).\r\n * - `ParityRegion` -- a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - `UnionRegion` -- a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure of a `Path`.\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAOvC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AC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3ED,kCA2EC","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\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the\r\n * same plane).\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to\r\n * be on the same plane).\r\n * - `ParityRegion` -- a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - `UnionRegion` -- a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure of a `Path`.\r\n * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n"]}
|