@itwin/core-geometry 4.2.0-dev.9 → 4.3.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -1
- package/lib/cjs/Geometry.d.ts +4 -4
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +2 -2
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +2 -1
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +17 -11
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +14 -8
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +6 -5
- package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +3 -2
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -3
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -3
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +4 -4
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +93 -91
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +171 -152
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +19 -19
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +20 -22
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +47 -30
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +81 -46
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -5
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +14 -2
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +1 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +2 -2
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -0
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +3 -3
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +2 -2
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +54 -5
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +154 -3
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +20 -11
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +22 -11
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +3 -3
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +2 -2
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +104 -115
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts +28 -11
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +57 -45
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +15 -26
- package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js +23 -32
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +3 -6
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -2
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -3
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +1 -1
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +4 -3
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +4 -6
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.d.ts +14 -8
- package/lib/cjs/geometry4d/Map4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js +38 -16
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +4 -2
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +2 -2
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +2 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +55 -25
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +16 -7
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +38 -7
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +5 -39
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +7 -41
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -8
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +64 -18
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +6 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +68 -2
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +35 -26
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +84 -100
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +29 -11
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +45 -26
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.d.ts +2 -2
- package/lib/cjs/topology/HalfEdgeMarkSet.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js +4 -4
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +3 -0
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +19 -5
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +15 -7
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +89 -47
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +4 -4
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +2 -2
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
- package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
- package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +2 -1
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +17 -11
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +14 -8
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +6 -5
- package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +3 -2
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -3
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -3
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +4 -4
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +93 -91
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +171 -152
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +19 -19
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +19 -20
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +47 -30
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +81 -46
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +17 -5
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +12 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +1 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +2 -2
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.d.ts +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
- package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -0
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +3 -3
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +2 -2
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +54 -5
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +153 -3
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +20 -11
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +22 -11
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +3 -3
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +2 -2
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
- package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +103 -113
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
- package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts +28 -11
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +57 -45
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +15 -26
- package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js +23 -32
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +3 -6
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -2
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -3
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +1 -1
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +4 -3
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +4 -6
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.d.ts +14 -8
- package/lib/esm/geometry4d/Map4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Map4d.js +38 -16
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +4 -2
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +2 -2
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +2 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +55 -25
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +16 -7
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +38 -7
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +5 -39
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +7 -41
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -8
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +64 -18
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +6 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +68 -2
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +35 -26
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +84 -100
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +29 -11
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +45 -26
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.d.ts +2 -2
- package/lib/esm/topology/HalfEdgeMarkSet.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js +2 -2
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +3 -0
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +19 -5
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +15 -7
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +89 -47
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
- package/lib/cjs/curve/CurveChain.js.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -175
- package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
- package/lib/esm/curve/CurveChain.d.ts.map +0 -1
- package/lib/esm/curve/CurveChain.js.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -175
- package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Polyface
|
|
3
|
-
*/
|
|
4
1
|
import { ClipPlane } from "../clipping/ClipPlane";
|
|
5
2
|
import { ConvexClipPlaneSet } from "../clipping/ConvexClipPlaneSet";
|
|
6
3
|
import { UnionOfConvexClipPlaneSets } from "../clipping/UnionOfConvexClipPlaneSets";
|
|
4
|
+
import { AnyRegion } from "../curve/CurveTypes";
|
|
7
5
|
import { LineString3d } from "../curve/LineString3d";
|
|
6
|
+
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
8
7
|
import { PlaneAltitudeEvaluator } from "../Geometry";
|
|
8
|
+
import { Vector3d } from "../geometry3d/Point3dVector3d";
|
|
9
9
|
import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
|
|
10
10
|
import { PolyfaceBuilder } from "./PolyfaceBuilder";
|
|
11
11
|
/**
|
|
@@ -30,7 +30,7 @@ export declare class ClippedPolyfaceBuilders {
|
|
|
30
30
|
private constructor();
|
|
31
31
|
/** Simple create with default options on builder. */
|
|
32
32
|
static create(keepInside?: boolean, keepOutside?: boolean, buildSideFaces?: boolean): ClippedPolyfaceBuilders;
|
|
33
|
-
claimPolyface(selector: 0 | 1, fixup: boolean): IndexedPolyface | undefined;
|
|
33
|
+
claimPolyface(selector: 0 | 1, fixup: boolean, tolerance?: number): IndexedPolyface | undefined;
|
|
34
34
|
}
|
|
35
35
|
/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.
|
|
36
36
|
* @public
|
|
@@ -57,9 +57,8 @@ export declare class PolyfaceClip {
|
|
|
57
57
|
* * outputSelect determines how the clip output is structured
|
|
58
58
|
* * 0 outputs all shards -- this may have many interior edges.
|
|
59
59
|
* * 1 stitches shards together to get cleaner facets.
|
|
60
|
-
* @internal
|
|
61
60
|
*/
|
|
62
|
-
static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector?: number): void;
|
|
61
|
+
static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector?: number): void;
|
|
63
62
|
private static addRegion;
|
|
64
63
|
private static cleanupAndAddRegion;
|
|
65
64
|
private static addPolygonToBuilderAndDropToCache;
|
|
@@ -115,11 +114,21 @@ export declare class PolyfaceClip {
|
|
|
115
114
|
*/
|
|
116
115
|
static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelect?: number): void;
|
|
117
116
|
/** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
|
|
118
|
-
* * This method parses
|
|
117
|
+
* * This method parses the variant input types and calls a more specific method.
|
|
119
118
|
* * To get both inside and outside parts, use clipPolyfaceInsideOutside
|
|
120
119
|
* * WARNING: The new mesh is "points only".
|
|
121
120
|
*/
|
|
122
121
|
static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Drape the region onto the mesh.
|
|
124
|
+
* * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.
|
|
125
|
+
* @param mesh input mesh, untouched
|
|
126
|
+
* @param region planar region to drape onto mesh
|
|
127
|
+
* @param sweepVector optional sweep direction for region; if undefined, region normal is used
|
|
128
|
+
* @param options how to stroke the region boundary
|
|
129
|
+
* @returns clipped facets. No other mesh data but vertices appear in output.
|
|
130
|
+
*/
|
|
131
|
+
static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined;
|
|
123
132
|
/** Find consecutive points around a polygon (with implied closure edge) that are ON a plane
|
|
124
133
|
* @param points array of points around polygon. Closure edge is implied.
|
|
125
134
|
* @param chainContext context receiving edges
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolyfaceClip.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolyfaceClip.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG/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9F;;;;;;;;;;;;;;OAcG;WACW,+CAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAChH,cAAc,EAAE,eAAe,GAAG,SAAS,EAC3C,aAAa,EAAE,eAAe,GAAG,SAAS;IAsC5C;;;;;;;;;;;;;;;;OAgBG;WACW,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG;QAAE,WAAW,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,eAAe,CAAA;KAAE;CAe5I"}
|
|
@@ -8,8 +8,8 @@ exports.PolyfaceClip = exports.ClippedPolyfaceBuilders = void 0;
|
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Polyface
|
|
10
10
|
*/
|
|
11
|
-
// import { Point2d } from "./Geometry2d";
|
|
12
11
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
13
|
const ClipPlane_1 = require("../clipping/ClipPlane");
|
|
14
14
|
const ConvexClipPlaneSet_1 = require("../clipping/ConvexClipPlaneSet");
|
|
15
15
|
const UnionOfConvexClipPlaneSets_1 = require("../clipping/UnionOfConvexClipPlaneSets");
|
|
@@ -17,6 +17,7 @@ const LineString3d_1 = require("../curve/LineString3d");
|
|
|
17
17
|
const Loop_1 = require("../curve/Loop");
|
|
18
18
|
const RegionOps_1 = require("../curve/RegionOps");
|
|
19
19
|
const UnionRegion_1 = require("../curve/UnionRegion");
|
|
20
|
+
const Geometry_1 = require("../Geometry");
|
|
20
21
|
const FrameBuilder_1 = require("../geometry3d/FrameBuilder");
|
|
21
22
|
const GrowableXYZArray_1 = require("../geometry3d/GrowableXYZArray");
|
|
22
23
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
@@ -26,6 +27,7 @@ const ReusableObjectCache_1 = require("../geometry3d/ReusableObjectCache");
|
|
|
26
27
|
const SweepContour_1 = require("../solid/SweepContour");
|
|
27
28
|
const ChainMerge_1 = require("../topology/ChainMerge");
|
|
28
29
|
const RangeSearch_1 = require("./multiclip/RangeSearch");
|
|
30
|
+
const Polyface_1 = require("./Polyface");
|
|
29
31
|
const PolyfaceBuilder_1 = require("./PolyfaceBuilder");
|
|
30
32
|
const PolyfaceQuery_1 = require("./PolyfaceQuery");
|
|
31
33
|
/**
|
|
@@ -60,12 +62,13 @@ class ClippedPolyfaceBuilders {
|
|
|
60
62
|
static create(keepInside = true, keepOutside = false, buildSideFaces = false) {
|
|
61
63
|
return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder_1.PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder_1.PolyfaceBuilder.create() : undefined, buildSideFaces);
|
|
62
64
|
}
|
|
63
|
-
claimPolyface(selector, fixup) {
|
|
65
|
+
claimPolyface(selector, fixup, tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
64
66
|
const builder = selector === 0 ? this.builderA : this.builderB;
|
|
65
67
|
if (builder) {
|
|
66
|
-
let polyface = builder.claimPolyface();
|
|
68
|
+
let polyface = builder.claimPolyface(true, tolerance);
|
|
67
69
|
if (fixup) {
|
|
68
70
|
polyface = PolyfaceQuery_1.PolyfaceQuery.cloneWithTVertexFixup(polyface);
|
|
71
|
+
polyface = PolyfaceQuery_1.PolyfaceQuery.cloneWithDanglingEdgesRemoved(polyface);
|
|
69
72
|
}
|
|
70
73
|
return polyface;
|
|
71
74
|
}
|
|
@@ -114,12 +117,15 @@ class PolyfaceClip {
|
|
|
114
117
|
* * outputSelect determines how the clip output is structured
|
|
115
118
|
* * 0 outputs all shards -- this may have many interior edges.
|
|
116
119
|
* * 1 stitches shards together to get cleaner facets.
|
|
117
|
-
* @internal
|
|
118
120
|
*/
|
|
119
121
|
static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, allClippers, destination, outputSelector = 1) {
|
|
122
|
+
if (polyface instanceof Polyface_1.Polyface) {
|
|
123
|
+
this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
120
126
|
const builderA = destination.builderA;
|
|
121
127
|
const builderB = destination.builderB;
|
|
122
|
-
const visitor = polyface
|
|
128
|
+
const visitor = polyface; // alias; we have a visitor now
|
|
123
129
|
const cache = new ReusableObjectCache_1.GrowableXYZArrayCache();
|
|
124
130
|
const insideShards = [];
|
|
125
131
|
const outsideShards = [];
|
|
@@ -197,6 +203,9 @@ class PolyfaceClip {
|
|
|
197
203
|
for (const child of region.children)
|
|
198
204
|
this.addRegion(builder, child);
|
|
199
205
|
}
|
|
206
|
+
else {
|
|
207
|
+
(0, core_bentley_1.assert)(!"unexpected region encountered");
|
|
208
|
+
}
|
|
200
209
|
}
|
|
201
210
|
}
|
|
202
211
|
// WARNING: shards are transformed into local system, not reverted!!!
|
|
@@ -208,7 +217,7 @@ class PolyfaceClip {
|
|
|
208
217
|
if (outsidePieces && outsidePieces.children.length > 0) {
|
|
209
218
|
if (localToWorld)
|
|
210
219
|
outsidePieces.tryTransformInPlace(localToWorld);
|
|
211
|
-
RegionOps_1.RegionOps.consolidateAdjacentPrimitives(outsidePieces);
|
|
220
|
+
RegionOps_1.RegionOps.consolidateAdjacentPrimitives(outsidePieces); // source of the T-vertices removed in claimPolyface
|
|
212
221
|
this.addRegion(builder, outsidePieces);
|
|
213
222
|
}
|
|
214
223
|
}
|
|
@@ -435,7 +444,7 @@ class PolyfaceClip {
|
|
|
435
444
|
}
|
|
436
445
|
}
|
|
437
446
|
/** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet
|
|
438
|
-
* * This method parses
|
|
447
|
+
* * This method parses the variant input types and calls a more specific method.
|
|
439
448
|
* * To get both inside and outside parts, use clipPolyfaceInsideOutside
|
|
440
449
|
* * WARNING: The new mesh is "points only".
|
|
441
450
|
*/
|
|
@@ -447,6 +456,28 @@ class PolyfaceClip {
|
|
|
447
456
|
// (The if tests exhaust the type space -- this line is unreachable.)
|
|
448
457
|
return undefined;
|
|
449
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Drape the region onto the mesh.
|
|
461
|
+
* * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.
|
|
462
|
+
* @param mesh input mesh, untouched
|
|
463
|
+
* @param region planar region to drape onto mesh
|
|
464
|
+
* @param sweepVector optional sweep direction for region; if undefined, region normal is used
|
|
465
|
+
* @param options how to stroke the region boundary
|
|
466
|
+
* @returns clipped facets. No other mesh data but vertices appear in output.
|
|
467
|
+
*/
|
|
468
|
+
static drapeRegion(mesh, region, sweepVector, options) {
|
|
469
|
+
if (mesh instanceof Polyface_1.Polyface)
|
|
470
|
+
return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);
|
|
471
|
+
const contour = SweepContour_1.SweepContour.createForLinearSweep(region);
|
|
472
|
+
if (!contour)
|
|
473
|
+
return undefined;
|
|
474
|
+
const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweepVector, false, false, options);
|
|
475
|
+
if (!clipper)
|
|
476
|
+
return undefined;
|
|
477
|
+
const builders = ClippedPolyfaceBuilders.create(true);
|
|
478
|
+
this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);
|
|
479
|
+
return builders.claimPolyface(0, true);
|
|
480
|
+
}
|
|
450
481
|
/** Find consecutive points around a polygon (with implied closure edge) that are ON a plane
|
|
451
482
|
* @param points array of points around polygon. Closure edge is implied.
|
|
452
483
|
* @param chainContext context receiving edges
|
|
@@ -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,6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,aAAa,CAAC,CAAC;oBACvH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc;wBACpC,cAAc,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;oBACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa;wBACnC,aAAa,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;iBACnD;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,CAAC,cAAc,CAAC,KAAsB,EAAE,KAAsB;QACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,aAAa,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,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/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,m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C,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;oBACvH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc;wBACpC,cAAc,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;oBACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa;wBACnC,aAAa,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;iBACnD;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,CAAC,cAAc,CAAC,KAAsB,EAAE,KAAsB;QACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,aAAa,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,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;AA1gBD,oCA0gBC","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/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { assert } from \"@itwin/core-bentley\";\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 { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { Geometry, 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, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | undefined {\r\n const builder = selector === 0 ? this.builderA : this.builderB;\r\n if (builder) {\r\n let polyface = builder.claimPolyface(true, tolerance);\r\n if (fixup) {\r\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\r\n polyface = PolyfaceQuery.cloneWithDanglingEdgesRemoved(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 */\r\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\r\n if (polyface instanceof Polyface) {\r\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);\r\n return;\r\n }\r\n const builderA = destination.builderA;\r\n const builderB = destination.builderB;\r\n const visitor = polyface; // alias; we have a visitor now\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 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 } else {\r\n assert(!\"unexpected region encountered\");\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); // source of the T-vertices removed in claimPolyface\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 /**\r\n * Drape the region onto the mesh.\r\n * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.\r\n * @param mesh input mesh, untouched\r\n * @param region planar region to drape onto mesh\r\n * @param sweepVector optional sweep direction for region; if undefined, region normal is used\r\n * @param options how to stroke the region boundary\r\n * @returns clipped facets. No other mesh data but vertices appear in output.\r\n */\r\n public static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined {\r\n if (mesh instanceof Polyface)\r\n return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);\r\n const contour = SweepContour.createForLinearSweep(region);\r\n if (!contour)\r\n return undefined;\r\n const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweepVector, false, false, options);\r\n if (!clipper)\r\n return undefined;\r\n const builders = ClippedPolyfaceBuilders.create(true);\r\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);\r\n return builders.claimPolyface(0, true);\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"]}
|
|
@@ -146,11 +146,13 @@ export declare class PolyfaceData {
|
|
|
146
146
|
*/
|
|
147
147
|
tryTransformInPlace(transform: Transform): boolean;
|
|
148
148
|
/**
|
|
149
|
+
* Compress the instance by equating duplicate data.
|
|
149
150
|
* * Search for duplicates within points, normals, params, and colors.
|
|
150
|
-
* *
|
|
151
|
-
* *
|
|
151
|
+
* * Compress each data array.
|
|
152
|
+
* * Revise all indexing for the relocated data.
|
|
153
|
+
* @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].
|
|
152
154
|
*/
|
|
153
|
-
compress(): void;
|
|
155
|
+
compress(tolerance?: number): void;
|
|
154
156
|
/**
|
|
155
157
|
* Test if facetStartIndex is (minimally!) valid:
|
|
156
158
|
* * length must be nonzero (recall that for "no facets" the facetStartIndexArray still must contain a 0)
|
|
@@ -167,40 +169,4 @@ export declare class PolyfaceData {
|
|
|
167
169
|
*/
|
|
168
170
|
static reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean;
|
|
169
171
|
}
|
|
170
|
-
/**
|
|
171
|
-
* pack out data entries that are unreferenced.
|
|
172
|
-
* @param data data to pack
|
|
173
|
-
* @param indices indices into the data.
|
|
174
|
-
|
|
175
|
-
function compressUnusedGrowableXYZArray(data: GrowableXYZArray, indices: number[]): boolean {
|
|
176
|
-
// 1 entry per data[i]
|
|
177
|
-
// pass 0: number of references
|
|
178
|
-
// pass 1: post-compression index (or -1)
|
|
179
|
-
const n0 = data.length;
|
|
180
|
-
const work = new Int32Array(data.length);
|
|
181
|
-
for (const k of indices) {
|
|
182
|
-
if (k < 0 || k >= n0)
|
|
183
|
-
return false;
|
|
184
|
-
work[k]++;
|
|
185
|
-
}
|
|
186
|
-
let n1 = 0;
|
|
187
|
-
for (let i = 0; i < n0; i++) {
|
|
188
|
-
if (work[i] === 0)
|
|
189
|
-
work[i] = -1;
|
|
190
|
-
else
|
|
191
|
-
work[i] = n1++;
|
|
192
|
-
}
|
|
193
|
-
const numIndex = indices.length;
|
|
194
|
-
for (let i = 0; i < numIndex; i++) {
|
|
195
|
-
indices[i] = work[indices[i]];
|
|
196
|
-
}
|
|
197
|
-
for (let i = 0; i < n0; i++) {
|
|
198
|
-
const j = work[i];
|
|
199
|
-
if (j >= 0)
|
|
200
|
-
data.moveIndexToIndex(i, j);
|
|
201
|
-
}
|
|
202
|
-
data.length = n1;
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
*/
|
|
206
172
|
//# sourceMappingURL=PolyfaceData.d.ts.map
|
|
@@ -1 +1 @@
|
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AAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;IAiCrH;;OAEG;WACW,yBAAyB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;CA+BlJ"}
|
|
@@ -369,15 +369,17 @@ class PolyfaceData {
|
|
|
369
369
|
return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
372
|
+
* Compress the instance by equating duplicate data.
|
|
372
373
|
* * Search for duplicates within points, normals, params, and colors.
|
|
373
|
-
* *
|
|
374
|
-
* *
|
|
374
|
+
* * Compress each data array.
|
|
375
|
+
* * Revise all indexing for the relocated data.
|
|
376
|
+
* @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].
|
|
375
377
|
*/
|
|
376
|
-
compress() {
|
|
377
|
-
const packedPoints = ClusterableArray_1.ClusterableArray.clusterGrowablePoint3dArray(this.point);
|
|
378
|
+
compress(tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
379
|
+
const packedPoints = ClusterableArray_1.ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);
|
|
378
380
|
this.point = packedPoints.growablePackedPoints;
|
|
379
381
|
packedPoints.updateIndices(this.pointIndex);
|
|
380
|
-
//
|
|
382
|
+
// for now, normals, params, and colors use the default tolerance for clustering...
|
|
381
383
|
if (this.normalIndex && this.normal) {
|
|
382
384
|
const packedNormals = ClusterableArray_1.ClusterableArray.clusterGrowablePoint3dArray(this.normal);
|
|
383
385
|
this.normal = packedNormals.growablePackedPoints;
|
|
@@ -497,40 +499,4 @@ class PolyfaceData {
|
|
|
497
499
|
*/
|
|
498
500
|
PolyfaceData.planarityLocalRelTol = 1.0e-13;
|
|
499
501
|
exports.PolyfaceData = PolyfaceData;
|
|
500
|
-
/**
|
|
501
|
-
* pack out data entries that are unreferenced.
|
|
502
|
-
* @param data data to pack
|
|
503
|
-
* @param indices indices into the data.
|
|
504
|
-
|
|
505
|
-
function compressUnusedGrowableXYZArray(data: GrowableXYZArray, indices: number[]): boolean {
|
|
506
|
-
// 1 entry per data[i]
|
|
507
|
-
// pass 0: number of references
|
|
508
|
-
// pass 1: post-compression index (or -1)
|
|
509
|
-
const n0 = data.length;
|
|
510
|
-
const work = new Int32Array(data.length);
|
|
511
|
-
for (const k of indices) {
|
|
512
|
-
if (k < 0 || k >= n0)
|
|
513
|
-
return false;
|
|
514
|
-
work[k]++;
|
|
515
|
-
}
|
|
516
|
-
let n1 = 0;
|
|
517
|
-
for (let i = 0; i < n0; i++) {
|
|
518
|
-
if (work[i] === 0)
|
|
519
|
-
work[i] = -1;
|
|
520
|
-
else
|
|
521
|
-
work[i] = n1++;
|
|
522
|
-
}
|
|
523
|
-
const numIndex = indices.length;
|
|
524
|
-
for (let i = 0; i < numIndex; i++) {
|
|
525
|
-
indices[i] = work[indices[i]];
|
|
526
|
-
}
|
|
527
|
-
for (let i = 0; i < n0; i++) {
|
|
528
|
-
const j = work[i];
|
|
529
|
-
if (j >= 0)
|
|
530
|
-
data.moveIndexToIndex(i, j);
|
|
531
|
-
}
|
|
532
|
-
data.length = n1;
|
|
533
|
-
return true;
|
|
534
|
-
}
|
|
535
|
-
*/
|
|
536
502
|
//# sourceMappingURL=PolyfaceData.js.map
|