@itwin/core-geometry 5.2.0-dev.8 → 5.3.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -1
- package/lib/cjs/Geometry.d.ts +30 -10
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +74 -10
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.d.ts +19 -6
- package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js +21 -5
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +3 -3
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +6 -6
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +2 -2
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +4 -6
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts +27 -17
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +17 -7
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +19 -6
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +17 -2
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +14 -1
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +21 -3
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +14 -11
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +23 -16
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +27 -17
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +61 -35
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +1 -0
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +1 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +8 -7
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +51 -1
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js +97 -3
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +4 -4
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +8 -8
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +6 -2
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +12 -7
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +9 -4
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +10 -5
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -4
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +21 -18
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +30 -50
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +5 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +0 -3
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +6 -2
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +12 -3
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +14 -18
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +18 -2
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +37 -4
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +1 -0
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.d.ts +8 -0
- package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js +18 -2
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +53 -26
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +14 -3
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +20 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +34 -32
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +28 -21
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts +16 -6
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js +28 -4
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +3 -4
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +1 -1
- package/lib/cjs/geometry3d/Transform.js +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.d.ts +12 -1
- package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js +17 -2
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts +16 -0
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +26 -0
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +5 -9
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.d.ts +13 -7
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js +13 -7
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +1 -3
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +2 -6
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +25 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +59 -8
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +7 -3
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +8 -10
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +9 -12
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +2 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +2 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +38 -12
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +91 -23
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +20 -11
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +43 -39
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +7 -4
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +16 -11
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +13 -11
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +40 -36
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/Voronoi.d.ts +195 -0
- package/lib/cjs/topology/Voronoi.d.ts.map +1 -0
- package/lib/cjs/topology/Voronoi.js +700 -0
- package/lib/cjs/topology/Voronoi.js.map +1 -0
- package/lib/cjs/topology/XYParitySearchContext.d.ts +1 -1
- package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Geometry.d.ts +30 -10
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +74 -10
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.d.ts +19 -6
- package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js +21 -5
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +3 -3
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +6 -6
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +2 -2
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +4 -6
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.d.ts +27 -17
- package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +17 -7
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +19 -6
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +17 -2
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +14 -1
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +21 -3
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +14 -11
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +23 -16
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +27 -17
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +61 -35
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +1 -0
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +1 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +8 -7
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +51 -1
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js +98 -4
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +4 -4
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +8 -8
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -3
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +6 -2
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +12 -7
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +9 -4
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +10 -5
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +2 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -4
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +21 -18
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +30 -50
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +5 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +0 -3
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +6 -2
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +12 -3
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +14 -18
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +18 -2
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +37 -4
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +1 -0
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.d.ts +8 -0
- package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js +18 -2
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +53 -26
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +14 -3
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +20 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +34 -32
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +28 -21
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts +16 -6
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js +28 -4
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +3 -4
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +1 -1
- package/lib/esm/geometry3d/Transform.js +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.d.ts +12 -1
- package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js +16 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts +16 -0
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +26 -0
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +5 -9
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.d.ts +13 -7
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/esm/numerics/SmallSystem.js +13 -7
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +1 -3
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +2 -6
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +25 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +59 -8
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +7 -3
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +8 -10
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts +8 -5
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js +9 -12
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +2 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +2 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +38 -12
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +92 -24
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +20 -11
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +43 -39
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +7 -4
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +17 -12
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +13 -11
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +40 -36
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/Voronoi.d.ts +195 -0
- package/lib/esm/topology/Voronoi.d.ts.map +1 -0
- package/lib/esm/topology/Voronoi.js +696 -0
- package/lib/esm/topology/Voronoi.js.map +1 -0
- package/lib/esm/topology/XYParitySearchContext.d.ts +1 -1
- package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -46,8 +46,11 @@ export declare class PolylineCompressionContext {
|
|
|
46
46
|
* * This is a global analysis (Douglas-Peucker)
|
|
47
47
|
* @param source input points.
|
|
48
48
|
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
49
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
50
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
51
|
+
* Default is false, meaning the input points are treated cyclically, allowing removal of the seam.
|
|
49
52
|
*/
|
|
50
|
-
static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance
|
|
53
|
+
static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance?: number, keepSeam?: boolean): Point3d[];
|
|
51
54
|
/**
|
|
52
55
|
* * Return a polyline with a subset of the input points.
|
|
53
56
|
* * This is a global analysis (Douglas-Peucker)
|
|
@@ -56,8 +59,11 @@ export declare class PolylineCompressionContext {
|
|
|
56
59
|
* @param source input points
|
|
57
60
|
* @param dest output points. Must be different from source.
|
|
58
61
|
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
62
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
63
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
64
|
+
* Default is false, meaning the input points are treated cyclically, allowing removal of the seam.
|
|
59
65
|
*/
|
|
60
|
-
static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance
|
|
66
|
+
static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance?: number, keepSeam?: boolean): void;
|
|
61
67
|
/**
|
|
62
68
|
* Return a simplified subset of given points, omitting a point if very close to its predecessor.
|
|
63
69
|
* * This is a local search, with a single pass over the data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineCompressionByEdgeOffset.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAGtD;;GAEG;AACH,qBAAa,0BAA0B;IACrC;;OAEG;IACH,OAAO;IAKP,OAAO,CAAC,OAAO,CAAuB;IAEtC,OAAO,CAAC,KAAK,CAAgC;IAE7C,yCAAyC;IACzC,OAAO,CAAC,iBAAiB,CAAS;IAClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B,2CAA2C;IAC3C,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;;;;;OAMG;IAGH,OAAO,CAAC,+BAA+B;IAcvC
|
|
1
|
+
{"version":3,"file":"PolylineCompressionByEdgeOffset.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAGtD;;GAEG;AACH,qBAAa,0BAA0B;IACrC;;OAEG;IACH,OAAO;IAKP,OAAO,CAAC,OAAO,CAAuB;IAEtC,OAAO,CAAC,KAAK,CAAgC;IAE7C,yCAAyC;IACzC,OAAO,CAAC,iBAAiB,CAAS;IAClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B,2CAA2C;IAC3C,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;;;;;OAMG;IAGH,OAAO,CAAC,+BAA+B;IAcvC;;;;;;;;OAQG;WACW,gCAAgC,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,GAAE,MAAqC,EAAE,QAAQ,GAAE,OAAe,GAAG,OAAO,EAAE;IAM9J;;;;;;;;;;;OAWG;WACW,8BAA8B,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,6BAA6B,EAAE,cAAc,GAAE,MAAqC,EAAE,QAAQ,GAAE,OAAe;IAuBhM;;;;;;OAMG;WACW,gCAAgC,CAAC,IAAI,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM;IA6B5F;;;;;OAKG;WACW,kCAAkC,CAAC,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM;IAgBhG;;OAEG;WACW,sCAAsC,CAAC,IAAI,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,EAAE,oBAAoB,SAAS;IAiCzI;;;;;OAKG;WACW,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM;CAqB7H"}
|
|
@@ -126,11 +126,14 @@ class PolylineCompressionContext {
|
|
|
126
126
|
* * This is a global analysis (Douglas-Peucker)
|
|
127
127
|
* @param source input points.
|
|
128
128
|
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
129
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
130
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
131
|
+
* Default is false, meaning the input points are treated cyclically, allowing removal of the seam.
|
|
129
132
|
*/
|
|
130
|
-
static compressPoint3dArrayByChordError(source, chordTolerance) {
|
|
133
|
+
static compressPoint3dArrayByChordError(source, chordTolerance = Geometry_1.Geometry.smallMetricDistance, keepSeam = false) {
|
|
131
134
|
const source1 = new Point3dArrayCarrier_1.Point3dArrayCarrier(source);
|
|
132
135
|
const dest1 = new Point3dArrayCarrier_1.Point3dArrayCarrier([]);
|
|
133
|
-
this.compressCollectionByChordError(source1, dest1, chordTolerance);
|
|
136
|
+
this.compressCollectionByChordError(source1, dest1, chordTolerance, keepSeam);
|
|
134
137
|
return dest1.data;
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
@@ -141,8 +144,11 @@ class PolylineCompressionContext {
|
|
|
141
144
|
* @param source input points
|
|
142
145
|
* @param dest output points. Must be different from source.
|
|
143
146
|
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
147
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
148
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
149
|
+
* Default is false, meaning the input points are treated cyclically, allowing removal of the seam.
|
|
144
150
|
*/
|
|
145
|
-
static compressCollectionByChordError(source, dest, chordTolerance) {
|
|
151
|
+
static compressCollectionByChordError(source, dest, chordTolerance = Geometry_1.Geometry.smallMetricDistance, keepSeam = false) {
|
|
146
152
|
dest.clear();
|
|
147
153
|
const n = source.length;
|
|
148
154
|
if (n === 1) {
|
|
@@ -153,7 +159,7 @@ class PolylineCompressionContext {
|
|
|
153
159
|
// Do compression on inclusive interval from indexA to indexB, with indices interpreted cyclically if closed
|
|
154
160
|
let indexA = 0;
|
|
155
161
|
let indexB = n - 1;
|
|
156
|
-
if (n > 2 && source.distanceIndexIndex(0, n - 1) <= chordTolerance) {
|
|
162
|
+
if (n > 2 && !keepSeam && source.distanceIndexIndex(0, n - 1) <= chordTolerance) {
|
|
157
163
|
// cyclic data. It is possible that the wrap point itself has to be seen as an internal point.
|
|
158
164
|
// do the search from point index where there is a large triangle . ..
|
|
159
165
|
const maxCrossProductIndex = context.indexOfMaxCrossProduct(0, n - 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineCompressionByEdgeOffset.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,0CAAuC;AAGvC,+DAA4D;AAC5D,uDAAsD;AAEtD,sBAAsB;AACtB;;GAEG;AACH,MAAa,0BAA0B;IACrC;;OAEG;IACH,YAAoB,MAA4B,EAAE,IAAmC,EAAE,SAAiB;QACtG,IAAI,CAAC,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IACO,OAAO,CAAuB;IAE9B,KAAK,CAAgC;IAE7C,yCAAyC;IACjC,iBAAiB,CAAS;IAClC;;OAEG;IACK,kBAAkB,CAAC,CAAS;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,KAAK;YACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,2CAA2C;IACnC,MAAM,CAAC,SAAS,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC;IAC/C,MAAM,CAAC,QAAQ,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC;IACtD;;;;;OAKG;IACK,sBAAsB,CAAC,MAAc,EAAE,MAAc;QAC3D,IAAI,IAAI,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,CAAC;QACN,IAAI,QAA4B,CAA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AAG,GAAG,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;gBAC/D,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;gBACpE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,sBAAsB,EAAE,CAAC;oBACrD,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;;AAjRH,gEAkRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\n\n// cspell:word Puecker\n/** context class for Puecker-Douglas polyline compression, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\n * @internal\n */\nexport class PolylineCompressionContext {\n /** Caller provides source and tolerance.\n * * pointer to source is retained, but contents of source are never modified.\n */\n private constructor(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, tolerance: number) {\n this._toleranceSquared = tolerance * tolerance;\n this._source = source;\n this._dest = dest;\n }\n private _source: IndexedXYZCollection;\n\n private _dest: IndexedReadWriteXYZCollection;\n\n /** Squared tolerance for equal point. */\n private _toleranceSquared: number;\n /** push (clone of) the point at index i from the source to the growing result.\n * * index is adjusted cyclically to source index range by modulo.\n */\n private acceptPointByIndex(i: number) {\n const point = this._source.getPoint3dAtCheckedPointIndex(this._source.cyclicIndex(i));\n if (point)\n this._dest.push(point);\n }\n /** work data used by find max deviation */\n private static _vector01: Vector3d = Vector3d.create();\n private static _vectorQ: Vector3d = Vector3d.create();\n /**\n * Return index of max magnitude of cross product of vectors (index to index+1) and (index to index+2)\n * * Return undefined if unable to find a nonzero cross product.\n * @param i0 first cross product central index.\n * @param i1 last cross product central index.\n */\n private indexOfMaxCrossProduct(index0: number, index1: number): number | undefined {\n let qMax = 0.0;\n let q;\n let indexMax: number | undefined;\n for (let index = index0; index <= index1; index++) {\n const iA = this._source.cyclicIndex(index);\n const iB = this._source.cyclicIndex(index + 1);\n const iC = this._source.cyclicIndex(index + 2);\n this._source.crossProductIndexIndexIndex(iA, iB, iC, PolylineCompressionContext._vectorQ);\n q = PolylineCompressionContext._vectorQ.magnitudeSquared();\n if (q > qMax) {\n qMax = q;\n indexMax = index;\n }\n }\n return indexMax;\n }\n\n /**\n * Return interior index where max deviation in excess of tolerance occurs.\n * @param i0 first index of interval\n * @param i1 INCLUSIVE final index\n */\n private indexOfMaxDeviation(index0: number, index1: number): number | undefined {\n const i0 = this._source.cyclicIndex(index0);\n const i1 = this._source.cyclicIndex(index1);\n let maxDeviation = this._toleranceSquared;\n let maxDeviationIndex;\n let numerator;\n let distanceSquared;\n let s;\n let i;\n this._source.vectorIndexIndex(i0, i1, PolylineCompressionContext._vector01)!;\n const denominator = PolylineCompressionContext._vector01.magnitudeSquared();\n for (let index = index0 + 1; index < index1; index++) {\n i = this._source.cyclicIndex(index);\n this._source.vectorIndexIndex(i0, i, PolylineCompressionContext._vectorQ);\n numerator = PolylineCompressionContext._vector01.dotProduct(PolylineCompressionContext._vectorQ);\n if (numerator <= 0) {\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\n } else if (numerator > denominator) {\n this._source.vectorIndexIndex(i1, i, PolylineCompressionContext._vectorQ);\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\n } else {\n s = numerator / denominator;\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\n }\n if (distanceSquared > maxDeviation) {\n maxDeviation = distanceSquared;\n maxDeviationIndex = index;\n }\n }\n return maxDeviationIndex;\n }\n /**\n *\n * @param i0 first active point index\n * @param i1 last active point index (INCLUSIVE -- not \"one beyond\")\n * @param chordTolerance\n * @param result\n */\n // ASSUME index i0 is already saved.\n // ASSUME point i\n private recursiveCompressByChordErrorGo(i0: number, i1: number) {\n if (i1 === i0 + 1) {\n this.acceptPointByIndex(i1);\n return;\n }\n const distantPointIndex = this.indexOfMaxDeviation(i0, i1);\n if (distantPointIndex === undefined) {\n this.acceptPointByIndex(i1); // which compresses out some points.\n } else {\n this.recursiveCompressByChordErrorGo(i0, distantPointIndex);\n this.recursiveCompressByChordErrorGo(distantPointIndex, i1);\n }\n }\n // cspell:word Peucker\n /**\n * Return a point array with a subset of the input points.\n * * This is a global analysis (Douglas-Peucker)\n * @param source input points.\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\n */\n public static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\n const source1 = new Point3dArrayCarrier(source);\n const dest1 = new Point3dArrayCarrier([]);\n this.compressCollectionByChordError(source1, dest1, chordTolerance);\n return dest1.data;\n }\n /**\n * * Return a polyline with a subset of the input points.\n * * This is a global analysis (Douglas-Peucker)\n * * Global search for vertices that are close to edges between widely separated neighbors.\n * * Recurses to smaller subsets.\n * @param source input points\n * @param dest output points. Must be different from source.\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\n */\n public static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance: number) {\n dest.clear();\n const n = source.length;\n if (n === 1) {\n dest.push(source.getPoint3dAtCheckedPointIndex(0)!);\n return;\n }\n const context = new PolylineCompressionContext(source, dest, chordTolerance);\n // Do compression on inclusive interval from indexA to indexB, with indices interpreted cyclically if closed\n let indexA = 0;\n let indexB = n - 1;\n if (n > 2 && source.distanceIndexIndex(0, n - 1)! <= chordTolerance) {\n // cyclic data. It is possible that the wrap point itself has to be seen as an internal point.\n // do the search from point index where there is a large triangle . ..\n const maxCrossProductIndex = context.indexOfMaxCrossProduct(0, n - 1);\n if (maxCrossProductIndex !== undefined) {\n indexA = maxCrossProductIndex + 1;\n indexB = indexA + n;\n }\n }\n context.acceptPointByIndex(indexA);\n context.recursiveCompressByChordErrorGo(indexA, indexB);\n }\n /**\n * Return a simplified subset of given points, omitting a point if very close to its predecessor.\n * * This is a local search, with a single pass over the data.\n * * First and last points are always retained.\n * @param data input points\n * @param maxEdgeLength length of largest edge to be compressed out\n */\n public static compressInPlaceByShortEdgeLength(data: GrowableXYZArray, maxEdgeLength: number) {\n const n = data.length;\n if (n < 2)\n return;\n let lastAcceptedIndex = 0;\n // back up from final point ..\n let indexB = n - 1;\n while (indexB > 0 && data.distanceIndexIndex(indexB - 1, n - 1)! <= maxEdgeLength)\n indexB--;\n if (indexB === 0) {\n // Theres only one point there.\n data.length = 1;\n return;\n }\n // we want the exact bits of the final point even if others were nearby ..\n if (indexB < n - 1)\n data.moveIndexToIndex(n - 1, indexB);\n let candidateIndex = lastAcceptedIndex + 1;\n while (candidateIndex <= indexB) {\n const d = data.distanceIndexIndex(lastAcceptedIndex, candidateIndex)!;\n if (d > maxEdgeLength) {\n data.moveIndexToIndex(candidateIndex, lastAcceptedIndex + 1);\n lastAcceptedIndex++;\n }\n candidateIndex++;\n }\n data.length = lastAcceptedIndex + 1;\n }\n\n /**\n * Return a simplified subset of given points, omitting the middle of three successive points if the triangle they form is small.\n * * This is a local search, with a single pass over the data.\n * @param data input points\n * @param maxTriangleArea area of largest triangle to compress\n */\n public static compressInPlaceBySmallTriangleArea(data: GrowableXYZArray, maxTriangleArea: number) {\n const n = data.length;\n if (n < 3)\n return;\n let lastAcceptedIndex = 0;\n const cross = Vector3d.create();\n for (let i1 = 1; i1 + 1 < n; i1++) {\n data.crossProductIndexIndexIndex(lastAcceptedIndex, i1, i1 + 1, cross);\n if (0.5 * cross.magnitude() > maxTriangleArea) {\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n }\n }\n data.moveIndexToIndex(n - 1, ++lastAcceptedIndex);\n data.length = lastAcceptedIndex + 1;\n }\n\n /** Copy points from source to dest, omitting those too close to edge between neighbors.\n * * First and last points are always preserved.\n */\n public static compressInPlaceByPerpendicularDistance(data: GrowableXYZArray, perpendicularDistance: number, maxExtensionFraction = 1.0001) {\n const n = data.length;\n if (n < 3)\n return;\n let lastAcceptedIndex = 0;\n const vector01 = PolylineCompressionContext._vector01;\n const vectorQ = PolylineCompressionContext._vectorQ;\n let distanceSquared;\n const perpendicularDistanceSquared = perpendicularDistance * perpendicularDistance;\n let denominator;\n let i1 = 1;\n for (; i1 + 1 < n; i1++) {\n data.vectorIndexIndex(lastAcceptedIndex, i1 + 1, vector01);\n data.vectorIndexIndex(lastAcceptedIndex, i1, vectorQ);\n denominator = vector01.magnitudeSquared();\n const s = Geometry.conditionalDivideFraction(vectorQ.dotProduct(vector01), denominator);\n if (s !== undefined) {\n if (s >= 0.0 && s <= maxExtensionFraction) {\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\n if (distanceSquared <= perpendicularDistanceSquared) {\n // force accept of point i1+1 .\n data.moveIndexToIndex(i1 + 1, ++lastAcceptedIndex);\n i1 = i1 + 1;\n continue;\n }\n }\n }\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n }\n if (i1 < n)\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n data.length = lastAcceptedIndex + 1;\n }\n /**\n * IF the first and last points are close AND first and last segments are colinear, remove first and last points. Prior second to last becomes replicated start and end.\n * * Expected to be called \"last\" after other compressions, so points \"next to\" shared first and last are good to keep.\n * @param points\n * @param perpendicularDistance\n */\n public static compressColinearWrapInPlace(points: Point3d[], duplicatePointTolerance: number, colinearPointTolerance: number) {\n const lastIndex = points.length - 1;\n if (lastIndex >= 3 && points[0].distance(points[lastIndex]) < duplicatePointTolerance) {\n // indices of 3 points potentially colinear.\n const indexA = lastIndex - 1;\n const indexB = 0;\n const indexC = 1;\n const vectorU = Vector3d.createStartEnd(points[indexA], points[indexC]);\n const vectorV = Vector3d.createStartEnd(points[indexA], points[indexB]);\n const uDotU = vectorU.dotProduct(vectorU);\n const uDotV = vectorU.dotProduct(vectorV);\n const fraction = Geometry.conditionalDivideFraction(uDotV, uDotU);\n if (fraction !== undefined && fraction > 0.0 && fraction < 1.0) {\n const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;\n if (Math.sqrt(Math.abs(h2)) < colinearPointTolerance) {\n points[0] = points[indexA];\n points.pop();\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PolylineCompressionByEdgeOffset.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,0CAAuC;AAGvC,+DAA4D;AAC5D,uDAAsD;AAEtD,sBAAsB;AACtB;;GAEG;AACH,MAAa,0BAA0B;IACrC;;OAEG;IACH,YAAoB,MAA4B,EAAE,IAAmC,EAAE,SAAiB;QACtG,IAAI,CAAC,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IACO,OAAO,CAAuB;IAE9B,KAAK,CAAgC;IAE7C,yCAAyC;IACjC,iBAAiB,CAAS;IAClC;;OAEG;IACK,kBAAkB,CAAC,CAAS;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,KAAK;YACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,2CAA2C;IACnC,MAAM,CAAC,SAAS,GAAa,0BAAQ,CAAC,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CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACxE,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC1C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAClE,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,GAAG,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;gBAC/D,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;gBACpE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,sBAAsB,EAAE,CAAC;oBACrD,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;;AAvRH,gEAwRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\n\n// cspell:word Puecker\n/** context class for Puecker-Douglas polyline compression, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\n * @internal\n */\nexport class PolylineCompressionContext {\n /** Caller provides source and tolerance.\n * * pointer to source is retained, but contents of source are never modified.\n */\n private constructor(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, tolerance: number) {\n this._toleranceSquared = tolerance * tolerance;\n this._source = source;\n this._dest = dest;\n }\n private _source: IndexedXYZCollection;\n\n private _dest: IndexedReadWriteXYZCollection;\n\n /** Squared tolerance for equal point. */\n private _toleranceSquared: number;\n /** push (clone of) the point at index i from the source to the growing result.\n * * index is adjusted cyclically to source index range by modulo.\n */\n private acceptPointByIndex(i: number) {\n const point = this._source.getPoint3dAtCheckedPointIndex(this._source.cyclicIndex(i));\n if (point)\n this._dest.push(point);\n }\n /** work data used by find max deviation */\n private static _vector01: Vector3d = Vector3d.create();\n private static _vectorQ: Vector3d = Vector3d.create();\n /**\n * Return index of max magnitude of cross product of vectors (index to index+1) and (index to index+2)\n * * Return undefined if unable to find a nonzero cross product.\n * @param i0 first cross product central index.\n * @param i1 last cross product central index.\n */\n private indexOfMaxCrossProduct(index0: number, index1: number): number | undefined {\n let qMax = 0.0;\n let q;\n let indexMax: number | undefined;\n for (let index = index0; index <= index1; index++) {\n const iA = this._source.cyclicIndex(index);\n const iB = this._source.cyclicIndex(index + 1);\n const iC = this._source.cyclicIndex(index + 2);\n this._source.crossProductIndexIndexIndex(iA, iB, iC, PolylineCompressionContext._vectorQ);\n q = PolylineCompressionContext._vectorQ.magnitudeSquared();\n if (q > qMax) {\n qMax = q;\n indexMax = index;\n }\n }\n return indexMax;\n }\n\n /**\n * Return interior index where max deviation in excess of tolerance occurs.\n * @param i0 first index of interval\n * @param i1 INCLUSIVE final index\n */\n private indexOfMaxDeviation(index0: number, index1: number): number | undefined {\n const i0 = this._source.cyclicIndex(index0);\n const i1 = this._source.cyclicIndex(index1);\n let maxDeviation = this._toleranceSquared;\n let maxDeviationIndex;\n let numerator;\n let distanceSquared;\n let s;\n let i;\n this._source.vectorIndexIndex(i0, i1, PolylineCompressionContext._vector01)!;\n const denominator = PolylineCompressionContext._vector01.magnitudeSquared();\n for (let index = index0 + 1; index < index1; index++) {\n i = this._source.cyclicIndex(index);\n this._source.vectorIndexIndex(i0, i, PolylineCompressionContext._vectorQ);\n numerator = PolylineCompressionContext._vector01.dotProduct(PolylineCompressionContext._vectorQ);\n if (numerator <= 0) {\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\n } else if (numerator > denominator) {\n this._source.vectorIndexIndex(i1, i, PolylineCompressionContext._vectorQ);\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\n } else {\n s = numerator / denominator;\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\n }\n if (distanceSquared > maxDeviation) {\n maxDeviation = distanceSquared;\n maxDeviationIndex = index;\n }\n }\n return maxDeviationIndex;\n }\n /**\n *\n * @param i0 first active point index\n * @param i1 last active point index (INCLUSIVE -- not \"one beyond\")\n * @param chordTolerance\n * @param result\n */\n // ASSUME index i0 is already saved.\n // ASSUME point i\n private recursiveCompressByChordErrorGo(i0: number, i1: number) {\n if (i1 === i0 + 1) {\n this.acceptPointByIndex(i1);\n return;\n }\n const distantPointIndex = this.indexOfMaxDeviation(i0, i1);\n if (distantPointIndex === undefined) {\n this.acceptPointByIndex(i1); // which compresses out some points.\n } else {\n this.recursiveCompressByChordErrorGo(i0, distantPointIndex);\n this.recursiveCompressByChordErrorGo(distantPointIndex, i1);\n }\n }\n // cspell:word Peucker\n /**\n * Return a point array with a subset of the input points.\n * * This is a global analysis (Douglas-Peucker)\n * @param source input points.\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\n * Default is [[Geometry.smallMetricDistance]].\n * @param keepSeam whether to preserve the endpoints of physically closed input.\n * Default is false, meaning the input points are treated cyclically, allowing removal of the seam.\n */\n public static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance: number = Geometry.smallMetricDistance, keepSeam: boolean = false): Point3d[] {\n const source1 = new Point3dArrayCarrier(source);\n const dest1 = new Point3dArrayCarrier([]);\n this.compressCollectionByChordError(source1, dest1, chordTolerance, keepSeam);\n return dest1.data;\n }\n /**\n * * Return a polyline with a subset of the input points.\n * * This is a global analysis (Douglas-Peucker)\n * * Global search for vertices that are close to edges between widely separated neighbors.\n * * Recurses to smaller subsets.\n * @param source input points\n * @param dest output points. Must be different from source.\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\n * Default is [[Geometry.smallMetricDistance]].\n * @param keepSeam whether to preserve the endpoints of physically closed input.\n * Default is false, meaning the input points are treated cyclically, allowing removal of the seam.\n */\n public static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance: number = Geometry.smallMetricDistance, keepSeam: boolean = false) {\n dest.clear();\n const n = source.length;\n if (n === 1) {\n dest.push(source.getPoint3dAtCheckedPointIndex(0)!);\n return;\n }\n const context = new PolylineCompressionContext(source, dest, chordTolerance);\n // Do compression on inclusive interval from indexA to indexB, with indices interpreted cyclically if closed\n let indexA = 0;\n let indexB = n - 1;\n if (n > 2 && !keepSeam && source.distanceIndexIndex(0, n - 1)! <= chordTolerance) {\n // cyclic data. It is possible that the wrap point itself has to be seen as an internal point.\n // do the search from point index where there is a large triangle . ..\n const maxCrossProductIndex = context.indexOfMaxCrossProduct(0, n - 1);\n if (maxCrossProductIndex !== undefined) {\n indexA = maxCrossProductIndex + 1;\n indexB = indexA + n;\n }\n }\n context.acceptPointByIndex(indexA);\n context.recursiveCompressByChordErrorGo(indexA, indexB);\n }\n /**\n * Return a simplified subset of given points, omitting a point if very close to its predecessor.\n * * This is a local search, with a single pass over the data.\n * * First and last points are always retained.\n * @param data input points\n * @param maxEdgeLength length of largest edge to be compressed out\n */\n public static compressInPlaceByShortEdgeLength(data: GrowableXYZArray, maxEdgeLength: number) {\n const n = data.length;\n if (n < 2)\n return;\n let lastAcceptedIndex = 0;\n // back up from final point ..\n let indexB = n - 1;\n while (indexB > 0 && data.distanceIndexIndex(indexB - 1, n - 1)! <= maxEdgeLength)\n indexB--;\n if (indexB === 0) {\n // Theres only one point there.\n data.length = 1;\n return;\n }\n // we want the exact bits of the final point even if others were nearby ..\n if (indexB < n - 1)\n data.moveIndexToIndex(n - 1, indexB);\n let candidateIndex = lastAcceptedIndex + 1;\n while (candidateIndex <= indexB) {\n const d = data.distanceIndexIndex(lastAcceptedIndex, candidateIndex)!;\n if (d > maxEdgeLength) {\n data.moveIndexToIndex(candidateIndex, lastAcceptedIndex + 1);\n lastAcceptedIndex++;\n }\n candidateIndex++;\n }\n data.length = lastAcceptedIndex + 1;\n }\n\n /**\n * Return a simplified subset of given points, omitting the middle of three successive points if the triangle they form is small.\n * * This is a local search, with a single pass over the data.\n * @param data input points\n * @param maxTriangleArea area of largest triangle to compress\n */\n public static compressInPlaceBySmallTriangleArea(data: GrowableXYZArray, maxTriangleArea: number) {\n const n = data.length;\n if (n < 3)\n return;\n let lastAcceptedIndex = 0;\n const cross = Vector3d.create();\n for (let i1 = 1; i1 + 1 < n; i1++) {\n data.crossProductIndexIndexIndex(lastAcceptedIndex, i1, i1 + 1, cross);\n if (0.5 * cross.magnitude() > maxTriangleArea) {\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n }\n }\n data.moveIndexToIndex(n - 1, ++lastAcceptedIndex);\n data.length = lastAcceptedIndex + 1;\n }\n\n /** Copy points from source to dest, omitting those too close to edge between neighbors.\n * * First and last points are always preserved.\n */\n public static compressInPlaceByPerpendicularDistance(data: GrowableXYZArray, perpendicularDistance: number, maxExtensionFraction = 1.0001) {\n const n = data.length;\n if (n < 3)\n return;\n let lastAcceptedIndex = 0;\n const vector01 = PolylineCompressionContext._vector01;\n const vectorQ = PolylineCompressionContext._vectorQ;\n let distanceSquared;\n const perpendicularDistanceSquared = perpendicularDistance * perpendicularDistance;\n let denominator;\n let i1 = 1;\n for (; i1 + 1 < n; i1++) {\n data.vectorIndexIndex(lastAcceptedIndex, i1 + 1, vector01);\n data.vectorIndexIndex(lastAcceptedIndex, i1, vectorQ);\n denominator = vector01.magnitudeSquared();\n const s = Geometry.conditionalDivideFraction(vectorQ.dotProduct(vector01), denominator);\n if (s !== undefined) {\n if (s >= 0.0 && s <= maxExtensionFraction) {\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\n if (distanceSquared <= perpendicularDistanceSquared) {\n // force accept of point i1+1 .\n data.moveIndexToIndex(i1 + 1, ++lastAcceptedIndex);\n i1 = i1 + 1;\n continue;\n }\n }\n }\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n }\n if (i1 < n)\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\n data.length = lastAcceptedIndex + 1;\n }\n /**\n * IF the first and last points are close AND first and last segments are colinear, remove first and last points. Prior second to last becomes replicated start and end.\n * * Expected to be called \"last\" after other compressions, so points \"next to\" shared first and last are good to keep.\n * @param points\n * @param perpendicularDistance\n */\n public static compressColinearWrapInPlace(points: Point3d[], duplicatePointTolerance: number, colinearPointTolerance: number) {\n const lastIndex = points.length - 1;\n if (lastIndex >= 3 && points[0].distance(points[lastIndex]) < duplicatePointTolerance) {\n // indices of 3 points potentially colinear.\n const indexA = lastIndex - 1;\n const indexB = 0;\n const indexC = 1;\n const vectorU = Vector3d.createStartEnd(points[indexA], points[indexC]);\n const vectorV = Vector3d.createStartEnd(points[indexA], points[indexB]);\n const uDotU = vectorU.dotProduct(vectorU);\n const uDotV = vectorU.dotProduct(vectorV);\n const fraction = Geometry.conditionalDivideFraction(uDotV, uDotU);\n if (fraction !== undefined && fraction > 0.0 && fraction < 1.0) {\n const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;\n if (Math.sqrt(Math.abs(h2)) < colinearPointTolerance) {\n points[0] = points[indexA];\n points.pop();\n }\n }\n }\n }\n}\n"]}
|
|
@@ -21,10 +21,13 @@ export declare class PolylineOps {
|
|
|
21
21
|
* Return a simplified subset of given points.
|
|
22
22
|
* * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm
|
|
23
23
|
* * This is a global search, with multiple passes over the data.
|
|
24
|
-
* @param source
|
|
25
|
-
* @param chordTolerance
|
|
24
|
+
* @param source input points.
|
|
25
|
+
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
26
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
27
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
28
|
+
* Default is false, meaning physically closed input points are treated cyclically, allowing removal of the seam.
|
|
26
29
|
*/
|
|
27
|
-
static compressByChordError(source: Point3d[], chordTolerance
|
|
30
|
+
static compressByChordError(source: Point3d[], chordTolerance?: number, keepSeam?: boolean): Point3d[];
|
|
28
31
|
/**
|
|
29
32
|
* Return a simplified subset of given points, omitting a point if very close to its predecessor.
|
|
30
33
|
* * This is a local search, with a single pass over the data.
|
|
@@ -111,5 +114,13 @@ export declare class PolylineOps {
|
|
|
111
114
|
* * `childDetail.fraction` is the local segment fraction
|
|
112
115
|
*/
|
|
113
116
|
static closestApproach(pointsA: Point3d[] | IndexedXYZCollection, extendA: VariantCurveExtendParameter, pointsB: Point3d[] | IndexedXYZCollection, extendB: VariantCurveExtendParameter, dMax?: number, result?: CurveLocationDetailPair): CurveLocationDetailPair | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Checks if all points are colinear.
|
|
119
|
+
* * This test does not take point order into account.
|
|
120
|
+
* @param points array of points to check.
|
|
121
|
+
* @param distanceTol tolerance for co-linearity check, default is Geometry.smallMetricDistance.
|
|
122
|
+
* @param xyOnly if true, only XY coordinates are used for the check, ignoring z coordinate.
|
|
123
|
+
*/
|
|
124
|
+
static isColinear(points: Point3d[], distanceTol?: number, xyOnly?: boolean): boolean;
|
|
114
125
|
}
|
|
115
126
|
//# sourceMappingURL=PolylineOps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineOps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolylineOps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAuC,2BAA2B,EAAE,MAAM,0BAA0B,CAAC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AAE,MAAM,GAAE,OAAe,EAAE,SAAS,GAAE,MAAqC,GAAG,OAAO,EAAE;IAmCvI;;;OAGG;WACW,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE;IAgB3D;;;OAGG;WACW,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE;IAgB9D;;;;;;;;;;;;OAYG;WACW,qCAAqC,CACjD,UAAU,EAAE,oBAAoB,GAAG,OAAO,EAAE,EAAE,sBAAsB,GAAE,OAAe,GACpF,4BAA4B,EAAE,GAAG,SAAS;IA2C7C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAgB;IAC7C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAgB;IAC7C,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAA0B;IAC9D;;;;;;;;;;;;;;;OAeG;WACW,eAAe,CAC3B,OAAO,EAAE,OAAO,EAAE,GAAG,oBAAoB,EACzC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,OAAO,EAAE,GAAG,oBAAoB,EACzC,OAAO,EAAE,2BAA2B,EACpC,IAAI,GAAE,MAAyB,EAC/B,MAAM,CAAC,EAAE,uBAAuB,GAC/B,uBAAuB,GAAG,SAAS;IAoDtC;;;;;;OAMG;WACW,UAAU,CACtB,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,GAAE,MAAqC,EAAE,MAAM,GAAE,OAAe,GAC7F,OAAO;CAKX"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.PolylineOps = void 0;
|
|
11
11
|
const CurveExtendMode_1 = require("../curve/CurveExtendMode");
|
|
12
|
+
const CurveOps_1 = require("../curve/CurveOps");
|
|
12
13
|
const LineSegment3d_1 = require("../curve/LineSegment3d");
|
|
13
14
|
const LineString3d_1 = require("../curve/LineString3d");
|
|
14
15
|
const Geometry_1 = require("../Geometry");
|
|
@@ -39,11 +40,14 @@ class PolylineOps {
|
|
|
39
40
|
* Return a simplified subset of given points.
|
|
40
41
|
* * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm
|
|
41
42
|
* * This is a global search, with multiple passes over the data.
|
|
42
|
-
* @param source
|
|
43
|
-
* @param chordTolerance
|
|
43
|
+
* @param source input points.
|
|
44
|
+
* @param chordTolerance Points less than this distance from a retained edge may be ignored.
|
|
45
|
+
* Default is [[Geometry.smallMetricDistance]].
|
|
46
|
+
* @param keepSeam whether to preserve the endpoints of physically closed input.
|
|
47
|
+
* Default is false, meaning physically closed input points are treated cyclically, allowing removal of the seam.
|
|
44
48
|
*/
|
|
45
|
-
static compressByChordError(source, chordTolerance) {
|
|
46
|
-
return PolylineCompressionByEdgeOffset_1.PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance);
|
|
49
|
+
static compressByChordError(source, chordTolerance = Geometry_1.Geometry.smallMetricDistance, keepSeam = false) {
|
|
50
|
+
return PolylineCompressionByEdgeOffset_1.PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance, keepSeam);
|
|
47
51
|
}
|
|
48
52
|
/**
|
|
49
53
|
* Return a simplified subset of given points, omitting a point if very close to its predecessor.
|
|
@@ -347,6 +351,18 @@ class PolylineOps {
|
|
|
347
351
|
}
|
|
348
352
|
return foundMin ? result : undefined;
|
|
349
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Checks if all points are colinear.
|
|
356
|
+
* * This test does not take point order into account.
|
|
357
|
+
* @param points array of points to check.
|
|
358
|
+
* @param distanceTol tolerance for co-linearity check, default is Geometry.smallMetricDistance.
|
|
359
|
+
* @param xyOnly if true, only XY coordinates are used for the check, ignoring z coordinate.
|
|
360
|
+
*/
|
|
361
|
+
static isColinear(points, distanceTol = Geometry_1.Geometry.smallMetricDistance, xyOnly = false) {
|
|
362
|
+
if (points.length < 3)
|
|
363
|
+
return true;
|
|
364
|
+
return undefined !== CurveOps_1.CurveOps.isColinear(points, { maxDeviation: distanceTol, xyColinear: xyOnly });
|
|
365
|
+
}
|
|
350
366
|
}
|
|
351
367
|
exports.PolylineOps = PolylineOps;
|
|
352
368
|
//# sourceMappingURL=PolylineOps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineOps.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineOps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,8DAA4G;AAE5G,0DAAuD;AACvD,wDAAqD;AACrD,0CAAuC;AACvC,yDAAsD;AAEtD,iFAA8E;AAC9E,+DAA4D;AAC5D,uDAAsD;AACtD,uFAA+E;AAC/E,mCAAkC;AAElC,sBAAsB;AACtB;;;GAGG;AACH,MAAa,WAAW;IACtB;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,MAAiB;QAC7C,MAAM,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,oBAAoB,CAAC,MAAiB,EAAE,cAAsB;QAC1E,OAAO,4DAA0B,CAAC,gCAAgC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IACD;;;;;;;OAOG;IACI,MAAM,CAAC,kBAAkB,CAAC,MAAwC,EAAE,aAAqB;QAC9F,MAAM,IAAI,GAAG,mCAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,4DAA0B,CAAC,gCAAgC,CAAC,IAAI,E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I,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC9C,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;wBACb,MAAM,YAAY,GAAG,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,iBAAiB;wBACnE,MAAM,YAAY,GAAG,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC;wBACjD,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;wBAC9E,2BAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,2BAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW;4BAC1D,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,uCAAuC;wBAC1H,IAAI,GAAG,CAAC,CAAC;wBACT,QAAQ,GAAG,IAAI,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;CACF;AA5UD,kCA4UC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\nimport { CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { PolylineCompressionContext } from \"./PolylineCompressionByEdgeOffset\";\nimport { Range1d } from \"./Range\";\n\n// cspell:word Puecker\n/**\n * PolylineOps is a collection of static methods operating on polylines.\n * @public\n */\nexport class PolylineOps {\n /**\n * Return a Range1d with the shortest and longest edge lengths of the polyline.\n * @param points points to examine.\n */\n public static edgeLengthRange(points: Point3d[]): Range1d {\n const range = Range1d.createNull();\n for (let i = 1; i < points.length; i++) {\n range.extendX(points[i - 1].distance(points[i]));\n }\n return range;\n }\n /**\n * Return a simplified subset of given points.\n * * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\n * * This is a global search, with multiple passes over the data.\n * @param source\n * @param chordTolerance\n */\n public static compressByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\n return PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance);\n }\n /**\n * Return a simplified subset of given points, omitting a point if very close to its predecessor.\n * * This is a local search, with a single pass over the data.\n * * First and last points are always retained.\n * @param source input points\n * @param maxEdgeLength length of largest edge to be compressed out\n * @see [[GrowableXYZArray.cloneCompressed]]\n */\n public static compressShortEdges(source: Point3d[] | IndexedXYZCollection, maxEdgeLength: number): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dest, maxEdgeLength);\n return dest.getPoint3dArray();\n }\n /**\n * Return a simplified subset of given points, omitting the middle of three successive points if the triangle they form is small.\n * * This is a local search, with a single pass over the data.\n * @param source input points\n * @param maxTriangleArea area of largest triangle to compress\n */\n public static compressSmallTriangles(source: Point3d[], maxTriangleArea: number): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n PolylineCompressionContext.compressInPlaceBySmallTriangleArea(dest, maxTriangleArea);\n return dest.getPoint3dArray();\n }\n\n /**\n * Return a simplified subset of given points, omitting points if close to the edge between neighboring points before and after\n * * This is a local search, with a single pass over the data for each pass.\n * @param source input points\n * @param maxDistance omit points if this close to edge between points before and after\n * @param numPass max number of times to run the filter. numPass=2 is observed to behave well.\n *\n */\n public static compressByPerpendicularDistance(source: Point3d[], maxDistance: number, numPass: number = 2): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n let num0 = dest.length;\n for (let pass = 0; pass < numPass; pass++) {\n PolylineCompressionContext.compressInPlaceByPerpendicularDistance(dest, maxDistance);\n const num1 = dest.length;\n if (num1 === num0)\n break;\n num0 = num1;\n }\n return dest.getPoint3dArray();\n }\n private static squaredDistanceToInterpolatedPoint(pointQ: Point3d, point0: Point3d, fraction: number, point1: Point3d): number {\n const g = 1.0 - fraction;\n const dx = pointQ.x - (g * point0.x + fraction * point1.x);\n const dy = pointQ.y - (g * point0.y + fraction * point1.y);\n const dz = pointQ.z - (g * point0.z + fraction * point1.z);\n return dx * dx + dy * dy + dz * dz;\n }\n /**\n * test if either\n * * points[indexA] matches pointQ\n * * line from points[indexA] to points[indexB] overlaps points[indexA] to pointQ\n * @param points\n * @param pointQ\n * @param tolerance\n */\n private static isDanglerConfiguration(points: Point3d[], indexA: number, indexB: number, pointQ: Point3d, squaredDistanceTolerance: number): boolean {\n if (indexA < 0 || indexA >= points.length)\n return false;\n const pointA = points[indexA];\n // simple point match ...\n const d2Q = pointA.distanceSquared(pointQ);\n if (d2Q <= squaredDistanceTolerance)\n return true;\n if (indexB < 0 || indexB >= points.length)\n return false;\n const pointB = points[indexB];\n // The expensive test .. does newPoint double back to an interior or extrapolation of the final dest segment?\n //\n // or pointQ\n const dot = pointA.dotVectorsToTargets(pointB, pointQ);\n // simple case -- pointB..pointA..pointQ continues forward\n if (dot <= 0.0)\n return false;\n const d2B = pointA.distanceSquared(pointB);\n let distanceSquared;\n if (d2Q >= d2B) {\n // pointB----------------------------------->>>>>>> pointA\n // pointQ<<<<---------------------------------------------------------\n const fraction = dot / d2Q; // safe to divide because of earlier d2Q test.\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointB, pointA, fraction, pointQ);\n } else {\n // pointB----------------------------------->>>>>>> pointA\n // pointQ<<<<----------------------\n const fraction = dot / d2B;\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointQ, pointA, fraction, pointB);\n }\n return distanceSquared < squaredDistanceTolerance;\n }\n /**\n * Return a simplified subset of given points, omitting points on \"danglers\" that depart and return on a single path.\n * @param source input points\n * @param closed if true, an edge returning to point 0 is implied even if final point does not match.\n * @param tolerance tolerance for near-zero distance.\n */\n public static compressDanglers(source: Point3d[], closed: boolean = false, tolerance: number = Geometry.smallMetricDistance): Point3d[] {\n let n = source.length;\n const squaredDistanceTolerance = tolerance * tolerance;\n if (closed)\n while (n > 1 && source[n - 1].distanceSquared(source[0]) <= squaredDistanceTolerance)\n n--;\n const dest = [];\n dest.push(source[0].clone());\n for (let i = 1; i < n; i++) {\n const newPoint = source[i];\n while (this.isDanglerConfiguration(dest, dest.length - 1, dest.length - 2, newPoint, squaredDistanceTolerance))\n dest.pop();\n dest.push(newPoint.clone());\n }\n if (closed) {\n // No purge moving backwards. Last point\n let leftIndex = 0;\n let rightIndex = dest.length - 1;\n while (rightIndex > leftIndex + 2) {\n if (this.isDanglerConfiguration(dest, leftIndex, leftIndex + 1, dest[rightIndex], squaredDistanceTolerance)) {\n leftIndex++;\n } else if (this.isDanglerConfiguration(dest, rightIndex, rightIndex - 1, dest[leftIndex], squaredDistanceTolerance)) {\n rightIndex--;\n } else {\n break;\n }\n }\n if (rightIndex + 1 < dest.length)\n dest.length = rightIndex + 1;\n if (leftIndex > 0) {\n dest.splice(0, leftIndex);\n }\n }\n return dest;\n }\n /**\n * Add closure points to a polyline or array of polylines\n * @param data points.\n */\n public static addClosurePoint(data: Point3d[] | Point3d[][]) {\n if (data.length === 0)\n return;\n const q0 = data[0];\n if (Array.isArray(q0)) {\n for (const child of data) {\n if (Array.isArray(child))\n this.addClosurePoint(child);\n }\n return;\n }\n const q1 = data[data.length - 1];\n if (q0 instanceof Point3d && q1 instanceof Point3d && !q0.isAlmostEqual(q1)) {\n (data as Point3d[]).push(q0.clone());\n }\n }\n /**\n * Remove closure points of a polyline or array of polylines\n * @param data points.\n */\n public static removeClosurePoint(data: Point3d[] | Point3d[][]) {\n if (data.length === 0)\n return;\n const q0 = data[0];\n if (Array.isArray(q0)) {\n for (const child of data) {\n if (Array.isArray(child))\n this.removeClosurePoint(child);\n }\n return;\n }\n const q1 = data[data.length - 1];\n if (q0 instanceof Point3d && q1 instanceof Point3d && q0.isAlmostEqual(q1)) {\n (data as Point3d[]).pop();\n }\n }\n /**\n * Create an array of planes.\n * * First plane has origin at first centerline point, with unit normal directed at the next point.\n * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors\n * along the incoming and outgoing segments.\n * * Last plane has origin at last centerline point, with unit normal directed from previous point.\n * * All sets of adjacent coincident points are reduced to a single point.\n * * Hence the output array may have fewer points than the centerline.\n * * If there are one or fewer distinct input points, the return is undefined.\n * @param centerline points to reside in output planes.\n * @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last\n * output planes are averaged and equated (cloned). Default false.\n */\n public static createBisectorPlanesForDistinctPoints(\n centerline: IndexedXYZCollection | Point3d[], wrapIfPhysicallyClosed: boolean = false,\n ): Plane3dByOriginAndUnitNormal[] | undefined {\n const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.\n if (packedPoints.length < 2)\n return undefined;\n const bisectorPlanes: Plane3dByOriginAndUnitNormal[] = [];\n const point0 = packedPoints[0];\n const point1 = packedPoints[1];\n const unit01 = Vector3d.createNormalizedStartEnd(point0, point1)!;\n const perpendicular0 = Plane3dByOriginAndUnitNormal.create(point0, unit01)!;\n const perpendicular1 = Plane3dByOriginAndUnitNormal.createXYPlane();\n // FIRST point gets simple perpendicular\n bisectorPlanes.push(perpendicular0.clone());\n // Each intermediate point gets average of adjacent perpendiculars\n for (let i = 1; i + 1 < packedPoints.length; i++) {\n Vector3d.createNormalizedStartEnd(packedPoints[i], packedPoints[i + 1], unit01);\n // remark: the prior pack should ensure the normalization is ok. But if it fails, we ignore this point...\n if (undefined !== Plane3dByOriginAndUnitNormal.create(packedPoints[i], unit01, perpendicular1)) {\n const newBisectorNormal = perpendicular0.getNormalRef().interpolate(0.5, perpendicular1.getNormalRef());\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(packedPoints[i], newBisectorNormal);\n if (undefined !== newBisectorPlane)\n bisectorPlanes.push(newBisectorPlane);\n perpendicular0.setFrom(perpendicular1);\n }\n }\n // LAST point gets simple perpendicular inherited from last pass\n bisectorPlanes.push(Plane3dByOriginAndUnitNormal.create(packedPoints[packedPoints.length - 1], perpendicular0.getNormalRef())!);\n // reset end planes to their average plane, but leave them alone if the closure point is a cusp\n const lastIndex = bisectorPlanes.length - 1;\n if (lastIndex > 0 && wrapIfPhysicallyClosed) {\n const firstPlane = bisectorPlanes[0];\n const lastPlane = bisectorPlanes[lastIndex];\n if (Geometry.isSamePoint3d(firstPlane.getOriginRef(), lastPlane.getOriginRef())) {\n const newBisectorNormal = firstPlane.getNormalRef().plus(lastPlane.getNormalRef()); // could be zero vector at a cusp\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(firstPlane.getOriginRef(), newBisectorNormal);\n if (undefined !== newBisectorPlane) {\n bisectorPlanes[0] = newBisectorPlane;\n bisectorPlanes[lastIndex] = Plane3dByOriginAndUnitNormal.create(lastPlane.getOriginRef(), newBisectorNormal)!;\n }\n }\n }\n return bisectorPlanes.length > 1 ? bisectorPlanes : undefined;\n }\n\n private static _workSegmentA?: LineSegment3d;\n private static _workSegmentB?: LineSegment3d;\n private static _workLocalDetailPair?: CurveLocationDetailPair;\n /**\n * Find smallest distance between polylines.\n * * For polylines with many points, it is more efficient to use [[LineString3dRangeTreeContext.searchForClosestApproach]].\n * @param pointsA first polyline\n * @param extendA how to extend polylineA forward/backward\n * @param pointsB second polyline\n * @param extendB how to extend polylineB forward/backward\n * @param dMax largest approach distance to consider\n * @param result optional pre-allocated object to populate and return\n * @returns pair of details, one for each polyline, with field values:\n * * `a` is the closest approach distance\n * * `point` is the point of closest approach\n * * `fraction` is the global polyline fraction\n * * `childDetail.a` is the segment index\n * * `childDetail.fraction` is the local segment fraction\n */\n public static closestApproach(\n pointsA: Point3d[] | IndexedXYZCollection,\n extendA: VariantCurveExtendParameter,\n pointsB: Point3d[] | IndexedXYZCollection,\n extendB: VariantCurveExtendParameter,\n dMax: number = Number.MAX_VALUE,\n result?: CurveLocationDetailPair,\n ): CurveLocationDetailPair | undefined {\n if (Array.isArray(pointsA))\n pointsA = new Point3dArrayCarrier(pointsA);\n if (Array.isArray(pointsB))\n pointsB = new Point3dArrayCarrier(pointsB);\n let dMin = dMax;\n let foundMin = false;\n const numSegmentA = pointsA.length - 1;\n const numSegmentB = pointsB.length - 1;\n const extendSegA = [CurveExtendMode.None, CurveExtendMode.None];\n const extendSegB = [CurveExtendMode.None, CurveExtendMode.None];\n // lambda to set extension for first and last segment of a polyline\n const convertExtend = (extendOut: CurveExtendMode[], extendIn: VariantCurveExtendParameter, segmentIndex: number, numSegments: number) => {\n extendOut[0] = extendOut[1] = CurveExtendMode.None;\n if (segmentIndex === 0)\n extendOut[0] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 0);\n else if (segmentIndex === numSegments - 1)\n extendOut[1] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 1);\n };\n // lambda to extract LineSegment3d from polyline\n const fillSegment = (points: IndexedXYZCollection, index: number, segment: LineSegment3d | undefined): LineSegment3d => {\n if (segment === undefined)\n return LineSegment3d.createCapture(points.getPoint3dAtUncheckedPointIndex(index), points.getPoint3dAtUncheckedPointIndex(index + 1));\n points.getPoint3dAtUncheckedPointIndex(index, segment.point0Ref);\n points.getPoint3dAtUncheckedPointIndex(index + 1, segment.point1Ref);\n return segment;\n };\n // just test the segments\n for (let indexA = 0; indexA < numSegmentA; indexA++) {\n this._workSegmentA = fillSegment(pointsA, indexA, this._workSegmentA);\n convertExtend(extendSegA, extendA, indexA, numSegmentA);\n for (let indexB = 0; indexB < numSegmentB; indexB++) {\n this._workSegmentB = fillSegment(pointsB, indexB, this._workSegmentB);\n convertExtend(extendSegB, extendB, indexB, numSegmentB);\n if (undefined !== (this._workLocalDetailPair = LineSegment3d.closestApproach(this._workSegmentA, extendSegA, this._workSegmentB, extendSegB, this._workLocalDetailPair))) {\n const d = this._workLocalDetailPair.detailA.a;\n if (d < dMin) {\n const childDetailA = result?.detailA.childDetail; // save and reuse\n const childDetailB = result?.detailB.childDetail;\n result = this._workLocalDetailPair.clone(result); // overwrite previous result\n LineString3d.convertLocalToGlobalDetail(result.detailA, indexA, numSegmentA, undefined, childDetailA);\n LineString3d.convertLocalToGlobalDetail(result.detailB, indexB, numSegmentB, undefined, childDetailB);\n if (result.detailA.childDetail && result.detailB.childDetail)\n result.detailA.childDetail.curve = result.detailB.childDetail.curve = undefined; // no CurvePrimitives survive in output\n dMin = d;\n foundMin = true;\n }\n }\n }\n }\n return foundMin ? result : undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PolylineOps.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineOps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,8DAA4G;AAE5G,gDAA6C;AAC7C,0DAAuD;AACvD,wDAAqD;AACrD,0CAAuC;AACvC,yDAAsD;AAEtD,iFAA8E;AAC9E,+DAA4D;AAC5D,uDAAsD;AACtD,uFAA+E;AAC/E,mCAAkC;AAElC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AY,CAAC,CAAC;wBACtG,2BAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW;4BAC1D,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,uCAAuC;wBAC1H,IAAI,GAAG,CAAC,CAAC;wBACT,QAAQ,GAAG,IAAI,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,UAAU,CACtB,MAAiB,EAAE,cAAsB,mBAAQ,CAAC,mBAAmB,EAAE,SAAkB,KAAK;QAE9F,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,OAAO,SAAS,KAAK,mBAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACtG,CAAC;CACF;AA7VD,kCA6VC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\nimport { CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { CurveOps } from \"../curve/CurveOps\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { PolylineCompressionContext } from \"./PolylineCompressionByEdgeOffset\";\nimport { Range1d } from \"./Range\";\n\n// cspell:word Puecker\n/**\n * PolylineOps is a collection of static methods operating on polylines.\n * @public\n */\nexport class PolylineOps {\n /**\n * Return a Range1d with the shortest and longest edge lengths of the polyline.\n * @param points points to examine.\n */\n public static edgeLengthRange(points: Point3d[]): Range1d {\n const range = Range1d.createNull();\n for (let i = 1; i < points.length; i++) {\n range.extendX(points[i - 1].distance(points[i]));\n }\n return range;\n }\n /**\n * Return a simplified subset of given points.\n * * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\n * * This is a global search, with multiple passes over the data.\n * @param source input points.\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\n * Default is [[Geometry.smallMetricDistance]].\n * @param keepSeam whether to preserve the endpoints of physically closed input.\n * Default is false, meaning physically closed input points are treated cyclically, allowing removal of the seam.\n */\n public static compressByChordError(source: Point3d[], chordTolerance: number = Geometry.smallMetricDistance, keepSeam: boolean = false): Point3d[] {\n return PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance, keepSeam);\n }\n /**\n * Return a simplified subset of given points, omitting a point if very close to its predecessor.\n * * This is a local search, with a single pass over the data.\n * * First and last points are always retained.\n * @param source input points\n * @param maxEdgeLength length of largest edge to be compressed out\n * @see [[GrowableXYZArray.cloneCompressed]]\n */\n public static compressShortEdges(source: Point3d[] | IndexedXYZCollection, maxEdgeLength: number): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dest, maxEdgeLength);\n return dest.getPoint3dArray();\n }\n /**\n * Return a simplified subset of given points, omitting the middle of three successive points if the triangle they form is small.\n * * This is a local search, with a single pass over the data.\n * @param source input points\n * @param maxTriangleArea area of largest triangle to compress\n */\n public static compressSmallTriangles(source: Point3d[], maxTriangleArea: number): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n PolylineCompressionContext.compressInPlaceBySmallTriangleArea(dest, maxTriangleArea);\n return dest.getPoint3dArray();\n }\n\n /**\n * Return a simplified subset of given points, omitting points if close to the edge between neighboring points before and after\n * * This is a local search, with a single pass over the data for each pass.\n * @param source input points\n * @param maxDistance omit points if this close to edge between points before and after\n * @param numPass max number of times to run the filter. numPass=2 is observed to behave well.\n *\n */\n public static compressByPerpendicularDistance(source: Point3d[], maxDistance: number, numPass: number = 2): Point3d[] {\n const dest = GrowableXYZArray.create(source);\n let num0 = dest.length;\n for (let pass = 0; pass < numPass; pass++) {\n PolylineCompressionContext.compressInPlaceByPerpendicularDistance(dest, maxDistance);\n const num1 = dest.length;\n if (num1 === num0)\n break;\n num0 = num1;\n }\n return dest.getPoint3dArray();\n }\n private static squaredDistanceToInterpolatedPoint(pointQ: Point3d, point0: Point3d, fraction: number, point1: Point3d): number {\n const g = 1.0 - fraction;\n const dx = pointQ.x - (g * point0.x + fraction * point1.x);\n const dy = pointQ.y - (g * point0.y + fraction * point1.y);\n const dz = pointQ.z - (g * point0.z + fraction * point1.z);\n return dx * dx + dy * dy + dz * dz;\n }\n /**\n * test if either\n * * points[indexA] matches pointQ\n * * line from points[indexA] to points[indexB] overlaps points[indexA] to pointQ\n * @param points\n * @param pointQ\n * @param tolerance\n */\n private static isDanglerConfiguration(points: Point3d[], indexA: number, indexB: number, pointQ: Point3d, squaredDistanceTolerance: number): boolean {\n if (indexA < 0 || indexA >= points.length)\n return false;\n const pointA = points[indexA];\n // simple point match ...\n const d2Q = pointA.distanceSquared(pointQ);\n if (d2Q <= squaredDistanceTolerance)\n return true;\n if (indexB < 0 || indexB >= points.length)\n return false;\n const pointB = points[indexB];\n // The expensive test .. does newPoint double back to an interior or extrapolation of the final dest segment?\n //\n // or pointQ\n const dot = pointA.dotVectorsToTargets(pointB, pointQ);\n // simple case -- pointB..pointA..pointQ continues forward\n if (dot <= 0.0)\n return false;\n const d2B = pointA.distanceSquared(pointB);\n let distanceSquared;\n if (d2Q >= d2B) {\n // pointB----------------------------------->>>>>>> pointA\n // pointQ<<<<---------------------------------------------------------\n const fraction = dot / d2Q; // safe to divide because of earlier d2Q test.\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointB, pointA, fraction, pointQ);\n } else {\n // pointB----------------------------------->>>>>>> pointA\n // pointQ<<<<----------------------\n const fraction = dot / d2B;\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointQ, pointA, fraction, pointB);\n }\n return distanceSquared < squaredDistanceTolerance;\n }\n /**\n * Return a simplified subset of given points, omitting points on \"danglers\" that depart and return on a single path.\n * @param source input points\n * @param closed if true, an edge returning to point 0 is implied even if final point does not match.\n * @param tolerance tolerance for near-zero distance.\n */\n public static compressDanglers(source: Point3d[], closed: boolean = false, tolerance: number = Geometry.smallMetricDistance): Point3d[] {\n let n = source.length;\n const squaredDistanceTolerance = tolerance * tolerance;\n if (closed)\n while (n > 1 && source[n - 1].distanceSquared(source[0]) <= squaredDistanceTolerance)\n n--;\n const dest = [];\n dest.push(source[0].clone());\n for (let i = 1; i < n; i++) {\n const newPoint = source[i];\n while (this.isDanglerConfiguration(dest, dest.length - 1, dest.length - 2, newPoint, squaredDistanceTolerance))\n dest.pop();\n dest.push(newPoint.clone());\n }\n if (closed) {\n // No purge moving backwards. Last point\n let leftIndex = 0;\n let rightIndex = dest.length - 1;\n while (rightIndex > leftIndex + 2) {\n if (this.isDanglerConfiguration(dest, leftIndex, leftIndex + 1, dest[rightIndex], squaredDistanceTolerance)) {\n leftIndex++;\n } else if (this.isDanglerConfiguration(dest, rightIndex, rightIndex - 1, dest[leftIndex], squaredDistanceTolerance)) {\n rightIndex--;\n } else {\n break;\n }\n }\n if (rightIndex + 1 < dest.length)\n dest.length = rightIndex + 1;\n if (leftIndex > 0) {\n dest.splice(0, leftIndex);\n }\n }\n return dest;\n }\n /**\n * Add closure points to a polyline or array of polylines\n * @param data points.\n */\n public static addClosurePoint(data: Point3d[] | Point3d[][]) {\n if (data.length === 0)\n return;\n const q0 = data[0];\n if (Array.isArray(q0)) {\n for (const child of data) {\n if (Array.isArray(child))\n this.addClosurePoint(child);\n }\n return;\n }\n const q1 = data[data.length - 1];\n if (q0 instanceof Point3d && q1 instanceof Point3d && !q0.isAlmostEqual(q1)) {\n (data as Point3d[]).push(q0.clone());\n }\n }\n /**\n * Remove closure points of a polyline or array of polylines\n * @param data points.\n */\n public static removeClosurePoint(data: Point3d[] | Point3d[][]) {\n if (data.length === 0)\n return;\n const q0 = data[0];\n if (Array.isArray(q0)) {\n for (const child of data) {\n if (Array.isArray(child))\n this.removeClosurePoint(child);\n }\n return;\n }\n const q1 = data[data.length - 1];\n if (q0 instanceof Point3d && q1 instanceof Point3d && q0.isAlmostEqual(q1)) {\n (data as Point3d[]).pop();\n }\n }\n /**\n * Create an array of planes.\n * * First plane has origin at first centerline point, with unit normal directed at the next point.\n * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors\n * along the incoming and outgoing segments.\n * * Last plane has origin at last centerline point, with unit normal directed from previous point.\n * * All sets of adjacent coincident points are reduced to a single point.\n * * Hence the output array may have fewer points than the centerline.\n * * If there are one or fewer distinct input points, the return is undefined.\n * @param centerline points to reside in output planes.\n * @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last\n * output planes are averaged and equated (cloned). Default false.\n */\n public static createBisectorPlanesForDistinctPoints(\n centerline: IndexedXYZCollection | Point3d[], wrapIfPhysicallyClosed: boolean = false,\n ): Plane3dByOriginAndUnitNormal[] | undefined {\n const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.\n if (packedPoints.length < 2)\n return undefined;\n const bisectorPlanes: Plane3dByOriginAndUnitNormal[] = [];\n const point0 = packedPoints[0];\n const point1 = packedPoints[1];\n const unit01 = Vector3d.createNormalizedStartEnd(point0, point1)!;\n const perpendicular0 = Plane3dByOriginAndUnitNormal.create(point0, unit01)!;\n const perpendicular1 = Plane3dByOriginAndUnitNormal.createXYPlane();\n // FIRST point gets simple perpendicular\n bisectorPlanes.push(perpendicular0.clone());\n // Each intermediate point gets average of adjacent perpendiculars\n for (let i = 1; i + 1 < packedPoints.length; i++) {\n Vector3d.createNormalizedStartEnd(packedPoints[i], packedPoints[i + 1], unit01);\n // remark: the prior pack should ensure the normalization is ok. But if it fails, we ignore this point...\n if (undefined !== Plane3dByOriginAndUnitNormal.create(packedPoints[i], unit01, perpendicular1)) {\n const newBisectorNormal = perpendicular0.getNormalRef().interpolate(0.5, perpendicular1.getNormalRef());\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(packedPoints[i], newBisectorNormal);\n if (undefined !== newBisectorPlane)\n bisectorPlanes.push(newBisectorPlane);\n perpendicular0.setFrom(perpendicular1);\n }\n }\n // LAST point gets simple perpendicular inherited from last pass\n bisectorPlanes.push(Plane3dByOriginAndUnitNormal.create(packedPoints[packedPoints.length - 1], perpendicular0.getNormalRef())!);\n // reset end planes to their average plane, but leave them alone if the closure point is a cusp\n const lastIndex = bisectorPlanes.length - 1;\n if (lastIndex > 0 && wrapIfPhysicallyClosed) {\n const firstPlane = bisectorPlanes[0];\n const lastPlane = bisectorPlanes[lastIndex];\n if (Geometry.isSamePoint3d(firstPlane.getOriginRef(), lastPlane.getOriginRef())) {\n const newBisectorNormal = firstPlane.getNormalRef().plus(lastPlane.getNormalRef()); // could be zero vector at a cusp\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(firstPlane.getOriginRef(), newBisectorNormal);\n if (undefined !== newBisectorPlane) {\n bisectorPlanes[0] = newBisectorPlane;\n bisectorPlanes[lastIndex] = Plane3dByOriginAndUnitNormal.create(lastPlane.getOriginRef(), newBisectorNormal)!;\n }\n }\n }\n return bisectorPlanes.length > 1 ? bisectorPlanes : undefined;\n }\n\n private static _workSegmentA?: LineSegment3d;\n private static _workSegmentB?: LineSegment3d;\n private static _workLocalDetailPair?: CurveLocationDetailPair;\n /**\n * Find smallest distance between polylines.\n * * For polylines with many points, it is more efficient to use [[LineString3dRangeTreeContext.searchForClosestApproach]].\n * @param pointsA first polyline\n * @param extendA how to extend polylineA forward/backward\n * @param pointsB second polyline\n * @param extendB how to extend polylineB forward/backward\n * @param dMax largest approach distance to consider\n * @param result optional pre-allocated object to populate and return\n * @returns pair of details, one for each polyline, with field values:\n * * `a` is the closest approach distance\n * * `point` is the point of closest approach\n * * `fraction` is the global polyline fraction\n * * `childDetail.a` is the segment index\n * * `childDetail.fraction` is the local segment fraction\n */\n public static closestApproach(\n pointsA: Point3d[] | IndexedXYZCollection,\n extendA: VariantCurveExtendParameter,\n pointsB: Point3d[] | IndexedXYZCollection,\n extendB: VariantCurveExtendParameter,\n dMax: number = Number.MAX_VALUE,\n result?: CurveLocationDetailPair,\n ): CurveLocationDetailPair | undefined {\n if (Array.isArray(pointsA))\n pointsA = new Point3dArrayCarrier(pointsA);\n if (Array.isArray(pointsB))\n pointsB = new Point3dArrayCarrier(pointsB);\n let dMin = dMax;\n let foundMin = false;\n const numSegmentA = pointsA.length - 1;\n const numSegmentB = pointsB.length - 1;\n const extendSegA = [CurveExtendMode.None, CurveExtendMode.None];\n const extendSegB = [CurveExtendMode.None, CurveExtendMode.None];\n // lambda to set extension for first and last segment of a polyline\n const convertExtend = (extendOut: CurveExtendMode[], extendIn: VariantCurveExtendParameter, segmentIndex: number, numSegments: number) => {\n extendOut[0] = extendOut[1] = CurveExtendMode.None;\n if (segmentIndex === 0)\n extendOut[0] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 0);\n else if (segmentIndex === numSegments - 1)\n extendOut[1] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 1);\n };\n // lambda to extract LineSegment3d from polyline\n const fillSegment = (points: IndexedXYZCollection, index: number, segment: LineSegment3d | undefined): LineSegment3d => {\n if (segment === undefined)\n return LineSegment3d.createCapture(points.getPoint3dAtUncheckedPointIndex(index), points.getPoint3dAtUncheckedPointIndex(index + 1));\n points.getPoint3dAtUncheckedPointIndex(index, segment.point0Ref);\n points.getPoint3dAtUncheckedPointIndex(index + 1, segment.point1Ref);\n return segment;\n };\n // just test the segments\n for (let indexA = 0; indexA < numSegmentA; indexA++) {\n this._workSegmentA = fillSegment(pointsA, indexA, this._workSegmentA);\n convertExtend(extendSegA, extendA, indexA, numSegmentA);\n for (let indexB = 0; indexB < numSegmentB; indexB++) {\n this._workSegmentB = fillSegment(pointsB, indexB, this._workSegmentB);\n convertExtend(extendSegB, extendB, indexB, numSegmentB);\n if (undefined !== (this._workLocalDetailPair = LineSegment3d.closestApproach(this._workSegmentA, extendSegA, this._workSegmentB, extendSegB, this._workLocalDetailPair))) {\n const d = this._workLocalDetailPair.detailA.a;\n if (d < dMin) {\n const childDetailA = result?.detailA.childDetail; // save and reuse\n const childDetailB = result?.detailB.childDetail;\n result = this._workLocalDetailPair.clone(result); // overwrite previous result\n LineString3d.convertLocalToGlobalDetail(result.detailA, indexA, numSegmentA, undefined, childDetailA);\n LineString3d.convertLocalToGlobalDetail(result.detailB, indexB, numSegmentB, undefined, childDetailB);\n if (result.detailA.childDetail && result.detailB.childDetail)\n result.detailA.childDetail.curve = result.detailB.childDetail.curve = undefined; // no CurvePrimitives survive in output\n dMin = d;\n foundMin = true;\n }\n }\n }\n }\n return foundMin ? result : undefined;\n }\n /**\n * Checks if all points are colinear.\n * * This test does not take point order into account.\n * @param points array of points to check.\n * @param distanceTol tolerance for co-linearity check, default is Geometry.smallMetricDistance.\n * @param xyOnly if true, only XY coordinates are used for the check, ignoring z coordinate.\n */\n public static isColinear(\n points: Point3d[], distanceTol: number = Geometry.smallMetricDistance, xyOnly: boolean = false,\n ): boolean {\n if (points.length < 3)\n return true;\n return undefined !== CurveOps.isColinear(points, { maxDeviation: distanceTol, xyColinear: xyOnly });\n }\n}\n"]}
|
|
@@ -22,9 +22,9 @@ export declare abstract class RangeBase {
|
|
|
22
22
|
/** Return true if x is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]' */
|
|
23
23
|
static isExtremeValue(x: number): boolean;
|
|
24
24
|
/** Return true if any x or y or z is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]' */
|
|
25
|
-
static isExtremePoint3d(xyz:
|
|
25
|
+
static isExtremePoint3d(xyz: XYAndZ): boolean;
|
|
26
26
|
/** Return true if either of x,y is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]' */
|
|
27
|
-
static isExtremePoint2d(xy:
|
|
27
|
+
static isExtremePoint2d(xy: XAndY): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Return the min absolute distance from any point of `[lowA,highA]' to any point of `[lowB,highB]'.
|
|
30
30
|
* * Both low,high pairs have order expectations: The condition `high < low` means null interval.
|
|
@@ -114,17 +114,17 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
114
114
|
/** Return a range initialized to have no content. */
|
|
115
115
|
static createNull<T extends Range3d>(result?: T): T;
|
|
116
116
|
/** Extend (modify in place) so that the range is large enough to include the supplied points. */
|
|
117
|
-
extend(...point:
|
|
117
|
+
extend(...point: XYAndZ[]): void;
|
|
118
118
|
/** Return a range large enough to include the supplied points. If no points are given, the range is a null range */
|
|
119
|
-
static create(...point:
|
|
119
|
+
static create(...point: XYAndZ[]): Range3d;
|
|
120
120
|
/** Create a range from freely structured MultiLineStringDataVariant. */
|
|
121
|
-
static createFromVariantData(data: MultiLineStringDataVariant): Range3d;
|
|
121
|
+
static createFromVariantData(data: MultiLineStringDataVariant, transform?: Transform, result?: Range3d): Range3d;
|
|
122
122
|
/** Create a Range3d enclosing the transformed points. */
|
|
123
|
-
static createTransformed<T extends Range3d>(transform: Transform, ...point:
|
|
123
|
+
static createTransformed<T extends Range3d>(transform: Transform, ...point: XYAndZ[]): T;
|
|
124
124
|
/** Create a Range3d enclosing the transformed points. */
|
|
125
|
-
static createTransformedArray<T extends Range3d>(transform: Transform, points:
|
|
125
|
+
static createTransformedArray<T extends Range3d>(transform: Transform, points: XYAndZ[] | GrowableXYZArray): T;
|
|
126
126
|
/** Create a Range3d enclosing the points after inverse transform. */
|
|
127
|
-
static createInverseTransformedArray<T extends Range3d>(transform: Transform, points:
|
|
127
|
+
static createInverseTransformedArray<T extends Range3d>(transform: Transform, points: XYAndZ[] | GrowableXYZArray): T;
|
|
128
128
|
/** Set the range to be a single point supplied as x,y,z values */
|
|
129
129
|
setXYZ(x: number, y: number, z: number): void;
|
|
130
130
|
/** Create a single point range */
|
|
@@ -136,11 +136,11 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
136
136
|
/** Creates a 3d range from a 2d range's low and high members, setting the corresponding z values to the value given. */
|
|
137
137
|
static createRange2d<T extends Range3d>(range: Range2d, z?: number, result?: T): T;
|
|
138
138
|
/** Create a range around an array of points. */
|
|
139
|
-
static createArray<T extends Range3d>(points:
|
|
139
|
+
static createArray<T extends Range3d>(points: XYAndZ[], result?: T): T;
|
|
140
140
|
/** Extend a range around an array of points (optionally transformed) */
|
|
141
|
-
extendArray(points:
|
|
141
|
+
extendArray(points: XYAndZ[] | GrowableXYZArray, transform?: Transform): void;
|
|
142
142
|
/** Extend a range around an array of points (optionally transformed) */
|
|
143
|
-
extendInverseTransformedArray(points:
|
|
143
|
+
extendInverseTransformedArray(points: XYAndZ[] | GrowableXYZArray, transform: Transform): void;
|
|
144
144
|
/** Multiply the point x,y,z by transform and use the coordinate to extend this range. */
|
|
145
145
|
extendTransformedXYZ(transform: Transform, x: number, y: number, z: number): void;
|
|
146
146
|
/** Multiply the point x,y,z,w by transform and use the coordinate to extend this range. */
|
|
@@ -209,7 +209,7 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
209
209
|
* * returns undefined if the range is null.
|
|
210
210
|
* * returns undefined if any direction (x,y,z) has zero length
|
|
211
211
|
*/
|
|
212
|
-
worldToLocal(point:
|
|
212
|
+
worldToLocal(point: XYAndZ, result?: Point3d): Point3d | undefined;
|
|
213
213
|
/**
|
|
214
214
|
* Return fractional coordinates of point within the range.
|
|
215
215
|
* * returns undefined if the range is null.
|
|
@@ -255,9 +255,9 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
255
255
|
/** Test if a point given as x,y is within the range (ignoring z of range). */
|
|
256
256
|
containsXY(x: number, y: number): boolean;
|
|
257
257
|
/** Test if a point is within the range. */
|
|
258
|
-
containsPoint(point:
|
|
258
|
+
containsPoint(point: XYAndZ): boolean;
|
|
259
259
|
/** Test if the x,y coordinates of a point are within the range. */
|
|
260
|
-
containsPointXY(point:
|
|
260
|
+
containsPointXY(point: XYAndZ): boolean;
|
|
261
261
|
/** Test of other range is within this range */
|
|
262
262
|
containsRange(other: Range3d): boolean;
|
|
263
263
|
/**
|
|
@@ -272,14 +272,18 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
272
272
|
* @param margin optional signed distance by which to expand/shrink `other` in all xy-directions.
|
|
273
273
|
*/
|
|
274
274
|
intersectsRangeXY(other: Range3d, margin?: number): boolean;
|
|
275
|
-
/** Return 0 if the point is within the range, otherwise the distance to the closest face or corner */
|
|
275
|
+
/** Return 0 if the point is within the range, otherwise the distance to the closest face or corner. */
|
|
276
276
|
distanceToPoint(point: XYAndZ): number;
|
|
277
|
+
/** Return 0 if the point's xy-coordinates are within the range, otherwise the xy-distance to the closest face or corner. */
|
|
278
|
+
distanceToPointXY(point: XAndY): number;
|
|
277
279
|
/** Returns 0 if the ranges have any overlap, otherwise the shortest absolute distance from one to the other. */
|
|
278
280
|
distanceToRange(other: Range3d): number;
|
|
281
|
+
/** Returns 0 if the ranges have any xy-overlap, otherwise the shortest absolute xy-distance from one to the other. */
|
|
282
|
+
distanceToRangeXY(other: Range3d): number;
|
|
279
283
|
/** Expand this range to include the given point. */
|
|
280
284
|
extendXYZ(x: number, y: number, z: number): void;
|
|
281
285
|
/** Expand this range by a point interpolated between given points. */
|
|
282
|
-
extendInterpolated(xyz0:
|
|
286
|
+
extendInterpolated(xyz0: XYAndZ, fraction: number, xyz1: XYAndZ): void;
|
|
283
287
|
/** Expand this range to include the x-coordinate. */
|
|
284
288
|
extendXOnly(x: number): void;
|
|
285
289
|
/** Expand this range to include the y-coordinate. */
|
|
@@ -291,9 +295,9 @@ export declare class Range3d extends RangeBase implements LowAndHighXYZ, BeJSONF
|
|
|
291
295
|
/** Expand this range by distances a (weighted and possibly signed) in all directions */
|
|
292
296
|
extendXYZW(x: number, y: number, z: number, w: number): void;
|
|
293
297
|
/** Expand this range to include an optionally transformed point. */
|
|
294
|
-
extendPoint(point:
|
|
298
|
+
extendPoint(point: XYAndZ, transform?: Transform): void;
|
|
295
299
|
/** Expand this range to include a transformed point. */
|
|
296
|
-
extendTransformedPoint(transform: Transform, point:
|
|
300
|
+
extendTransformedPoint(transform: Transform, point: XYAndZ): void;
|
|
297
301
|
/** Expand this range to include a range. */
|
|
298
302
|
extendRange(other: LowAndHighXYZ): void;
|
|
299
303
|
/**
|
|
@@ -490,22 +494,20 @@ export declare class Range1d extends RangeBase {
|
|
|
490
494
|
*/
|
|
491
495
|
expandInPlace(delta: number): void;
|
|
492
496
|
/**
|
|
493
|
-
* Clip this range to a linear half space condition
|
|
494
|
-
* *
|
|
495
|
-
* *
|
|
496
|
-
* *
|
|
497
|
-
* *
|
|
498
|
-
* *
|
|
499
|
-
* *
|
|
500
|
-
*
|
|
501
|
-
* *
|
|
502
|
-
* *
|
|
503
|
-
* * return true if the range is non-null after the clip.
|
|
497
|
+
* Clip this range to a linear half space condition.
|
|
498
|
+
* * If `limitA > limitB` the limit space is empty:
|
|
499
|
+
* * Make this range null.
|
|
500
|
+
* * Return `false`.
|
|
501
|
+
* * Otherwise for `limitA <= limitB`:
|
|
502
|
+
* * Solve `a + u * fA = limitA` and `a + u * fB = limitB`.
|
|
503
|
+
* * If unable to solve (i.e. u near zero), `a` alone determines whether to leave this interval unchanged or reduce to null.
|
|
504
|
+
* * Form an interval from the solution `{fA, fB}`.
|
|
505
|
+
* * Clip this instance to the solution interval.
|
|
506
|
+
* * Return `true` if the range is non-null after the clip.
|
|
504
507
|
* @param a constant of linear map
|
|
505
508
|
* @param u coefficient of linear map
|
|
506
509
|
* @param limitA crossing value, assumed in range relation with limitB
|
|
507
510
|
* @param limitB crossing value, assumed in range relation with limitB
|
|
508
|
-
* @param limitIsHigh true if the limit is an upper limit on mapped values.
|
|
509
511
|
*/
|
|
510
512
|
clipLinearMapToInterval(a: number, u: number, limitA: number, limitB: number): boolean;
|
|
511
513
|
}
|
|
@@ -573,7 +575,7 @@ export declare class Range2d extends RangeBase implements LowAndHighXY {
|
|
|
573
575
|
/** Create a box with 2 pairs of xy candidates. If any direction has order flip, create null. */
|
|
574
576
|
static createXYXYOrCorrectToNull<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, result?: T): T;
|
|
575
577
|
/** Create a range around an array of points. */
|
|
576
|
-
static createArray<T extends Range2d>(points:
|
|
578
|
+
static createArray<T extends Range2d>(points: XAndY[], result?: T): T;
|
|
577
579
|
/** Test if the box has high<low for any of x,y, condition. Note that a range around a single point is NOT null. */
|
|
578
580
|
get isNull(): boolean;
|
|
579
581
|
/**
|
|
@@ -663,6 +665,6 @@ export declare class Range2d extends RangeBase implements LowAndHighXY {
|
|
|
663
665
|
* * returns undefined if the range is null.
|
|
664
666
|
* * returns undefined if any direction (x,y) has zero length
|
|
665
667
|
*/
|
|
666
|
-
worldToLocal(point:
|
|
668
|
+
worldToLocal(point: XAndY, result?: Point2d): Point2d | undefined;
|
|
667
669
|
}
|
|
668
670
|
//# sourceMappingURL=Range.d.ts.map
|