@itwin/core-geometry 4.1.0-dev.6 → 4.1.0-dev.62
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 +62 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -0
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +4 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +1 -0
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +1 -0
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +36 -26
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +46 -39
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +67 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +75 -7
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +9 -7
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +4 -3
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +4 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +6 -4
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +4 -4
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +7 -5
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +18 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +7 -7
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +19 -11
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +6 -6
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +15 -9
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +7 -7
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +69 -47
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +70 -47
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +6 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +6 -5
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +17 -8
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -0
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +5 -2
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +153 -87
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +9 -0
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +13 -0
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +27 -0
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +35 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +8 -0
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +13 -0
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +55 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +134 -94
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +297 -145
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +7 -0
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +12 -0
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +64 -6
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +104 -19
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +30 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -1
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +2 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +2 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +9 -0
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -0
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +2 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +1 -0
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +1 -0
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +36 -26
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +46 -39
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +67 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +74 -6
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +9 -7
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +4 -3
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +4 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +6 -4
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +4 -4
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +7 -5
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +18 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +7 -7
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +19 -11
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +6 -6
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +15 -9
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +4 -6
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +7 -7
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +69 -47
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +70 -47
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +6 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +6 -5
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +17 -8
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -0
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +5 -2
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +153 -87
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +9 -0
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +13 -0
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +51 -55
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +13 -11
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +27 -0
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +35 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +8 -0
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +13 -0
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +56 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +134 -94
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +297 -145
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +7 -0
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +12 -0
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +64 -6
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +103 -19
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +30 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -1
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -1
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +2 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +2 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +9 -0
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +5 -5
|
@@ -25,10 +25,12 @@ const ProxyCurve_1 = require("./ProxyCurve");
|
|
|
25
25
|
* A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:
|
|
26
26
|
* - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.
|
|
27
27
|
* The two instantiable forms of `CurveChain` are
|
|
28
|
-
* - `Path` - A chain not required to close
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the
|
|
29
|
+
* same plane).
|
|
30
|
+
* - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to
|
|
31
|
+
* be on the same plane).
|
|
32
|
+
* - `ParityRegion` -- a collection of coplanar `Loop`s, with "in/out" classification by parity rules.
|
|
33
|
+
* - `UnionRegion` -- a collection of coplanar `Loop`s, with "in/out" classification by union rules.
|
|
32
34
|
* - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.
|
|
33
35
|
*
|
|
34
36
|
* @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.
|
|
@@ -68,7 +70,7 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
68
70
|
* Return the max gap between adjacent primitives in Path and Loop collections.
|
|
69
71
|
* * In a Path, gaps are computed between consecutive primitives.
|
|
70
72
|
* * In a Loop, gaps are computed between consecutive primitives and between last and first.
|
|
71
|
-
* *
|
|
73
|
+
* * Gaps are NOT computed between consecutive CurvePrimitives in "unstructured" collections. The type is
|
|
72
74
|
* "unstructured" so gaps should not be semantically meaningful.
|
|
73
75
|
*/
|
|
74
76
|
maxGap() {
|
|
@@ -90,11 +92,15 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
90
92
|
cloneTransformed(transform) {
|
|
91
93
|
return CloneCurvesContext_1.CloneCurvesContext.clone(this, transform);
|
|
92
94
|
}
|
|
93
|
-
/** Create a deep copy with all linestrings
|
|
95
|
+
/** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */
|
|
94
96
|
cloneWithExpandedLineStrings() {
|
|
95
97
|
return CloneWithExpandedLineStrings_1.CloneWithExpandedLineStrings.clone(this);
|
|
96
98
|
}
|
|
97
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Push all CurvePrimitives contained in the instance onto the `results` array.
|
|
101
|
+
* * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives
|
|
102
|
+
* of the Loop are pushed onto `results`.
|
|
103
|
+
*/
|
|
98
104
|
collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings = false) {
|
|
99
105
|
if (this.children) {
|
|
100
106
|
for (const child of this.children) {
|
|
@@ -106,10 +112,12 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
114
|
/**
|
|
109
|
-
* Return an array containing
|
|
115
|
+
* Return an array containing all CurvePrimitives in the instance.
|
|
116
|
+
* * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of
|
|
117
|
+
* the Loop are pushed onto the returned array.
|
|
110
118
|
* @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without
|
|
111
|
-
* clearing the array.
|
|
112
|
-
* @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself.
|
|
119
|
+
* clearing the array).
|
|
120
|
+
* @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,
|
|
113
121
|
* it recurses to its (otherwise hidden) children.
|
|
114
122
|
*/
|
|
115
123
|
collectCurvePrimitives(collectorArray, smallestPossiblePrimitives = false, explodeLineStrings = false) {
|
|
@@ -124,7 +132,7 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
124
132
|
* * `UnionRegion`
|
|
125
133
|
*/
|
|
126
134
|
get isAnyRegionType() {
|
|
127
|
-
return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() ===
|
|
135
|
+
return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;
|
|
128
136
|
}
|
|
129
137
|
/** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */
|
|
130
138
|
get isOpenPath() {
|
|
@@ -132,12 +140,16 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
132
140
|
}
|
|
133
141
|
/**
|
|
134
142
|
* Return true for a single-loop planar region type, i.e. `Loop`.
|
|
135
|
-
* * This is
|
|
143
|
+
* * This is NOT a test for physical closure of a `Path`.
|
|
136
144
|
*/
|
|
137
145
|
get isClosedPath() {
|
|
138
146
|
return this.dgnBoundaryType() === 2;
|
|
139
147
|
}
|
|
140
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Extend (increase) the given range as needed to encompass all curves in the curve collection.
|
|
150
|
+
* @param rangeToExtend the given range.
|
|
151
|
+
* @param transform if supplied, the range is extended with transformed curves.
|
|
152
|
+
*/
|
|
141
153
|
extendRange(rangeToExtend, transform) {
|
|
142
154
|
const children = this.children;
|
|
143
155
|
if (children) {
|
|
@@ -147,8 +159,8 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
147
159
|
}
|
|
148
160
|
}
|
|
149
161
|
/**
|
|
150
|
-
*
|
|
151
|
-
* *
|
|
162
|
+
* Find any CurvePrimitive in the source and evaluate it at the given fraction.
|
|
163
|
+
* * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.
|
|
152
164
|
* @param source containing `CurvePrimitive` or `CurveCollection`
|
|
153
165
|
* @param fraction fraction to use in `curve.fractionToPoint(fraction)`
|
|
154
166
|
*/
|
|
@@ -181,19 +193,20 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
|
|
|
181
193
|
exports.CurveCollection = CurveCollection;
|
|
182
194
|
/**
|
|
183
195
|
* Shared base class for use by both open and closed paths.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* `
|
|
187
|
-
*
|
|
188
|
-
* to xyz, but in fact does all the
|
|
189
|
-
* calculations over multiple primitives.
|
|
190
|
-
* - The specific derived classes are `Path` and `Loop`
|
|
191
|
-
* - `CurveChain` is an intermediate class. It is not instantiable on its own.
|
|
196
|
+
* * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.
|
|
197
|
+
* * The specific derived classes are `Path` and `Loop`
|
|
198
|
+
* * `CurveChain` is an intermediate class. It is not instantiable on its own.
|
|
199
|
+
* * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings
|
|
200
|
+
* from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.
|
|
192
201
|
* @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.
|
|
193
202
|
* @public
|
|
194
203
|
*/
|
|
195
204
|
class CurveChain extends CurveCollection {
|
|
196
|
-
|
|
205
|
+
/** Constructor */
|
|
206
|
+
constructor() {
|
|
207
|
+
super();
|
|
208
|
+
this._curves = [];
|
|
209
|
+
}
|
|
197
210
|
/** Return the array of `CurvePrimitive` */
|
|
198
211
|
get children() {
|
|
199
212
|
if (this._curves === undefined)
|
|
@@ -201,7 +214,7 @@ class CurveChain extends CurveCollection {
|
|
|
201
214
|
return this._curves;
|
|
202
215
|
}
|
|
203
216
|
/**
|
|
204
|
-
* Return the
|
|
217
|
+
* Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.
|
|
205
218
|
* * In particular, `-1` is the final curve.
|
|
206
219
|
* @param index cyclic index
|
|
207
220
|
*/
|
|
@@ -209,8 +222,7 @@ class CurveChain extends CurveCollection {
|
|
|
209
222
|
const n = this.children.length;
|
|
210
223
|
if (n === 0)
|
|
211
224
|
return undefined;
|
|
212
|
-
|
|
213
|
-
if (index >= 0 && index < n)
|
|
225
|
+
if (index >= 0 && index < n) // try simplest non-cyclic access first
|
|
214
226
|
return this.children[index];
|
|
215
227
|
if (cyclic) {
|
|
216
228
|
const index2 = Geometry_1.Geometry.modulo(index, n);
|
|
@@ -223,6 +235,11 @@ class CurveChain extends CurveCollection {
|
|
|
223
235
|
* @param options tolerance parameters controlling the stroking.
|
|
224
236
|
*/
|
|
225
237
|
getPackedStrokes(options) {
|
|
238
|
+
/**
|
|
239
|
+
* The object returned by "cloneStroked" has the same type (Loop or Path) but instead of a chain of
|
|
240
|
+
* CurvePrimitives as children, it has a single LineString3d child. "getPackedStrokes" just returns
|
|
241
|
+
* the points of that LineString3d using "packedPoints".
|
|
242
|
+
*/
|
|
226
243
|
const tree = this.cloneStroked(options);
|
|
227
244
|
if (tree instanceof CurveChain) {
|
|
228
245
|
const children = tree.children;
|
|
@@ -234,16 +251,6 @@ class CurveChain extends CurveCollection {
|
|
|
234
251
|
}
|
|
235
252
|
return undefined;
|
|
236
253
|
}
|
|
237
|
-
/* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.
|
|
238
|
-
Reducing it to abstract.
|
|
239
|
-
Hypothetically, a derived class in the wild might be depending on this.
|
|
240
|
-
{
|
|
241
|
-
const strokes = LineString3d.create();
|
|
242
|
-
for (const curve of this.children)
|
|
243
|
-
curve.emitStrokes(strokes, options);
|
|
244
|
-
return strokes;
|
|
245
|
-
}
|
|
246
|
-
*/
|
|
247
254
|
/**
|
|
248
255
|
* Add a child curve.
|
|
249
256
|
* * Returns false if the given child is not a CurvePrimitive.
|
|
@@ -276,7 +283,7 @@ class CurveChain extends CurveCollection {
|
|
|
276
283
|
this._curves.reverse();
|
|
277
284
|
}
|
|
278
285
|
/**
|
|
279
|
-
* Return the index where target is found in the array of children
|
|
286
|
+
* Return the index where target is found in the array of children.
|
|
280
287
|
* @param alsoSearchProxies whether to also check proxy curves of the children
|
|
281
288
|
*/
|
|
282
289
|
childIndex(target, alsoSearchProxies) {
|
|
@@ -295,7 +302,7 @@ class CurveChain extends CurveCollection {
|
|
|
295
302
|
}
|
|
296
303
|
return undefined;
|
|
297
304
|
}
|
|
298
|
-
/** Evaluate an indexed curve at a fraction.
|
|
305
|
+
/** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */
|
|
299
306
|
primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(index, fraction, cyclic = false, result) {
|
|
300
307
|
const primitive = this.cyclicCurvePrimitive(index, cyclic);
|
|
301
308
|
if (primitive) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAQvC,+DAA4D;AAC5D,qDAAkD;AAElD,mDAAgD;AAChD,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EA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EC;AAED;;;GAGG;AACH,MAAa,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA;AATD,8FASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close, and not enclosing a planar area\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed.\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by union rules\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings expanded to multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /** Recurse through children to collect CurvePrimitive's in flat array. */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is _not- a test for physical closure of a `Path`\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * * Find any curve primitive in the source.\r\n * * Evaluate it at a fraction (which by default is an interior fraction)\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * - A `CurveChain` contains only curvePrimitives. No other paths, loops, or regions allowed.\r\n * - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance)\r\n * `CurveChainWithDistanceIndex`\r\n * which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction\r\n * to xyz, but in fact does all the\r\n * calculations over multiple primitives.\r\n * - The specific derived classes are `Path` and `Loop`\r\n * - `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n protected constructor() { super(); this._curves = []; }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the `[index]` curve primitive, optionally using `modulo` to map`index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n /** Try simplest non-cyclic access first . . */\r\n if (index >= 0 && index < n)\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.\r\n Reducing it to abstract.\r\n Hypothetically, a derived class in the wild might be depending on this.\r\n {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return strokes;\r\n }\r\n */\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace() {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() { super(); this._children = []; }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAQvC,+DAA4D;AAC5D,qDAAkD;AAElD,mDAAgD;AAChD,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EAAuE;AACvE,4FAAyF;AACzF,4EAAyE;AACzE,wFAAqF;AACrF,iDAA8C;AAC9C,6CAA0C;AAe1C;;;;;;;;;;;;;;GAcG;AACH,MAAsB,eAAgB,SAAQ,6BAAa;IAA3D;;QACE,wCAAwC;QACxB,qBAAgB,GAAG,iBAAiB,CAAC;QAGrD,mEAAmE;QACnE,uDAAuD;QAChD,YAAO,GAAY,KAAK,CAAC;IAwKlC,CAAC;IAvKC,6DAA6D;IACtD,UAAU;QACf,O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------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the\r\n * same plane).\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to\r\n * be on the same plane).\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules.\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by union rules.\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure of a `Path`.\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCurve.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAyB,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;;;OAOG;WACW,mBAAmB,
|
|
1
|
+
{"version":3,"file":"CurveCurve.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG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AAwB,EAAE,WAAmB;QAEvE,MAAM,OAAO,GAAG,IAAI,qDAAyB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACpE,OAAO,CAAC,mBAAmB,GAAG,WAAW,CAAC;QAC1C,SAAS,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;CAEF;AA1FD,gCA0FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurveCloseApproachXY } from \"./CurveCurveCloseApproachXY\";\r\nimport { CurveCurveIntersectXY, CurveLocationDetailArrayPair } from \"./CurveCurveIntersectXY\";\r\nimport { CurveCurveIntersectXYZ } from \"./CurveCurveIntersectXYZ\";\r\nimport { CurveLocationDetailPair } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\n\r\n/**\r\n * `CurveCurve` has static method for various computations that work on a pair of curves or curve collections.\r\n * @public\r\n */\r\nexport class CurveCurve {\r\n /**\r\n * Return xy intersections of 2 curves.\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionXYPairs(\r\n geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, geometryA, extendA, geometryB, extendB, tolerance);\r\n if (geometryB instanceof CurvePrimitive) {\r\n geometryA.dispatchToGeometryHandler(handler);\r\n } else if (geometryB instanceof CurveCollection) {\r\n const allCurves = geometryB.collectCurvePrimitives();\r\n for (const child of allCurves) {\r\n handler.resetGeometry(geometryA, false, child, false);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return xy intersections of 2 projected curves\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionProjectedXYPairs(\r\n worldToLocal: Matrix4d, geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(worldToLocal, geometryA, extendA, geometryB, extendB, tolerance);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return full 3d xyz intersections of 2 curves.\r\n * * Implemented for combinations of LineSegment3d, LineString3d, Arc3d.\r\n * * Not Implemented for bspline and bezier curves.\r\n * @beta\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n */\r\n public static intersectionXYZ(\r\n geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean\r\n ): CurveLocationDetailArrayPair {\r\n const handler = new CurveCurveIntersectXYZ(geometryA, extendA, geometryB, extendB);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabResults();\r\n }\r\n /**\r\n * Return xy intersections of input curves.\r\n * @param primitives input curves to intersect\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static allIntersectionsAmongPrimitivesXY(\r\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, undefined, false, undefined, false, tolerance);\r\n for (let i = 0; i < primitives.length; i++) {\r\n const geometryA = primitives[i];\r\n for (let j = i + 1; j < primitives.length; j++) {\r\n handler.resetGeometry(geometryA, false, primitives[j], false);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return xy close approaches of 2 projected curves\r\n * @param geometryA first geometry\r\n * @param geometryB second geometry\r\n */\r\n public static closeApproachProjectedXYPairs(\r\n geometryA: GeometryQuery, geometryB: GeometryQuery, maxDistance: number\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveCloseApproachXY(geometryA, geometryB);\r\n handler.maxDistanceToAccept = maxDistance;\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -2,21 +2,69 @@
|
|
|
2
2
|
* @module Curve
|
|
3
3
|
*/
|
|
4
4
|
import { PlaneAltitudeEvaluator } from "../Geometry";
|
|
5
|
+
import { Angle } from "../geometry3d/Angle";
|
|
5
6
|
import { AngleSweep } from "../geometry3d/AngleSweep";
|
|
6
7
|
import { Ellipsoid, GeodesicPathPoint } from "../geometry3d/Ellipsoid";
|
|
7
8
|
import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection";
|
|
9
|
+
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
8
10
|
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
11
|
+
import { Ray3d } from "../geometry3d/Ray3d";
|
|
12
|
+
import { XAndY } from "../geometry3d/XYZProps";
|
|
13
|
+
import { IndexedPolyface } from "../polyface/Polyface";
|
|
14
|
+
import { RuledSweep } from "../solid/RuledSweep";
|
|
9
15
|
import { Arc3d } from "./Arc3d";
|
|
16
|
+
import { AnyCurve } from "./CurveChain";
|
|
10
17
|
import { CurveChain } from "./CurveCollection";
|
|
11
18
|
import { CurvePrimitive } from "./CurvePrimitive";
|
|
12
19
|
import { GeometryQuery } from "./GeometryQuery";
|
|
13
20
|
import { LineString3d } from "./LineString3d";
|
|
14
21
|
import { Loop } from "./Loop";
|
|
15
22
|
import { Path } from "./Path";
|
|
16
|
-
import { Angle } from "../geometry3d/Angle";
|
|
17
23
|
import { IntegratedSpiralTypeName } from "./spiral/TransitionSpiral3d";
|
|
18
|
-
import {
|
|
19
|
-
|
|
24
|
+
import { StrokeOptions } from "./StrokeOptions";
|
|
25
|
+
/**
|
|
26
|
+
* Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them, as returned by [CurveFactory.createMiteredSweepSections].
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export interface SectionSequenceWithPlanes {
|
|
30
|
+
/** the plane of each section */
|
|
31
|
+
planes: Plane3dByOriginAndUnitNormal[];
|
|
32
|
+
/** section curve projected onto the corresponding plane */
|
|
33
|
+
sections: AnyCurve[];
|
|
34
|
+
/**
|
|
35
|
+
* Optional `RuledSweep` generated from the sections.
|
|
36
|
+
* * The `RuledSweep` and sections array refer to the same section objects.
|
|
37
|
+
*/
|
|
38
|
+
ruledSweep?: RuledSweep;
|
|
39
|
+
/** Optional mesh generated from the `RuledSweep` generated from the sections. */
|
|
40
|
+
mesh?: IndexedPolyface;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Enumeration of geometric output for [CurveFactory.createMiteredSweepSections].
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export declare enum MiteredSweepOutputSelect {
|
|
47
|
+
/** Output only the parallel arrays of planes and sections. */
|
|
48
|
+
Sections = 0,
|
|
49
|
+
/** Output planes and sections, as well as the assembled ruled sweep. */
|
|
50
|
+
AlsoRuledSweep = 1,
|
|
51
|
+
/** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */
|
|
52
|
+
AlsoMesh = 2
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Interface bundling options for [CurveFactory.createMiteredSweepSections].
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface MiteredSweepOptions {
|
|
59
|
+
/** Whether first and last planes are averaged and equated when the centerline is physically closed. Default value is `false`. */
|
|
60
|
+
wrapIfPhysicallyClosed?: boolean;
|
|
61
|
+
/** Whether to output sections only, or sections plus optional geometry constructed from them. Default value is `MiteredSweepOutputSelect.Sections`. */
|
|
62
|
+
outputSelect?: MiteredSweepOutputSelect;
|
|
63
|
+
/** How to stroke the ruled sweep if outputting a mesh. If undefined, default stroke options are used. */
|
|
64
|
+
strokeOptions?: StrokeOptions;
|
|
65
|
+
/** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */
|
|
66
|
+
capped?: boolean;
|
|
67
|
+
}
|
|
20
68
|
/**
|
|
21
69
|
* The `CurveFactory` class contains methods for specialized curve constructions.
|
|
22
70
|
* @public
|
|
@@ -83,6 +131,22 @@ export declare class CurveFactory {
|
|
|
83
131
|
* @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d
|
|
84
132
|
*/
|
|
85
133
|
static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[];
|
|
134
|
+
/**
|
|
135
|
+
* Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
|
|
136
|
+
* * The caller should place the initialSection on a plane perpendicular to the first edge.
|
|
137
|
+
* * This plane is commonly (but not necessarily) through the start point itself.
|
|
138
|
+
* * If the geometry is not "on a perpendicular plane", the output geometry will still be flattened onto the various planes.
|
|
139
|
+
* * In the "open path" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)
|
|
140
|
+
* the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.
|
|
141
|
+
* * In the "closed path" case, the output plane for the first and last point is the bisector of the start and end planes from the "open path" case,
|
|
142
|
+
* and the first/last section geometry may be different from `initialSection`.
|
|
143
|
+
* * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.
|
|
144
|
+
* @param centerline sweep path, e.g., as stroked from a smooth centerline curve
|
|
145
|
+
* @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.
|
|
146
|
+
* @param options options for computation and output
|
|
147
|
+
* @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
|
|
148
|
+
*/
|
|
149
|
+
static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[], initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined;
|
|
86
150
|
/**
|
|
87
151
|
* Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep
|
|
88
152
|
* * The vector from start point to center is in the direction of upVector crossed with tangentA.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveFactory.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAkC,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"CurveFactory.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAkC,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,C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LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.CurveFactory = void 0;
|
|
7
|
+
exports.CurveFactory = exports.MiteredSweepOutputSelect = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Curve
|
|
10
10
|
*/
|
|
11
11
|
// import { Geometry, Angle, AngleSweep } from "../Geometry";
|
|
12
12
|
const Geometry_1 = require("../Geometry");
|
|
13
|
+
const Angle_1 = require("../geometry3d/Angle");
|
|
13
14
|
const AngleSweep_1 = require("../geometry3d/AngleSweep");
|
|
14
15
|
const Matrix3d_1 = require("../geometry3d/Matrix3d");
|
|
16
|
+
const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
|
|
15
17
|
const Point3dArrayCarrier_1 = require("../geometry3d/Point3dArrayCarrier");
|
|
16
18
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
19
|
+
const PolylineOps_1 = require("../geometry3d/PolylineOps");
|
|
20
|
+
const Ray3d_1 = require("../geometry3d/Ray3d");
|
|
21
|
+
const Segment1d_1 = require("../geometry3d/Segment1d");
|
|
22
|
+
const Transform_1 = require("../geometry3d/Transform");
|
|
23
|
+
const Polynomials_1 = require("../numerics/Polynomials");
|
|
17
24
|
const PolyfaceBuilder_1 = require("../polyface/PolyfaceBuilder");
|
|
18
25
|
const Cone_1 = require("../solid/Cone");
|
|
26
|
+
const RuledSweep_1 = require("../solid/RuledSweep");
|
|
19
27
|
const TorusPipe_1 = require("../solid/TorusPipe");
|
|
20
28
|
const Arc3d_1 = require("./Arc3d");
|
|
21
29
|
const CurveCollection_1 = require("./CurveCollection");
|
|
@@ -25,13 +33,20 @@ const LineSegment3d_1 = require("./LineSegment3d");
|
|
|
25
33
|
const LineString3d_1 = require("./LineString3d");
|
|
26
34
|
const Loop_1 = require("./Loop");
|
|
27
35
|
const Path_1 = require("./Path");
|
|
28
|
-
const Angle_1 = require("../geometry3d/Angle");
|
|
29
|
-
const Transform_1 = require("../geometry3d/Transform");
|
|
30
36
|
const IntegratedSpiral3d_1 = require("./spiral/IntegratedSpiral3d");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Enumeration of geometric output for [CurveFactory.createMiteredSweepSections].
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
var MiteredSweepOutputSelect;
|
|
42
|
+
(function (MiteredSweepOutputSelect) {
|
|
43
|
+
/** Output only the parallel arrays of planes and sections. */
|
|
44
|
+
MiteredSweepOutputSelect[MiteredSweepOutputSelect["Sections"] = 0] = "Sections";
|
|
45
|
+
/** Output planes and sections, as well as the assembled ruled sweep. */
|
|
46
|
+
MiteredSweepOutputSelect[MiteredSweepOutputSelect["AlsoRuledSweep"] = 1] = "AlsoRuledSweep";
|
|
47
|
+
/** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */
|
|
48
|
+
MiteredSweepOutputSelect[MiteredSweepOutputSelect["AlsoMesh"] = 2] = "AlsoMesh";
|
|
49
|
+
})(MiteredSweepOutputSelect = exports.MiteredSweepOutputSelect || (exports.MiteredSweepOutputSelect = {}));
|
|
35
50
|
/**
|
|
36
51
|
* The `CurveFactory` class contains methods for specialized curve constructions.
|
|
37
52
|
* @public
|
|
@@ -334,6 +349,59 @@ class CurveFactory {
|
|
|
334
349
|
}
|
|
335
350
|
return arcs;
|
|
336
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
|
|
354
|
+
* * The caller should place the initialSection on a plane perpendicular to the first edge.
|
|
355
|
+
* * This plane is commonly (but not necessarily) through the start point itself.
|
|
356
|
+
* * If the geometry is not "on a perpendicular plane", the output geometry will still be flattened onto the various planes.
|
|
357
|
+
* * In the "open path" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)
|
|
358
|
+
* the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.
|
|
359
|
+
* * In the "closed path" case, the output plane for the first and last point is the bisector of the start and end planes from the "open path" case,
|
|
360
|
+
* and the first/last section geometry may be different from `initialSection`.
|
|
361
|
+
* * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.
|
|
362
|
+
* @param centerline sweep path, e.g., as stroked from a smooth centerline curve
|
|
363
|
+
* @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.
|
|
364
|
+
* @param options options for computation and output
|
|
365
|
+
* @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
|
|
366
|
+
*/
|
|
367
|
+
static createMiteredSweepSections(centerline, initialSection, options) {
|
|
368
|
+
const sectionData = { sections: [], planes: [] };
|
|
369
|
+
const planes = PolylineOps_1.PolylineOps.createBisectorPlanesForDistinctPoints(centerline, options.wrapIfPhysicallyClosed);
|
|
370
|
+
if (planes !== undefined && planes.length > 1) {
|
|
371
|
+
// Projection to target plane, constructing sweep direction from two given planes.
|
|
372
|
+
// If successful, push the target plane and swept section to the output arrays and return the swept section.
|
|
373
|
+
// If unsuccessful, leave the output arrays alone and return the input section.
|
|
374
|
+
const doSweepToPlane = function (edgePlane0, edgePlane1, targetPlane, section) {
|
|
375
|
+
const sweepVector = Point3dVector3d_1.Vector3d.createStartEnd(edgePlane0.getOriginRef(), edgePlane1.getOriginRef());
|
|
376
|
+
const transform = Transform_1.Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());
|
|
377
|
+
if (transform === undefined)
|
|
378
|
+
return section;
|
|
379
|
+
const section1 = section.cloneTransformed(transform);
|
|
380
|
+
if (section1 === undefined)
|
|
381
|
+
return section;
|
|
382
|
+
sectionData.planes.push(targetPlane);
|
|
383
|
+
sectionData.sections.push(section1);
|
|
384
|
+
return section1;
|
|
385
|
+
};
|
|
386
|
+
let currentSection = doSweepToPlane(planes[0], planes[1], planes[0], initialSection);
|
|
387
|
+
for (let i = 1; i < planes.length; i++) {
|
|
388
|
+
currentSection = doSweepToPlane(planes[i - 1], planes[i], planes[i], currentSection);
|
|
389
|
+
}
|
|
390
|
+
if (options.outputSelect) {
|
|
391
|
+
const ruledSweep = RuledSweep_1.RuledSweep.create(sectionData.sections, options.capped ?? false);
|
|
392
|
+
if (ruledSweep) {
|
|
393
|
+
sectionData.ruledSweep = ruledSweep;
|
|
394
|
+
if (MiteredSweepOutputSelect.AlsoMesh === options.outputSelect) {
|
|
395
|
+
const builder = PolyfaceBuilder_1.PolyfaceBuilder.create(options.strokeOptions);
|
|
396
|
+
builder.addRuledSweep(ruledSweep);
|
|
397
|
+
sectionData.mesh = builder.claimPolyface();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return sectionData;
|
|
402
|
+
}
|
|
403
|
+
return undefined;
|
|
404
|
+
}
|
|
337
405
|
/**
|
|
338
406
|
* Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep
|
|
339
407
|
* * The vector from start point to center is in the direction of upVector crossed with tangentA.
|