@itwin/core-geometry 4.2.0-dev.3 → 4.2.0-dev.30
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 +59 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +12 -8
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +5 -3
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +20 -8
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +77 -2
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +6 -5
- package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +6 -4
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +3 -2
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +2 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -3
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -3
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +4 -4
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.d.ts +15 -15
- package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js +15 -15
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +4 -17
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +3 -22
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +41 -26
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +73 -40
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +13 -2
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.d.ts +19 -0
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -0
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +1 -1
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +16 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +18 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +1 -1
- package/lib/cjs/curve/UnionRegion.js +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +31 -42
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +12 -14
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts +57 -36
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +99 -74
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +4 -3
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +2 -2
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +2 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +12 -8
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +5 -3
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +20 -8
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +77 -2
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +6 -5
- package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +6 -4
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +3 -2
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +2 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -3
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -3
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +4 -4
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.d.ts +15 -15
- package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js +15 -15
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +4 -17
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +2 -20
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +41 -26
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +73 -40
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +12 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +11 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.d.ts +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.d.ts +19 -0
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
- package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -0
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +1 -1
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +16 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +16 -0
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +1 -1
- package/lib/esm/curve/UnionRegion.js +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +30 -40
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +11 -13
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts +57 -36
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +99 -74
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +4 -3
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +2 -2
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +2 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +3 -3
- package/lib/cjs/curve/CurveChain.d.ts +0 -17
- package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
- package/lib/cjs/curve/CurveChain.js.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -164
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
- package/lib/esm/curve/CurveChain.d.ts +0 -17
- package/lib/esm/curve/CurveChain.d.ts.map +0 -1
- package/lib/esm/curve/CurveChain.js.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -164
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,mEAAmE;AACnE,qDAAkD;AAClD,uEAAoE;AACpE,uFAAoF;AAEpF,wDAAqD;AACrD,wCAAqC;AACrC,kDAAmE;AACnE,sDAAmD;AAEnD,6DAA0D;AAC1D,qEAAkE;AAClE,mEAAkE;AAClE,yDAAsF;AACtF,+CAAgE;AAChE,2EAA0E;AAE1E,wDAAqD;AACrD,uDAA2D;AAC3D,yDAAsD;AAEtD,uDAAoD;AACpD,mDAAgD;AAE9C;;;GAGG;AACF,MAAM,aAAa;IAGlB,YAAmB,MAAwB,EAAE,kBAA0B;QACrE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAEH;;;;;;;;;;;GAWG;AACH,MAAa,uBAAuB;IAOlC,YAAoB,QAAqC,EAAE,QAAqC,EAAE,oBAA6B,KAAK;QAClI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IACD,qDAAqD;IAC9C,MAAM,CAAC,MAAM,CAAC,aAAsB,IAAI,EAAE,cAAuB,KAAK,EAAE,iBAA0B,KAAK;QAC5G,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC,iCAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,iCAAe,CAAC,MA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CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,CAAC;CACF;AAhfD,oCAgfC","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 Polyface\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { ClipPlane } from \"../clipping/ClipPlane\";\r\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\r\nimport { AnyRegion } from \"../curve/CurveChain\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SweepContour } from \"../solid/SweepContour\";\r\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\r\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\r\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\r\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\r\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\r\n\r\n /**\r\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\r\n * @private\r\n */\r\n class ClipCandidate {\r\n public nextConvexSetIndex: number;\r\n public points: GrowableXYZArray;\r\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\r\n this.nextConvexSetIndex = nextConvexSetIndex;\r\n this.points = points;\r\n }\r\n }\r\n\r\n/**\r\n * A pair of PolyfaceBuilder objects, for use by clippers that emit inside and outside parts.\r\n * * There are nominally 4 builders:\r\n * * builderA collects simple \"inside\" clip.\r\n * * builderB collects simple \"outside\" clip.\r\n * * builderA1 collects \"side\" clip for inside.\r\n * * builderB1 collets \"side\" clip for outside.\r\n * * `static ClippedPolyfaceBuilders.create(keepInside, keepOutside)` initializes `builderA` and `builderB` (each optionally to undefined), with undefined `builderA1` and `builderB1`\r\n * * `builders.enableSideBuilders()` makes `builderA1` and `builderB1` match `builderA` and `builderB`.\r\n * * construction methods aim their facets at appropriate builders if defined.\r\n * * @public\r\n */\r\nexport class ClippedPolyfaceBuilders {\r\n /** An available builder. Typically the \"inside\" parts */\r\n public builderA?: PolyfaceBuilder;\r\n /** An available builder. Typically the \"outside\" parts */\r\n public builderB?: PolyfaceBuilder;\r\n /** request to construct cut faces */\r\n public buildClosureFaces?: boolean;\r\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\r\n this.builderA = builderA;\r\n this.builderB = builderB;\r\n this.buildClosureFaces = buildClosureFaces;\r\n }\r\n /** Simple create with default options on builder. */\r\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false) {\r\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\r\n }\r\n\r\n public claimPolyface(selector: 0 | 1, fixup: boolean): IndexedPolyface | undefined {\r\n const builder = selector === 0 ? this.builderA : this.builderB;\r\n if (builder) {\r\n let polyface = builder.claimPolyface();\r\n if (fixup) {\r\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\r\n }\r\n return polyface;\r\n }\r\n return undefined;\r\n }\r\n}\r\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\r\n * @public\r\n */\r\nexport class PolyfaceClip {\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return all surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\r\n */\r\n public static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true) {\r\n return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);\r\n }\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return all surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\r\n */\r\n public static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): Polyface {\r\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\r\n this.clipPolyfaceInsideOutside(polyface, clipper, builders);\r\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\r\n }\r\n\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\".\r\n */\r\n public static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): Polyface {\r\n const visitor = polyface.createVisitor(0);\r\n const builder = PolyfaceBuilder.create();\r\n const work = new GrowableXYZArray(10);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n clipper.clipConvexPolygonInPlace(visitor.point, work);\r\n if (visitor.point.length > 2)\r\n builder.addPolygonGrowableXYZArray(visitor.point);\r\n }\r\n return builder.claimPolyface(true);\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * * outputSelect determines how the clip output is structured\r\n * * 0 outputs all shards -- this may have many interior edges.\r\n * * 1 stitches shards together to get cleaner facets.\r\n * @internal\r\n */\r\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const insideShards: GrowableXYZArray[] = [];\r\n const outsideShards: GrowableXYZArray[] = [];\r\n const residualPolygons: ClipCandidate[] = [];\r\n let candidate: ClipCandidate | undefined;\r\n const outsideParts: GrowableXYZArray[] = [];\r\n\r\n const numConvexSet = allClippers.convexSets.length;\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\r\n while ((candidate = residualPolygons.pop()) !== undefined) {\r\n const convexSetIndex = candidate.nextConvexSetIndex;\r\n if (convexSetIndex >= numConvexSet) {\r\n // ths remnant polygon is OUT ...\r\n if (candidate.points.length > 2)\r\n outsideShards.push(candidate.points);\r\n } else {\r\n const clipper = allClippers.convexSets[convexSetIndex];\r\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\r\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\r\n if (insidePart) {\r\n if (insidePart.length > 2)\r\n insideShards.push(insidePart);\r\n // Keep outside parts active for clip by later facets . . .\r\n for (const outsidePolygon of outsideParts) {\r\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\r\n }\r\n } else {\r\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\r\n candidate.nextConvexSetIndex++;\r\n residualPolygons.push(candidate);\r\n }\r\n outsideParts.length = 0;\r\n }\r\n }\r\n if (outsideShards.length === 0) {\r\n builderA?.addPolygonGrowableXYZArray(visitor.point);\r\n } else if (insideShards.length === 0) {\r\n // the facet spanned clippers but is intact outside\r\n builderB?.addPolygonGrowableXYZArray(visitor.point);\r\n } else {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\r\n let worldToLocal: Transform | undefined;\r\n if (outputSelector === 1 && localToWorld !== undefined\r\n && undefined !== (worldToLocal = localToWorld.inverse())) {\r\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\r\n\r\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\r\n } else {\r\n for (const shard of insideShards)\r\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\r\n for (const shard of outsideShards)\r\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\r\n }\r\n }\r\n outsideShards.length = 0;\r\n insideShards.length = 0;\r\n }\r\n cache.dropAllToCache(outsideParts);\r\n if (destination.buildClosureFaces) {\r\n for (const clipper of allClippers.convexSets) {\r\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\r\n }\r\n }\r\n }\r\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined) {\r\n if (builder !== undefined && region !== undefined) {\r\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\r\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\r\n } else if (region instanceof UnionRegion) {\r\n for (const child of region.children)\r\n this.addRegion(builder, child);\r\n }\r\n }\r\n }\r\n // WARNING: shards are transformed into local system, not reverted!!!\r\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[],\r\n worldToLocal: Transform | undefined, localToWorld: Transform | undefined) {\r\n if (builder !== undefined && shards.length > 0) {\r\n if (worldToLocal)\r\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\r\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\r\n if (outsidePieces && outsidePieces.children.length > 0){\r\n if (localToWorld)\r\n outsidePieces.tryTransformInPlace(localToWorld);\r\n RegionOps.consolidateAdjacentPrimitives(outsidePieces);\r\n this.addRegion(builder, outsidePieces);\r\n }\r\n }\r\n }\r\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\r\n if (polygon) {\r\n if (builder)\r\n builder.addPolygonGrowableXYZArray(polygon);\r\n cache.dropToCache(polygon);\r\n }\r\n }\r\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\r\n let polygon;\r\n while ((polygon = polygonArray.pop()) !== undefined) {\r\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\r\n }\r\n }\r\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\r\n const chainContexts = [];\r\n for (const plane of clipper.planes) {\r\n if (!plane.interior) {\r\n const c = ChainMergeContext.create();\r\n c.plane = plane;\r\n c.convexClipper = clipper;\r\n chainContexts.push(c);\r\n }\r\n }\r\n return chainContexts;\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * @internal\r\n */\r\n public static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const outsideParts: GrowableXYZArray[] = [];\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n // !!! currentCandidates and next candidates are empty at this point !!!\r\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\r\n if (insidePart === undefined) {\r\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\r\n builderB?.addPolygonGrowableXYZArray(visitor.point);\r\n cache.dropToCache(insidePart);\r\n cache.dropAllToCache(outsideParts);\r\n }\r\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\r\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\r\n }\r\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\r\n }\r\n /**\r\n *\r\n * @param visitor visitor for all facets of interest (entire polyface)\r\n * @param clipper ConvexClipPlaneSet to apply\r\n * @param destination builders to receive inside, outside parts\r\n * @param cache GrowableArray cache.\r\n */\r\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders,\r\n cache: GrowableXYZArrayCache) {\r\n if (destination.buildClosureFaces) {\r\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\r\n const workPoints = cache.grabFromCache();\r\n const facetPoints = cache.grabFromCache();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n for (const chainContext of chainContexts) {\r\n const plane = chainContext.plane;\r\n facetPoints.clear();\r\n facetPoints.pushFrom(visitor.point);\r\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\r\n chainContext.addSegmentsOnPlane(facetPoints, true);\r\n }\r\n }\r\n cache.dropToCache(facetPoints);\r\n cache.dropToCache(workPoints);\r\n for (const chainContext of chainContexts) {\r\n this.addClosureFacets(chainContext, destination, cache);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param visitor visitor for all facets of interest (entire polyface)\r\n * @param clipper ConvexClipPlaneSet to apply\r\n * @param destination builders to receive inside, outside parts\r\n * @param cache GrowableArray cache.\r\n */\r\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders,\r\n cache: GrowableXYZArrayCache) {\r\n if (destination.buildClosureFaces) {\r\n const chainContext = ChainMergeContext.create();\r\n chainContext.plane = plane;\r\n const workPoints = cache.grabFromCache();\r\n const facetPoints = cache.grabFromCache();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n facetPoints.clear();\r\n facetPoints.pushFrom(visitor.point);\r\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\r\n chainContext.addSegmentsOnPlane(facetPoints, true);\r\n }\r\n cache.dropToCache(facetPoints);\r\n cache.dropToCache(workPoints);\r\n this.addClosureFacets(chainContext, destination, cache);\r\n }\r\n }\r\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\r\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\r\n }\r\n /**\r\n * * Triangulate the contour.\r\n * * Add all the triangles to both builders\r\n * * reversed in builderB.\r\n */\r\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\r\n const polygonA = cache.grabFromCache();\r\n const polygonB = cache.grabFromCache();\r\n if (destination.builderB)\r\n destination.builderB.toggleReversedFacetFlag();\r\n contour.announceFacets((facets: IndexedPolyface) => {\r\n const visitor = facets.createVisitor();\r\n // The contour facets are convex .. easy clip ..\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n polygonA.clear();\r\n polygonA.pushFromGrowableXYZArray(visitor.point);\r\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\r\n if (polygonA.length > 2) {\r\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\r\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\r\n }\r\n }\r\n }, undefined);\r\n if (destination.builderB)\r\n destination.builderB.toggleReversedFacetFlag();\r\n cache.dropToCache(polygonA);\r\n cache.dropToCache(polygonB);\r\n }\r\n\r\n /**\r\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\r\n * @param chainContext ASSUMED TO HAVE A PLANE\r\n * @param destination\r\n */\r\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\r\n const clipper = chainContext.convexClipper;\r\n const plane = chainContext.plane!;\r\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\r\n chainContext.clusterAndMergeVerticesXYZ();\r\n const loops = chainContext.collectMaximalGrowableXYZArrays();\r\n if (loops.length > 1) {\r\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\r\n for (const loopSet of loopSets) {\r\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\r\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\r\n if (contour !== undefined) {\r\n if (clipper) {\r\n this.addClippedContour(contour, clipper, destination, cache);\r\n } else {\r\n if (destination.builderA)\r\n contour.emitFacets(destination.builderA, true, clipper);\r\n if (destination.builderB)\r\n contour.emitFacets(destination.builderB, false, clipper);\r\n }\r\n }\r\n }\r\n } else {\r\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\r\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\r\n if (contour !== undefined) {\r\n if (clipper) {\r\n this.addClippedContour(contour, clipper, destination, cache);\r\n } else {\r\n if (destination.builderA)\r\n contour.emitFacets(destination.builderA, true, clipper);\r\n if (destination.builderB)\r\n contour.emitFacets(destination.builderB, false, clipper);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * @internal\r\n */\r\n public static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const inside = cache.grabFromCache();\r\n const outside = cache.grabFromCache();\r\n const range = Range1d.createNull();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n // !!! currentCandidates and next candidates are empty at this point !!!\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\r\n if (builderA)\r\n builderA.addPolygonGrowableXYZArray(inside);\r\n if (builderB)\r\n builderB.addPolygonGrowableXYZArray(outside);\r\n }\r\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\r\n cache.dropToCache(inside);\r\n cache.dropToCache(outside);\r\n }\r\n\r\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\r\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\r\n * * if `destination.buildClosureFaces` is set, and also build closure facets\r\n * * This method parses the variant input types and calls a more specific method.\r\n * * WARNING: The new mesh is \"points only\".\r\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\r\n */\r\n public static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders,\r\n outputSelect: number = 0) {\r\n if (clipper instanceof ClipPlane) {\r\n this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);\r\n } else if (clipper instanceof ConvexClipPlaneSet) {\r\n this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);\r\n } else if (clipper instanceof UnionOfConvexClipPlaneSets) {\r\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);\r\n }\r\n }\r\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\r\n * * This method parses the variant input types and calls a more specific method.\r\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\r\n * * WARNING: The new mesh is \"points only\".\r\n */\r\n public static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\r\n if (clipper instanceof ClipPlane)\r\n return this.clipPolyfaceClipPlane(polyface, clipper);\r\n if (clipper instanceof ConvexClipPlaneSet)\r\n return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);\r\n // (The if tests exhaust the type space -- this line is unreachable.)\r\n return undefined;\r\n }\r\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\r\n * @param points array of points around polygon. Closure edge is implied.\r\n * @param chainContext context receiving edges\r\n * @param point0 work point\r\n * @param point1 work point\r\n */\r\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d) {\r\n const n = points.length;\r\n if (n > 1) {\r\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\r\n for (let i = 0; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, point1);\r\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\r\n chainContext.addSegment(point0, point1);\r\n point0.setFromPoint3d(point1);\r\n }\r\n }\r\n }\r\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\r\n * * Return all edges chained as array of LineString3d.\r\n */\r\n public static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[] {\r\n const chainContext = ChainMergeContext.create();\r\n\r\n const visitor = polyface.createVisitor(0);\r\n const work = new GrowableXYZArray(10);\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\r\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\r\n }\r\n chainContext.clusterAndMergeVerticesXYZ();\r\n return chainContext.collectMaximalChains();\r\n }\r\n\r\n /**\r\n * * Split facets of mesh \"A\" into parts that are\r\n * * under mesh \"B\"\r\n * * over mesh \"B\"\r\n * * both meshes are represented by visitors rather than the meshes themselves\r\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\r\n * * The respective clip parts are fed to caller-supplied builders.\r\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\r\n * * This step is commonly one-half of \"cut fill\".\r\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\r\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\r\n * @param visitorA iterator over polyface to be split.\r\n * @param visitorB iterator over polyface that acts as a splitter\r\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\r\n */\r\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor,\r\n builderAUnderB: PolyfaceBuilder | undefined,\r\n builderAOverB: PolyfaceBuilder | undefined) {\r\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\r\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\r\n if (!searchA)\r\n return;\r\n const range = Range3d.create();\r\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\r\n visitorA.point.setRange(range);\r\n searchA.addRange(range, visitorA.currentReadIndex());\r\n }\r\n const xyClip = new GrowableXYZArray(10);\r\n const workArray = new GrowableXYZArray(10);\r\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\r\n const below = new GrowableXYZArray(10);\r\n const above = new GrowableXYZArray(10);\r\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\r\n const altitudeRange = Range1d.createNull();\r\n\r\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\r\n visitorB.point.setRange(range);\r\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\r\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\r\n visitorA.moveToReadIndex(readIndexA);\r\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\r\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\r\n if (xyClip.length > 0) {\r\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\r\n if (below.length > 0 && builderAUnderB)\r\n builderAUnderB.addPolygonGrowableXYZArray(below);\r\n if (above.length > 0 && builderAOverB)\r\n builderAOverB.addPolygonGrowableXYZArray(above);\r\n }\r\n return true;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * * Split facets into vertically overlapping sections\r\n * * both meshes are represented by visitors rather than the meshes themselves\r\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\r\n * * The respective clip parts are returned as separate meshes.\r\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\r\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\r\n * * Each output contains some facets from meshA and some from meshB:\r\n * * meshAUnderB -- areas where meshA is underneath mesh B.\r\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\r\n * * meshAOverB -- areas where meshB is over meshB.\r\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\r\n *\r\n * @param visitorA iterator over polyface to be split.\r\n * @param visitorB iterator over polyface that acts as a splitter\r\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\r\n */\r\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\r\n const visitorA = meshA.createVisitor();\r\n const visitorB = meshB.createVisitor();\r\n const builderAUnderB = PolyfaceBuilder.create();\r\n const builderAOverB = PolyfaceBuilder.create();\r\n builderAUnderB.toggleReversedFacetFlag();\r\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\r\n builderAUnderB.toggleReversedFacetFlag();\r\n builderAOverB.toggleReversedFacetFlag();\r\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\r\n return {\r\n meshAUnderB: builderAUnderB.claimPolyface(),\r\n meshAOverB: builderAOverB.claimPolyface(),\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,mEAAmE;AACnE,qDAAkD;AAClD,uEAAoE;AACpE,uFAAoF;AAEpF,wDAAqD;AACrD,wCAAqC;AACrC,kDAAmE;AACnE,sDAAmD;AAEnD,6DAA0D;AAC1D,qEAAkE;AAClE,mEAAkE;AAClE,yDAAsF;AACtF,+CAAgE;AAChE,2EAA0E;AAE1E,wDAAqD;AACrD,uDAA2D;AAC3D,yDAAsD;AAEtD,uDAAoD;AACpD,mDAAgD;AAEhD;;;GAGG;AACH,MAAM,aAAa;IAGjB,YAAmB,MAAwB,EAAE,kBAA0B;QACrE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAa,uBAAuB;IAOlC,YAAoB,QAAqC,EAAE,QAAqC,EAAE,oBAA6B,KAAK;QAClI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IACD,qDAAqD;IAC9C,MAAM,CAAC,MAAM,CAAC,aAAsB,IAAI,EAAE,cAAuB,KAAK,EAAE,iBAA0B,KAAK;QAC5G,OAAO,IAAI,u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E,cAAc,EAAE,aAAa,CAAC,CAAC;QACxG,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACxC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,CAAC;CACF;AAhfD,oCAgfC","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 Polyface\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { ClipPlane } from \"../clipping/ClipPlane\";\r\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\r\nimport { AnyRegion } from \"../curve/CurveTypes\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SweepContour } from \"../solid/SweepContour\";\r\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\r\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\r\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\r\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\r\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\r\n\r\n/**\r\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\r\n * @private\r\n */\r\nclass ClipCandidate {\r\n public nextConvexSetIndex: number;\r\n public points: GrowableXYZArray;\r\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\r\n this.nextConvexSetIndex = nextConvexSetIndex;\r\n this.points = points;\r\n }\r\n}\r\n\r\n/**\r\n * A pair of PolyfaceBuilder objects, for use by clippers that emit inside and outside parts.\r\n * * There are nominally 4 builders:\r\n * * builderA collects simple \"inside\" clip.\r\n * * builderB collects simple \"outside\" clip.\r\n * * builderA1 collects \"side\" clip for inside.\r\n * * builderB1 collets \"side\" clip for outside.\r\n * * `static ClippedPolyfaceBuilders.create(keepInside, keepOutside)` initializes `builderA` and `builderB` (each optionally to undefined), with undefined `builderA1` and `builderB1`\r\n * * `builders.enableSideBuilders()` makes `builderA1` and `builderB1` match `builderA` and `builderB`.\r\n * * construction methods aim their facets at appropriate builders if defined.\r\n * * @public\r\n */\r\nexport class ClippedPolyfaceBuilders {\r\n /** An available builder. Typically the \"inside\" parts */\r\n public builderA?: PolyfaceBuilder;\r\n /** An available builder. Typically the \"outside\" parts */\r\n public builderB?: PolyfaceBuilder;\r\n /** request to construct cut faces */\r\n public buildClosureFaces?: boolean;\r\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\r\n this.builderA = builderA;\r\n this.builderB = builderB;\r\n this.buildClosureFaces = buildClosureFaces;\r\n }\r\n /** Simple create with default options on builder. */\r\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false) {\r\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\r\n }\r\n\r\n public claimPolyface(selector: 0 | 1, fixup: boolean): IndexedPolyface | undefined {\r\n const builder = selector === 0 ? this.builderA : this.builderB;\r\n if (builder) {\r\n let polyface = builder.claimPolyface();\r\n if (fixup) {\r\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\r\n }\r\n return polyface;\r\n }\r\n return undefined;\r\n }\r\n}\r\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\r\n * @public\r\n */\r\nexport class PolyfaceClip {\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return all surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\r\n */\r\n public static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true) {\r\n return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);\r\n }\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return all surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\r\n */\r\n public static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): Polyface {\r\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\r\n this.clipPolyfaceInsideOutside(polyface, clipper, builders);\r\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\r\n }\r\n\r\n /** Clip each facet of polyface to the ClipPlane.\r\n * * Return surviving clip as a new mesh.\r\n * * WARNING: The new mesh is \"points only\".\r\n */\r\n public static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): Polyface {\r\n const visitor = polyface.createVisitor(0);\r\n const builder = PolyfaceBuilder.create();\r\n const work = new GrowableXYZArray(10);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n clipper.clipConvexPolygonInPlace(visitor.point, work);\r\n if (visitor.point.length > 2)\r\n builder.addPolygonGrowableXYZArray(visitor.point);\r\n }\r\n return builder.claimPolyface(true);\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * * outputSelect determines how the clip output is structured\r\n * * 0 outputs all shards -- this may have many interior edges.\r\n * * 1 stitches shards together to get cleaner facets.\r\n * @internal\r\n */\r\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const insideShards: GrowableXYZArray[] = [];\r\n const outsideShards: GrowableXYZArray[] = [];\r\n const residualPolygons: ClipCandidate[] = [];\r\n let candidate: ClipCandidate | undefined;\r\n const outsideParts: GrowableXYZArray[] = [];\r\n\r\n const numConvexSet = allClippers.convexSets.length;\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\r\n while ((candidate = residualPolygons.pop()) !== undefined) {\r\n const convexSetIndex = candidate.nextConvexSetIndex;\r\n if (convexSetIndex >= numConvexSet) {\r\n // ths remnant polygon is OUT ...\r\n if (candidate.points.length > 2)\r\n outsideShards.push(candidate.points);\r\n } else {\r\n const clipper = allClippers.convexSets[convexSetIndex];\r\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\r\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\r\n if (insidePart) {\r\n if (insidePart.length > 2)\r\n insideShards.push(insidePart);\r\n // Keep outside parts active for clip by later facets . . .\r\n for (const outsidePolygon of outsideParts) {\r\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\r\n }\r\n } else {\r\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\r\n candidate.nextConvexSetIndex++;\r\n residualPolygons.push(candidate);\r\n }\r\n outsideParts.length = 0;\r\n }\r\n }\r\n if (outsideShards.length === 0) {\r\n builderA?.addPolygonGrowableXYZArray(visitor.point);\r\n } else if (insideShards.length === 0) {\r\n // the facet spanned clippers but is intact outside\r\n builderB?.addPolygonGrowableXYZArray(visitor.point);\r\n } else {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\r\n let worldToLocal: Transform | undefined;\r\n if (outputSelector === 1 && localToWorld !== undefined\r\n && undefined !== (worldToLocal = localToWorld.inverse())) {\r\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\r\n\r\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\r\n } else {\r\n for (const shard of insideShards)\r\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\r\n for (const shard of outsideShards)\r\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\r\n }\r\n }\r\n outsideShards.length = 0;\r\n insideShards.length = 0;\r\n }\r\n cache.dropAllToCache(outsideParts);\r\n if (destination.buildClosureFaces) {\r\n for (const clipper of allClippers.convexSets) {\r\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\r\n }\r\n }\r\n }\r\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined) {\r\n if (builder !== undefined && region !== undefined) {\r\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\r\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\r\n } else if (region instanceof UnionRegion) {\r\n for (const child of region.children)\r\n this.addRegion(builder, child);\r\n }\r\n }\r\n }\r\n // WARNING: shards are transformed into local system, not reverted!!!\r\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[],\r\n worldToLocal: Transform | undefined, localToWorld: Transform | undefined) {\r\n if (builder !== undefined && shards.length > 0) {\r\n if (worldToLocal)\r\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\r\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\r\n if (outsidePieces && outsidePieces.children.length > 0) {\r\n if (localToWorld)\r\n outsidePieces.tryTransformInPlace(localToWorld);\r\n RegionOps.consolidateAdjacentPrimitives(outsidePieces);\r\n this.addRegion(builder, outsidePieces);\r\n }\r\n }\r\n }\r\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\r\n if (polygon) {\r\n if (builder)\r\n builder.addPolygonGrowableXYZArray(polygon);\r\n cache.dropToCache(polygon);\r\n }\r\n }\r\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\r\n let polygon;\r\n while ((polygon = polygonArray.pop()) !== undefined) {\r\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\r\n }\r\n }\r\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\r\n const chainContexts = [];\r\n for (const plane of clipper.planes) {\r\n if (!plane.interior) {\r\n const c = ChainMergeContext.create();\r\n c.plane = plane;\r\n c.convexClipper = clipper;\r\n chainContexts.push(c);\r\n }\r\n }\r\n return chainContexts;\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * @internal\r\n */\r\n public static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const outsideParts: GrowableXYZArray[] = [];\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n // !!! currentCandidates and next candidates are empty at this point !!!\r\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\r\n if (insidePart === undefined) {\r\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\r\n builderB?.addPolygonGrowableXYZArray(visitor.point);\r\n cache.dropToCache(insidePart);\r\n cache.dropAllToCache(outsideParts);\r\n }\r\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\r\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\r\n }\r\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\r\n }\r\n /**\r\n *\r\n * @param visitor visitor for all facets of interest (entire polyface)\r\n * @param clipper ConvexClipPlaneSet to apply\r\n * @param destination builders to receive inside, outside parts\r\n * @param cache GrowableArray cache.\r\n */\r\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders,\r\n cache: GrowableXYZArrayCache) {\r\n if (destination.buildClosureFaces) {\r\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\r\n const workPoints = cache.grabFromCache();\r\n const facetPoints = cache.grabFromCache();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n for (const chainContext of chainContexts) {\r\n const plane = chainContext.plane;\r\n facetPoints.clear();\r\n facetPoints.pushFrom(visitor.point);\r\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\r\n chainContext.addSegmentsOnPlane(facetPoints, true);\r\n }\r\n }\r\n cache.dropToCache(facetPoints);\r\n cache.dropToCache(workPoints);\r\n for (const chainContext of chainContexts) {\r\n this.addClosureFacets(chainContext, destination, cache);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param visitor visitor for all facets of interest (entire polyface)\r\n * @param clipper ConvexClipPlaneSet to apply\r\n * @param destination builders to receive inside, outside parts\r\n * @param cache GrowableArray cache.\r\n */\r\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders,\r\n cache: GrowableXYZArrayCache) {\r\n if (destination.buildClosureFaces) {\r\n const chainContext = ChainMergeContext.create();\r\n chainContext.plane = plane;\r\n const workPoints = cache.grabFromCache();\r\n const facetPoints = cache.grabFromCache();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n facetPoints.clear();\r\n facetPoints.pushFrom(visitor.point);\r\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\r\n chainContext.addSegmentsOnPlane(facetPoints, true);\r\n }\r\n cache.dropToCache(facetPoints);\r\n cache.dropToCache(workPoints);\r\n this.addClosureFacets(chainContext, destination, cache);\r\n }\r\n }\r\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\r\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\r\n }\r\n /**\r\n * * Triangulate the contour.\r\n * * Add all the triangles to both builders\r\n * * reversed in builderB.\r\n */\r\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\r\n const polygonA = cache.grabFromCache();\r\n const polygonB = cache.grabFromCache();\r\n if (destination.builderB)\r\n destination.builderB.toggleReversedFacetFlag();\r\n contour.announceFacets((facets: IndexedPolyface) => {\r\n const visitor = facets.createVisitor();\r\n // The contour facets are convex .. easy clip ..\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n polygonA.clear();\r\n polygonA.pushFromGrowableXYZArray(visitor.point);\r\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\r\n if (polygonA.length > 2) {\r\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\r\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\r\n }\r\n }\r\n }, undefined);\r\n if (destination.builderB)\r\n destination.builderB.toggleReversedFacetFlag();\r\n cache.dropToCache(polygonA);\r\n cache.dropToCache(polygonB);\r\n }\r\n\r\n /**\r\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\r\n * @param chainContext ASSUMED TO HAVE A PLANE\r\n * @param destination\r\n */\r\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\r\n const clipper = chainContext.convexClipper;\r\n const plane = chainContext.plane!;\r\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\r\n chainContext.clusterAndMergeVerticesXYZ();\r\n const loops = chainContext.collectMaximalGrowableXYZArrays();\r\n if (loops.length > 1) {\r\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\r\n for (const loopSet of loopSets) {\r\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\r\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\r\n if (contour !== undefined) {\r\n if (clipper) {\r\n this.addClippedContour(contour, clipper, destination, cache);\r\n } else {\r\n if (destination.builderA)\r\n contour.emitFacets(destination.builderA, true, clipper);\r\n if (destination.builderB)\r\n contour.emitFacets(destination.builderB, false, clipper);\r\n }\r\n }\r\n }\r\n } else {\r\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\r\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\r\n if (contour !== undefined) {\r\n if (clipper) {\r\n this.addClippedContour(contour, clipper, destination, cache);\r\n } else {\r\n if (destination.builderA)\r\n contour.emitFacets(destination.builderA, true, clipper);\r\n if (destination.builderB)\r\n contour.emitFacets(destination.builderB, false, clipper);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Clip each facet of polyface to the the clippers.\r\n * * Add inside, outside fragments to builderA, builderB\r\n * * This does not consider params, normals, colors. Just points.\r\n * @internal\r\n */\r\n public static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders) {\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface.createVisitor(0);\r\n const cache = new GrowableXYZArrayCache();\r\n const inside = cache.grabFromCache();\r\n const outside = cache.grabFromCache();\r\n const range = Range1d.createNull();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n // !!! currentCandidates and next candidates are empty at this point !!!\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\r\n if (builderA)\r\n builderA.addPolygonGrowableXYZArray(inside);\r\n if (builderB)\r\n builderB.addPolygonGrowableXYZArray(outside);\r\n }\r\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\r\n cache.dropToCache(inside);\r\n cache.dropToCache(outside);\r\n }\r\n\r\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\r\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\r\n * * if `destination.buildClosureFaces` is set, and also build closure facets\r\n * * This method parses the variant input types and calls a more specific method.\r\n * * WARNING: The new mesh is \"points only\".\r\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\r\n */\r\n public static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders,\r\n outputSelect: number = 0) {\r\n if (clipper instanceof ClipPlane) {\r\n this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);\r\n } else if (clipper instanceof ConvexClipPlaneSet) {\r\n this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);\r\n } else if (clipper instanceof UnionOfConvexClipPlaneSets) {\r\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);\r\n }\r\n }\r\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\r\n * * This method parses the variant input types and calls a more specific method.\r\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\r\n * * WARNING: The new mesh is \"points only\".\r\n */\r\n public static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\r\n if (clipper instanceof ClipPlane)\r\n return this.clipPolyfaceClipPlane(polyface, clipper);\r\n if (clipper instanceof ConvexClipPlaneSet)\r\n return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);\r\n // (The if tests exhaust the type space -- this line is unreachable.)\r\n return undefined;\r\n }\r\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\r\n * @param points array of points around polygon. Closure edge is implied.\r\n * @param chainContext context receiving edges\r\n * @param point0 work point\r\n * @param point1 work point\r\n */\r\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d) {\r\n const n = points.length;\r\n if (n > 1) {\r\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\r\n for (let i = 0; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, point1);\r\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\r\n chainContext.addSegment(point0, point1);\r\n point0.setFromPoint3d(point1);\r\n }\r\n }\r\n }\r\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\r\n * * Return all edges chained as array of LineString3d.\r\n */\r\n public static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[] {\r\n const chainContext = ChainMergeContext.create();\r\n\r\n const visitor = polyface.createVisitor(0);\r\n const work = new GrowableXYZArray(10);\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\r\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\r\n }\r\n chainContext.clusterAndMergeVerticesXYZ();\r\n return chainContext.collectMaximalChains();\r\n }\r\n\r\n /**\r\n * * Split facets of mesh \"A\" into parts that are\r\n * * under mesh \"B\"\r\n * * over mesh \"B\"\r\n * * both meshes are represented by visitors rather than the meshes themselves\r\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\r\n * * The respective clip parts are fed to caller-supplied builders.\r\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\r\n * * This step is commonly one-half of \"cut fill\".\r\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\r\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\r\n * @param visitorA iterator over polyface to be split.\r\n * @param visitorB iterator over polyface that acts as a splitter\r\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\r\n */\r\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor,\r\n builderAUnderB: PolyfaceBuilder | undefined,\r\n builderAOverB: PolyfaceBuilder | undefined) {\r\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\r\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\r\n if (!searchA)\r\n return;\r\n const range = Range3d.create();\r\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\r\n visitorA.point.setRange(range);\r\n searchA.addRange(range, visitorA.currentReadIndex());\r\n }\r\n const xyClip = new GrowableXYZArray(10);\r\n const workArray = new GrowableXYZArray(10);\r\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\r\n const below = new GrowableXYZArray(10);\r\n const above = new GrowableXYZArray(10);\r\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\r\n const altitudeRange = Range1d.createNull();\r\n\r\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\r\n visitorB.point.setRange(range);\r\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\r\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\r\n visitorA.moveToReadIndex(readIndexA);\r\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\r\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\r\n if (xyClip.length > 0) {\r\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\r\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\r\n if (below.length > 0 && builderAUnderB)\r\n builderAUnderB.addPolygonGrowableXYZArray(below);\r\n if (above.length > 0 && builderAOverB)\r\n builderAOverB.addPolygonGrowableXYZArray(above);\r\n }\r\n return true;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * * Split facets into vertically overlapping sections\r\n * * both meshes are represented by visitors rather than the meshes themselves\r\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\r\n * * The respective clip parts are returned as separate meshes.\r\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\r\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\r\n * * Each output contains some facets from meshA and some from meshB:\r\n * * meshAUnderB -- areas where meshA is underneath mesh B.\r\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\r\n * * meshAOverB -- areas where meshB is over meshB.\r\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\r\n *\r\n * @param visitorA iterator over polyface to be split.\r\n * @param visitorB iterator over polyface that acts as a splitter\r\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\r\n */\r\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\r\n const visitorA = meshA.createVisitor();\r\n const visitorB = meshB.createVisitor();\r\n const builderAUnderB = PolyfaceBuilder.create();\r\n const builderAOverB = PolyfaceBuilder.create();\r\n builderAUnderB.toggleReversedFacetFlag();\r\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\r\n builderAUnderB.toggleReversedFacetFlag();\r\n builderAOverB.toggleReversedFacetFlag();\r\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\r\n return {\r\n meshAUnderB: builderAUnderB.claimPolyface(),\r\n meshAOverB: builderAOverB.claimPolyface(),\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Solid
|
|
3
3
|
*/
|
|
4
|
-
import { AnyCurve } from "../curve/
|
|
4
|
+
import { AnyCurve } from "../curve/CurveTypes";
|
|
5
5
|
import { CurveCollection } from "../curve/CurveCollection";
|
|
6
6
|
import { GeometryQuery } from "../curve/GeometryQuery";
|
|
7
7
|
import { GeometryHandler } from "../geometry3d/GeometryHandler";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,wDAAqD;AACrD,wCAAqC;AACrC,wCAAqC;AAErC,mEAAyD;AACzD,yDAAsD;AAEtD,uDAAoD;AAEpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,WAAY,SAAQ,+BAAc;IAO7C,YAAoB,OAAqB,EAAE,SAAmB,EAAE,MAAe;QAC7E,KAAK,CAAC,MAAM,CAAC,CAAC;QAPhB,wCAAwC;QACxB,uBAAkB,GAAG,aAAa,CAAC;QAOjD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD;;;;;OAKG;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C","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 Solid\r\n */\r\n\r\nimport { AnyCurve } from \"../curve/CurveChain\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * A LinearSweep is a `SolidPrimitive` defined by\r\n * * A set of curves (any Loop, Path, or parityRegion)\r\n * * A sweep vector\r\n * If the object is \"capped\", the curves must be planar.\r\n * @public\r\n */\r\nexport class LinearSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"linearSweep\";\r\n\r\n private _contour: SweepContour;\r\n private _direction: Vector3d;\r\n\r\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\r\n super(capped);\r\n this._contour = contour;\r\n this._direction = direction;\r\n }\r\n /**\r\n * Create a sweep of a starting contour.\r\n * @param contour contour to be swept\r\n * @param direction sweep vector. The contour is swept the full length of the vector.\r\n * @param capped true to include end caps\r\n */\r\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\r\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\r\n if (!sweepable)\r\n return undefined;\r\n return new LinearSweep(sweepable, direction, capped);\r\n }\r\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\r\n * * If not capped, the xyPoints array is always used unchanged.\r\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\r\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\r\n * * * if the final point is not close to the first an extra point is added.\r\n * * If capped, the point order will be reversed if necessary to produce positive volume.\r\n * @param xyPoints array of xy coordinates\r\n * @param z z value to be used for all coordinates\r\n * @param zSweep the sweep distance in the z direction.\r\n * @param capped true if caps are to be added.\r\n */\r\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\r\n const xyz = LineString3d.createXY(xyPoints, z, capped);\r\n if (capped) {\r\n xyz.addClosurePoint();\r\n const area = PolygonOps.areaXY(xyz.points);\r\n if (area * zSweep < 0.0)\r\n xyz.points.reverse();\r\n }\r\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\r\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\r\n }\r\n /** get a reference to the swept curves */\r\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\r\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\r\n public getSweepContourRef(): SweepContour { return this._contour; }\r\n /** return a clone of the sweep vector */\r\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\r\n /** Test if `other` is also an instance of `LinearSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\r\n /** Return a deep clone */\r\n public clone(): LinearSweep {\r\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\r\n }\r\n /** apply a transform to the curves and sweep vector */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n if (this._contour.tryTransformInPlace(transform)) {\r\n transform.multiplyVector(this._direction, this._direction);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n return this._contour.localToWorld.cloneRigid();\r\n }\r\n /** Return a transformed clone */\r\n public cloneTransformed(transform: Transform): LinearSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Test for near-equality of coordinates in `other` */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof LinearSweep) {\r\n return this._contour.isAlmostEqual(other._contour)\r\n && this._direction.isAlmostEqual(other._direction)\r\n && this.capped === other.capped;\r\n }\r\n return false;\r\n }\r\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleLinearSweep(this);\r\n }\r\n /**\r\n * Return the curves at a fraction along the sweep direction.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const section = this._contour.curves.clone();\r\n if (section && vFraction !== 0.0)\r\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\r\n return section;\r\n }\r\n /** Extend `rangeToExtend` to include this geometry. */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\r\n const contourRange = this._contour.curves.range(transform);\r\n rangeToExtend.extendRange(contourRange);\r\n if (transform) {\r\n const transformedDirection = transform.multiplyVector(this._direction);\r\n contourRange.low.addInPlace(transformedDirection);\r\n contourRange.high.addInPlace(transformedDirection);\r\n } else {\r\n contourRange.low.addInPlace(this._direction);\r\n contourRange.high.addInPlace(this._direction);\r\n }\r\n rangeToExtend.extendRange(contourRange);\r\n }\r\n /**\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped && this._contour.curves.isAnyRegionType;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"LinearSweep.js","sourceRoot":"","sources":["../../../src/solid/LinearSweep.ts"],"names":[],"mappings":";AAAA;;;+FA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AAY,CAAC,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;SACpD;aAAM;YACL,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC/C;QACD,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC;IAC7D,CAAC;CACF;AA9HD,kCA8HC","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 Solid\r\n */\r\n\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * A LinearSweep is a `SolidPrimitive` defined by\r\n * * A set of curves (any Loop, Path, or parityRegion)\r\n * * A sweep vector\r\n * If the object is \"capped\", the curves must be planar.\r\n * @public\r\n */\r\nexport class LinearSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"linearSweep\";\r\n\r\n private _contour: SweepContour;\r\n private _direction: Vector3d;\r\n\r\n private constructor(contour: SweepContour, direction: Vector3d, capped: boolean) {\r\n super(capped);\r\n this._contour = contour;\r\n this._direction = direction;\r\n }\r\n /**\r\n * Create a sweep of a starting contour.\r\n * @param contour contour to be swept\r\n * @param direction sweep vector. The contour is swept the full length of the vector.\r\n * @param capped true to include end caps\r\n */\r\n public static create(contour: AnyCurve, direction: Vector3d, capped: boolean): LinearSweep | undefined {\r\n const sweepable = SweepContour.createForLinearSweep(contour, direction);\r\n if (!sweepable)\r\n return undefined;\r\n return new LinearSweep(sweepable, direction, capped);\r\n }\r\n /** Create a z-direction sweep of the polyline or polygon given as xy linestring values.\r\n * * If not capped, the xyPoints array is always used unchanged.\r\n * * If capped but the xyPoints array does not close, exact closure will be enforced by one of these:\r\n * * * If the final point is almost equal to the first, it is replaced by the exact first point.\r\n * * * if the final point is not close to the first an extra point is added.\r\n * * If capped, the point order will be reversed if necessary to produce positive volume.\r\n * @param xyPoints array of xy coordinates\r\n * @param z z value to be used for all coordinates\r\n * @param zSweep the sweep distance in the z direction.\r\n * @param capped true if caps are to be added.\r\n */\r\n public static createZSweep(xyPoints: XAndY[], z: number, zSweep: number, capped: boolean): LinearSweep | undefined {\r\n const xyz = LineString3d.createXY(xyPoints, z, capped);\r\n if (capped) {\r\n xyz.addClosurePoint();\r\n const area = PolygonOps.areaXY(xyz.points);\r\n if (area * zSweep < 0.0)\r\n xyz.points.reverse();\r\n }\r\n const contour: CurveCollection = capped ? Loop.create(xyz) : Path.create(xyz);\r\n return LinearSweep.create(contour, Vector3d.create(0, 0, zSweep), capped);\r\n }\r\n /** get a reference to the swept curves */\r\n public getCurvesRef(): CurveCollection { return this._contour.curves; }\r\n /** Get a reference to the `SweepContour` carrying the plane of the curves */\r\n public getSweepContourRef(): SweepContour { return this._contour; }\r\n /** return a clone of the sweep vector */\r\n public cloneSweepVector(): Vector3d { return this._direction.clone(); }\r\n /** Test if `other` is also an instance of `LinearSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof LinearSweep; }\r\n /** Return a deep clone */\r\n public clone(): LinearSweep {\r\n return new LinearSweep(this._contour.clone(), this._direction.clone(), this.capped);\r\n }\r\n /** apply a transform to the curves and sweep vector */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n if (this._contour.tryTransformInPlace(transform)) {\r\n transform.multiplyVector(this._direction, this._direction);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n return this._contour.localToWorld.cloneRigid();\r\n }\r\n /** Return a transformed clone */\r\n public cloneTransformed(transform: Transform): LinearSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Test for near-equality of coordinates in `other` */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof LinearSweep) {\r\n return this._contour.isAlmostEqual(other._contour)\r\n && this._direction.isAlmostEqual(other._direction)\r\n && this.capped === other.capped;\r\n }\r\n return false;\r\n }\r\n /** Invoke strongly typed `handler.handleLinearSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleLinearSweep(this);\r\n }\r\n /**\r\n * Return the curves at a fraction along the sweep direction.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const section = this._contour.curves.clone();\r\n if (section && vFraction !== 0.0)\r\n section.tryTransformInPlace(Transform.createTranslation(this._direction.scale(vFraction)));\r\n return section;\r\n }\r\n /** Extend `rangeToExtend` to include this geometry. */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\r\n const contourRange = this._contour.curves.range(transform);\r\n rangeToExtend.extendRange(contourRange);\r\n if (transform) {\r\n const transformedDirection = transform.multiplyVector(this._direction);\r\n contourRange.low.addInPlace(transformedDirection);\r\n contourRange.high.addInPlace(transformedDirection);\r\n } else {\r\n contourRange.low.addInPlace(this._direction);\r\n contourRange.high.addInPlace(this._direction);\r\n }\r\n rangeToExtend.extendRange(contourRange);\r\n }\r\n /**\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped && this._contour.curves.isAnyRegionType;\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Solid
|
|
3
3
|
*/
|
|
4
|
-
import { AnyCurve } from "../curve/
|
|
4
|
+
import { AnyCurve } from "../curve/CurveTypes";
|
|
5
5
|
import { CurveCollection } from "../curve/CurveCollection";
|
|
6
6
|
import { GeometryQuery } from "../curve/GeometryQuery";
|
|
7
7
|
import { Angle } from "../geometry3d/Angle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAE5C,qDAAkD;AAGlD,uDAAoD;AACpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;GAQG;AACH,MAAa,eAAgB,SAAQ,+BAAc;IAOjD,YAAoB,OAAqB,EAAE,cAAqB,EAAE,UAAiB,EAAE,MAAe;QAClG,KAAK,CAAC,MAAM,CAAC,CAAC;QAPhB,wCAAwC;QACxB,uBAAkB,GAAG,iBAAiB,CAAC;QAOrD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,iCAA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B,GAAG,qBAAS,CAAC,cAAc,EAAE,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE;gBACjC,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,kBAAkB,CAAC,CAAC;gBAC1H,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;aAChD;SAEF;aAAM;YACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;SAC/F;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF;AA5HD,0CA4HC","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 Solid\r\n */\r\n\r\nimport { AnyCurve } from \"../curve/CurveChain\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * A LinearSweep is\r\n * * A planar contour (any Loop, Path, or parityRegion)\r\n * * An axis vector.\r\n * * The planar contour is expected to be in the plane of the axis vector\r\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\r\n * * A sweep angle.\r\n * @public\r\n */\r\nexport class RotationalSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"rotationalSweep\";\r\n\r\n private _contour: SweepContour;\r\n private _normalizedAxis: Ray3d;\r\n private _sweepAngle: Angle;\r\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\r\n super(capped);\r\n this._contour = contour;\r\n this._normalizedAxis = normalizedAxis;\r\n this.capped = capped;\r\n this._sweepAngle = sweepAngle;\r\n }\r\n /** Create a rotational sweep. */\r\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\r\n if (!axis.direction.normalizeInPlace())\r\n return undefined;\r\n const sweepable = SweepContour.createForRotation(contour, axis);\r\n if (!sweepable)\r\n return undefined;\r\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\r\n }\r\n\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin at origin of rotation ray\r\n * * z direction along the rotation ray.\r\n * * y direction perpendicular to the base contour plane\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\r\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\r\n if (axes) {\r\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\r\n }\r\n return undefined;\r\n }\r\n /** return clone of (not reference to) the axis vector. */\r\n public cloneAxisRay(): Ray3d { return this._normalizedAxis.clone(); }\r\n /** Return (REFERENCE TO) the swept curves. */\r\n public getCurves(): CurveCollection { return this._contour.curves; }\r\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\r\n public getSweepContourRef(): SweepContour { return this._contour; }\r\n /** Return the sweep angle. */\r\n public getSweep(): Angle { return this._sweepAngle.clone(); }\r\n /** Test if `other` is a `RotationalSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof RotationalSweep; }\r\n /** Test for same axis, capping, and swept geometry. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RotationalSweep) {\r\n return this._contour.isAlmostEqual(other._contour)\r\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\r\n && this.capped === other.capped;\r\n }\r\n return false;\r\n }\r\n /** return a deep clone */\r\n public clone(): RotationalSweep {\r\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\r\n }\r\n /** Transform the contour and axis */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (!transform.matrix.isSingular()\r\n && this._contour.tryTransformInPlace(transform)) {\r\n this._normalizedAxis.transformInPlace(transform);\r\n return this._normalizedAxis.direction.normalizeInPlace();\r\n }\r\n return false;\r\n }\r\n /** return a cloned transform. */\r\n public cloneTransformed(transform: Transform): RotationalSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRotationalSweep(this);\r\n }\r\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\r\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\r\n const radians = this._sweepAngle.radians * vFraction;\r\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\r\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\r\n result ? result.matrix : undefined) as Matrix3d);\r\n return rotation;\r\n }\r\n /**\r\n * Return the curves of a constant-v section of the solid.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const section = this._contour.curves.clone();\r\n if (section) {\r\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\r\n }\r\n return section;\r\n }\r\n /** Extend range using sampled points on the surface. */\r\n public extendRange(range: Range3d, transform?: Transform) {\r\n const degreeStep = 360 / 32;\r\n const options = StrokeOptions.createForCurves();\r\n options.angleTol = Angle.createDegrees(degreeStep);\r\n const strokes = this._contour.curves.cloneStroked(options);\r\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\r\n const stepTransform = Transform.createIdentity();\r\n if (transform) {\r\n const compositeTransform = Transform.createIdentity();\r\n for (let i = 0; i <= numStep; i++) {\r\n transform.multiplyTransformTransform(this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform);\r\n strokes.extendRange(range, compositeTransform);\r\n }\r\n\r\n } else {\r\n for (let i = 0; i <= numStep; i++)\r\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\r\n }\r\n }\r\n /**\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped || this._sweepAngle.isFullCircle;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAE5C,qDAAkD;AAGlD,uDAAoD;AACpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;GAQG;AACH,MAAa,eAAgB,SAAQ,+BAAc;IAOjD,YAAoB,OAAqB,EAAE,cAAqB,EAAE,UAAiB,EAAE,MAAe;QAClG,KAAK,CAAC,MAAM,CAAC,CAAC;QAPhB,wCAAwC;QACxB,uBAAkB,GAAG,iBAAiB,CAAC;QAOrD,IAAI,CAAC,QAAQ,GAAG,OAA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CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,MAAM,aAAa,GAAG,qBAAS,CAAC,cAAc,EAAE,CAAC;QACjD,IAAI,SAAS,EAAE;YACb,MAAM,kBAAkB,GAAG,qBAAS,CAAC,cAAc,EAAE,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE;gBACjC,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,kBAAkB,CAAC,CAAC;gBAC1H,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;aAChD;SAEF;aAAM;YACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;SAC/F;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF;AA5HD,0CA4HC","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 Solid\r\n */\r\n\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * A LinearSweep is\r\n * * A planar contour (any Loop, Path, or parityRegion)\r\n * * An axis vector.\r\n * * The planar contour is expected to be in the plane of the axis vector\r\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\r\n * * A sweep angle.\r\n * @public\r\n */\r\nexport class RotationalSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"rotationalSweep\";\r\n\r\n private _contour: SweepContour;\r\n private _normalizedAxis: Ray3d;\r\n private _sweepAngle: Angle;\r\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\r\n super(capped);\r\n this._contour = contour;\r\n this._normalizedAxis = normalizedAxis;\r\n this.capped = capped;\r\n this._sweepAngle = sweepAngle;\r\n }\r\n /** Create a rotational sweep. */\r\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\r\n if (!axis.direction.normalizeInPlace())\r\n return undefined;\r\n const sweepable = SweepContour.createForRotation(contour, axis);\r\n if (!sweepable)\r\n return undefined;\r\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\r\n }\r\n\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin at origin of rotation ray\r\n * * z direction along the rotation ray.\r\n * * y direction perpendicular to the base contour plane\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\r\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\r\n if (axes) {\r\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\r\n }\r\n return undefined;\r\n }\r\n /** return clone of (not reference to) the axis vector. */\r\n public cloneAxisRay(): Ray3d { return this._normalizedAxis.clone(); }\r\n /** Return (REFERENCE TO) the swept curves. */\r\n public getCurves(): CurveCollection { return this._contour.curves; }\r\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\r\n public getSweepContourRef(): SweepContour { return this._contour; }\r\n /** Return the sweep angle. */\r\n public getSweep(): Angle { return this._sweepAngle.clone(); }\r\n /** Test if `other` is a `RotationalSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof RotationalSweep; }\r\n /** Test for same axis, capping, and swept geometry. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RotationalSweep) {\r\n return this._contour.isAlmostEqual(other._contour)\r\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\r\n && this.capped === other.capped;\r\n }\r\n return false;\r\n }\r\n /** return a deep clone */\r\n public clone(): RotationalSweep {\r\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\r\n }\r\n /** Transform the contour and axis */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (!transform.matrix.isSingular()\r\n && this._contour.tryTransformInPlace(transform)) {\r\n this._normalizedAxis.transformInPlace(transform);\r\n return this._normalizedAxis.direction.normalizeInPlace();\r\n }\r\n return false;\r\n }\r\n /** return a cloned transform. */\r\n public cloneTransformed(transform: Transform): RotationalSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRotationalSweep(this);\r\n }\r\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\r\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\r\n const radians = this._sweepAngle.radians * vFraction;\r\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\r\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\r\n result ? result.matrix : undefined) as Matrix3d);\r\n return rotation;\r\n }\r\n /**\r\n * Return the curves of a constant-v section of the solid.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const section = this._contour.curves.clone();\r\n if (section) {\r\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\r\n }\r\n return section;\r\n }\r\n /** Extend range using sampled points on the surface. */\r\n public extendRange(range: Range3d, transform?: Transform) {\r\n const degreeStep = 360 / 32;\r\n const options = StrokeOptions.createForCurves();\r\n options.angleTol = Angle.createDegrees(degreeStep);\r\n const strokes = this._contour.curves.cloneStroked(options);\r\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\r\n const stepTransform = Transform.createIdentity();\r\n if (transform) {\r\n const compositeTransform = Transform.createIdentity();\r\n for (let i = 0; i <= numStep; i++) {\r\n transform.multiplyTransformTransform(this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform);\r\n strokes.extendRange(range, compositeTransform);\r\n }\r\n\r\n } else {\r\n for (let i = 0; i <= numStep; i++)\r\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\r\n }\r\n }\r\n /**\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped || this._sweepAngle.isFullCircle;\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCurve } from "../curve/
|
|
1
|
+
import { AnyCurve } from "../curve/CurveTypes";
|
|
2
2
|
import { CurveCollection } from "../curve/CurveCollection";
|
|
3
3
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
4
4
|
import { GeometryQuery } from "../curve/GeometryQuery";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuledSweep.js","sourceRoot":"","s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;SACpB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;;;OAIG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CAEF;AApLD,gCAoLC","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 Solid\r\n */\r\n\r\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\r\nimport { AnyCurve } from \"../curve/CurveChain\";\r\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * * type for a function argument taking 2 curves and returning another curve or failing with undefined.\r\n * * This is used (for instance) by `RuleSweep.mutatePartners`\r\n * @public\r\n */\r\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\r\n/**\r\n * A ruled sweep (surface) is a collection of 2 or more contours.\r\n * * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves)\r\n * @public\r\n */\r\nexport class RuledSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"ruledSweep\";\r\n\r\n private _contours: SweepContour[];\r\n private constructor(contours: SweepContour[], capped: boolean) {\r\n super(capped);\r\n this._contours = contours;\r\n }\r\n /**\r\n * Create a ruled sweep from an array of contours.\r\n * * the contours are CAPTURED (not cloned)\r\n */\r\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\r\n const sweepContours = [];\r\n for (const contour of contours) {\r\n const sweepable = SweepContour.createForLinearSweep(contour);\r\n if (sweepable === undefined) return undefined;\r\n sweepContours.push(sweepable);\r\n }\r\n return new RuledSweep(sweepContours, capped);\r\n }\r\n /** Return a reference to the array of SweepContour. */\r\n public sweepContoursRef(): SweepContour[] { return this._contours; }\r\n /** Return clones of all the sweep contours\r\n * * See also cloneContours, which returns the spatial contours without their local coordinate system definitions)\r\n */\r\n public cloneSweepContours(): SweepContour[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.clone());\r\n }\r\n return result;\r\n }\r\n /** Return clones of all the contours\r\n * * See also cloneContours, which returns the contours in their local coordinate systems\r\n */\r\n public cloneContours(): CurveCollection[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.curves.clone());\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone */\r\n public clone(): RuledSweep {\r\n return new RuledSweep(this.cloneSweepContours(), this.capped);\r\n }\r\n /** Transform all contours in place. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n for (const contour of this._contours) {\r\n contour.tryTransformInPlace(transform);\r\n }\r\n return true;\r\n }\r\n /** Return a cloned transform. */\r\n public cloneTransformed(transform: Transform): RuledSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n if (this._contours.length === 0) return undefined;\r\n return this._contours[0].localToWorld.cloneRigid();\r\n }\r\n /** Test if `other` is an instance of a `RuledSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof RuledSweep; }\r\n /** test same contour geometry and capping. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RuledSweep) {\r\n if (this.capped !== other.capped) return false;\r\n if (this._contours.length !== other._contours.length) return false;\r\n for (let i = 0; i < this._contours.length; i++) {\r\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** dispatch to strongly typed `handler.handleRuledSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRuledSweep(this);\r\n }\r\n /**\r\n * Return the section curves at a fraction of the sweep\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const numSection = this._contours.length;\r\n if (numSection < 2)\r\n return undefined;\r\n const q = vFraction * numSection;\r\n let section0 = 0;\r\n if (vFraction >= 1.0)\r\n section0 = numSection - 1;\r\n else\r\n section0 = Math.floor(q);\r\n if (section0 + 1 >= numSection)\r\n section0 = numSection - 2;\r\n const section1 = section0 + 1;\r\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\r\n return RuledSweep.mutatePartners(this._contours[section0].curves, this._contours[section1].curves,\r\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\r\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\r\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\r\n return undefined;\r\n });\r\n }\r\n /** Pass each contour to `extendRange` */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n for (const contour of this._contours)\r\n contour.curves.extendRange(rangeToExtend, transform);\r\n }\r\n\r\n /** Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed by the caller-supplied primitiveMutator function.\r\n * @returns Returns undefined if there is any type mismatch between the two collections.\r\n */\r\n public static mutatePartners(collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator): CurveCollection | undefined {\r\n if (!collectionA.isSameGeometryClass(collectionB))\r\n return undefined;\r\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\r\n const chainA = collectionA;\r\n const chainB = collectionB;\r\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\r\n const childrenA = chainA.children;\r\n const childrenB = chainB.children;\r\n if (childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\r\n if (!newChild)\r\n return undefined;\r\n chainC.children.push(newChild);\r\n }\r\n return chainC;\r\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\r\n const collectionC = collectionA.cloneEmptyPeer();\r\n const childrenA = collectionA.children;\r\n const childrenB = collectionB.children;\r\n const childrenC = collectionC.children;\r\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const childA = childrenA[i];\r\n const childB = childrenB[i];\r\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\r\n const newPrimitive = primitiveMutator(childA, childB);\r\n if (!newPrimitive)\r\n return undefined;\r\n childrenC.push(newPrimitive);\r\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\r\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\r\n if (!newChild)\r\n return undefined;\r\n if (newChild instanceof CurveCollection)\r\n childrenC.push(newChild);\r\n }\r\n }\r\n return collectionC;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return true if this is a closed volume, as observed by\r\n * * cap flag\r\n * identical first and last contours.\r\n */\r\n public get isClosedVolume(): boolean {\r\n const n = this._contours.length;\r\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RuledSweep.js","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sFAAmF;AAEnF,8DAAuE;AACvE,4DAAyD;AAEzD,0CAAuC;AAIvC,qDAAkD;AAClD,iDAA8C;AAQ9C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,+BAAc;IAK5C,YAAoB,QAAwB,EAAE,MAAe;QAC3D,KAAK,CAAC,MAAM,CAAC,CAAC;QALhB,wCAAwC;QACxB,uBAAkB,GAAG,YAAY,CAAC;QAKhD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,QAAoB,EAAE,MAAe;QACxD,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,MAAM,SAAS,GAAG,2BAAY,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC7D,IAAI,SAAS,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAC;YAC9C,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/B;QACD,OAAO,IAAI,UAAU,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,uDAAuD;IAChD,gBAAgB,KAAqB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE;;OAEG;IACI,kBAAkB;QACvB,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;OAEG;IACI,aAAa;QAClB,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ACnB,IAAI,QAAQ,YAAY,iCAAe;wBACrC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBAC5B;aACF;YACD,OAAO,WAAW,CAAC;SACpB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;;;OAIG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CAEF;AApLD,gCAoLC","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 Solid\r\n */\r\n\r\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * * type for a function argument taking 2 curves and returning another curve or failing with undefined.\r\n * * This is used (for instance) by `RuleSweep.mutatePartners`\r\n * @public\r\n */\r\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\r\n/**\r\n * A ruled sweep (surface) is a collection of 2 or more contours.\r\n * * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves)\r\n * @public\r\n */\r\nexport class RuledSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"ruledSweep\";\r\n\r\n private _contours: SweepContour[];\r\n private constructor(contours: SweepContour[], capped: boolean) {\r\n super(capped);\r\n this._contours = contours;\r\n }\r\n /**\r\n * Create a ruled sweep from an array of contours.\r\n * * the contours are CAPTURED (not cloned)\r\n */\r\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\r\n const sweepContours = [];\r\n for (const contour of contours) {\r\n const sweepable = SweepContour.createForLinearSweep(contour);\r\n if (sweepable === undefined) return undefined;\r\n sweepContours.push(sweepable);\r\n }\r\n return new RuledSweep(sweepContours, capped);\r\n }\r\n /** Return a reference to the array of SweepContour. */\r\n public sweepContoursRef(): SweepContour[] { return this._contours; }\r\n /** Return clones of all the sweep contours\r\n * * See also cloneContours, which returns the spatial contours without their local coordinate system definitions)\r\n */\r\n public cloneSweepContours(): SweepContour[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.clone());\r\n }\r\n return result;\r\n }\r\n /** Return clones of all the contours\r\n * * See also cloneContours, which returns the contours in their local coordinate systems\r\n */\r\n public cloneContours(): CurveCollection[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.curves.clone());\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone */\r\n public clone(): RuledSweep {\r\n return new RuledSweep(this.cloneSweepContours(), this.capped);\r\n }\r\n /** Transform all contours in place. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n for (const contour of this._contours) {\r\n contour.tryTransformInPlace(transform);\r\n }\r\n return true;\r\n }\r\n /** Return a cloned transform. */\r\n public cloneTransformed(transform: Transform): RuledSweep {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n if (this._contours.length === 0) return undefined;\r\n return this._contours[0].localToWorld.cloneRigid();\r\n }\r\n /** Test if `other` is an instance of a `RuledSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof RuledSweep; }\r\n /** test same contour geometry and capping. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RuledSweep) {\r\n if (this.capped !== other.capped) return false;\r\n if (this._contours.length !== other._contours.length) return false;\r\n for (let i = 0; i < this._contours.length; i++) {\r\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** dispatch to strongly typed `handler.handleRuledSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRuledSweep(this);\r\n }\r\n /**\r\n * Return the section curves at a fraction of the sweep\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const numSection = this._contours.length;\r\n if (numSection < 2)\r\n return undefined;\r\n const q = vFraction * numSection;\r\n let section0 = 0;\r\n if (vFraction >= 1.0)\r\n section0 = numSection - 1;\r\n else\r\n section0 = Math.floor(q);\r\n if (section0 + 1 >= numSection)\r\n section0 = numSection - 2;\r\n const section1 = section0 + 1;\r\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\r\n return RuledSweep.mutatePartners(this._contours[section0].curves, this._contours[section1].curves,\r\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\r\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\r\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\r\n return undefined;\r\n });\r\n }\r\n /** Pass each contour to `extendRange` */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n for (const contour of this._contours)\r\n contour.curves.extendRange(rangeToExtend, transform);\r\n }\r\n\r\n /** Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed by the caller-supplied primitiveMutator function.\r\n * @returns Returns undefined if there is any type mismatch between the two collections.\r\n */\r\n public static mutatePartners(collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator): CurveCollection | undefined {\r\n if (!collectionA.isSameGeometryClass(collectionB))\r\n return undefined;\r\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\r\n const chainA = collectionA;\r\n const chainB = collectionB;\r\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\r\n const childrenA = chainA.children;\r\n const childrenB = chainB.children;\r\n if (childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\r\n if (!newChild)\r\n return undefined;\r\n chainC.children.push(newChild);\r\n }\r\n return chainC;\r\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\r\n const collectionC = collectionA.cloneEmptyPeer();\r\n const childrenA = collectionA.children;\r\n const childrenB = collectionB.children;\r\n const childrenC = collectionC.children;\r\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const childA = childrenA[i];\r\n const childB = childrenB[i];\r\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\r\n const newPrimitive = primitiveMutator(childA, childB);\r\n if (!newPrimitive)\r\n return undefined;\r\n childrenC.push(newPrimitive);\r\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\r\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\r\n if (!newChild)\r\n return undefined;\r\n if (newChild instanceof CurveCollection)\r\n childrenC.push(newChild);\r\n }\r\n }\r\n return collectionC;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return true if this is a closed volume, as observed by\r\n * * cap flag\r\n * identical first and last contours.\r\n */\r\n public get isClosedVolume(): boolean {\r\n const n = this._contours.length;\r\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnionOfConvexClipPlaneSets } from "../clipping/UnionOfConvexClipPlaneSets";
|
|
2
|
-
import { AnyCurve } from "../curve/
|
|
2
|
+
import { AnyCurve } from "../curve/CurveTypes";
|
|
3
3
|
import { CurveCollection } from "../curve/CurveCollection";
|
|
4
4
|
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
5
5
|
import { Vector3d } from "../geometry3d/Point3dVector3d";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SweepContour.js","sourceRoot":"","sources":["../../../src/solid/SweepContour.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,qDAAkD;AAClD,uEAAoE;AACpE,uFAAoF;AAGpF,4DAAyD;AACzD,wDAAqD;AACrD,wCAAqC;AACrC,wDAAqD;AACrD,wCAAqC;AACrC,kDAA+C;AAE/C,6DAA0D;AAC1D,mEAAkE;AAClE,yDAAsD;AAItD,iEAA8D;AAC9D,yEAAsE;AACtE,6DAAqF;AAErF;;;;GAIG;AACH,MAAa,YAAY;IAQvB,YAAoB,OAAiB,EAAE,GAAc,EAAE,IAAuB;QAC5E,IAAI,OAAO,YAAY,+BAAc,EAAE;YACrC,2FAA2F;YAC3F,4FAA4F;YAC5F,MAAM,SAAS,GAAG,OAAO,CAAC;YAC1B,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,WAAI,EAAE,CAAC,CAAC,CAAC,IAAI,WAAI,EAAE,CAAC;YAC3F,OAAO,CAAC,WAAW,CAAC,SAAS,C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AC;CACF;AA1PD,oCA0PC","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 Solid\r\n */\r\n\r\nimport { ClipPlane } from \"../clipping/ClipPlane\";\r\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\r\nimport { AnyCurve } from \"../curve/CurveChain\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { RegionOps } from \"../curve/RegionOps\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\n\r\n/**\r\n * Sweepable contour with Transform for local to world interaction.\r\n * * The surface/solid classes `LinearSweep`, `RotationalSweep`, `RuledSweep` use this for their swept contours.\r\n * @public\r\n */\r\nexport class SweepContour {\r\n /** The underlying curve collection, in its world coordinates position. */\r\n public curves: CurveCollection;\r\n /** coordinate frame that in which the curves are all in the xy plane. */\r\n public localToWorld: Transform;\r\n /** Axis used only in rotational case. */\r\n public axis: Ray3d | undefined;\r\n\r\n private constructor(contour: AnyCurve, map: Transform, axis: Ray3d | undefined) {\r\n if (contour instanceof CurvePrimitive) {\r\n // this.curves is a CurveCollection (not AnyCurve) so that contour type determines closure.\r\n // This is the only time we detect CurvePrimitive closure and wrap as a relevant CurveChain.\r\n const primitive = contour;\r\n contour = contour.startPoint().isAlmostEqual(contour.endPoint()) ? new Loop() : new Path();\r\n contour.tryAddChild(primitive);\r\n }\r\n this.curves = contour;\r\n this.localToWorld = map;\r\n this.axis = axis;\r\n }\r\n /** Create for linear sweep.\r\n * * The optional default normal may be useful for guiding coordinate frame setup.\r\n * * the contour is CAPTURED.\r\n */\r\n public static createForLinearSweep(contour: AnyCurve, defaultNormal?: Vector3d): SweepContour | undefined {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(defaultNormal, contour);\r\n if (localToWorld) {\r\n return new SweepContour(contour, localToWorld, undefined);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create for linear sweep.\r\n * * The optional default normal may be useful for guiding coordinate frame setup.\r\n * * the points are captured into linestrings and Loops as needed.\r\n */\r\n public static createForPolygon(points: MultiLineStringDataVariant, defaultNormal?: Vector3d): SweepContour | undefined {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(defaultNormal, points);\r\n if (localToWorld) {\r\n if (defaultNormal !== undefined) {\r\n if (localToWorld.matrix.dotColumnZ(defaultNormal))\r\n localToWorld.matrix.scaleColumnsInPlace(1.0, -1.0, -1.0);\r\n }\r\n const linestrings = LineString3d.createArrayOfLineString3d(points);\r\n const loops = [];\r\n for (const ls of linestrings) {\r\n ls.addClosurePoint();\r\n loops.push(Loop.create(ls));\r\n }\r\n if (loops.length === 1) {\r\n return new SweepContour(loops[0], localToWorld, undefined);\r\n } else if (loops.length > 1) {\r\n return new SweepContour(ParityRegion.createLoops(loops), localToWorld, undefined);\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create for rotational sweep.\r\n * * The axis ray is retained.\r\n * * the contour is CAPTURED.\r\n */\r\n public static createForRotation(contour: AnyCurve, axis: Ray3d): SweepContour | undefined {\r\n // createRightHandedFrame -- the axis is a last-gasp resolver for in-plane vectors.\r\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, contour, axis);\r\n if (localToWorld) {\r\n return new SweepContour(contour, localToWorld, axis.clone());\r\n }\r\n return undefined;\r\n }\r\n /** Return (Reference to) the curves */\r\n public getCurves(): CurveCollection { return this.curves; }\r\n /** Apply `transform` to the curves, axis.\r\n * * The local to world frame is reconstructed for the transformed curves.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (this.curves.tryTransformInPlace(transform)) {\r\n if (this.axis)\r\n this.axis.transformInPlace(transform);\r\n\r\n const localToWorld = this.axis !== undefined\r\n ? FrameBuilder.createRightHandedFrame(undefined, this.curves, this.axis)\r\n : FrameBuilder.createRightHandedFrame(undefined, this.curves);\r\n if (localToWorld) {\r\n this.localToWorld.setFrom(localToWorld);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): SweepContour {\r\n return new SweepContour(this.curves.clone(), this.localToWorld.clone(), this.axis);\r\n }\r\n /** Return a transformed clone. */\r\n public cloneTransformed(transform: Transform): SweepContour | undefined {\r\n const newContour = this.clone();\r\n if (newContour.tryTransformInPlace(transform))\r\n return newContour;\r\n return undefined;\r\n }\r\n /** Test for near equality of cures and local frame. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof SweepContour) {\r\n return this.curves.isAlmostEqual(other.curves) && this.localToWorld.isAlmostEqual(other.localToWorld);\r\n }\r\n return false;\r\n }\r\n\r\n private _xyStrokes?: AnyCurve;\r\n private _facets?: IndexedPolyface;\r\n public get xyStrokes(): AnyCurve | undefined { return this._xyStrokes; }\r\n /**\r\n * build the (cached) internal facets.\r\n * @param options options for stroking the curves.\r\n */\r\n public buildFacets(options: StrokeOptions | undefined): void {\r\n if (!this._facets) {\r\n if (this.curves instanceof Loop) {\r\n this._xyStrokes = this.curves.cloneStroked(options);\r\n if (this._xyStrokes instanceof Loop && this._xyStrokes.children.length === 1) {\r\n const children = this._xyStrokes.children;\r\n const linestring = children[0] as LineString3d;\r\n const points = linestring.points;\r\n this.localToWorld.multiplyInversePoint3dArrayInPlace(points);\r\n if (PolygonOps.sumTriangleAreasXY(points) < 0)\r\n points.reverse();\r\n const graph = Triangulator.createTriangulatedGraphFromSingleLoop(points);\r\n if (graph) {\r\n Triangulator.flipTriangles(graph);\r\n const unflippedPoly = PolyfaceBuilder.graphToPolyface(graph, options);\r\n this._facets = unflippedPoly;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n } else { // earcut failed (e.g., on a split washer polygon, where the bridge edge is traversed twice)\r\n const polyface = RegionOps.polygonXYAreaUnionLoopsToPolyface(points, [], true);\r\n if (polyface) {\r\n this._facets = polyface as IndexedPolyface;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n }\r\n }\r\n }\r\n } else if (this.curves instanceof ParityRegion) {\r\n this._xyStrokes = this.curves.cloneStroked(options);\r\n if (this._xyStrokes instanceof (ParityRegion)) {\r\n const worldToLocal = this.localToWorld.inverse()!;\r\n this._xyStrokes.tryTransformInPlace(worldToLocal);\r\n const strokes = [];\r\n for (const childLoop of this._xyStrokes.children) {\r\n const loopCurves = childLoop.children;\r\n if (loopCurves.length === 1) {\r\n const c = loopCurves[0];\r\n if (c instanceof LineString3d)\r\n strokes.push(c.packedPoints);\r\n }\r\n }\r\n const numLoops = strokes.length;\r\n /** Try the earcut algorithm first -- lots less machinery, but can't handle any form of overlap */\r\n const graph = Triangulator.createTriangulatedGraphFromLoops(strokes);\r\n if (graph && HalfEdgeGraphSearch.isTriangulatedCCW(graph, true, numLoops - 1)) {\r\n Triangulator.flipTriangles(graph);\r\n const unflippedPoly = PolyfaceBuilder.graphToPolyface(graph, options);\r\n this._facets = unflippedPoly;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n } else {\r\n // earcut failed. Restart with full merge and parity analysis.\r\n const polyface = RegionOps.polygonXYAreaUnionLoopsToPolyface(strokes, [], true);\r\n if (polyface) {\r\n this._facets = polyface as IndexedPolyface;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** delete existing facets.\r\n * * This protects against PolyfaceBuilder reusing facets constructed with different options settings.\r\n */\r\n public purgeFacets() {\r\n this._facets = undefined;\r\n }\r\n\r\n /** Emit facets to a builder.\r\n * This method may cache and reuse facets over multiple calls.\r\n */\r\n public emitFacets(builder: PolyfaceBuilder, reverse: boolean, transform?: Transform) {\r\n this.buildFacets(builder.options);\r\n if (this._facets)\r\n builder.addIndexedPolyface(this._facets, reverse, transform);\r\n }\r\n\r\n /** Emit facets to a function\r\n * This method may cache and reuse facets over multiple calls.\r\n */\r\n public announceFacets(announce: (facets: IndexedPolyface) => void, options: StrokeOptions | undefined) {\r\n this.buildFacets(options);\r\n if (this._facets)\r\n announce(this._facets);\r\n }\r\n\r\n /**\r\n * Triangulate the region.\r\n * Create a UnionOfConvexClipPlaneSets that clips to the swept region.\r\n * * If sweepVector is not given, the sweep direction is perpendicular to the plane of the contour.\r\n * * If sweepVector is given, it is the sweep direction and does not have to be perpendicular to the contour.\r\n * * cap0 and cap1 indicate construction of clip planes parallel to the contour plane.\r\n * * If cap1 is true, the cap plane is at `anyPointOnPlane + sweepVector`. That is, the sweep vector indicates both direction and distance.\r\n * * caps are NOT created of sweepVector is not given.\r\n */\r\n public sweepToUnionOfConvexClipPlaneSets(sweepVector?: Vector3d, cap0: boolean = false, cap1: boolean = false): UnionOfConvexClipPlaneSets | undefined {\r\n const builder = PolyfaceBuilder.create();\r\n // It's a trip around the barn, but it's easy to make a polyface and scan it . . .\r\n if (!sweepVector)\r\n cap0 = cap1 = false;\r\n this.buildFacets(builder.options);\r\n if (sweepVector === undefined)\r\n sweepVector = this.localToWorld.matrix.columnZ();\r\n const zVector = this.localToWorld.matrix.columnZ();\r\n const facets = this._facets;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n if (facets) {\r\n const plane0Origin = this.localToWorld.getOrigin();\r\n const plane1Origin = plane0Origin.plus(sweepVector);\r\n const inwardNormal0 = zVector.clone();\r\n const inwardNormal1 = zVector.negate();\r\n\r\n const result = UnionOfConvexClipPlaneSets.createEmpty();\r\n const visitor = facets.createVisitor(1);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n const numEdges = visitor.point.length - 1;\r\n const clipper = ConvexClipPlaneSet.createEmpty();\r\n for (let i = 0; i < numEdges; i++) {\r\n visitor.point.getPoint3dAtUncheckedPointIndex(i, point0);\r\n visitor.point.getPoint3dAtUncheckedPointIndex(i + 1, point1);\r\n const plane = ClipPlane.createEdgeAndUpVector(point1, point0, sweepVector);\r\n const visible = visitor.edgeVisible[i];\r\n plane?.setFlags(!visible, !visible);\r\n clipper.addPlaneToConvexSet(plane);\r\n }\r\n if (cap0)\r\n clipper.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(inwardNormal0, plane0Origin));\r\n if (cap1)\r\n clipper.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(inwardNormal1, plane1Origin));\r\n result.addConvexSet(clipper);\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SweepContour.js","sourceRoot":"","sources":["../../../src/solid/SweepContour.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,qDAAkD;AAClD,uEAAoE;AACpE,uFAAoF;AAGpF,4DAAyD;AACzD,wDAAqD;AACrD,wCAAqC;AACrC,wDAAqD;AACrD,wCAAqC;AACrC,kDAA+C;AAE/C,6DAA0D;AAC1D,mEAAkE;AAClE,yDAAsD;AAItD,iEAA8D;AAC9D,yEAAsE;AACtE,6DAAqF;AAErF;;;;GAIG;AACH,MAAa,YAAY;IAQvB,YAAoB,OAAiB,EAAE,GAAc,EA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N,OAAO,CAAC,mBAAmB,CAAC,qBAAS,CAAC,oBAAoB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;gBAC3F,IAAI,IAAI;oBACN,OAAO,CAAC,mBAAmB,CAAC,qBAAS,CAAC,oBAAoB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;gBAC3F,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;aAC9B;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA1PD,oCA0PC","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 Solid\r\n */\r\n\r\nimport { ClipPlane } from \"../clipping/ClipPlane\";\r\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { RegionOps } from \"../curve/RegionOps\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\n\r\n/**\r\n * Sweepable contour with Transform for local to world interaction.\r\n * * The surface/solid classes `LinearSweep`, `RotationalSweep`, `RuledSweep` use this for their swept contours.\r\n * @public\r\n */\r\nexport class SweepContour {\r\n /** The underlying curve collection, in its world coordinates position. */\r\n public curves: CurveCollection;\r\n /** coordinate frame that in which the curves are all in the xy plane. */\r\n public localToWorld: Transform;\r\n /** Axis used only in rotational case. */\r\n public axis: Ray3d | undefined;\r\n\r\n private constructor(contour: AnyCurve, map: Transform, axis: Ray3d | undefined) {\r\n if (contour instanceof CurvePrimitive) {\r\n // this.curves is a CurveCollection (not AnyCurve) so that contour type determines closure.\r\n // This is the only time we detect CurvePrimitive closure and wrap as a relevant CurveChain.\r\n const primitive = contour;\r\n contour = contour.startPoint().isAlmostEqual(contour.endPoint()) ? new Loop() : new Path();\r\n contour.tryAddChild(primitive);\r\n }\r\n this.curves = contour;\r\n this.localToWorld = map;\r\n this.axis = axis;\r\n }\r\n /** Create for linear sweep.\r\n * * The optional default normal may be useful for guiding coordinate frame setup.\r\n * * the contour is CAPTURED.\r\n */\r\n public static createForLinearSweep(contour: AnyCurve, defaultNormal?: Vector3d): SweepContour | undefined {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(defaultNormal, contour);\r\n if (localToWorld) {\r\n return new SweepContour(contour, localToWorld, undefined);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create for linear sweep.\r\n * * The optional default normal may be useful for guiding coordinate frame setup.\r\n * * the points are captured into linestrings and Loops as needed.\r\n */\r\n public static createForPolygon(points: MultiLineStringDataVariant, defaultNormal?: Vector3d): SweepContour | undefined {\r\n const localToWorld = FrameBuilder.createRightHandedFrame(defaultNormal, points);\r\n if (localToWorld) {\r\n if (defaultNormal !== undefined) {\r\n if (localToWorld.matrix.dotColumnZ(defaultNormal))\r\n localToWorld.matrix.scaleColumnsInPlace(1.0, -1.0, -1.0);\r\n }\r\n const linestrings = LineString3d.createArrayOfLineString3d(points);\r\n const loops = [];\r\n for (const ls of linestrings) {\r\n ls.addClosurePoint();\r\n loops.push(Loop.create(ls));\r\n }\r\n if (loops.length === 1) {\r\n return new SweepContour(loops[0], localToWorld, undefined);\r\n } else if (loops.length > 1) {\r\n return new SweepContour(ParityRegion.createLoops(loops), localToWorld, undefined);\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create for rotational sweep.\r\n * * The axis ray is retained.\r\n * * the contour is CAPTURED.\r\n */\r\n public static createForRotation(contour: AnyCurve, axis: Ray3d): SweepContour | undefined {\r\n // createRightHandedFrame -- the axis is a last-gasp resolver for in-plane vectors.\r\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, contour, axis);\r\n if (localToWorld) {\r\n return new SweepContour(contour, localToWorld, axis.clone());\r\n }\r\n return undefined;\r\n }\r\n /** Return (Reference to) the curves */\r\n public getCurves(): CurveCollection { return this.curves; }\r\n /** Apply `transform` to the curves, axis.\r\n * * The local to world frame is reconstructed for the transformed curves.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (this.curves.tryTransformInPlace(transform)) {\r\n if (this.axis)\r\n this.axis.transformInPlace(transform);\r\n\r\n const localToWorld = this.axis !== undefined\r\n ? FrameBuilder.createRightHandedFrame(undefined, this.curves, this.axis)\r\n : FrameBuilder.createRightHandedFrame(undefined, this.curves);\r\n if (localToWorld) {\r\n this.localToWorld.setFrom(localToWorld);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): SweepContour {\r\n return new SweepContour(this.curves.clone(), this.localToWorld.clone(), this.axis);\r\n }\r\n /** Return a transformed clone. */\r\n public cloneTransformed(transform: Transform): SweepContour | undefined {\r\n const newContour = this.clone();\r\n if (newContour.tryTransformInPlace(transform))\r\n return newContour;\r\n return undefined;\r\n }\r\n /** Test for near equality of cures and local frame. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof SweepContour) {\r\n return this.curves.isAlmostEqual(other.curves) && this.localToWorld.isAlmostEqual(other.localToWorld);\r\n }\r\n return false;\r\n }\r\n\r\n private _xyStrokes?: AnyCurve;\r\n private _facets?: IndexedPolyface;\r\n public get xyStrokes(): AnyCurve | undefined { return this._xyStrokes; }\r\n /**\r\n * build the (cached) internal facets.\r\n * @param options options for stroking the curves.\r\n */\r\n public buildFacets(options: StrokeOptions | undefined): void {\r\n if (!this._facets) {\r\n if (this.curves instanceof Loop) {\r\n this._xyStrokes = this.curves.cloneStroked(options);\r\n if (this._xyStrokes instanceof Loop && this._xyStrokes.children.length === 1) {\r\n const children = this._xyStrokes.children;\r\n const linestring = children[0] as LineString3d;\r\n const points = linestring.points;\r\n this.localToWorld.multiplyInversePoint3dArrayInPlace(points);\r\n if (PolygonOps.sumTriangleAreasXY(points) < 0)\r\n points.reverse();\r\n const graph = Triangulator.createTriangulatedGraphFromSingleLoop(points);\r\n if (graph) {\r\n Triangulator.flipTriangles(graph);\r\n const unflippedPoly = PolyfaceBuilder.graphToPolyface(graph, options);\r\n this._facets = unflippedPoly;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n } else { // earcut failed (e.g., on a split washer polygon, where the bridge edge is traversed twice)\r\n const polyface = RegionOps.polygonXYAreaUnionLoopsToPolyface(points, [], true);\r\n if (polyface) {\r\n this._facets = polyface as IndexedPolyface;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n }\r\n }\r\n }\r\n } else if (this.curves instanceof ParityRegion) {\r\n this._xyStrokes = this.curves.cloneStroked(options);\r\n if (this._xyStrokes instanceof (ParityRegion)) {\r\n const worldToLocal = this.localToWorld.inverse()!;\r\n this._xyStrokes.tryTransformInPlace(worldToLocal);\r\n const strokes = [];\r\n for (const childLoop of this._xyStrokes.children) {\r\n const loopCurves = childLoop.children;\r\n if (loopCurves.length === 1) {\r\n const c = loopCurves[0];\r\n if (c instanceof LineString3d)\r\n strokes.push(c.packedPoints);\r\n }\r\n }\r\n const numLoops = strokes.length;\r\n /** Try the earcut algorithm first -- lots less machinery, but can't handle any form of overlap */\r\n const graph = Triangulator.createTriangulatedGraphFromLoops(strokes);\r\n if (graph && HalfEdgeGraphSearch.isTriangulatedCCW(graph, true, numLoops - 1)) {\r\n Triangulator.flipTriangles(graph);\r\n const unflippedPoly = PolyfaceBuilder.graphToPolyface(graph, options);\r\n this._facets = unflippedPoly;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n } else {\r\n // earcut failed. Restart with full merge and parity analysis.\r\n const polyface = RegionOps.polygonXYAreaUnionLoopsToPolyface(strokes, [], true);\r\n if (polyface) {\r\n this._facets = polyface as IndexedPolyface;\r\n this._facets.tryTransformInPlace(this.localToWorld);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** delete existing facets.\r\n * * This protects against PolyfaceBuilder reusing facets constructed with different options settings.\r\n */\r\n public purgeFacets() {\r\n this._facets = undefined;\r\n }\r\n\r\n /** Emit facets to a builder.\r\n * This method may cache and reuse facets over multiple calls.\r\n */\r\n public emitFacets(builder: PolyfaceBuilder, reverse: boolean, transform?: Transform) {\r\n this.buildFacets(builder.options);\r\n if (this._facets)\r\n builder.addIndexedPolyface(this._facets, reverse, transform);\r\n }\r\n\r\n /** Emit facets to a function\r\n * This method may cache and reuse facets over multiple calls.\r\n */\r\n public announceFacets(announce: (facets: IndexedPolyface) => void, options: StrokeOptions | undefined) {\r\n this.buildFacets(options);\r\n if (this._facets)\r\n announce(this._facets);\r\n }\r\n\r\n /**\r\n * Triangulate the region.\r\n * Create a UnionOfConvexClipPlaneSets that clips to the swept region.\r\n * * If sweepVector is not given, the sweep direction is perpendicular to the plane of the contour.\r\n * * If sweepVector is given, it is the sweep direction and does not have to be perpendicular to the contour.\r\n * * cap0 and cap1 indicate construction of clip planes parallel to the contour plane.\r\n * * If cap1 is true, the cap plane is at `anyPointOnPlane + sweepVector`. That is, the sweep vector indicates both direction and distance.\r\n * * caps are NOT created of sweepVector is not given.\r\n */\r\n public sweepToUnionOfConvexClipPlaneSets(sweepVector?: Vector3d, cap0: boolean = false, cap1: boolean = false): UnionOfConvexClipPlaneSets | undefined {\r\n const builder = PolyfaceBuilder.create();\r\n // It's a trip around the barn, but it's easy to make a polyface and scan it . . .\r\n if (!sweepVector)\r\n cap0 = cap1 = false;\r\n this.buildFacets(builder.options);\r\n if (sweepVector === undefined)\r\n sweepVector = this.localToWorld.matrix.columnZ();\r\n const zVector = this.localToWorld.matrix.columnZ();\r\n const facets = this._facets;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n if (facets) {\r\n const plane0Origin = this.localToWorld.getOrigin();\r\n const plane1Origin = plane0Origin.plus(sweepVector);\r\n const inwardNormal0 = zVector.clone();\r\n const inwardNormal1 = zVector.negate();\r\n\r\n const result = UnionOfConvexClipPlaneSets.createEmpty();\r\n const visitor = facets.createVisitor(1);\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n const numEdges = visitor.point.length - 1;\r\n const clipper = ConvexClipPlaneSet.createEmpty();\r\n for (let i = 0; i < numEdges; i++) {\r\n visitor.point.getPoint3dAtUncheckedPointIndex(i, point0);\r\n visitor.point.getPoint3dAtUncheckedPointIndex(i + 1, point1);\r\n const plane = ClipPlane.createEdgeAndUpVector(point1, point0, sweepVector);\r\n const visible = visitor.edgeVisible[i];\r\n plane?.setFlags(!visible, !visible);\r\n clipper.addPlaneToConvexSet(plane);\r\n }\r\n if (cap0)\r\n clipper.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(inwardNormal0, plane0Origin));\r\n if (cap1)\r\n clipper.addPlaneToConvexSet(ClipPlane.createNormalAndPoint(inwardNormal1, plane1Origin));\r\n result.addConvexSet(clipper);\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CurveCollection } from "../curve/CurveCollection";
|
|
2
2
|
import { CurveLocationDetailPair } from "../curve/CurveLocationDetail";
|
|
3
3
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
4
|
+
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
5
|
+
import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection";
|
|
4
6
|
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
7
|
+
import { GrowableXYZArrayCache } from "../geometry3d/ReusableObjectCache";
|
|
5
8
|
import { ClipPlane } from "./ClipPlane";
|
|
6
9
|
import { PolygonClipper } from "./ClipUtils";
|
|
7
10
|
import { ConvexClipPlaneSet } from "./ConvexClipPlaneSet";
|
|
8
|
-
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
9
|
-
import { GrowableXYZArrayCache } from "../geometry3d/ReusableObjectCache";
|
|
10
11
|
/**
|
|
11
12
|
* An AlternatingConvexClipTreeNode is a node in a tree structure in which
|
|
12
13
|
* <ul>
|
|
@@ -79,7 +80,7 @@ export declare class AlternatingCCTreeNode implements PolygonClipper {
|
|
|
79
80
|
* from the cache. This is NOT cleared.
|
|
80
81
|
* @param arrayCache cache for reusable GrowableXYZArray.
|
|
81
82
|
*/
|
|
82
|
-
appendPolygonClip(xyz:
|
|
83
|
+
appendPolygonClip(xyz: IndexedXYZCollection, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache): void;
|
|
83
84
|
depth(): number;
|
|
84
85
|
}
|
|
85
86
|
/**
|