@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
|
@@ -27,6 +27,7 @@ export declare class Ray3d implements BeJSONFunctions {
|
|
|
27
27
|
private static _workVector2?;
|
|
28
28
|
private static _workVector3?;
|
|
29
29
|
private static _workVector4?;
|
|
30
|
+
private static _workMatrix?;
|
|
30
31
|
private constructor();
|
|
31
32
|
private static _create;
|
|
32
33
|
/** Create a ray on the x axis. */
|
|
@@ -105,7 +106,7 @@ export declare class Ray3d implements BeJSONFunctions {
|
|
|
105
106
|
* Return a transform for rigid axes at ray origin with z in ray direction.
|
|
106
107
|
* * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])
|
|
107
108
|
*/
|
|
108
|
-
toRigidZFrame(): Transform | undefined;
|
|
109
|
+
toRigidZFrame(result?: Transform): Transform | undefined;
|
|
109
110
|
/** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */
|
|
110
111
|
setFromJSON(json?: any): void;
|
|
111
112
|
/**
|
|
@@ -154,6 +155,7 @@ export declare class Ray3d implements BeJSONFunctions {
|
|
|
154
155
|
intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d;
|
|
155
156
|
/**
|
|
156
157
|
* Compute the intersection of the ray with a triangle.
|
|
158
|
+
* * This method is faster than `BarycentricTriangle.intersectRay3d`.
|
|
157
159
|
* @param vertex0 first vertex of the triangle
|
|
158
160
|
* @param vertex1 second vertex of the triangle
|
|
159
161
|
* @param vertex2 third vertex of the triangle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray3d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAA+C,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAa,eAAe,EAAY,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC;;;;;;GAMG;AACH,qBAAa,KAAM,YAAW,eAAe;IAC3C,qBAAqB;IACd,MAAM,EAAE,OAAO,CAAC;IACvB,0EAA0E;IACnE,SAAS,EAAE,QAAQ,CAAC;IAC3B,0BAA0B;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;
|
|
1
|
+
{"version":3,"file":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,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAClH,OAAO,GAAG,SAAS;IAiFtB;;;OAGG;IACI,iCAAiC,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAO1F;;;;;;;;;;;;OAYG;WACW,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,uBAAuB;IAgC1F;;;;;;;;OAQG;WACW,0BAA0B,CACtC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAC/E,KAAK;CAcT"}
|
|
@@ -227,9 +227,9 @@ export class Ray3d {
|
|
|
227
227
|
* Return a transform for rigid axes at ray origin with z in ray direction.
|
|
228
228
|
* * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])
|
|
229
229
|
*/
|
|
230
|
-
toRigidZFrame() {
|
|
231
|
-
const axes = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY);
|
|
232
|
-
return Transform.createOriginAndMatrix(this.origin, axes);
|
|
230
|
+
toRigidZFrame(result) {
|
|
231
|
+
const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);
|
|
232
|
+
return Transform.createOriginAndMatrix(this.origin, axes, result);
|
|
233
233
|
}
|
|
234
234
|
/** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */
|
|
235
235
|
setFromJSON(json) {
|
|
@@ -341,6 +341,7 @@ export class Ray3d {
|
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Compute the intersection of the ray with a triangle.
|
|
344
|
+
* * This method is faster than `BarycentricTriangle.intersectRay3d`.
|
|
344
345
|
* @param vertex0 first vertex of the triangle
|
|
345
346
|
* @param vertex1 second vertex of the triangle
|
|
346
347
|
* @param vertex2 third vertex of the triangle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAqB;AACrB;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAYhB,oCAAoC;IACpC,YAAoB,MAAe,EAAE,SAAmB;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACrB,CAAC;IACO,MAAM,CAAC,OAAO,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;QACrF,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,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C;QACzB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,CAAC,CAAC;QAC9E,IAAI,QAAQ,IAAI,GAAG;YACjB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;aACpF;YACH,MAAM,CAAC,GAAW,QAAQ,GAAG,GAAG,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;SACnE;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","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 CartesianGeometry\r\n */\r\nimport { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { AxisOrder, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/Polynomials\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\nimport { XYAndZ } from \"./XYZProps\";\r\n\r\n// cspell:word Cramer\r\n/**\r\n * A Ray3d contains\r\n * * an `origin` point.\r\n * * a `direction` vector (The vector is not required to be normalized).\r\n * * an optional weight (number).\r\n * @public\r\n */\r\nexport class Ray3d implements BeJSONFunctions {\r\n /** The ray origin */\r\n public origin: Point3d;\r\n /** The ray direction. This is commonly (but not always) a unit vector. */\r\n public direction: Vector3d;\r\n /** Numeric annotation. */\r\n public a?: number; // optional (e.g. weight)\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workVector2?: Vector3d;\r\n private static _workVector3?: Vector3d;\r\n private static _workVector4?: Vector3d;\r\n // constructor (captures references)\r\n private constructor(origin: Point3d, direction: Vector3d) {\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.a = undefined;\r\n }\r\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\r\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\r\n }\r\n /** Create a ray on the x axis. */\r\n public static createXAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 1, 0, 0);\r\n }\r\n /** Create a ray on the y axis. */\r\n public static createYAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 1, 0);\r\n }\r\n /** Create a ray on the z axis. */\r\n public static createZAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 0, 1);\r\n }\r\n /** Create a ray with all zeros. */\r\n public static createZero(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setZero();\r\n result.direction.setZero();\r\n return result;\r\n }\r\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\r\n }\r\n /**\r\n * Test for nearly equal Ray3d objects.\r\n * * This tests for near equality of origin and direction -- i.e. member-by-member comparison.\r\n * * Use [[isAlmostEqualPointSet]] to allow origins to be anywhere along the common ray and to have to allow the\r\n * directions to be scaled or opposing.\r\n */\r\n public isAlmostEqual(other: Ray3d): boolean {\r\n return this.origin.isAlmostEqual(other.origin) && this.direction.isAlmostEqual(other.direction);\r\n }\r\n /**\r\n * Return the dot product of the ray's direction vector with a vector from the ray origin\r\n * to the `spacePoint`.\r\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\r\n * of `spacePoint` with respect to the plane.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\r\n */\r\n public dotProductToPoint(spacePoint: Point3d): number {\r\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\r\n }\r\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\r\n public pointToFraction(spacePoint: Point3d): number {\r\n return Geometry.safeDivideFraction(\r\n this.dotProductToPoint(spacePoint),\r\n this.direction.magnitudeSquared(),\r\n 0,\r\n );\r\n }\r\n /** Return the `spacePoint` projected onto the ray. */\r\n public projectPointToRay(spacePoint: Point3d): Point3d {\r\n /**\r\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\r\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\r\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\r\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\r\n * spacePoint with respect to the plane.\r\n */\r\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\r\n }\r\n /**\r\n * Test for nearly equal rays, allowing origin float and direction scaling.\r\n * * Use [[isAlmostEqual]] to require member-by-member comparison.\r\n */\r\n public isAlmostEqualPointSet(other: Ray3d): boolean {\r\n /**\r\n * This function tests two rays to determine if they define the same infinite lines.\r\n * So the origins can be different as long as they are on the infinite line (they can\r\n * \"float\") but the directions must be parallel or antiparallel.\r\n */\r\n if (!this.direction.isParallelTo(other.direction, true))\r\n return false;\r\n /**\r\n * In exact math, we consider a ray to have an infinite line as direction (not a finite vector).\r\n * Therefore, in exact math it is not possible for one origin to be on the other ray but not vice\r\n * versa. However, we test both ways because first check may pass due to round-off errors.\r\n */\r\n let workPoint = this.projectPointToRay(other.origin);\r\n if (!other.origin.isAlmostEqualMetric(workPoint))\r\n return false;\r\n workPoint = other.projectPointToRay(this.origin);\r\n if (!this.origin.isAlmostEqualMetric(workPoint))\r\n return false;\r\n return true;\r\n }\r\n /** Create a ray from origin and direction. */\r\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(origin, direction);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), direction.clone());\r\n }\r\n /**\r\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\r\n * coordinates and derivatives.\r\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\r\n * @param weightedDerivative `[x,y,z,w]` derivatives\r\n * @param result\r\n */\r\n public static createWeightedDerivative(\r\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\r\n ): Ray3d | undefined {\r\n const w = weightedPoint[3];\r\n const dw = weightedDerivative[3];\r\n const x = weightedPoint[0];\r\n const y = weightedPoint[1];\r\n const z = weightedPoint[2];\r\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\r\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\r\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\r\n if (Geometry.isSmallMetricDistance(w))\r\n return undefined;\r\n const divW = 1.0 / w;\r\n const divWW = divW * divW;\r\n return Ray3d.createXYZUVW(\r\n x * divW, y * divW, z * divW,\r\n dx * divWW, dy * divWW, dz * divWW,\r\n result,\r\n );\r\n }\r\n /** Create from coordinates of the origin and direction. */\r\n public static createXYZUVW(\r\n originX: number, originY: number, originZ: number,\r\n directionX: number, directionY: number, directionZ: number,\r\n result?: Ray3d,\r\n ): Ray3d {\r\n if (result) {\r\n result.getOriginRef().set(originX, originY, originZ);\r\n result.getDirectionRef().set(directionX, directionY, directionZ);\r\n return result;\r\n }\r\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\r\n }\r\n /** Capture origin and direction in a new Ray3d. */\r\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\r\n return new Ray3d(origin, direction);\r\n }\r\n /** Create from (clones of) origin, direction, and numeric weight. */\r\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setFrom(direction);\r\n result.a = a;\r\n return result;\r\n }\r\n result = new Ray3d(origin.clone(), direction.clone());\r\n result.a = a;\r\n return result;\r\n }\r\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\r\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setStartEnd(origin, target);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\r\n }\r\n /** Return a reference to the ray's origin. */\r\n public getOriginRef(): Point3d {\r\n return this.origin;\r\n }\r\n /** Return a reference to the ray's direction vector. */\r\n public getDirectionRef(): Vector3d {\r\n return this.direction;\r\n }\r\n /** Copy coordinates from origin and direction. */\r\n public set(origin: Point3d, direction: Vector3d): void {\r\n this.origin.setFrom(origin);\r\n this.direction.setFrom(direction);\r\n }\r\n /** Clone the ray. */\r\n public clone(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(this.origin.clone(), this.direction.clone());\r\n return result;\r\n }\r\n return new Ray3d(this.origin.clone(), this.direction.clone());\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\r\n return Ray3d.create(\r\n transform.multiplyPoint3d(this.origin, result?.origin),\r\n transform.multiplyVector(this.direction, result?.direction),\r\n result,\r\n );\r\n }\r\n /** Create a clone and return the inverse transform of the clone. */\r\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\r\n if (!transform.computeCachedInverse(true))\r\n return undefined;\r\n return Ray3d.create(\r\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\r\n transform.matrix.multiplyInverseXYZAsVector3d(\r\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\r\n )!,\r\n result,\r\n );\r\n }\r\n /** Apply a transform in place. */\r\n public transformInPlace(transform: Transform) {\r\n transform.multiplyPoint3d(this.origin, this.origin);\r\n transform.multiplyVector(this.direction, this.direction);\r\n }\r\n /** Copy data from another ray. */\r\n public setFrom(source: Ray3d): void {\r\n this.set(source.origin, source.direction);\r\n }\r\n /**\r\n * Return a point at fractional position along the ray.\r\n * * fraction 0 is the ray origin.\r\n * * fraction 1 is at the end of the direction vector when placed at the origin.\r\n */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.origin.plusScaled(this.direction, fraction, result);\r\n }\r\n /**\r\n * Return a transform for rigid axes at ray origin with z in ray direction.\r\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\r\n */\r\n public toRigidZFrame(): Transform | undefined {\r\n const axes = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY);\r\n return Transform.createOriginAndMatrix(this.origin, axes);\r\n }\r\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\r\n public setFromJSON(json?: any) {\r\n if (!json) {\r\n this.origin.set(0, 0, 0);\r\n this.direction.set(0, 0, 1);\r\n return;\r\n }\r\n this.origin.setFromJSON(json.origin);\r\n this.direction.setFromJSON(json.direction);\r\n }\r\n /**\r\n * Construct a JSON object from this Ray3d.\r\n * @return {*} [origin,normal]\r\n */\r\n public toJSON(): any {\r\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\r\n }\r\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\r\n public static fromJSON(json?: any) {\r\n const result = Ray3d.createXAxis();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Try to scale the direction vector to a given `magnitude`.\r\n * * Returns `false` if the ray direction is a zero vector.\r\n */\r\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\r\n if (this.direction.tryNormalizeInPlace()) {\r\n this.direction.scaleInPlace(magnitude);\r\n return true;\r\n }\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /**\r\n * Normalize the ray direction in place.\r\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\r\n * * Save the parameter `a` as the optional `a` member of the ray.\r\n * * Normalize the ray's direction vector.\r\n * * If parameter `a` is nearly zero,\r\n * * Set the `a` member to zero.\r\n * * Set the ray's direction vector to zero.\r\n * @param a value to be saved (e.g,. area).\r\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\r\n */\r\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\r\n const tolerance = Geometry.smallMetricDistanceSquared;\r\n this.a = a;\r\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\r\n return true;\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /** Return distance from the ray to point in space. */\r\n public distance(spacePoint: Point3d): number {\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.dotProductToPoint(spacePoint);\r\n const aa = Geometry.inverseMetricDistanceSquared(uu);\r\n if (aa)\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\r\n else\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\r\n }\r\n /**\r\n * Return the intersection parameter of the line defined by the ray with a `plane`.\r\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\r\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\r\n * be `ray.origin + f * ray.direction`. Therefore:\r\n * * if ray intersects the plane at its origin, the function returns f = 0.\r\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\r\n * * if intersects behind the ray origin, the function returns f < 0.\r\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\r\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\r\n */\r\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\r\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\r\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\r\n const nDotN = this.direction.magnitudeSquared();\r\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\r\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\r\n if (undefined === division)\r\n return undefined;\r\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\r\n if (undefined === division1)\r\n return undefined;\r\n if (result) {\r\n this.origin.plusScaled(this.direction, division, result);\r\n }\r\n return division;\r\n }\r\n /**\r\n * Find the intersection of the line defined by the ray with a Range3d.\r\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\r\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\r\n */\r\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\r\n if (range.isNull)\r\n return Range1d.createNull(result);\r\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\r\n if (interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x)\r\n && interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y)\r\n && interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z)\r\n )\r\n return interval;\r\n return interval;\r\n }\r\n /**\r\n * Compute the intersection of the ray with a triangle.\r\n * @param vertex0 first vertex of the triangle\r\n * @param vertex1 second vertex of the triangle\r\n * @param vertex2 third vertex of the triangle\r\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\r\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\r\n * @param parameterTol optional tolerance used to snap barycentric coordinates of the intersection point to\r\n * a triangle edge or vertex (if tolerance is not provided, Geometry.smallFloatingPoint is used)\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\r\n */\r\n public intersectionWithTriangle(\r\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\r\n ): Point3d | undefined {\r\n /**\r\n * Suppose ray is shown by \"rayOrigin + t*rayVector\" and barycentric coordinate of point\r\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\r\n *\r\n * Then if ray intersects triangle at a point we have\r\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\r\n * or\r\n * -t*rayVector + u*(v1-v0) + v*(v2-v0) = rayOrigin - v0\r\n *\r\n * This equation can be reformulated as the following linear system:\r\n *\r\n * [ | | | ] [t] [ | ]\r\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\r\n * [ | | | ] [v] [ | ]\r\n *\r\n * Then to find t, u, and v use Cramer's Rule and also the fact that if matrix A = [c1,c2,c3], then\r\n * det(A) = c1.(c2 x c3) which leads to\r\n *\r\n * t = [(rayOrigin - v0).((v1-v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n * u = [-rayVector.((rayOrigin - v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n * v = [-rayVector.((v1-v0) x (rayOrigin - v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n *\r\n * Now note that swapping any 2 vectors c_i and c_j in formula c1.(c2 x c3) negates it. For example:\r\n * c1.(c2 x c3) = -c3.(c2 x c1) = c2.(c3 x c1)\r\n *\r\n * This leads to the final formulas used in the following code:\r\n * t = [(v2-v0).((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n * u = [(rayOrigin - v0).(rayVector x (v2-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n * v = [-rayVector.((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n *\r\n * Note that we should verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1.\r\n * That's because w = 1-(u+v) and if we have those 4 checks, it's guaranteed that v <= 1 and 0 <= u+v and so\r\n * 0 <= w <= 1.\r\n *\r\n * More info be found at\r\n * https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm\r\n */\r\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\r\n distanceTol = Geometry.smallMetricDistance;\r\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\r\n parameterTol = Geometry.smallFloatingPoint;\r\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\r\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\r\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\r\n const a = edge1.dotProduct(h);\r\n if (a >= -distanceTol && a <= distanceTol)\r\n return undefined; // ray is parallel to the triangle (includes coplanar case)\r\n const f = 1.0 / a;\r\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\r\n let u = f * s.dotProduct(h);\r\n if (u < 0.0) {\r\n if (u > -parameterTol)\r\n u = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u > 1.0) {\r\n if (u < 1.0 + parameterTol)\r\n u = 1.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\r\n let v = f * this.direction.dotProduct(q);\r\n if (v < 0.0) {\r\n if (v > -parameterTol)\r\n v = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u + v > 1.0) {\r\n if (u + v < 1.0 + parameterTol)\r\n v = 1.0 - u;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\r\n const t = f * edge2.dotProduct(q);\r\n if (t <= distanceTol) // line intersection but not ray intersection\r\n return undefined;\r\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\r\n }\r\n /**\r\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\r\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v = targetPoint - q`.\r\n */\r\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\r\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\r\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\r\n return vectorV.plusScaled(this.direction, -fraction, result);\r\n }\r\n /**\r\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\r\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\r\n * annotation (in member `approachType`) indicating one of these relationships:\r\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\r\n * in detailA and detailB\r\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\r\n * The rays are skew in space.\r\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\r\n * fractions and points are a representative single common point.\r\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\r\n * at the minimum distance\r\n */\r\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\r\n const intersectionFractions = Vector2d.create();\r\n let fractionA, fractionB;\r\n let pointA, pointB;\r\n let pairType;\r\n if (\r\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\r\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\r\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\r\n intersectionFractions,\r\n )\r\n ) {\r\n fractionA = intersectionFractions.x;\r\n fractionB = intersectionFractions.y;\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\r\n } else {\r\n fractionB = 0.0;\r\n fractionA = rayA.pointToFraction(rayB.origin);\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\r\n }\r\n const pair = CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\r\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\r\n pair.approachType = pairType;\r\n return pair;\r\n }\r\n /**\r\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\r\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\r\n * @param pt1 start point of the interpolation.\r\n * @param fraction fractional position between points.\r\n * @param pt2 end point of the interpolation.\r\n * @param tangentScale scale factor to apply to the startToEnd vector.\r\n * @param result optional receiver.\r\n */\r\n public static interpolatePointAndTangent(\r\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\r\n ): Ray3d {\r\n result = result ?? Ray3d.createZero();\r\n const dx = pt2.x - pt1.x;\r\n const dy = pt2.y - pt1.y;\r\n const dz = pt2.z - pt1.z;\r\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\r\n if (fraction <= 0.5)\r\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\r\n else {\r\n const t: number = fraction - 1.0;\r\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geomet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QAAQ,IAAI,GAAG;YACjB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;aACpF;YACH,MAAM,CAAC,GAAW,QAAQ,GAAG,GAAG,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;SACnE;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","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 CartesianGeometry\r\n */\r\nimport { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { AxisOrder, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/Polynomials\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\nimport { XYAndZ } from \"./XYZProps\";\r\n\r\n// cspell:word Cramer\r\n/**\r\n * A Ray3d contains\r\n * * an `origin` point.\r\n * * a `direction` vector (The vector is not required to be normalized).\r\n * * an optional weight (number).\r\n * @public\r\n */\r\nexport class Ray3d implements BeJSONFunctions {\r\n /** The ray origin */\r\n public origin: Point3d;\r\n /** The ray direction. This is commonly (but not always) a unit vector. */\r\n public direction: Vector3d;\r\n /** Numeric annotation. */\r\n public a?: number; // optional (e.g. weight)\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workVector2?: Vector3d;\r\n private static _workVector3?: Vector3d;\r\n private static _workVector4?: Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n // constructor (captures references)\r\n private constructor(origin: Point3d, direction: Vector3d) {\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.a = undefined;\r\n }\r\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\r\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\r\n }\r\n /** Create a ray on the x axis. */\r\n public static createXAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 1, 0, 0);\r\n }\r\n /** Create a ray on the y axis. */\r\n public static createYAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 1, 0);\r\n }\r\n /** Create a ray on the z axis. */\r\n public static createZAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 0, 1);\r\n }\r\n /** Create a ray with all zeros. */\r\n public static createZero(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setZero();\r\n result.direction.setZero();\r\n return result;\r\n }\r\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\r\n }\r\n /**\r\n * Test for nearly equal Ray3d objects.\r\n * * This tests for near equality of origin and direction -- i.e. member-by-member comparison.\r\n * * Use [[isAlmostEqualPointSet]] to allow origins to be anywhere along the common ray and to have to allow the\r\n * directions to be scaled or opposing.\r\n */\r\n public isAlmostEqual(other: Ray3d): boolean {\r\n return this.origin.isAlmostEqual(other.origin) && this.direction.isAlmostEqual(other.direction);\r\n }\r\n /**\r\n * Return the dot product of the ray's direction vector with a vector from the ray origin\r\n * to the `spacePoint`.\r\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\r\n * of `spacePoint` with respect to the plane.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\r\n */\r\n public dotProductToPoint(spacePoint: Point3d): number {\r\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\r\n }\r\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\r\n public pointToFraction(spacePoint: Point3d): number {\r\n return Geometry.safeDivideFraction(\r\n this.dotProductToPoint(spacePoint),\r\n this.direction.magnitudeSquared(),\r\n 0,\r\n );\r\n }\r\n /** Return the `spacePoint` projected onto the ray. */\r\n public projectPointToRay(spacePoint: Point3d): Point3d {\r\n /**\r\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\r\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\r\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\r\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\r\n * spacePoint with respect to the plane.\r\n */\r\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\r\n }\r\n /**\r\n * Test for nearly equal rays, allowing origin float and direction scaling.\r\n * * Use [[isAlmostEqual]] to require member-by-member comparison.\r\n */\r\n public isAlmostEqualPointSet(other: Ray3d): boolean {\r\n /**\r\n * This function tests two rays to determine if they define the same infinite lines.\r\n * So the origins can be different as long as they are on the infinite line (they can\r\n * \"float\") but the directions must be parallel or antiparallel.\r\n */\r\n if (!this.direction.isParallelTo(other.direction, true))\r\n return false;\r\n /**\r\n * In exact math, we consider a ray to have an infinite line as direction (not a finite vector).\r\n * Therefore, in exact math it is not possible for one origin to be on the other ray but not vice\r\n * versa. However, we test both ways because first check may pass due to round-off errors.\r\n */\r\n let workPoint = this.projectPointToRay(other.origin);\r\n if (!other.origin.isAlmostEqualMetric(workPoint))\r\n return false;\r\n workPoint = other.projectPointToRay(this.origin);\r\n if (!this.origin.isAlmostEqualMetric(workPoint))\r\n return false;\r\n return true;\r\n }\r\n /** Create a ray from origin and direction. */\r\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(origin, direction);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), direction.clone());\r\n }\r\n /**\r\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\r\n * coordinates and derivatives.\r\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\r\n * @param weightedDerivative `[x,y,z,w]` derivatives\r\n * @param result\r\n */\r\n public static createWeightedDerivative(\r\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\r\n ): Ray3d | undefined {\r\n const w = weightedPoint[3];\r\n const dw = weightedDerivative[3];\r\n const x = weightedPoint[0];\r\n const y = weightedPoint[1];\r\n const z = weightedPoint[2];\r\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\r\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\r\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\r\n if (Geometry.isSmallMetricDistance(w))\r\n return undefined;\r\n const divW = 1.0 / w;\r\n const divWW = divW * divW;\r\n return Ray3d.createXYZUVW(\r\n x * divW, y * divW, z * divW,\r\n dx * divWW, dy * divWW, dz * divWW,\r\n result,\r\n );\r\n }\r\n /** Create from coordinates of the origin and direction. */\r\n public static createXYZUVW(\r\n originX: number, originY: number, originZ: number,\r\n directionX: number, directionY: number, directionZ: number,\r\n result?: Ray3d,\r\n ): Ray3d {\r\n if (result) {\r\n result.getOriginRef().set(originX, originY, originZ);\r\n result.getDirectionRef().set(directionX, directionY, directionZ);\r\n return result;\r\n }\r\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\r\n }\r\n /** Capture origin and direction in a new Ray3d. */\r\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\r\n return new Ray3d(origin, direction);\r\n }\r\n /** Create from (clones of) origin, direction, and numeric weight. */\r\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setFrom(direction);\r\n result.a = a;\r\n return result;\r\n }\r\n result = new Ray3d(origin.clone(), direction.clone());\r\n result.a = a;\r\n return result;\r\n }\r\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\r\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setStartEnd(origin, target);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\r\n }\r\n /** Return a reference to the ray's origin. */\r\n public getOriginRef(): Point3d {\r\n return this.origin;\r\n }\r\n /** Return a reference to the ray's direction vector. */\r\n public getDirectionRef(): Vector3d {\r\n return this.direction;\r\n }\r\n /** Copy coordinates from origin and direction. */\r\n public set(origin: Point3d, direction: Vector3d): void {\r\n this.origin.setFrom(origin);\r\n this.direction.setFrom(direction);\r\n }\r\n /** Clone the ray. */\r\n public clone(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(this.origin.clone(), this.direction.clone());\r\n return result;\r\n }\r\n return new Ray3d(this.origin.clone(), this.direction.clone());\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\r\n return Ray3d.create(\r\n transform.multiplyPoint3d(this.origin, result?.origin),\r\n transform.multiplyVector(this.direction, result?.direction),\r\n result,\r\n );\r\n }\r\n /** Create a clone and return the inverse transform of the clone. */\r\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\r\n if (!transform.computeCachedInverse(true))\r\n return undefined;\r\n return Ray3d.create(\r\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\r\n transform.matrix.multiplyInverseXYZAsVector3d(\r\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\r\n )!,\r\n result,\r\n );\r\n }\r\n /** Apply a transform in place. */\r\n public transformInPlace(transform: Transform) {\r\n transform.multiplyPoint3d(this.origin, this.origin);\r\n transform.multiplyVector(this.direction, this.direction);\r\n }\r\n /** Copy data from another ray. */\r\n public setFrom(source: Ray3d): void {\r\n this.set(source.origin, source.direction);\r\n }\r\n /**\r\n * Return a point at fractional position along the ray.\r\n * * fraction 0 is the ray origin.\r\n * * fraction 1 is at the end of the direction vector when placed at the origin.\r\n */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.origin.plusScaled(this.direction, fraction, result);\r\n }\r\n /**\r\n * Return a transform for rigid axes at ray origin with z in ray direction.\r\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\r\n */\r\n public toRigidZFrame(result?: Transform): Transform | undefined {\r\n const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);\r\n return Transform.createOriginAndMatrix(this.origin, axes, result);\r\n }\r\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\r\n public setFromJSON(json?: any) {\r\n if (!json) {\r\n this.origin.set(0, 0, 0);\r\n this.direction.set(0, 0, 1);\r\n return;\r\n }\r\n this.origin.setFromJSON(json.origin);\r\n this.direction.setFromJSON(json.direction);\r\n }\r\n /**\r\n * Construct a JSON object from this Ray3d.\r\n * @return {*} [origin,normal]\r\n */\r\n public toJSON(): any {\r\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\r\n }\r\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\r\n public static fromJSON(json?: any) {\r\n const result = Ray3d.createXAxis();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Try to scale the direction vector to a given `magnitude`.\r\n * * Returns `false` if the ray direction is a zero vector.\r\n */\r\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\r\n if (this.direction.tryNormalizeInPlace()) {\r\n this.direction.scaleInPlace(magnitude);\r\n return true;\r\n }\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /**\r\n * Normalize the ray direction in place.\r\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\r\n * * Save the parameter `a` as the optional `a` member of the ray.\r\n * * Normalize the ray's direction vector.\r\n * * If parameter `a` is nearly zero,\r\n * * Set the `a` member to zero.\r\n * * Set the ray's direction vector to zero.\r\n * @param a value to be saved (e.g,. area).\r\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\r\n */\r\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\r\n const tolerance = Geometry.smallMetricDistanceSquared;\r\n this.a = a;\r\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\r\n return true;\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /** Return distance from the ray to point in space. */\r\n public distance(spacePoint: Point3d): number {\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.dotProductToPoint(spacePoint);\r\n const aa = Geometry.inverseMetricDistanceSquared(uu);\r\n if (aa)\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\r\n else\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\r\n }\r\n /**\r\n * Return the intersection parameter of the line defined by the ray with a `plane`.\r\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\r\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\r\n * be `ray.origin + f * ray.direction`. Therefore:\r\n * * if ray intersects the plane at its origin, the function returns f = 0.\r\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\r\n * * if intersects behind the ray origin, the function returns f < 0.\r\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\r\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\r\n */\r\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\r\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\r\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\r\n const nDotN = this.direction.magnitudeSquared();\r\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\r\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\r\n if (undefined === division)\r\n return undefined;\r\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\r\n if (undefined === division1)\r\n return undefined;\r\n if (result) {\r\n this.origin.plusScaled(this.direction, division, result);\r\n }\r\n return division;\r\n }\r\n /**\r\n * Find the intersection of the line defined by the ray with a Range3d.\r\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\r\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\r\n */\r\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\r\n if (range.isNull)\r\n return Range1d.createNull(result);\r\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\r\n if (interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x)\r\n && interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y)\r\n && interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z)\r\n )\r\n return interval;\r\n return interval;\r\n }\r\n /**\r\n * Compute the intersection of the ray with a triangle.\r\n * * This method is faster than `BarycentricTriangle.intersectRay3d`.\r\n * @param vertex0 first vertex of the triangle\r\n * @param vertex1 second vertex of the triangle\r\n * @param vertex2 third vertex of the triangle\r\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\r\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\r\n * @param parameterTol optional tolerance used to snap barycentric coordinates of the intersection point to\r\n * a triangle edge or vertex (if tolerance is not provided, Geometry.smallFloatingPoint is used)\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\r\n */\r\n public intersectionWithTriangle(\r\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\r\n ): Point3d | undefined {\r\n /**\r\n * Suppose ray is shown by \"rayOrigin + t*rayVector\" and barycentric coordinate of point\r\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\r\n *\r\n * Then if ray intersects triangle at a point we have\r\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\r\n * or\r\n * -t*rayVector + u*(v1-v0) + v*(v2-v0) = rayOrigin - v0\r\n *\r\n * This equation can be reformulated as the following linear system:\r\n *\r\n * [ | | | ] [t] [ | ]\r\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\r\n * [ | | | ] [v] [ | ]\r\n *\r\n * Then to find t, u, and v use Cramer's Rule and also the fact that if matrix A = [c1,c2,c3], then\r\n * det(A) = c1.(c2 x c3) which leads to\r\n *\r\n * t = [(rayOrigin - v0).((v1-v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n * u = [-rayVector.((rayOrigin - v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n * v = [-rayVector.((v1-v0) x (rayOrigin - v0))] / [-rayVector.((v1-v0) x (v2-v0))]\r\n *\r\n * Now note that swapping any 2 vectors c_i and c_j in formula c1.(c2 x c3) negates it. For example:\r\n * c1.(c2 x c3) = -c3.(c2 x c1) = c2.(c3 x c1)\r\n *\r\n * This leads to the final formulas used in the following code:\r\n * t = [(v2-v0).((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n * u = [(rayOrigin - v0).(rayVector x (v2-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n * v = [-rayVector.((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\r\n *\r\n * Note that we should verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1.\r\n * That's because w = 1-(u+v) and if we have those 4 checks, it's guaranteed that v <= 1 and 0 <= u+v and so\r\n * 0 <= w <= 1.\r\n *\r\n * More info be found at\r\n * https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm\r\n */\r\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\r\n distanceTol = Geometry.smallMetricDistance;\r\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\r\n parameterTol = Geometry.smallFloatingPoint;\r\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\r\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\r\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\r\n const a = edge1.dotProduct(h);\r\n if (a >= -distanceTol && a <= distanceTol)\r\n return undefined; // ray is parallel to the triangle (includes coplanar case)\r\n const f = 1.0 / a;\r\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\r\n let u = f * s.dotProduct(h);\r\n if (u < 0.0) {\r\n if (u > -parameterTol)\r\n u = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u > 1.0) {\r\n if (u < 1.0 + parameterTol)\r\n u = 1.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\r\n let v = f * this.direction.dotProduct(q);\r\n if (v < 0.0) {\r\n if (v > -parameterTol)\r\n v = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u + v > 1.0) {\r\n if (u + v < 1.0 + parameterTol)\r\n v = 1.0 - u;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\r\n const t = f * edge2.dotProduct(q);\r\n if (t <= distanceTol) // line intersection but not ray intersection\r\n return undefined;\r\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\r\n }\r\n /**\r\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\r\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v = targetPoint - q`.\r\n */\r\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\r\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\r\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\r\n return vectorV.plusScaled(this.direction, -fraction, result);\r\n }\r\n /**\r\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\r\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\r\n * annotation (in member `approachType`) indicating one of these relationships:\r\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\r\n * in detailA and detailB\r\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\r\n * The rays are skew in space.\r\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\r\n * fractions and points are a representative single common point.\r\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\r\n * at the minimum distance\r\n */\r\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\r\n const intersectionFractions = Vector2d.create();\r\n let fractionA, fractionB;\r\n let pointA, pointB;\r\n let pairType;\r\n if (\r\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\r\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\r\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\r\n intersectionFractions,\r\n )\r\n ) {\r\n fractionA = intersectionFractions.x;\r\n fractionB = intersectionFractions.y;\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\r\n } else {\r\n fractionB = 0.0;\r\n fractionA = rayA.pointToFraction(rayB.origin);\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\r\n }\r\n const pair = CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\r\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\r\n pair.approachType = pairType;\r\n return pair;\r\n }\r\n /**\r\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\r\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\r\n * @param pt1 start point of the interpolation.\r\n * @param fraction fractional position between points.\r\n * @param pt2 end point of the interpolation.\r\n * @param tangentScale scale factor to apply to the startToEnd vector.\r\n * @param result optional receiver.\r\n */\r\n public static interpolatePointAndTangent(\r\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\r\n ): Ray3d {\r\n result = result ?? Ray3d.createZero();\r\n const dx = pt2.x - pt1.x;\r\n const dy = pt2.y - pt1.y;\r\n const dz = pt2.z - pt1.z;\r\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\r\n if (fraction <= 0.5)\r\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\r\n else {\r\n const t: number = fraction - 1.0;\r\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GrowableXYZArray } from "./GrowableXYZArray";
|
|
2
|
+
import { IndexedXYZCollection } from "./IndexedXYZCollection";
|
|
2
3
|
/** @packageDocumentation
|
|
3
4
|
* @module ArraysAndInterfaces
|
|
4
5
|
*/
|
|
@@ -50,6 +51,6 @@ export declare class GrowableXYZArrayCache extends ReusableObjectCache<GrowableX
|
|
|
50
51
|
* Grab an array from the cache and immediately fill from a source
|
|
51
52
|
* @param source
|
|
52
53
|
*/
|
|
53
|
-
grabAndFill(source:
|
|
54
|
+
grabAndFill(source: IndexedXYZCollection): GrowableXYZArray;
|
|
54
55
|
}
|
|
55
56
|
//# sourceMappingURL=ReusableObjectCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReusableObjectCache.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReusableObjectCache.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH;;;;;;GAMG;AACH,8BAAsB,mBAAmB,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAC/C,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,CAAC;IACtC,OAAO,CAAC,cAAc,CAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS;IAMT;;;OAGG;IACI,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS;IAOtC;;;;;OAKG;IACI,aAAa,IAAI,CAAC;IAUzB;;OAEG;IACI,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE;CAKhC;AACD;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC9E,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IACrD,SAAS,CAAC,cAAc,IAAI,gBAAgB;;IAE5C;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB;CAMnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReusableObjectCache.js","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReusableObjectCache.js","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;GAEG;AACH;;;;;;GAMG;AACH,MAAM,OAAgB,mBAAmB;IAOvC;;OAEG;IACH;QACE,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,IAAmB;QACpC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IACD;;;;;OAKG;IACI,aAAa;QAClB,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;QACrC,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;aAAM;YACL,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;OAEG;IACI,cAAc,CAAC,IAAS;QAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;SAC9B;IACH,CAAC;CACF;AACD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAqC;IACpE,aAAa,CAAC,IAAsB,IAAU,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,cAAc,KAAuB,OAAO,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjF,gBAAuB,KAAK,EAAE,CAAC,CAAC,CAAC;IACjC;;;OAGG;IACI,WAAW,CAAC,MAA4B;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IAEd,CAAC;CACF","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\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n/**\r\n * abstract class managing an array of objects of type T, available for reuse by trusted callers.\r\n * * Derived class must implement these methods:\r\n * * `createForCache()` -- create a new, ready-to-use object\r\n * * `clearForCache (data: T)` -- tidy up `data` so it can be reused.\r\n * @internal\r\n */\r\nexport abstract class ReusableObjectCache<T> {\r\n protected abstract clearForCache(data: T): void;\r\n protected abstract createForCache(): T;\r\n private _cachedObjects: T[];\r\n public numDrop: number;\r\n public numCreate: number;\r\n public numReuse: number;\r\n /**\r\n * create a new cache for objects of type T\r\n */\r\n protected constructor() {\r\n this._cachedObjects = [];\r\n this.numDrop = 0;\r\n this.numCreate = 0;\r\n this.numReuse = 0;\r\n }\r\n /** Present `data` for storage in the cache, and hence reuse by any subsequent `grabFromCache`\r\n * * `data` will be sent to `clearForCache`.\r\n * * caller should never refer to this instance again.\r\n */\r\n public dropToCache(data: T | undefined) {\r\n if (data) {\r\n this.numDrop++;\r\n this.clearForCache(data);\r\n this._cachedObjects.push(data);\r\n }\r\n }\r\n /**\r\n * grab an object from the cache.\r\n * * The returned object becomes property of the caller.\r\n * * That is, the cache does not remember it for any further management\r\n * @param data\r\n */\r\n public grabFromCache(): T {\r\n let data = this._cachedObjects.pop();\r\n if (data === undefined) {\r\n data = this.createForCache();\r\n this.numCreate++;\r\n } else {\r\n this.numReuse++;\r\n }\r\n return data;\r\n }\r\n /** Drop all entries of data[] to the cache.\r\n * @param data on input, the data to drop. on output, data is an empty array.\r\n */\r\n public dropAllToCache(data: T[]) {\r\n while (data.length > 0) {\r\n this.dropToCache(data.pop());\r\n }\r\n }\r\n}\r\n/**\r\n * Cache of GrowableXYZArray.\r\n * Intended for use by (for instance) clipping methods that can be structured to have disciplined reuse of a small number of arrays for a large number of steps.\r\n * @internal\r\n */\r\nexport class GrowableXYZArrayCache extends ReusableObjectCache<GrowableXYZArray> {\r\n protected clearForCache(data: GrowableXYZArray): void { data.length = 0; }\r\n protected createForCache(): GrowableXYZArray { return new GrowableXYZArray(10); }\r\n public constructor() { super(); }\r\n /**\r\n * Grab an array from the cache and immediately fill from a source\r\n * @param source\r\n */\r\n public grabAndFill(source: IndexedXYZCollection): GrowableXYZArray {\r\n const dest = this.grabFromCache();\r\n dest.pushFrom(source);\r\n return dest;\r\n\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module CartesianGeometry
|
|
3
3
|
*/
|
|
4
|
-
import { AnyRegion } from "../curve/
|
|
4
|
+
import { AnyRegion } from "../curve/CurveTypes";
|
|
5
5
|
import { Loop } from "../curve/Loop";
|
|
6
6
|
import { IndexedReadWriteXYZCollection, IndexedXYZCollection } from "./IndexedXYZCollection";
|
|
7
7
|
import { Point3d } from "./Point3dVector3d";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortablePolygon.js","sourceRoot":"","sources":["../../../src/geometry3d/SortablePolygon.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAM/F,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAwB,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;AACH,MAAe,mBAAmB;CAuBjC;AACD;;GAEG;AACH,MAAM,cAAe,SAAQ,mBAAmB;IAG9C,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,YAAmB,IAAmC;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD;;;;OAIG;IACI,eAAe,CAAC,EA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I,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IACM,kBAAkB,CAAC,UAAkB;QAC1C,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IACM,mBAAmB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;IACjD,CAAC;CACF","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 CartesianGeometry\r\n */\r\nimport { AnyRegion } from \"../curve/CurveChain\";\r\nimport { CurveChain } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { RegionOps } from \"../curve/RegionOps\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/** abstract base class for area-related queries of a loop.\r\n * * subclasses have particular logic for `Loop` and polygon data.\r\n * @internal\r\n */\r\nabstract class SimpleRegionCarrier {\r\n public abstract classifyPointXY(xy: XAndY): number | undefined;\r\n // Find any point on an edge.\r\n // evaluate tangent.\r\n // move to left or right according to signedArea, producing an interior point for the loop.\r\n public abstract getAnyInteriorPoint(): Point3d | undefined;\r\n /**\r\n * * grab the loop formatted as a simple polygon.\r\n * * stroke if necessary.\r\n */\r\n public abstract grabPolygon(): IndexedReadWriteXYZCollection | undefined;\r\n /**\r\n * * grab the loop formatted as a strongly typed loop object\r\n */\r\n public abstract grabLoop(): Loop | undefined;\r\n /**\r\n * (Property access) Return the signed area of the loop\r\n */\r\n public abstract get signedArea(): number;\r\n /**\r\n * If the current `signedArea` has different sign versus `targetSign`, reverse the loop in place.\r\n */\r\n public abstract reverseForAreaSign(targetSign: number): void;\r\n}\r\n/**\r\n * Implement `LoopCarrier` queries with the area as a polygon carried in an `IndexedReadWriteXYZCollection`\r\n */\r\nclass PolygonCarrier extends SimpleRegionCarrier {\r\n public data: IndexedReadWriteXYZCollection;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: IndexedReadWriteXYZCollection) {\r\n super();\r\n this.data = data;\r\n this._signedArea = PolygonOps.areaXY(data);\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return PolygonOps.classifyPointInPolygonXY(xy.x, xy.y, this.data);\r\n }\r\n /** Return some point \"inside\"\r\n * NEEDS WORK: this returns a point ON --\r\n */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.length; childIndex++) {\r\n const q = this.constructInteriorPointNearEdge(childIndex, 0.2349);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined { return this.data; }\r\n public grabLoop(): Loop | undefined {\r\n return Loop.createPolygon(this.data);\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n public constructInteriorPointNearEdge(edgeIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (edgeIndex + 1 < this.data.length) {\r\n const point0 = this.data.getPoint3dAtUncheckedPointIndex(edgeIndex);\r\n const point1 = this.data.getPoint3dAtUncheckedPointIndex(edgeIndex + 1);\r\n const vector = point0.vectorTo(point1);\r\n const point = point0.interpolate(fractionAlong, point1);\r\n vector.rotate90CCWXY(vector);\r\n if (vector.normalizeInPlace()) {\r\n if (this._signedArea < 0)\r\n vector.scaleInPlace(-1.0);\r\n const refDistance = Math.sqrt(Math.abs(this._signedArea));\r\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\r\n const candidatePoint = point.plusScaled(vector, fraction * refDistance);\r\n if (1 === this.classifyPointXY(candidatePoint))\r\n return candidatePoint;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n}\r\n/**\r\n * Implement `LoopCarrier` queries with the area as a strongly typed `Loop`\r\n */\r\nclass LoopCarrier extends SimpleRegionCarrier {\r\n public data: Loop;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: Loop) {\r\n super();\r\n this.data = data;\r\n const areaMoments = RegionOps.computeXYAreaMoments(data);\r\n this._signedArea = areaMoments !== undefined ? areaMoments.quantitySum : 0.0;\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return RegionOps.testPointInOnOutRegionXY(this.data, xy.x, xy.y);\r\n }\r\n public constructInteriorPointNearChild(childIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (childIndex < this.data.children.length) {\r\n const primitive = this.data.children[childIndex];\r\n const ray = primitive.fractionToPointAndUnitTangent(fractionAlong);\r\n ray.direction.rotate90CCWXY(ray.direction);\r\n if (this._signedArea < 0.0)\r\n ray.direction.scaleInPlace(-1.0);\r\n const refDistance = Math.sqrt(Math.abs(this._signedArea));\r\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\r\n const candidatePoint = ray.fractionToPoint(fraction * refDistance);\r\n if (1 === this.classifyPointXY(candidatePoint))\r\n return candidatePoint;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return some point \"inside\"\r\n * NEEDS WORK: this returns a point ON --\r\n */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.children.length; childIndex++) {\r\n const q = this.constructInteriorPointNearChild(childIndex, 0.2349);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined {\r\n const strokes = this.data.cloneStroked();\r\n if (strokes instanceof CurveChain) {\r\n const linestring = LineString3d.create();\r\n for (const child of strokes.children) {\r\n if (child instanceof CurvePrimitive) {\r\n child.emitStrokes(linestring);\r\n }\r\n }\r\n return linestring.numPoints() > 0 ? linestring.packedPoints : undefined;\r\n }\r\n return undefined;\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this.data;\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseChildrenInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A `SortablePolygon` carries a (single) loop with data useful for sorting for inner-outer structure.\r\n * @internal\r\n */\r\nexport class SortablePolygon {\r\n private _loopCarrier: SimpleRegionCarrier;\r\n public anyPoint?: Point3d;\r\n public sortKey: number;\r\n public range: Range3d;\r\n public parentIndex?: number;\r\n public isHole: boolean;\r\n public outputSetIndex?: number;\r\n /**\r\n *\r\n * @param loop Loop to capture.\r\n */\r\n public constructor(loop: IndexedReadWriteXYZCollection | Loop, range: Range3d) {\r\n if (loop instanceof IndexedReadWriteXYZCollection)\r\n this._loopCarrier = new PolygonCarrier(loop);\r\n else\r\n this._loopCarrier = new LoopCarrier(loop);\r\n this.range = range;\r\n this.sortKey = Math.abs(this._loopCarrier.signedArea);\r\n this.isHole = false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushPolygon(loops: SortablePolygon[], loop: IndexedReadWriteXYZCollection): boolean {\r\n const range = loop.getRange();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushLoop(loops: SortablePolygon[], loop: Loop): boolean {\r\n const range = loop.range();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n private static assignParentsAndDepth(loops: SortablePolygon[]): void {\r\n // Sort largest to smallest ...\r\n loops.sort((loopA: SortablePolygon, loopB: SortablePolygon) => (loopB.sortKey - loopA.sortKey));\r\n // starting with smallest loop, point each loop to smallest containing parent.\r\n for (let i = loops.length; i-- > 0;) {\r\n const thisLoop = loops[i];\r\n const xy = thisLoop._loopCarrier.getAnyInteriorPoint();\r\n if (xy !== undefined) {\r\n // find smallest containing parent (search forward only to hit)\r\n loops[i].parentIndex = undefined;\r\n loops[i].outputSetIndex = undefined;\r\n for (let j = i; j-- > 0;) {\r\n const otherLoop = loops[j];\r\n if (otherLoop.range.containsXY(xy.x, xy.y)) {\r\n if (1 === otherLoop._loopCarrier.classifyPointXY(xy)) {\r\n thisLoop.parentIndex = j;\r\n // The loops are searched from small area to larger. Any other containing loop is larger, so otherLoop must be the smallest.\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static assemblePolygonSet(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n const outputSets: IndexedReadWriteXYZCollection[][] = [];\r\n\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (const loopData of loops) {\r\n loopData.isHole = false;\r\n const parentIndex = loopData.parentIndex;\r\n if (parentIndex !== undefined)\r\n loopData.isHole = !loops[parentIndex].isHole;\r\n if (!loopData.isHole) {\r\n loopData._loopCarrier.reverseForAreaSign(1.0);\r\n loopData.outputSetIndex = outputSets.length;\r\n outputSets.push([]);\r\n outputSets[loopData.outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n } else {\r\n loopData._loopCarrier.reverseForAreaSign(-1.0);\r\n const outputSetIndex = loops[parentIndex!].outputSetIndex!;\r\n outputSets[outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n private static assembleLoopSet(loops: SortablePolygon[]): AnyRegion[] {\r\n const outputSets: AnyRegion[] = [];\r\n const numLoops = loops.length;\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (let candidateIndex = 0; candidateIndex < numLoops; candidateIndex++) {\r\n const candidateData = loops[candidateIndex];\r\n const parentIndex = candidateData.parentIndex;\r\n candidateData.isHole = parentIndex !== undefined ? !loops[parentIndex].isHole : false;\r\n\r\n if (!candidateData.isHole) {\r\n candidateData._loopCarrier.reverseForAreaSign(1.0);\r\n const candidateLoop = candidateData._loopCarrier.grabLoop()!;\r\n let candidateParityRegion: ParityRegion | undefined;\r\n // find all directly contained children . . .\r\n for (let childIndex = candidateIndex + 1; childIndex < numLoops; childIndex++) {\r\n const childData = loops[childIndex];\r\n if (childData.parentIndex === candidateIndex) {\r\n if (candidateParityRegion === undefined) {\r\n candidateParityRegion = ParityRegion.create();\r\n candidateParityRegion.tryAddChild(candidateLoop);\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n } else {\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n }\r\n }\r\n }\r\n if (candidateParityRegion !== undefined)\r\n outputSets.push(candidateParityRegion);\r\n else if (candidateLoop !== undefined)\r\n outputSets.push(candidateLoop);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n\r\n public static sortAsAnyRegion(loops: SortablePolygon[]): AnyRegion {\r\n this.assignParentsAndDepth(loops);\r\n const regions = this.assembleLoopSet(loops);\r\n if (regions.length === 1)\r\n return regions[0];\r\n else {\r\n const unionRegion = UnionRegion.create();\r\n for (const region of regions)\r\n unionRegion.tryAddChild(region);\r\n return unionRegion;\r\n }\r\n }\r\n public static sortAsArrayOfArrayOfPolygons(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n this.assignParentsAndDepth(loops);\r\n return this.assemblePolygonSet(loops);\r\n }\r\n public grabPolygon(): IndexedXYZCollection | undefined {\r\n return this._loopCarrier.grabPolygon();\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this._loopCarrier.grabLoop();\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n this._loopCarrier.reverseForAreaSign(targetSign);\r\n }\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n return this._loopCarrier.getAnyInteriorPoint();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SortablePolygon.js","sourceRoot":"","sources":["../../../src/geometry3d/SortablePolygon.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAM/F,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAwB,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG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B,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClC,OAAO,WAAW,CAAC;SACpB;IACH,CAAC;IACM,MAAM,CAAC,4BAA4B,CAAC,KAAwB;QACjE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IACM,WAAW;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;IACM,QAAQ;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IACM,kBAAkB,CAAC,UAAkB;QAC1C,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IACM,mBAAmB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;IACjD,CAAC;CACF","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 CartesianGeometry\r\n */\r\nimport { AnyRegion } from \"../curve/CurveTypes\";\r\nimport { CurveChain } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { RegionOps } from \"../curve/RegionOps\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/** abstract base class for area-related queries of a loop.\r\n * * subclasses have particular logic for `Loop` and polygon data.\r\n * @internal\r\n */\r\nabstract class SimpleRegionCarrier {\r\n public abstract classifyPointXY(xy: XAndY): number | undefined;\r\n // Find any point on an edge.\r\n // evaluate tangent.\r\n // move to left or right according to signedArea, producing an interior point for the loop.\r\n public abstract getAnyInteriorPoint(): Point3d | undefined;\r\n /**\r\n * * grab the loop formatted as a simple polygon.\r\n * * stroke if necessary.\r\n */\r\n public abstract grabPolygon(): IndexedReadWriteXYZCollection | undefined;\r\n /**\r\n * * grab the loop formatted as a strongly typed loop object\r\n */\r\n public abstract grabLoop(): Loop | undefined;\r\n /**\r\n * (Property access) Return the signed area of the loop\r\n */\r\n public abstract get signedArea(): number;\r\n /**\r\n * If the current `signedArea` has different sign versus `targetSign`, reverse the loop in place.\r\n */\r\n public abstract reverseForAreaSign(targetSign: number): void;\r\n}\r\n/**\r\n * Implement `LoopCarrier` queries with the area as a polygon carried in an `IndexedReadWriteXYZCollection`\r\n */\r\nclass PolygonCarrier extends SimpleRegionCarrier {\r\n public data: IndexedReadWriteXYZCollection;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: IndexedReadWriteXYZCollection) {\r\n super();\r\n this.data = data;\r\n this._signedArea = PolygonOps.areaXY(data);\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return PolygonOps.classifyPointInPolygonXY(xy.x, xy.y, this.data);\r\n }\r\n /** Return some point \"inside\"\r\n * NEEDS WORK: this returns a point ON --\r\n */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.length; childIndex++) {\r\n const q = this.constructInteriorPointNearEdge(childIndex, 0.2349);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined { return this.data; }\r\n public grabLoop(): Loop | undefined {\r\n return Loop.createPolygon(this.data);\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n public constructInteriorPointNearEdge(edgeIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (edgeIndex + 1 < this.data.length) {\r\n const point0 = this.data.getPoint3dAtUncheckedPointIndex(edgeIndex);\r\n const point1 = this.data.getPoint3dAtUncheckedPointIndex(edgeIndex + 1);\r\n const vector = point0.vectorTo(point1);\r\n const point = point0.interpolate(fractionAlong, point1);\r\n vector.rotate90CCWXY(vector);\r\n if (vector.normalizeInPlace()) {\r\n if (this._signedArea < 0)\r\n vector.scaleInPlace(-1.0);\r\n const refDistance = Math.sqrt(Math.abs(this._signedArea));\r\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\r\n const candidatePoint = point.plusScaled(vector, fraction * refDistance);\r\n if (1 === this.classifyPointXY(candidatePoint))\r\n return candidatePoint;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n}\r\n/**\r\n * Implement `LoopCarrier` queries with the area as a strongly typed `Loop`\r\n */\r\nclass LoopCarrier extends SimpleRegionCarrier {\r\n public data: Loop;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: Loop) {\r\n super();\r\n this.data = data;\r\n const areaMoments = RegionOps.computeXYAreaMoments(data);\r\n this._signedArea = areaMoments !== undefined ? areaMoments.quantitySum : 0.0;\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return RegionOps.testPointInOnOutRegionXY(this.data, xy.x, xy.y);\r\n }\r\n public constructInteriorPointNearChild(childIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (childIndex < this.data.children.length) {\r\n const primitive = this.data.children[childIndex];\r\n const ray = primitive.fractionToPointAndUnitTangent(fractionAlong);\r\n ray.direction.rotate90CCWXY(ray.direction);\r\n if (this._signedArea < 0.0)\r\n ray.direction.scaleInPlace(-1.0);\r\n const refDistance = Math.sqrt(Math.abs(this._signedArea));\r\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\r\n const candidatePoint = ray.fractionToPoint(fraction * refDistance);\r\n if (1 === this.classifyPointXY(candidatePoint))\r\n return candidatePoint;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return some point \"inside\"\r\n * NEEDS WORK: this returns a point ON --\r\n */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.children.length; childIndex++) {\r\n const q = this.constructInteriorPointNearChild(childIndex, 0.2349);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined {\r\n const strokes = this.data.cloneStroked();\r\n if (strokes instanceof CurveChain) {\r\n const linestring = LineString3d.create();\r\n for (const child of strokes.children) {\r\n if (child instanceof CurvePrimitive) {\r\n child.emitStrokes(linestring);\r\n }\r\n }\r\n return linestring.numPoints() > 0 ? linestring.packedPoints : undefined;\r\n }\r\n return undefined;\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this.data;\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseChildrenInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A `SortablePolygon` carries a (single) loop with data useful for sorting for inner-outer structure.\r\n * @internal\r\n */\r\nexport class SortablePolygon {\r\n private _loopCarrier: SimpleRegionCarrier;\r\n public anyPoint?: Point3d;\r\n public sortKey: number;\r\n public range: Range3d;\r\n public parentIndex?: number;\r\n public isHole: boolean;\r\n public outputSetIndex?: number;\r\n /**\r\n *\r\n * @param loop Loop to capture.\r\n */\r\n public constructor(loop: IndexedReadWriteXYZCollection | Loop, range: Range3d) {\r\n if (loop instanceof IndexedReadWriteXYZCollection)\r\n this._loopCarrier = new PolygonCarrier(loop);\r\n else\r\n this._loopCarrier = new LoopCarrier(loop);\r\n this.range = range;\r\n this.sortKey = Math.abs(this._loopCarrier.signedArea);\r\n this.isHole = false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushPolygon(loops: SortablePolygon[], loop: IndexedReadWriteXYZCollection): boolean {\r\n const range = loop.getRange();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushLoop(loops: SortablePolygon[], loop: Loop): boolean {\r\n const range = loop.range();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n private static assignParentsAndDepth(loops: SortablePolygon[]): void {\r\n // Sort largest to smallest ...\r\n loops.sort((loopA: SortablePolygon, loopB: SortablePolygon) => (loopB.sortKey - loopA.sortKey));\r\n // starting with smallest loop, point each loop to smallest containing parent.\r\n for (let i = loops.length; i-- > 0;) {\r\n const thisLoop = loops[i];\r\n const xy = thisLoop._loopCarrier.getAnyInteriorPoint();\r\n if (xy !== undefined) {\r\n // find smallest containing parent (search forward only to hit)\r\n loops[i].parentIndex = undefined;\r\n loops[i].outputSetIndex = undefined;\r\n for (let j = i; j-- > 0;) {\r\n const otherLoop = loops[j];\r\n if (otherLoop.range.containsXY(xy.x, xy.y)) {\r\n if (1 === otherLoop._loopCarrier.classifyPointXY(xy)) {\r\n thisLoop.parentIndex = j;\r\n // The loops are searched from small area to larger. Any other containing loop is larger, so otherLoop must be the smallest.\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static assemblePolygonSet(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n const outputSets: IndexedReadWriteXYZCollection[][] = [];\r\n\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (const loopData of loops) {\r\n loopData.isHole = false;\r\n const parentIndex = loopData.parentIndex;\r\n if (parentIndex !== undefined)\r\n loopData.isHole = !loops[parentIndex].isHole;\r\n if (!loopData.isHole) {\r\n loopData._loopCarrier.reverseForAreaSign(1.0);\r\n loopData.outputSetIndex = outputSets.length;\r\n outputSets.push([]);\r\n outputSets[loopData.outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n } else {\r\n loopData._loopCarrier.reverseForAreaSign(-1.0);\r\n const outputSetIndex = loops[parentIndex!].outputSetIndex!;\r\n outputSets[outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n private static assembleLoopSet(loops: SortablePolygon[]): AnyRegion[] {\r\n const outputSets: AnyRegion[] = [];\r\n const numLoops = loops.length;\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (let candidateIndex = 0; candidateIndex < numLoops; candidateIndex++) {\r\n const candidateData = loops[candidateIndex];\r\n const parentIndex = candidateData.parentIndex;\r\n candidateData.isHole = parentIndex !== undefined ? !loops[parentIndex].isHole : false;\r\n\r\n if (!candidateData.isHole) {\r\n candidateData._loopCarrier.reverseForAreaSign(1.0);\r\n const candidateLoop = candidateData._loopCarrier.grabLoop()!;\r\n let candidateParityRegion: ParityRegion | undefined;\r\n // find all directly contained children . . .\r\n for (let childIndex = candidateIndex + 1; childIndex < numLoops; childIndex++) {\r\n const childData = loops[childIndex];\r\n if (childData.parentIndex === candidateIndex) {\r\n if (candidateParityRegion === undefined) {\r\n candidateParityRegion = ParityRegion.create();\r\n candidateParityRegion.tryAddChild(candidateLoop);\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n } else {\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n }\r\n }\r\n }\r\n if (candidateParityRegion !== undefined)\r\n outputSets.push(candidateParityRegion);\r\n else if (candidateLoop !== undefined)\r\n outputSets.push(candidateLoop);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n\r\n public static sortAsAnyRegion(loops: SortablePolygon[]): AnyRegion {\r\n this.assignParentsAndDepth(loops);\r\n const regions = this.assembleLoopSet(loops);\r\n if (regions.length === 1)\r\n return regions[0];\r\n else {\r\n const unionRegion = UnionRegion.create();\r\n for (const region of regions)\r\n unionRegion.tryAddChild(region);\r\n return unionRegion;\r\n }\r\n }\r\n public static sortAsArrayOfArrayOfPolygons(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n this.assignParentsAndDepth(loops);\r\n return this.assemblePolygonSet(loops);\r\n }\r\n public grabPolygon(): IndexedXYZCollection | undefined {\r\n return this._loopCarrier.grabPolygon();\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this._loopCarrier.grabLoop();\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n this._loopCarrier.reverseForAreaSign(targetSign);\r\n }\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n return this._loopCarrier.getAnyInteriorPoint();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Transform.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;A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;;;OAOG;IACI,6BAA6B,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,GAAG,IAAI;IASxF;;;;;;;;;;;;;OAaG;IACI,0BAA0B,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS;IAStE;;;;;;;;;;;;;OAaG;IACI,yBAAyB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS;IAUhF;;;;;;;;OAQG;IACI,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAoB/D;;;;OAIG;IACI,OAAO,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS;IAczD;;;;;;;;;;OAUG;WACW,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI;CAmChH"}
|
|
@@ -77,15 +77,13 @@ export class Transform {
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
if (Geometry.isArrayOfNumberArray(json, 3, 4)) {
|
|
80
|
-
|
|
81
|
-
this.
|
|
82
|
-
this._origin.set(data[0][3], data[1][3], data[2][3]);
|
|
80
|
+
this._matrix.setRowValues(json[0][0], json[0][1], json[0][2], json[1][0], json[1][1], json[1][2], json[2][0], json[2][1], json[2][2]);
|
|
81
|
+
this._origin.set(json[0][3], json[1][3], json[2][3]);
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
84
|
if (Geometry.isNumberArray(json, 12)) {
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
this._origin.set(data[3], data[7], data[11]);
|
|
85
|
+
this._matrix.setRowValues(json[0], json[1], json[2], json[4], json[5], json[6], json[8], json[9], json[10]);
|
|
86
|
+
this._origin.set(json[3], json[7], json[11]);
|
|
89
87
|
return;
|
|
90
88
|
}
|
|
91
89
|
}
|