@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
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Curve
|
|
7
7
|
*/
|
|
8
|
+
import { assert } from "@itwin/core-bentley";
|
|
8
9
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
9
10
|
import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
|
|
10
11
|
import { Geometry } from "../Geometry";
|
|
@@ -17,14 +18,14 @@ import { PlaneAltitudeRangeContext } from "./internalContexts/PlaneAltitudeRange
|
|
|
17
18
|
import { OffsetOptions } from "./OffsetOptions";
|
|
18
19
|
import { Path } from "./Path";
|
|
19
20
|
/**
|
|
20
|
-
* Annotation of an interval of a curve.
|
|
21
|
+
* Annotation of a fragment, i.e. an interval of a curve.
|
|
21
22
|
* * The interval is marked with two pairs of numbers:
|
|
22
|
-
* * * fraction0, fraction1 = fraction parameters along the child curve
|
|
23
|
-
* * * distance0,distance1 = distances within containing CurveChainWithDistanceIndex
|
|
23
|
+
* * * fraction0, fraction1 = fraction parameters along the child curve.
|
|
24
|
+
* * * distance0, distance1 = distances within containing CurveChainWithDistanceIndex.
|
|
24
25
|
* @public
|
|
25
26
|
*/
|
|
26
27
|
export class PathFragment {
|
|
27
|
-
/** Create a fragment with complete fraction, distance and child data. */
|
|
28
|
+
/** Create a fragment with complete fraction, distance, and child data. */
|
|
28
29
|
constructor(childFraction0, childFraction1, distance0, distance1, childCurve, range) {
|
|
29
30
|
this.childFraction0 = childFraction0;
|
|
30
31
|
this.childFraction1 = childFraction1;
|
|
@@ -34,68 +35,64 @@ export class PathFragment {
|
|
|
34
35
|
this.range = range;
|
|
35
36
|
this.a = 0;
|
|
36
37
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Return true if the distance is within the distance limits of this fragment.
|
|
39
|
-
* @param distance
|
|
40
|
-
*/
|
|
38
|
+
/** Return true if the distance is within the distance limits of this fragment. */
|
|
41
39
|
containsChainDistance(distance) {
|
|
42
40
|
return distance >= this.chainDistance0 && distance <= this.chainDistance1;
|
|
43
41
|
}
|
|
44
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Return a quick minimum distance from spacePoint to the curve.
|
|
44
|
+
* * The returned distance is to the curve's range box if defined; otherwise, the true distance is computed.
|
|
45
|
+
* * Thus the returned distance may be SMALLER than the true distance to the curve, but not larger.
|
|
46
|
+
*/
|
|
45
47
|
quickMinDistanceToChildCurve(spacePoint) {
|
|
46
|
-
if (this.range)
|
|
48
|
+
if (this.range)
|
|
47
49
|
return this.range.distanceToPoint(spacePoint);
|
|
48
|
-
}
|
|
49
|
-
// ugh. have to do real computation ..
|
|
50
50
|
const detail = this.childCurve.closestPoint(spacePoint, false);
|
|
51
51
|
if (detail)
|
|
52
52
|
return detail.a;
|
|
53
53
|
return 0;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Return an array with (references to) all the path fragments, sorted smallest to largest on the "a" value
|
|
57
|
-
*
|
|
56
|
+
* Return an array with (references to) all the input path fragments, sorted smallest to largest on the "a" value,
|
|
57
|
+
* initialized with `quickMinDistanceToChildCurve`
|
|
58
58
|
*/
|
|
59
59
|
static collectSortedQuickMinDistances(fragments, spacePoint) {
|
|
60
60
|
const sortedFragments = [];
|
|
61
|
-
for (const
|
|
62
|
-
|
|
63
|
-
sortedFragments.push(
|
|
61
|
+
for (const frag of fragments) {
|
|
62
|
+
frag.a = frag.quickMinDistanceToChildCurve(spacePoint);
|
|
63
|
+
sortedFragments.push(frag);
|
|
64
64
|
}
|
|
65
|
-
sortedFragments.sort((
|
|
65
|
+
sortedFragments.sort((frag1, frag2) => frag1.a - frag2.a);
|
|
66
66
|
return sortedFragments;
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Return true if this fragment addresses `curve` and brackets `fraction`
|
|
70
|
-
* @param distance
|
|
71
|
-
*/
|
|
68
|
+
/** Return true if `this` fragment addresses `curve` and brackets `fraction`. */
|
|
72
69
|
containsChildCurveAndChildFraction(curve, fraction) {
|
|
73
70
|
return this.childCurve === curve && fraction >= this.childFraction0 && fraction <= this.childFraction1;
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
76
|
-
* Convert distance to local fraction
|
|
77
|
-
* Note that proportional calculation does NOT account for
|
|
73
|
+
* Convert distance to local fraction and apply that to interpolate between the stored curve fractions.
|
|
74
|
+
* Note that proportional calculation does NOT account for non-uniform parameterization in the child curve.
|
|
78
75
|
*/
|
|
79
76
|
chainDistanceToInterpolatedChildFraction(distance) {
|
|
80
|
-
return Geometry.inverseInterpolate(this.childFraction0, this.chainDistance0, this.childFraction1, this.chainDistance1, distance, this.childFraction0); // the interval
|
|
77
|
+
return Geometry.inverseInterpolate(this.childFraction0, this.chainDistance0, this.childFraction1, this.chainDistance1, distance, this.childFraction0); // the interval must have nonzero length so division should be safe
|
|
81
78
|
}
|
|
82
|
-
/** Convert chainDistance to
|
|
79
|
+
/** Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`. */
|
|
83
80
|
chainDistanceToAccurateChildFraction(chainDistance, allowExtrapolation) {
|
|
84
|
-
// The fragments are really expected to do good mappings in their distance range ...
|
|
85
81
|
const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation ?? false);
|
|
86
82
|
return childDetail.fraction;
|
|
87
83
|
}
|
|
88
84
|
/**
|
|
89
|
-
* Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives
|
|
90
|
-
* @param globalDistance total length of the global curve
|
|
85
|
+
* Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives.
|
|
86
|
+
* @param globalDistance total length of the global curve
|
|
91
87
|
*/
|
|
92
88
|
fractionScaleFactor(globalDistance) {
|
|
93
89
|
return globalDistance * (this.childFraction1 - this.childFraction0) / (this.chainDistance1 - this.chainDistance0);
|
|
94
90
|
}
|
|
95
91
|
/**
|
|
96
92
|
* Reverse the fraction and distance data.
|
|
97
|
-
* *
|
|
98
|
-
* *
|
|
93
|
+
* * Each child fraction `f` is replaced by `1-f`
|
|
94
|
+
* * Each `chainDistance` is replaced by `totalDistance - chainDistance`
|
|
95
|
+
* @param totalDistance the total distance
|
|
99
96
|
*/
|
|
100
97
|
reverseFractionsAndDistances(totalDistance) {
|
|
101
98
|
const f0 = this.childFraction0;
|
|
@@ -107,14 +104,14 @@ export class PathFragment {
|
|
|
107
104
|
this.chainDistance0 = totalDistance - d1;
|
|
108
105
|
this.chainDistance1 = totalDistance - d0;
|
|
109
106
|
}
|
|
110
|
-
/** @deprecated in 3.x. Use childFractionToChainDistance */
|
|
107
|
+
/** @deprecated in 3.x. Use `PathFragment.childFractionToChainDistance`. */
|
|
111
108
|
childFractionTChainDistance(fraction) {
|
|
112
109
|
return this.childFractionToChainDistance(fraction);
|
|
113
110
|
}
|
|
114
111
|
/**
|
|
115
|
-
* Convert a fractional position on the childCurve to distance
|
|
116
|
-
* * Return value is SIGNED
|
|
117
|
-
* @param fraction
|
|
112
|
+
* Convert a fractional position on the childCurve of this fragment to distance on the curve chain.
|
|
113
|
+
* * Return value is SIGNED and will be negative when `fraction < this.childFraction0`.
|
|
114
|
+
* @param fraction the fractional position on the childCurve of this fragment
|
|
118
115
|
*/
|
|
119
116
|
childFractionToChainDistance(fraction) {
|
|
120
117
|
let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);
|
|
@@ -123,7 +120,7 @@ export class PathFragment {
|
|
|
123
120
|
return this.chainDistance0 + d;
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
/** Non-instantiable class to build a distance index for a
|
|
123
|
+
/** Non-instantiable class to build a distance index for a curve chain. */
|
|
127
124
|
class DistanceIndexConstructionContext {
|
|
128
125
|
constructor() {
|
|
129
126
|
this._accumulatedDistance = 0;
|
|
@@ -135,7 +132,6 @@ class DistanceIndexConstructionContext {
|
|
|
135
132
|
endParentCurvePrimitive(_cp) { }
|
|
136
133
|
endCurvePrimitive(_cp) { }
|
|
137
134
|
announcePointTangent(_xyz, _fraction, _tangent) { }
|
|
138
|
-
/** Announce numPoints interpolated between point0 and point1, with associated fractions */
|
|
139
135
|
announceSegmentInterval(cp, point0, point1, numStrokes, fraction0, fraction1) {
|
|
140
136
|
const fragmentPoint0 = point0.clone();
|
|
141
137
|
const fragmentPoint1 = point1.clone();
|
|
@@ -167,7 +163,10 @@ class DistanceIndexConstructionContext {
|
|
|
167
163
|
this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, range));
|
|
168
164
|
}
|
|
169
165
|
}
|
|
170
|
-
needPrimaryGeometryForStrokes() {
|
|
166
|
+
needPrimaryGeometryForStrokes() {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
/** Create an array of PathFragment from input curve chain. */
|
|
171
170
|
static createPathFragmentIndex(path, options) {
|
|
172
171
|
const handler = new DistanceIndexConstructionContext();
|
|
173
172
|
for (const curve of path.children) {
|
|
@@ -182,12 +181,11 @@ class DistanceIndexConstructionContext {
|
|
|
182
181
|
* distance along a CurveChain.
|
|
183
182
|
* * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`
|
|
184
183
|
* to `t1` is easily computed as `L*(t1-t0)`.
|
|
185
|
-
* * The curve chain can be any type derived from CurveChain.
|
|
186
|
-
* * * i.e. either a `Path` or a `Loop`
|
|
184
|
+
* * The curve chain can be any type derived from `CurveChain`, i.e., either a `Path` or a `Loop`.
|
|
187
185
|
* @public
|
|
188
186
|
*/
|
|
189
187
|
class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
190
|
-
/** Test if other is a `CurveChainWithDistanceIndex` */
|
|
188
|
+
/** Test if `other` is a `CurveChainWithDistanceIndex` */
|
|
191
189
|
isSameGeometryClass(other) {
|
|
192
190
|
return other instanceof CurveChainWithDistanceIndex;
|
|
193
191
|
}
|
|
@@ -212,7 +210,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
212
210
|
}
|
|
213
211
|
/**
|
|
214
212
|
* Reference to the contained path.
|
|
215
|
-
* * Do not modify the path.
|
|
213
|
+
* * Do not modify the path. The distance index will be wrong.
|
|
216
214
|
*/
|
|
217
215
|
get path() {
|
|
218
216
|
return this._path;
|
|
@@ -306,14 +304,14 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
306
304
|
}
|
|
307
305
|
return true;
|
|
308
306
|
}
|
|
309
|
-
/** Return the start point of
|
|
307
|
+
/** Return the start point of `this` curve. */
|
|
310
308
|
startPoint(result) {
|
|
311
309
|
const c = this._path.cyclicCurvePrimitive(0);
|
|
312
310
|
if (c)
|
|
313
311
|
return c.startPoint(result);
|
|
314
312
|
return Point3d.createZero(result);
|
|
315
313
|
}
|
|
316
|
-
/** Return the end point of
|
|
314
|
+
/** Return the end point of of `this` curve. */
|
|
317
315
|
endPoint(result) {
|
|
318
316
|
const c = this._path.cyclicCurvePrimitive(-1);
|
|
319
317
|
if (c)
|
|
@@ -349,7 +347,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
349
347
|
/**
|
|
350
348
|
* Return an array containing only the curve primitives.
|
|
351
349
|
* @param collectorArray array to receive primitives (pushed -- the array is not cleared)
|
|
352
|
-
* @param smallestPossiblePrimitives if true, recurse on the
|
|
350
|
+
* @param smallestPossiblePrimitives if true, recurse on the children. If false, only push `this`.
|
|
353
351
|
* @param explodeLinestrings (if smallestPossiblePrimitives is true) whether to push a [[LineSegment3d]] for each
|
|
354
352
|
* segment of a [[LineString3d]] child. If false, push only the [[LineString3d]].
|
|
355
353
|
*/
|
|
@@ -376,21 +374,17 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
376
374
|
CurvePrimitive.installStrokeCountMap(this, myMap, parentStrokeMap);
|
|
377
375
|
}
|
|
378
376
|
/**
|
|
379
|
-
* Second step of double dispatch:
|
|
377
|
+
* Second step of double dispatch: call `this._path.dispatchToGeometryHandler (handler)`
|
|
380
378
|
* * Note that this exposes the children individually to the handler.
|
|
381
379
|
*/
|
|
382
380
|
dispatchToGeometryHandler(handler) {
|
|
383
|
-
return
|
|
381
|
+
return handler.handleCurveChainWithDistanceIndex(this);
|
|
384
382
|
}
|
|
385
|
-
/** Extend
|
|
383
|
+
/** Extend `rangeToExtend` as needed to include these curves (optionally transformed) */
|
|
386
384
|
extendRange(rangeToExtend, transform) {
|
|
387
385
|
this._path.extendRange(rangeToExtend, transform);
|
|
388
386
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Curve length is always positive.
|
|
391
|
-
* @returns Returns a (high accuracy) length of the curve between fractional positions
|
|
392
|
-
* @returns Returns the length of the curve.
|
|
393
|
-
*/
|
|
387
|
+
/** Return a (high accuracy and positive) length of the curve between fractional positions */
|
|
394
388
|
curveLengthBetweenFractions(fraction0, fraction1) {
|
|
395
389
|
return Math.abs(fraction1 - fraction0) * this._totalLength;
|
|
396
390
|
}
|
|
@@ -404,9 +398,10 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
404
398
|
return result;
|
|
405
399
|
}
|
|
406
400
|
/**
|
|
407
|
-
*
|
|
408
|
-
* @param distance
|
|
409
|
-
* @param allowExtrapolation
|
|
401
|
+
* Return the PathFragment object at the given `distance` along the chain.
|
|
402
|
+
* @param distance distance along the chain.
|
|
403
|
+
* @param allowExtrapolation if `true`, returns first fragment for negative distances and returns last fragment
|
|
404
|
+
* for distances larger than curve length. If `false` returns `undefined` for those out of bound distances.
|
|
410
405
|
*/
|
|
411
406
|
chainDistanceToFragment(distance, allowExtrapolation = false) {
|
|
412
407
|
const i = this.chainDistanceToFragmentIndex(distance, allowExtrapolation);
|
|
@@ -415,9 +410,10 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
415
410
|
return undefined;
|
|
416
411
|
}
|
|
417
412
|
/**
|
|
418
|
-
*
|
|
419
|
-
* @param distance
|
|
420
|
-
* @param allowExtrapolation
|
|
413
|
+
* Return the index of the PathFragment at the given `distance` along the chain.
|
|
414
|
+
* @param distance distance along the chain.
|
|
415
|
+
* @param allowExtrapolation if `true`, returns 0 for negative distances and returns last fragment index for
|
|
416
|
+
* distances larger than curve length. If `false` returns `undefined` for those out of bound distances.
|
|
421
417
|
*/
|
|
422
418
|
chainDistanceToFragmentIndex(distance, allowExtrapolation = false) {
|
|
423
419
|
const numFragments = this._fragments.length;
|
|
@@ -427,7 +423,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
427
423
|
return allowExtrapolation ? 0 : undefined;
|
|
428
424
|
if (distance > this._totalLength)
|
|
429
425
|
return allowExtrapolation ? (numFragments - 1) : undefined;
|
|
430
|
-
//
|
|
426
|
+
// linear search (opportunity for improvement)
|
|
431
427
|
for (let i = 0; i < numFragments; i++) {
|
|
432
428
|
if (fragments[i].containsChainDistance(distance))
|
|
433
429
|
return i;
|
|
@@ -437,33 +433,29 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
437
433
|
}
|
|
438
434
|
/**
|
|
439
435
|
* Convert distance along the chain to fraction along the chain.
|
|
440
|
-
* @param distance distance along the chain
|
|
436
|
+
* @param distance distance along the chain.
|
|
441
437
|
*/
|
|
442
438
|
chainDistanceToChainFraction(distance) {
|
|
443
439
|
return distance / this._totalLength;
|
|
444
440
|
}
|
|
445
|
-
/**
|
|
446
|
-
* Resolve a fraction within a specific curve to a fragment.
|
|
447
|
-
* @param curve
|
|
448
|
-
* @param fraction
|
|
449
|
-
*/
|
|
441
|
+
/** Return the PathFragment object containing the point at the given `fraction` of the given child curve. */
|
|
450
442
|
curveAndChildFractionToFragment(curve, fraction) {
|
|
451
443
|
const numFragments = this._fragments.length;
|
|
452
444
|
const fragments = this._fragments;
|
|
453
445
|
if (numFragments > 0) {
|
|
454
|
-
|
|
446
|
+
if (fraction < 0)
|
|
447
|
+
return fragments[0];
|
|
448
|
+
if (fraction > 1.0)
|
|
449
|
+
return fragments[numFragments - 1];
|
|
450
|
+
// linear search (opportunity for improvement)
|
|
455
451
|
for (const fragment of fragments) {
|
|
456
452
|
if (fragment.containsChildCurveAndChildFraction(curve, fraction))
|
|
457
453
|
return fragment;
|
|
458
454
|
}
|
|
459
|
-
if (fraction <= 0)
|
|
460
|
-
return fragments[0];
|
|
461
|
-
if (fraction > 1.0)
|
|
462
|
-
return fragments[numFragments - 1];
|
|
463
455
|
}
|
|
464
456
|
return undefined;
|
|
465
457
|
}
|
|
466
|
-
/** Returns the total length of
|
|
458
|
+
/** Returns the total length of `this` curve. */
|
|
467
459
|
curveLength() {
|
|
468
460
|
return this._totalLength;
|
|
469
461
|
}
|
|
@@ -476,52 +468,59 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
476
468
|
}
|
|
477
469
|
/**
|
|
478
470
|
* Return the point (x,y,z) on the curve at fractional position along the chain.
|
|
479
|
-
* @param fraction fractional position along the
|
|
480
|
-
* @returns
|
|
471
|
+
* @param fraction fractional position along the curve.
|
|
472
|
+
* @returns a point on the curve.
|
|
481
473
|
*/
|
|
482
474
|
fractionToPoint(fraction, result) {
|
|
483
|
-
const
|
|
484
|
-
const fragment = this.chainDistanceToFragment(
|
|
475
|
+
const distanceAlongPath = fraction * this._totalLength;
|
|
476
|
+
const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
|
|
485
477
|
if (fragment) {
|
|
486
|
-
const childFraction = fragment.chainDistanceToAccurateChildFraction(
|
|
478
|
+
const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
|
|
487
479
|
return fragment.childCurve.fractionToPoint(childFraction, result);
|
|
488
480
|
}
|
|
489
|
-
//
|
|
490
|
-
//
|
|
481
|
+
assert(false); // we never expect to get here
|
|
482
|
+
// no fragment found. just return the first point on the curve.
|
|
491
483
|
return this._fragments[0].childCurve.fractionToPoint(0.0, result);
|
|
492
484
|
}
|
|
493
485
|
/**
|
|
494
486
|
* Return the point (x,y,z) and derivative on the curve at fractional position.
|
|
495
|
-
* * Note that
|
|
496
|
-
* *
|
|
497
|
-
* *
|
|
487
|
+
* * Note that the derivative is "derivative of xyz with respect to fraction".
|
|
488
|
+
* * The derivative shows the speed of the "fractional point" moving along the curve.
|
|
489
|
+
* * The derivative is not generally a unit vector. Use `fractionToPointAndUnitTangent` for a unit vector.
|
|
498
490
|
* @param fraction fractional position along the geometry.
|
|
499
|
-
* @
|
|
491
|
+
* @param result optional receiver for the result.
|
|
492
|
+
* @returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.
|
|
500
493
|
*/
|
|
501
494
|
fractionToPointAndDerivative(fraction, result) {
|
|
502
495
|
const distanceAlongPath = fraction * this._totalLength;
|
|
503
496
|
const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
|
|
504
|
-
const
|
|
505
|
-
result = fragment.childCurve.fractionToPointAndDerivative(
|
|
506
|
-
//
|
|
507
|
-
//
|
|
508
|
-
// Then
|
|
509
|
-
// derivative we seek is
|
|
510
|
-
|
|
497
|
+
const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
|
|
498
|
+
result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);
|
|
499
|
+
// Recall the standard arclength formula s(t) for the curve C = C(t), with derivative s'(t) = ||C'||.
|
|
500
|
+
// Define fractional arclength for C by f = f(t) = s(t)/L, where L is the total length of C. Then f' = ||C'||/L.
|
|
501
|
+
// Denote the inverse of f by t = t(f). Then C = C(t(f)) is a parameterization of C by its fractional arclength f.
|
|
502
|
+
// 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'||.
|
|
503
|
+
// The fragment gives us C', so we're just a scale away.
|
|
504
|
+
// Math details can be found at core/geometry/internaldocs/Curve.md
|
|
505
|
+
const a = this._totalLength / result.direction.magnitude(); // L/||C'||
|
|
511
506
|
result.direction.scaleInPlace(a);
|
|
512
507
|
return result;
|
|
513
508
|
}
|
|
514
509
|
/**
|
|
515
|
-
*
|
|
510
|
+
* Return the point (x,y,z) and normalized derivative on the curve at fractional position.
|
|
511
|
+
* * Note that the derivative is "derivative of xyz with respect to fraction".
|
|
512
|
+
* * The un-normalized derivative shows the speed of the "fractional point" moving along the curve.
|
|
513
|
+
* * To find the un-normalized derivative, use `fractionToPointAndDerivative`.
|
|
516
514
|
* @param fraction fractional position on the curve
|
|
517
515
|
* @param result optional receiver for the result.
|
|
518
|
-
*
|
|
516
|
+
* @returns a ray whose origin is the curve point and direction is the normalized derivative with respect to
|
|
517
|
+
* the fraction.
|
|
519
518
|
*/
|
|
520
519
|
fractionToPointAndUnitTangent(fraction, result) {
|
|
521
520
|
const distanceAlongPath = fraction * this._totalLength;
|
|
522
521
|
const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
|
|
523
|
-
const
|
|
524
|
-
result = fragment.childCurve.fractionToPointAndDerivative(
|
|
522
|
+
const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
|
|
523
|
+
result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);
|
|
525
524
|
result.direction.normalizeInPlace();
|
|
526
525
|
return result;
|
|
527
526
|
}
|
|
@@ -530,34 +529,39 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
530
529
|
* * origin at fractional position along the curve
|
|
531
530
|
* * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to
|
|
532
531
|
* the fraction.
|
|
533
|
-
* * vectorV is the second derivative, i.e.derivative of vectorU
|
|
532
|
+
* * vectorV is the second derivative, i.e. derivative of vectorU which points in the direction of the curve's
|
|
533
|
+
* derivative's change.
|
|
534
534
|
*/
|
|
535
535
|
fractionToPointAnd2Derivatives(fraction, result) {
|
|
536
536
|
const distanceAlongPath = fraction * this._totalLength;
|
|
537
537
|
const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
|
|
538
|
-
const
|
|
539
|
-
result = fragment.childCurve.fractionToPointAnd2Derivatives(
|
|
538
|
+
const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
|
|
539
|
+
result = fragment.childCurve.fractionToPointAnd2Derivatives(childFraction, result);
|
|
540
540
|
if (!result)
|
|
541
541
|
return undefined;
|
|
542
|
-
// See fractionToPointAndDerivative
|
|
543
|
-
//
|
|
544
|
-
// d/
|
|
545
|
-
//
|
|
542
|
+
// See fractionToPointAndDerivative, where we show d/df(C(t(f))) = L C'/||C'||.
|
|
543
|
+
// Here we seek the 2nd derivative. We'll use the quotient rule, and the identities
|
|
544
|
+
// d/dt||x(t)|| = x.x'/||x|| and ||x||^2 = x.x, where "." is the dot product.
|
|
545
|
+
// d2/df2(C(t(f))) = L d/df(C'/||C'||) = L (||C'|| d/df(C') - C' d/df||C'||) / ||C'||^2
|
|
546
546
|
// = L (||C'|| C" L/||C'|| - C' C'.C"/||C'|| L/||C'||) / ||C'||^2
|
|
547
|
-
// = (L/||C'||)^2 (C" - C' C'.C"/C'.C' )
|
|
548
|
-
//
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
result.vectorU.
|
|
555
|
-
|
|
547
|
+
// = (L/||C'||)^2 (C" - C' C'.C"/C'.C' ), where C' and C" are given by the fragment.
|
|
548
|
+
// The second derivative that fractionToPointAnd2Derivatives returns is C", so the second
|
|
549
|
+
// derivative we seek is just few scales away.
|
|
550
|
+
// Math details can be found at core/geometry/internaldocs/Curve.md
|
|
551
|
+
const magU = result.vectorU.magnitude(); // ||C'||
|
|
552
|
+
const dotUU = magU * magU; // ||C'||^2
|
|
553
|
+
const dotUV = result.vectorU.dotProduct(result.vectorV); // C'.C"
|
|
554
|
+
result.vectorV.addScaledInPlace(result.vectorU, -dotUV / dotUU); // add -(C'*C'.C")/(||C'||^2) to vectorV
|
|
555
|
+
const scale = this._totalLength / magU; // L/||C'||
|
|
556
|
+
result.vectorU.scaleInPlace(scale); // scale vectorU by L/||C'||
|
|
557
|
+
result.vectorV.scaleInPlace(scale * scale); // scale vectorV by (L/||C'(t)||)^2
|
|
556
558
|
return result;
|
|
557
559
|
}
|
|
558
560
|
/**
|
|
559
561
|
* Attempt to transform in place.
|
|
560
|
-
* * Warning: If any child fails, this object becomes invalid
|
|
562
|
+
* * Warning: If any child transform fails, `this` object becomes invalid but that should never happen.
|
|
563
|
+
* @param transform the transform to be applied.
|
|
564
|
+
* @returns true if all of child transforms succeed and false otherwise.
|
|
561
565
|
*/
|
|
562
566
|
tryTransformInPlace(transform) {
|
|
563
567
|
let numFail = 0;
|
|
@@ -570,48 +574,45 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
570
574
|
/** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */
|
|
571
575
|
reverseInPlace() {
|
|
572
576
|
this._path.reverseChildrenInPlace();
|
|
573
|
-
const totalLength = this._totalLength;
|
|
574
577
|
for (const fragment of this._fragments) {
|
|
575
|
-
fragment.reverseFractionsAndDistances(
|
|
578
|
+
fragment.reverseFractionsAndDistances(this._totalLength);
|
|
576
579
|
}
|
|
577
580
|
this._fragments.reverse();
|
|
578
581
|
}
|
|
579
582
|
/**
|
|
580
|
-
* Test for equality conditions
|
|
581
|
-
* * Mismatched
|
|
582
|
-
* * If
|
|
583
|
-
* @param other
|
|
583
|
+
* Test for equality conditions.
|
|
584
|
+
* * Mismatched total length is a quick exit condition.
|
|
585
|
+
* * If total length matches, recurse to the path for matching primitives.
|
|
584
586
|
*/
|
|
585
587
|
isAlmostEqual(other) {
|
|
586
588
|
if (other instanceof CurveChainWithDistanceIndex) {
|
|
587
|
-
return Geometry.isSameCoordinate(this._totalLength, other._totalLength)
|
|
588
|
-
&& this._path.isAlmostEqual(other._path);
|
|
589
|
+
return Geometry.isSameCoordinate(this._totalLength, other._totalLength) && this._path.isAlmostEqual(other._path);
|
|
589
590
|
}
|
|
590
591
|
return false;
|
|
591
592
|
}
|
|
592
593
|
/**
|
|
593
|
-
*
|
|
594
|
-
* * See `CurvePrimitive` for parameter details.
|
|
595
|
-
* * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex
|
|
594
|
+
* (Attempt to) find a position on the curve at a signed distance from start fraction.
|
|
595
|
+
* * See `CurvePrimitive.moveSignedDistanceFromFraction` for parameter details.
|
|
596
|
+
* * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex and
|
|
596
597
|
* has pointer to an additional detail for the child curve.
|
|
597
598
|
*/
|
|
598
599
|
moveSignedDistanceFromFraction(startFraction, signedDistance, allowExtension, result) {
|
|
599
600
|
const distanceA = startFraction * this._totalLength;
|
|
600
601
|
const distanceB = distanceA + signedDistance;
|
|
601
602
|
const fragmentB = this.chainDistanceToFragment(distanceB, true);
|
|
602
|
-
const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result);
|
|
603
|
+
const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result); // local detail related to the child curve
|
|
603
604
|
const endFraction = startFraction + (signedDistance / this._totalLength);
|
|
604
|
-
const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, endFraction, signedDistance, result);
|
|
605
|
+
const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, endFraction, signedDistance, result); // global detail related to the curve chain
|
|
605
606
|
chainDetail.childDetail = childDetail;
|
|
606
607
|
return chainDetail;
|
|
607
608
|
}
|
|
608
609
|
/**
|
|
610
|
+
* Return an object summarizing closest point test counts.
|
|
609
611
|
* The returned object has
|
|
610
612
|
* * numCalls = number of times closestPoint was called.
|
|
611
|
-
* * numCurvesTested = number of curves tested with full closestPoint
|
|
612
|
-
* * numAssigned = number of times a new minimum value was recorded
|
|
613
|
+
* * numCurvesTested = number of curves tested with full closestPoint.
|
|
614
|
+
* * numAssigned = number of times a new minimum value was recorded.
|
|
613
615
|
* * numCandidate = number of curves that would be tested in worst case.
|
|
614
|
-
* return an object summarizing closest point test counts
|
|
615
616
|
* @param clear if true, counts are cleared after the return object is formed.
|
|
616
617
|
*/
|
|
617
618
|
static getClosestPointTestCounts(clear = true) {
|
|
@@ -628,13 +629,13 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
628
629
|
}
|
|
629
630
|
/**
|
|
630
631
|
* Search for the curve point that is closest to the spacePoint.
|
|
631
|
-
* * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which
|
|
632
|
-
*
|
|
633
|
-
* * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex
|
|
632
|
+
* * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which (via a handler)
|
|
633
|
+
* determines a CurveLocation detail among the children.
|
|
634
|
+
* * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex and
|
|
634
635
|
* has pointer to an additional detail for the child curve.
|
|
635
636
|
* @param spacePoint point in space
|
|
636
637
|
* @param extend true to extend the curve
|
|
637
|
-
* @returns
|
|
638
|
+
* @returns a CurveLocationDetail structure that holds the details of the close point.
|
|
638
639
|
*/
|
|
639
640
|
closestPoint(spacePoint, extend) {
|
|
640
641
|
let childDetail;
|
|
@@ -645,44 +646,43 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
645
646
|
}
|
|
646
647
|
else {
|
|
647
648
|
const sortedFragments = PathFragment.collectSortedQuickMinDistances(this._fragments, spacePoint);
|
|
648
|
-
const extend0 = [
|
|
649
|
-
|
|
649
|
+
const extend0 = [
|
|
650
|
+
CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0),
|
|
651
|
+
CurveExtendMode.None,
|
|
652
|
+
];
|
|
653
|
+
const extend1 = [
|
|
654
|
+
CurveExtendMode.None,
|
|
655
|
+
CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1),
|
|
656
|
+
];
|
|
650
657
|
const fragment0 = this._fragments[0];
|
|
651
658
|
const fragment1 = this._fragments[this._fragments.length - 1];
|
|
652
659
|
CurveChainWithDistanceIndex._numCalls++;
|
|
653
660
|
CurveChainWithDistanceIndex._numCandidate += sortedFragments.length;
|
|
654
|
-
|
|
655
|
-
|
|
661
|
+
let detailA;
|
|
662
|
+
for (const sortedFragment of sortedFragments) {
|
|
663
|
+
if (sortedFragment.a > aMin)
|
|
664
|
+
// sortedFragments help early exit because it is likely that one of the first few fragments
|
|
665
|
+
// in sortedFragments is the fragment with minimum distance from space point to the curve.
|
|
656
666
|
break;
|
|
657
667
|
CurveChainWithDistanceIndex._numTested++;
|
|
658
|
-
const child =
|
|
659
|
-
|
|
668
|
+
const child = sortedFragment.childCurve;
|
|
669
|
+
detailA = child.closestPoint(spacePoint, sortedFragment === fragment0 ? extend0 : sortedFragment === fragment1 ? extend1 : false, detailA);
|
|
660
670
|
if (detailA && detailA.a < aMin) {
|
|
661
671
|
aMin = detailA.a;
|
|
662
|
-
childDetail =
|
|
663
|
-
childDetail.a = detailA.a;
|
|
672
|
+
childDetail = detailA.clone(childDetail);
|
|
664
673
|
CurveChainWithDistanceIndex._numAssigned++;
|
|
665
674
|
}
|
|
666
675
|
}
|
|
667
676
|
}
|
|
668
677
|
if (!childDetail)
|
|
669
678
|
return undefined;
|
|
670
|
-
|
|
671
|
-
if (fragment) {
|
|
672
|
-
const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
|
|
673
|
-
const chainFraction = this.chainDistanceToChainFraction(chainDistance);
|
|
674
|
-
const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
|
|
675
|
-
chainDetail.childDetail = childDetail;
|
|
676
|
-
chainDetail.a = childDetail.a;
|
|
677
|
-
return chainDetail;
|
|
678
|
-
}
|
|
679
|
-
return undefined;
|
|
679
|
+
return this.computeChainDetail(childDetail);
|
|
680
680
|
}
|
|
681
681
|
/**
|
|
682
682
|
* Construct an offset of each child as viewed in the xy-plane (ignoring z).
|
|
683
|
-
* * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset
|
|
683
|
+
* * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset to return a fully
|
|
684
684
|
* joined offset.
|
|
685
|
-
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve)
|
|
685
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve) or offset options object.
|
|
686
686
|
*/
|
|
687
687
|
constructOffsetXY(offsetDistanceOrOptions) {
|
|
688
688
|
const options = OffsetOptions.create(offsetDistanceOrOptions);
|
|
@@ -702,13 +702,32 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
702
702
|
* Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of
|
|
703
703
|
* projection.
|
|
704
704
|
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
705
|
-
* @param lowHigh optional receiver for output
|
|
705
|
+
* @param lowHigh optional receiver for output.
|
|
706
706
|
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the
|
|
707
707
|
* end of the ray.
|
|
708
708
|
*/
|
|
709
709
|
projectedParameterRange(ray, lowHigh) {
|
|
710
710
|
return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);
|
|
711
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Compute the global chain detail corresponding to a local child detail.
|
|
714
|
+
* @param childDetail the local detail, with respect to a child of this chain.
|
|
715
|
+
* @returns the global detail, with respect to this chain.
|
|
716
|
+
*/
|
|
717
|
+
computeChainDetail(childDetail) {
|
|
718
|
+
if (!childDetail.curve)
|
|
719
|
+
return undefined;
|
|
720
|
+
const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);
|
|
721
|
+
if (fragment) {
|
|
722
|
+
const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
|
|
723
|
+
const chainFraction = this.chainDistanceToChainFraction(chainDistance);
|
|
724
|
+
const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
|
|
725
|
+
chainDetail.childDetail = childDetail;
|
|
726
|
+
chainDetail.a = childDetail.a;
|
|
727
|
+
return chainDetail;
|
|
728
|
+
}
|
|
729
|
+
return undefined;
|
|
730
|
+
}
|
|
712
731
|
}
|
|
713
732
|
CurveChainWithDistanceIndex._numCalls = 0;
|
|
714
733
|
CurveChainWithDistanceIndex._numTested = 0;
|