@itwin/core-geometry 4.3.0-dev.2 → 4.3.0-dev.21
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 +41 -1
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +2 -4
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js +27 -17
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +68 -44
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +242 -119
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js +19 -5
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts +30 -33
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +76 -69
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +32 -5
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +92 -11
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +18 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +47 -0
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +9 -9
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +7 -10
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +2 -2
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +3 -16
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -4
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +32 -10
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +4 -5
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.d.ts +14 -2
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js +2 -4
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +3 -6
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -4
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/PointString3d.d.ts +2 -1
- package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +7 -12
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +2 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +80 -18
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +73 -8
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +2 -3
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +2 -3
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +38 -36
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +21 -5
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js +71 -45
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +28 -21
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +11 -2
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +16 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +213 -62
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.d.ts +5 -1
- package/lib/cjs/geometry3d/Segment1d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js +11 -7
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +2 -3
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +2 -3
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +14 -1
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +22 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts +91 -68
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +100 -79
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +115 -60
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +120 -62
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js +10 -12
- package/lib/cjs/numerics/PascalCoefficients.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 +3 -0
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +13 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +6 -3
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +39 -12
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +94 -17
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +69 -42
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +80 -55
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +6 -8
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -14
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +85 -259
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/cjs/serialization/SerializationHelpers.js +591 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
- package/lib/cjs/solid/SweepContour.d.ts +4 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +4 -2
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +2 -4
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js +27 -17
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +68 -44
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +242 -119
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js +19 -5
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js +2 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts +30 -33
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +76 -69
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +32 -5
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +92 -11
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +48 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +9 -9
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +7 -10
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +2 -2
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +3 -16
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +17 -4
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +32 -10
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +4 -5
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurveTypes.d.ts +14 -2
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js +2 -4
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +3 -6
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -4
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/PointString3d.d.ts +2 -1
- package/lib/esm/curve/PointString3d.d.ts.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +7 -12
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +2 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +81 -19
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +74 -9
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +2 -3
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +2 -3
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +38 -36
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +21 -5
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js +71 -45
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +28 -21
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +11 -2
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +16 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +213 -62
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.d.ts +5 -1
- package/lib/esm/geometry3d/Segment1d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js +11 -7
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +2 -3
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +2 -3
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +14 -1
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +22 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts +91 -68
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +100 -79
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +115 -60
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +120 -62
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js +10 -12
- package/lib/esm/numerics/PascalCoefficients.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 +3 -0
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +13 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +6 -3
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceData.js +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +39 -12
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +94 -17
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +10 -10
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +69 -42
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +80 -55
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +7 -9
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -14
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +86 -260
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/esm/serialization/SerializationHelpers.js +588 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
- package/lib/esm/solid/SweepContour.d.ts +4 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +4 -2
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiChainCollector.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/MultiChainCollector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAc,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,mBAAmB;IAe9B;;;OAGG;IACH,YAAmB,YAAY,GAAG,QAAQ,CAAC,mBAAmB,EAAE,iBAAqC,QAAQ,CAAC,mBAAmB;QAC/H,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IACD;;;;;OAKG;IACK,qBAAqB,CAAC,GAAY,EAAE,SAAiB,EAAE,mBAA2B,CAAC,CAAC;QAC1F,KAAK,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CAAC,EAAE,CAAC,CAAC;aACrB;SACF;IACH,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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { FrameBuilder } from \"../../geometry3d/FrameBuilder\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { AnyCurve } from \"../CurveTypes\";\r\nimport { BagOfCurves, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { ChainTypes, RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\r\n * * The caller makes a sequence of calls to announce individual primitives.\r\n * * This collector (unlike the simpler [[ChainCollectorContext]]) expects to have inputs arriving in random order, leaving multiple open chains in play at any time.\r\n * * When all curves have been announced, the call to `grabResults` restructures the various active chains into Paths (and optionally, Loops).\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * * Usage pattern is\r\n * * initialization: `context = new MultiChainCollector(gapTol, planeTol)`\r\n * * many times:\r\n * * `context.captureCurve(anyCurve)`\r\n * * `context.captureCurvePrimitive(primitive)`\r\n * * end: `result = context.grabResult(makeLoopIfClosed)`\r\n * @internal\r\n */\r\nexport class MultiChainCollector {\r\n /** accumulated chains */\r\n private _chains: CurvePrimitive[][];\r\n /** largest gap distance to close */\r\n private _gapTolerance: number;\r\n /** end point snap tolerance (assumed to be as tight or tighter than gapTolerance) */\r\n private _snapTolerance: number;\r\n /** tolerance for choosing Path or Loop. If undefined, always Path. */\r\n private _planeTolerance: number | undefined;\r\n\r\n private static _staticPointA: Point3d;\r\n private static _staticPointB: Point3d;\r\n private _xyzWork0?: Point3d;\r\n private _xyzWork1?: Point3d;\r\n\r\n /** Initialize with an empty array of chains.\r\n * @param gapTolerance tolerance for calling endpoints identical\r\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\r\n */\r\n public constructor(gapTolerance = Geometry.smallMetricDistance, planeTolerance: number | undefined = Geometry.smallMetricDistance) {\r\n this._chains = [];\r\n this._gapTolerance = gapTolerance;\r\n this._snapTolerance = Geometry.smallMetricDistance;\r\n this._planeTolerance = planeTolerance;\r\n }\r\n /**\r\n * Find a chain (with index _other than_ exceptChainIndex) that starts or ends at xyz\r\n * @param xyz endpoint to check\r\n * @param tolerance absolute distance tolerance for equating endpoints\r\n * @param exceptChainIndex index of chain to ignore. Send -1 to consider all chains.\r\n */\r\n private findAnyChainToConnect(xyz: Point3d, tolerance: number, exceptChainIndex: number = -1): { chainIndex: number, atEnd: boolean } | undefined {\r\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\r\n if (exceptChainIndex === chainIndexA)\r\n continue;\r\n const chain = this._chains[chainIndexA];\r\n this._xyzWork1 = chain[chain.length - 1].endPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: true };\r\n this._xyzWork1 = chain[0].startPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: false };\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Insert a single curve primitive into the active chains.\r\n * * The primitive is captured (not cloned)\r\n * * The primitive may be reversed in place\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurvePrimitive(candidate: CurvePrimitive) {\r\n if (this._snapTolerance < this._gapTolerance) {\r\n if (this.attachPrimitiveToAnyChain(candidate, this._snapTolerance))\r\n return;\r\n }\r\n if (this.attachPrimitiveToAnyChain(candidate, this._gapTolerance))\r\n return;\r\n this._chains.push([candidate]);\r\n }\r\n /**\r\n * Insert any curve into the collection.\r\n * * This recurses into Path, Loop, BagOfCurves etc\r\n * * All primitives are captured, and may be reversed in place.\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurve(candidate: AnyCurve) {\r\n if (candidate instanceof CurvePrimitive)\r\n this.captureCurvePrimitive(candidate);\r\n else if (candidate instanceof CurveCollection && candidate.children !== undefined) {\r\n for (const c of candidate.children) {\r\n this.captureCurve(c as AnyCurve);\r\n }\r\n }\r\n }\r\n /** If allowed by the geometry type, move an endpoint. */\r\n private static simpleEndPointMove(curve: CurvePrimitive, atEnd: boolean, to: XYAndZ): boolean {\r\n if (curve instanceof (LineSegment3d)) {\r\n if (atEnd) {\r\n curve.point1Ref.setFrom(to);\r\n } else {\r\n curve.point0Ref.setFrom(to);\r\n }\r\n return true;\r\n } else if (curve instanceof LineString3d && curve.numPoints() > 0) {\r\n const i = atEnd ? curve.numPoints() - 1 : 0;\r\n curve.packedPoints.setAtCheckedPointIndex(i, to);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Try to move the end of curve0 and/or the start of curve1 to a common point.\r\n * * All z-coordinates are ignored.\r\n * @param curve0 first curve, assumed to end close to the start of curve1\r\n * @param curve1 second curve, assumed to start close to the end of curve0\r\n * @param gapTolerance max distance to move a curve start/end point\r\n * @returns whether curve start/end point(s) moved\r\n */\r\n private static moveHeadOrTail(curve0: CurvePrimitive, curve1: CurvePrimitive, gapTolerance: number): boolean {\r\n const xyz0 = curve0.endPoint();\r\n const xyz1 = curve1.startPoint();\r\n const minShift = Geometry.smallMetricDistance * 0.001;\r\n const d01 = xyz0.distanceXY(xyz1);\r\n if (d01 < minShift)\r\n return false;\r\n // try lines and linestrings\r\n if (d01 < gapTolerance) {\r\n if (this.simpleEndPointMove(curve1, false, xyz0) || this.simpleEndPointMove(curve0, true, xyz1))\r\n return true;\r\n }\r\n // try other primitive types\r\n const intersections = CurveCurve.intersectionXYPairs(curve0, true, curve1, true);\r\n const shiftFactor = 5.0;\r\n for (const pair of intersections) {\r\n const detail0 = pair.detailA;\r\n const detail1 = pair.detailB;\r\n const distance0 = detail0.point.distanceXY(xyz0);\r\n const distance1 = detail1.point.distanceXY(xyz1);\r\n if (distance0 < shiftFactor * gapTolerance && distance1 < shiftFactor * gapTolerance) {\r\n if (curve0 instanceof Arc3d && curve1 instanceof Arc3d) {\r\n const radians0End = curve0.sweep.fractionToRadians(detail0.fraction);\r\n curve0.sweep.setStartEndRadians(curve0.sweep.startRadians, radians0End);\r\n const radians1Start = curve1.sweep.fractionToRadians(detail1.fraction);\r\n curve1.sweep.setStartEndRadians(radians1Start, curve1.sweep.endRadians);\r\n return true;\r\n }\r\n // TODO: other combinations of types\r\n }\r\n }\r\n return false;\r\n }\r\n /** Announce a curve primitive\r\n * * If a \"nearby\" connection is possible, insert the candidate in the chain and force endpoint match.\r\n * * Otherwise start a new chain.\r\n */\r\n private attachPrimitiveToAnyChain(candidate: CurvePrimitive, tolerance: number): boolean {\r\n if (candidate) {\r\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n } else {\r\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Merge two entries in the chain array.\r\n * * Move each primitive from chainB to the end of chainA.\r\n * * Clear chainB.\r\n * * Move the final chain to chainB index.\r\n * * Decrement the array length.\r\n * @param chainIndexA index of chainA\r\n * @param chainIndexB index of chainB\r\n */\r\n private mergeChainsForwardForward(chainIndexA: number, chainIndexB: number) {\r\n const chainA = this._chains[chainIndexA];\r\n const chainB = this._chains[chainIndexB];\r\n for (const p of chainB) {\r\n chainA.push(p);\r\n }\r\n chainB.length = 0; // chainIndexB is unused\r\n const lastChainIndex = this._chains.length - 1;\r\n if (chainIndexB !== lastChainIndex)\r\n this._chains[chainIndexB] = this._chains[lastChainIndex];\r\n this._chains.pop();\r\n }\r\n /** Reverse the curve chain in place. */\r\n private reverseChain(chainIndex: number) {\r\n const chain = this._chains[chainIndex];\r\n chain.reverse();\r\n for (const p of chain)\r\n p.reverseInPlace();\r\n }\r\n /** See if the head or tail of chainIndex matches any existing chain. If so, merge the two chains. */\r\n private searchAndMergeChainIndex(chainIndex: number, tolerance: number): void {\r\n // ASSUME valid index of non-empty chain\r\n const chain = this._chains[chainIndex];\r\n const lastIndexInChain = chain.length - 1;\r\n this._xyzWork0 = chain[0].startPoint(this._xyzWork0);\r\n // try start with any other chain\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (!connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(connect.chainIndex, chainIndex);\r\n return;\r\n }\r\n // try end with any other chain\r\n this._xyzWork0 = chain[lastIndexInChain].endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(chainIndex, connect.chainIndex);\r\n return;\r\n }\r\n }\r\n /**\r\n * Convert an array of curve primitives into the simplest possible strongly typed curve structure.\r\n * @param curves input array, assembled correctly into a single contiguous path, captured by returned object\r\n * @param makeLoopIfClosed whether to return a Loop from physically closed curves array, otherwise Path\r\n * @return Loop or Path if multiple curves; the primitive if only one curve; undefined if no curves\r\n */\r\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\r\n if (curves.length === 0)\r\n return undefined;\r\n if (makeLoopIfClosed) {\r\n const primitive0 = curves[0];\r\n const primitiveN = curves[curves.length - 1];\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n if (MultiChainCollector.moveHeadOrTail(primitiveN, primitive0, this._gapTolerance)) {\r\n // get the corrected coordinates\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n }\r\n if (MultiChainCollector._staticPointA.isAlmostEqual(MultiChainCollector._staticPointB, this._gapTolerance)) {\r\n const localToWorld = FrameBuilder.createRightHandedLocalToWorld(curves);\r\n if (localToWorld) {\r\n const worldToLocal = localToWorld.inverse();\r\n if (worldToLocal) {\r\n const range = RegionOps.curveArrayRange(curves, worldToLocal);\r\n if (this._planeTolerance !== undefined && range.zLength() <= this._planeTolerance) {\r\n return Loop.createArray(curves);\r\n }\r\n }\r\n }\r\n return Path.createArray(curves);\r\n }\r\n }\r\n if (curves.length === 1)\r\n return curves[0];\r\n return Path.createArray(curves);\r\n }\r\n /** Stroke the curve chain to a line string, de-duplicate the points. */\r\n private chainToLineString3d(chain: CurvePrimitive[], options?: StrokeOptions): LineString3d | undefined {\r\n if (chain.length === 0)\r\n return undefined;\r\n const linestring = LineString3d.create();\r\n for (const curve of chain)\r\n curve.emitStrokes(linestring, options);\r\n linestring.removeDuplicatePoints(this._gapTolerance);\r\n return linestring;\r\n }\r\n /** Return the collected results, structured as the simplest possible type. */\r\n public grabResult(makeLoopIfClosed: boolean = false): ChainTypes {\r\n const chains = this._chains;\r\n if (chains.length === 0)\r\n return undefined;\r\n if (chains.length === 1)\r\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\r\n const bag = BagOfCurves.create();\r\n for (const chain of chains) {\r\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\r\n bag.tryAddChild(q);\r\n }\r\n return bag;\r\n }\r\n /** Return chains as individual calls to announceChain. */\r\n public announceChainsAsLineString3d(announceChain: (ls: LineString3d) => void, options?: StrokeOptions): void {\r\n const chains = this._chains;\r\n if (chains.length === 1) {\r\n const ls = this.chainToLineString3d(chains[0], options);\r\n if (ls)\r\n announceChain(ls);\r\n } else if (chains.length > 1) {\r\n for (const chain of chains) {\r\n const ls = this.chainToLineString3d(chain, options);\r\n if (ls)\r\n announceChain(ls);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"MultiChainCollector.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/MultiChainCollector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F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I,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;YAC7D,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;SACpB;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,0DAA0D;IACnD,4BAA4B,CAAC,aAAyC,EAAE,OAAuB;QACpG,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxD,IAAI,EAAE;gBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;SACrB;aAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,EAAE;oBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;aACrB;SACF;IACH,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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { FrameBuilder } from \"../../geometry3d/FrameBuilder\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { BagOfCurves, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { AnyChain, AnyCurve } from \"../CurveTypes\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\r\n * * The caller makes a sequence of calls to announce individual primitives.\r\n * * This collector (unlike the simpler [[ChainCollectorContext]]) expects to have inputs arriving in random order, leaving multiple open chains in play at any time.\r\n * * When all curves have been announced, the call to `grabResults` restructures the various active chains into Paths (and optionally, Loops).\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * * Usage pattern is\r\n * * initialization: `context = new MultiChainCollector(gapTol, planeTol)`\r\n * * many times:\r\n * * `context.captureCurve(anyCurve)`\r\n * * `context.captureCurvePrimitive(primitive)`\r\n * * end: `result = context.grabResult(makeLoopIfClosed)`\r\n * @internal\r\n */\r\nexport class MultiChainCollector {\r\n /** accumulated chains */\r\n private _chains: CurvePrimitive[][];\r\n /** largest gap distance to close */\r\n private _gapTolerance: number;\r\n /** end point snap tolerance (assumed to be as tight or tighter than gapTolerance) */\r\n private _snapTolerance: number;\r\n /** tolerance for choosing Path or Loop. If undefined, always Path. */\r\n private _planeTolerance: number | undefined;\r\n\r\n private static _staticPointA: Point3d;\r\n private static _staticPointB: Point3d;\r\n private _xyzWork0?: Point3d;\r\n private _xyzWork1?: Point3d;\r\n\r\n /** Initialize with an empty array of chains.\r\n * @param gapTolerance tolerance for calling endpoints identical\r\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\r\n */\r\n public constructor(gapTolerance = Geometry.smallMetricDistance, planeTolerance: number | undefined = Geometry.smallMetricDistance) {\r\n this._chains = [];\r\n this._gapTolerance = gapTolerance;\r\n this._snapTolerance = Geometry.smallMetricDistance;\r\n this._planeTolerance = planeTolerance;\r\n }\r\n /**\r\n * Find a chain (with index _other than_ exceptChainIndex) that starts or ends at xyz\r\n * @param xyz endpoint to check\r\n * @param tolerance absolute distance tolerance for equating endpoints\r\n * @param exceptChainIndex index of chain to ignore. Send -1 to consider all chains.\r\n */\r\n private findAnyChainToConnect(xyz: Point3d, tolerance: number, exceptChainIndex: number = -1): { chainIndex: number, atEnd: boolean } | undefined {\r\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\r\n if (exceptChainIndex === chainIndexA)\r\n continue;\r\n const chain = this._chains[chainIndexA];\r\n this._xyzWork1 = chain[chain.length - 1].endPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: true };\r\n this._xyzWork1 = chain[0].startPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: false };\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Insert a single curve primitive into the active chains.\r\n * * The primitive is captured (not cloned)\r\n * * The primitive may be reversed in place\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurvePrimitive(candidate: CurvePrimitive) {\r\n if (this._snapTolerance < this._gapTolerance) {\r\n if (this.attachPrimitiveToAnyChain(candidate, this._snapTolerance))\r\n return;\r\n }\r\n if (this.attachPrimitiveToAnyChain(candidate, this._gapTolerance))\r\n return;\r\n this._chains.push([candidate]);\r\n }\r\n /**\r\n * Insert any curve into the collection.\r\n * * This recurses into Path, Loop, BagOfCurves etc\r\n * * All primitives are captured, and may be reversed in place.\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurve(candidate: AnyCurve) {\r\n if (candidate instanceof CurvePrimitive)\r\n this.captureCurvePrimitive(candidate);\r\n else if (candidate instanceof CurveCollection) {\r\n for (const c of candidate.children)\r\n this.captureCurve(c);\r\n }\r\n }\r\n /** If allowed by the geometry type, move an endpoint. */\r\n private static simpleEndPointMove(curve: CurvePrimitive, atEnd: boolean, to: XYAndZ): boolean {\r\n if (curve instanceof (LineSegment3d)) {\r\n if (atEnd) {\r\n curve.point1Ref.setFrom(to);\r\n } else {\r\n curve.point0Ref.setFrom(to);\r\n }\r\n return true;\r\n } else if (curve instanceof LineString3d && curve.numPoints() > 0) {\r\n const i = atEnd ? curve.numPoints() - 1 : 0;\r\n curve.packedPoints.setAtCheckedPointIndex(i, to);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Try to move the end of curve0 and/or the start of curve1 to a common point.\r\n * * All z-coordinates are ignored.\r\n * @param curve0 first curve, assumed to end close to the start of curve1\r\n * @param curve1 second curve, assumed to start close to the end of curve0\r\n * @param gapTolerance max distance to move a curve start/end point\r\n * @returns whether curve start/end point(s) moved\r\n */\r\n private static moveHeadOrTail(curve0: CurvePrimitive, curve1: CurvePrimitive, gapTolerance: number): boolean {\r\n const xyz0 = curve0.endPoint();\r\n const xyz1 = curve1.startPoint();\r\n const minShift = Geometry.smallMetricDistance * 0.001;\r\n const d01 = xyz0.distanceXY(xyz1);\r\n if (d01 < minShift)\r\n return false;\r\n // try lines and linestrings\r\n if (d01 < gapTolerance) {\r\n if (this.simpleEndPointMove(curve1, false, xyz0) || this.simpleEndPointMove(curve0, true, xyz1))\r\n return true;\r\n }\r\n // try other primitive types\r\n const intersections = CurveCurve.intersectionXYPairs(curve0, true, curve1, true);\r\n const shiftFactor = 5.0;\r\n for (const pair of intersections) {\r\n const detail0 = pair.detailA;\r\n const detail1 = pair.detailB;\r\n const distance0 = detail0.point.distanceXY(xyz0);\r\n const distance1 = detail1.point.distanceXY(xyz1);\r\n if (distance0 < shiftFactor * gapTolerance && distance1 < shiftFactor * gapTolerance) {\r\n if (curve0 instanceof Arc3d && curve1 instanceof Arc3d) {\r\n const radians0End = curve0.sweep.fractionToRadians(detail0.fraction);\r\n curve0.sweep.setStartEndRadians(curve0.sweep.startRadians, radians0End);\r\n const radians1Start = curve1.sweep.fractionToRadians(detail1.fraction);\r\n curve1.sweep.setStartEndRadians(radians1Start, curve1.sweep.endRadians);\r\n return true;\r\n }\r\n // TODO: other combinations of types\r\n }\r\n }\r\n return false;\r\n }\r\n /** Announce a curve primitive\r\n * * If a \"nearby\" connection is possible, insert the candidate in the chain and force endpoint match.\r\n * * Otherwise start a new chain.\r\n */\r\n private attachPrimitiveToAnyChain(candidate: CurvePrimitive, tolerance: number): boolean {\r\n if (candidate) {\r\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n } else {\r\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Merge two entries in the chain array.\r\n * * Move each primitive from chainB to the end of chainA.\r\n * * Clear chainB.\r\n * * Move the final chain to chainB index.\r\n * * Decrement the array length.\r\n * @param chainIndexA index of chainA\r\n * @param chainIndexB index of chainB\r\n */\r\n private mergeChainsForwardForward(chainIndexA: number, chainIndexB: number) {\r\n const chainA = this._chains[chainIndexA];\r\n const chainB = this._chains[chainIndexB];\r\n for (const p of chainB) {\r\n chainA.push(p);\r\n }\r\n chainB.length = 0; // chainIndexB is unused\r\n const lastChainIndex = this._chains.length - 1;\r\n if (chainIndexB !== lastChainIndex)\r\n this._chains[chainIndexB] = this._chains[lastChainIndex];\r\n this._chains.pop();\r\n }\r\n /** Reverse the curve chain in place. */\r\n private reverseChain(chainIndex: number) {\r\n const chain = this._chains[chainIndex];\r\n chain.reverse();\r\n for (const p of chain)\r\n p.reverseInPlace();\r\n }\r\n /** See if the head or tail of chainIndex matches any existing chain. If so, merge the two chains. */\r\n private searchAndMergeChainIndex(chainIndex: number, tolerance: number): void {\r\n // ASSUME valid index of non-empty chain\r\n const chain = this._chains[chainIndex];\r\n const lastIndexInChain = chain.length - 1;\r\n this._xyzWork0 = chain[0].startPoint(this._xyzWork0);\r\n // try start with any other chain\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (!connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(connect.chainIndex, chainIndex);\r\n return;\r\n }\r\n // try end with any other chain\r\n this._xyzWork0 = chain[lastIndexInChain].endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(chainIndex, connect.chainIndex);\r\n return;\r\n }\r\n }\r\n /**\r\n * Convert an array of curve primitives into the simplest possible strongly typed curve structure.\r\n * @param curves input array, assembled correctly into a single contiguous path, captured by returned object\r\n * @param makeLoopIfClosed whether to return a Loop from physically closed curves array, otherwise Path\r\n * @return Loop or Path if multiple curves; the primitive if only one curve; undefined if no curves\r\n */\r\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\r\n if (curves.length === 0)\r\n return undefined;\r\n if (makeLoopIfClosed) {\r\n const primitive0 = curves[0];\r\n const primitiveN = curves[curves.length - 1];\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n if (MultiChainCollector.moveHeadOrTail(primitiveN, primitive0, this._gapTolerance)) {\r\n // get the corrected coordinates\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n }\r\n if (MultiChainCollector._staticPointA.isAlmostEqual(MultiChainCollector._staticPointB, this._gapTolerance)) {\r\n const localToWorld = FrameBuilder.createRightHandedLocalToWorld(curves);\r\n if (localToWorld) {\r\n const worldToLocal = localToWorld.inverse();\r\n if (worldToLocal) {\r\n const range = RegionOps.curveArrayRange(curves, worldToLocal);\r\n if (this._planeTolerance !== undefined && range.zLength() <= this._planeTolerance) {\r\n return Loop.createArray(curves);\r\n }\r\n }\r\n }\r\n return Path.createArray(curves);\r\n }\r\n }\r\n if (curves.length === 1)\r\n return curves[0];\r\n return Path.createArray(curves);\r\n }\r\n /** Stroke the curve chain to a line string, de-duplicate the points. */\r\n private chainToLineString3d(chain: CurvePrimitive[], options?: StrokeOptions): LineString3d | undefined {\r\n if (chain.length === 0)\r\n return undefined;\r\n const linestring = LineString3d.create();\r\n for (const curve of chain)\r\n curve.emitStrokes(linestring, options);\r\n linestring.removeDuplicatePoints(this._gapTolerance);\r\n return linestring;\r\n }\r\n /** Return the collected results, structured as the simplest possible type. */\r\n public grabResult(makeLoopIfClosed: boolean = false): AnyChain | undefined {\r\n const chains = this._chains;\r\n if (chains.length === 0)\r\n return undefined;\r\n if (chains.length === 1)\r\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\r\n const bag = BagOfCurves.create();\r\n for (const chain of chains) {\r\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\r\n bag.tryAddChild(q);\r\n }\r\n return bag;\r\n }\r\n /** Return chains as individual calls to announceChain. */\r\n public announceChainsAsLineString3d(announceChain: (ls: LineString3d) => void, options?: StrokeOptions): void {\r\n const chains = this._chains;\r\n if (chains.length === 1) {\r\n const ls = this.chainToLineString3d(chains[0], options);\r\n if (ls)\r\n announceChain(ls);\r\n } else if (chains.length > 1) {\r\n for (const chain of chains) {\r\n const ls = this.chainToLineString3d(chain, options);\r\n if (ls)\r\n announceChain(ls);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -8,7 +8,7 @@ import { Loop } from "../Loop";
|
|
|
8
8
|
import { JointOptions, OffsetOptions } from "../OffsetOptions";
|
|
9
9
|
import { Path } from "../Path";
|
|
10
10
|
/**
|
|
11
|
-
* Context for building a wire offset.
|
|
11
|
+
* Context for building a wire xy-offset.
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
export declare class PolygonWireOffsetContext {
|
|
@@ -20,8 +20,8 @@ export declare class PolygonWireOffsetContext {
|
|
|
20
20
|
private static _offsetB;
|
|
21
21
|
private static createOffsetSegment;
|
|
22
22
|
/**
|
|
23
|
-
* Construct a wire (not area) that is offset from given polyline or polygon
|
|
24
|
-
*
|
|
23
|
+
* Construct a wire (not area) that is offset from given polyline or polygon.
|
|
24
|
+
* * For best results, points should be in a horizontal plane because z-coordinates are ignored.
|
|
25
25
|
* * This is a simple wire offset (in the form of a line string), not an area.
|
|
26
26
|
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
27
27
|
* * See [[JointOptions]] class doc for offset construction rules.
|
|
@@ -33,7 +33,7 @@ export declare class PolygonWireOffsetContext {
|
|
|
33
33
|
constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions): CurveChain | undefined;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Context for building a wire offset from a Path or Loop of CurvePrimitives
|
|
36
|
+
* Context for building a wire xy-offset from a Path or Loop of CurvePrimitives
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
export declare class CurveChainWireOffsetContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOffsetContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"PolygonOffsetContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AAGrE,O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10 @@ class Joint {
|
|
|
165
165
|
return numOut++ < maxTest;
|
|
166
166
|
}, maxTest);
|
|
167
167
|
}
|
|
168
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,
|
|
170
|
+
* such as whether to extend both curves to intersection or to fill the gap between curves.
|
|
171
|
+
*/
|
|
169
172
|
static annotateChain(start, options, maxTest = 100) {
|
|
170
173
|
if (start)
|
|
171
174
|
Joint.visitJointsOnChain(start, (joint) => { joint.annotateJointMode(options); return true; }, maxTest);
|
|
@@ -197,6 +200,7 @@ class Joint {
|
|
|
197
200
|
if (this.curve0 && this.curve1) {
|
|
198
201
|
const ray0 = this.curve0.fractionToPointAndDerivative(1.0);
|
|
199
202
|
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
203
|
+
ray0.direction.z = ray1.direction.z = 0.0; // xy-offset
|
|
200
204
|
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
201
205
|
if (intersection.approachType === CurveCurveApproachType.Intersection) {
|
|
202
206
|
if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {
|
|
@@ -275,7 +279,7 @@ class Joint {
|
|
|
275
279
|
this.fraction0 = 1.0;
|
|
276
280
|
}
|
|
277
281
|
else if (this.curve0 && this.curve1) { // joints at the middle of the chain
|
|
278
|
-
if (this.curve0.endPoint().
|
|
282
|
+
if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments
|
|
279
283
|
this.fraction0 = 1.0;
|
|
280
284
|
this.fraction1 = 0.0;
|
|
281
285
|
this.flexure = JointMode.Trim;
|
|
@@ -283,8 +287,9 @@ class Joint {
|
|
|
283
287
|
else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines
|
|
284
288
|
const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
|
|
285
289
|
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
290
|
+
ray0.direction.z = ray1.direction.z = 0.0; // xy-offset
|
|
286
291
|
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
287
|
-
if (intersection.approachType === CurveCurveApproachType.Intersection) {
|
|
292
|
+
if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {
|
|
288
293
|
this.fraction0 = intersection.detailA.fraction;
|
|
289
294
|
this.fraction1 = intersection.detailB.fraction;
|
|
290
295
|
if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend
|
|
@@ -405,7 +410,7 @@ class Joint {
|
|
|
405
410
|
}
|
|
406
411
|
}
|
|
407
412
|
/**
|
|
408
|
-
* Context for building a wire offset.
|
|
413
|
+
* Context for building a wire xy-offset.
|
|
409
414
|
* @internal
|
|
410
415
|
*/
|
|
411
416
|
class PolygonWireOffsetContext {
|
|
@@ -414,6 +419,7 @@ class PolygonWireOffsetContext {
|
|
|
414
419
|
// Construct a single offset from base points
|
|
415
420
|
static createOffsetSegment(basePointA, basePointB, distance) {
|
|
416
421
|
Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);
|
|
422
|
+
this._unitAlong.z = 0.0; // xy-offset
|
|
417
423
|
if (this._unitAlong.normalizeInPlace()) {
|
|
418
424
|
this._unitAlong.rotate90CCWXY(this._unitPerp);
|
|
419
425
|
const segment = LineSegment3d.create(basePointA.plusScaled(this._unitPerp, distance, this._offsetA), basePointB.plusScaled(this._unitPerp, distance, this._offsetB));
|
|
@@ -423,8 +429,8 @@ class PolygonWireOffsetContext {
|
|
|
423
429
|
return undefined;
|
|
424
430
|
}
|
|
425
431
|
/**
|
|
426
|
-
* Construct a wire (not area) that is offset from given polyline or polygon
|
|
427
|
-
*
|
|
432
|
+
* Construct a wire (not area) that is offset from given polyline or polygon.
|
|
433
|
+
* * For best results, points should be in a horizontal plane because z-coordinates are ignored.
|
|
428
434
|
* * This is a simple wire offset (in the form of a line string), not an area.
|
|
429
435
|
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
430
436
|
* * See [[JointOptions]] class doc for offset construction rules.
|
|
@@ -434,36 +440,34 @@ class PolygonWireOffsetContext {
|
|
|
434
440
|
* object.
|
|
435
441
|
*/
|
|
436
442
|
constructPolygonWireXYOffset(points, wrap, leftOffsetDistanceOrOptions) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
*/
|
|
441
|
-
if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {
|
|
442
|
-
wrap = false;
|
|
443
|
-
}
|
|
444
|
-
/** create raw offsets as a linked list (joint0) */
|
|
443
|
+
if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))
|
|
444
|
+
wrap = false; // no wrap possible for polylines
|
|
445
|
+
// create raw offset segments as a linked list of Joints, starting with joint0
|
|
445
446
|
const options = JointOptions.create(leftOffsetDistanceOrOptions);
|
|
446
447
|
const numPoints = points.length;
|
|
447
|
-
let fragment0
|
|
448
|
-
let joint0
|
|
449
|
-
let
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
448
|
+
let fragment0;
|
|
449
|
+
let joint0, previousJoint;
|
|
450
|
+
for (let i = 0; i + 1 < numPoints; ++i) {
|
|
451
|
+
if (!previousJoint) { // start the linked list at the first nontrivial xy-segment
|
|
452
|
+
if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))
|
|
453
|
+
previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);
|
|
457
|
+
if (fragment1) { // append the next nontrivial xy-segment
|
|
458
|
+
const newJoint = new Joint(fragment0, fragment1, points[i]);
|
|
459
|
+
Joint.link(previousJoint, newJoint);
|
|
460
|
+
previousJoint = newJoint;
|
|
461
|
+
fragment0 = fragment1;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
463
464
|
}
|
|
464
|
-
|
|
465
|
+
if (!fragment0 || !previousJoint || !joint0)
|
|
466
|
+
return undefined; // no edge with positive xy-length
|
|
467
|
+
const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);
|
|
468
|
+
Joint.link(previousJoint, lastJoint);
|
|
465
469
|
Joint.annotateChain(joint0, options, numPoints);
|
|
466
|
-
|
|
470
|
+
// make limited passes through the Joint chain until no self-intersections are removed
|
|
467
471
|
for (let pass = 0; pass++ < 5;) {
|
|
468
472
|
const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);
|
|
469
473
|
joint0 = state.newStart;
|
|
@@ -476,10 +480,8 @@ class PolygonWireOffsetContext {
|
|
|
476
480
|
}
|
|
477
481
|
*/
|
|
478
482
|
}
|
|
479
|
-
// Joint.collectPrimitivesFromChain(joint0, result, numPoints);
|
|
480
|
-
/** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */
|
|
481
483
|
const chain = LineString3d.create();
|
|
482
|
-
Joint.collectStrokesFromChain(joint0, chain, numPoints);
|
|
484
|
+
Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)
|
|
483
485
|
const n = chain.packedPoints.length;
|
|
484
486
|
if (n > 1) {
|
|
485
487
|
if (chain.packedPoints.front().isAlmostEqual(chain.packedPoints.back()))
|
|
@@ -496,7 +498,7 @@ PolygonWireOffsetContext._offsetA = Point3d.create();
|
|
|
496
498
|
PolygonWireOffsetContext._offsetB = Point3d.create();
|
|
497
499
|
export { PolygonWireOffsetContext };
|
|
498
500
|
/**
|
|
499
|
-
* Context for building a wire offset from a Path or Loop of CurvePrimitives
|
|
501
|
+
* Context for building a wire xy-offset from a Path or Loop of CurvePrimitives
|
|
500
502
|
* @internal
|
|
501
503
|
*/
|
|
502
504
|
export class CurveChainWireOffsetContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AAEpB;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,6CAAU,CAAA;IACV,0CAAS,CAAA;IACT,yDAAgB,CAAA;IAChB,uCAAO,CAAA;AACT,CAAC,EAPI,SAAS,KAAT,SAAS,QAOb;AAED;;;GAGG;AACH,MAAM,KAAK;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IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\n\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number,\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number,\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in\r\n * a plane parallel to xy-plane).\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\r\n ): CurveChain | undefined {\r\n /**\r\n * if \"wrap = true\", then first and last point in the points array must be close; otherwise\r\n * generated offset will be invalid.\r\n */\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {\r\n wrap = false;\r\n }\r\n /** create raw offsets as a linked list (joint0) */\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n Joint.annotateChain(joint0, options, numPoints);\r\n /** make limited passes through the Joint chain until no self-intersections are removed */\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\r\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param curve primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ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,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\n\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n /**\r\n * Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,\r\n * such as whether to extend both curves to intersection or to fill the gap between curves.\r\n */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number,\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire xy-offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number,\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n this._unitAlong.z = 0.0; // xy-offset\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon.\r\n * * For best results, points should be in a horizontal plane because z-coordinates are ignored.\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\r\n ): CurveChain | undefined {\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))\r\n wrap = false; // no wrap possible for polylines\r\n // create raw offset segments as a linked list of Joints, starting with joint0\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0: CurvePrimitive | undefined;\r\n let joint0, previousJoint: Joint | undefined;\r\n for (let i = 0; i + 1 < numPoints; ++i) {\r\n if (!previousJoint) { // start the linked list at the first nontrivial xy-segment\r\n if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))\r\n previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);\r\n } else {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n if (fragment1) { // append the next nontrivial xy-segment\r\n const newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n }\r\n if (!fragment0 || !previousJoint || !joint0)\r\n return undefined; // no edge with positive xy-length\r\n const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, lastJoint);\r\n Joint.annotateChain(joint0, options, numPoints);\r\n // make limited passes through the Joint chain until no self-intersections are removed\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire xy-offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\r\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param curve primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
|
|
@@ -21,17 +21,33 @@ export declare class CoincidentGeometryQuery {
|
|
|
21
21
|
* * reevaluate the points as simple interpolation between given points.
|
|
22
22
|
*/
|
|
23
23
|
static assignDetailInterpolatedFractionsAndPoints(detail: CurveLocationDetail, f0: number, f1: number, pointA: Point3d, pointB: Point3d, swap?: boolean): void;
|
|
24
|
-
/** Return a curve location detail with projection of a `spacePoint` to the line segment with `pointA` and `pointB`
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
24
|
+
/** Return a curve location detail with projection of a `spacePoint` to the line segment with `pointA` and `pointB` */
|
|
27
25
|
projectPointToSegmentXY(spacePoint: Point3d, pointA: Point3d, pointB: Point3d): CurveLocationDetail;
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Given a detail pair representing the projection of each of two colinear line segments onto the other,
|
|
28
|
+
* clamp the details (in place) to the line segments' endpoints according to the given flags.
|
|
29
|
+
* @param overlap segment overlap as returned by [[coincidentSegmentRangeXY]], modified on return
|
|
30
|
+
* @param pointA0 start point of segment A
|
|
31
|
+
* @param pointA1 end point of segment A
|
|
32
|
+
* @param pointB0 start point of segment B
|
|
33
|
+
* @param pointB1 end point of segment B
|
|
34
|
+
* @param extendA0 whether to extend segment A beyond its start
|
|
35
|
+
* @param extendA1 whether to extend segment A beyond its end
|
|
36
|
+
* @param extendB0 whether to extend segment B beyond its start
|
|
37
|
+
* @param extendB1 whether to extend segment B beyond its end
|
|
38
|
+
* @return reference to the input clamped in place, or undefined (leaving interval untouched) if clamping would result in empty interval.
|
|
39
|
+
*/
|
|
40
|
+
clampCoincidentOverlapToSegmentBounds(overlap: CurveLocationDetailPair, pointA0: Point3d, pointA1: Point3d, pointB0: Point3d, pointB1: Point3d, extendA0?: boolean, extendA1?: boolean, extendB0?: boolean, extendB1?: boolean): CurveLocationDetailPair | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Compute whether two line segments have a coincident overlap in xy.
|
|
43
|
+
* * Project `pointA0` and `pointA1` onto the line formed by `pointB0` and `pointB1` and vice versa
|
|
44
|
+
* * If all projection distances are sufficiently small, return a detail pair recording the coincident interval, optionally clipped to segment bounds.
|
|
31
45
|
* @param pointA0 start point of segment A
|
|
32
46
|
* @param pointA1 end point of segment A
|
|
33
47
|
* @param pointB0 start point of segment B
|
|
34
48
|
* @param pointB1 end point of segment B
|
|
49
|
+
* @param restrictToBounds whether to clip the coincident segment details to the segment bounds
|
|
50
|
+
* @return detail pair for the coincident interval (`detailA` has fractions along segment A, and `detailB` has fractions along segment B), or undefined if no coincidence
|
|
35
51
|
*/
|
|
36
52
|
coincidentSegmentRangeXY(pointA0: Point3d, pointA1: Point3d, pointB0: Point3d, pointB1: Point3d, restrictToBounds?: boolean): CurveLocationDetailPair | undefined;
|
|
37
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoincidentGeometryOps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/CoincidentGeometryOps.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAI5F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAGtD;;;;;GAKG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAAC,UAAU,CAA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