@itwin/core-geometry 4.1.0-dev.7 → 4.1.0-dev.70
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 +82 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +2 -2
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +2 -2
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -0
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +3 -1
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +3 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +2 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +3 -2
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +62 -42
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +71 -48
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +36 -26
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +46 -39
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +67 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +75 -7
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +9 -7
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +77 -0
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -0
- package/lib/cjs/curve/CurveOps.js +160 -0
- package/lib/cjs/curve/CurveOps.js.map +1 -0
- package/lib/cjs/curve/CurvePrimitive.d.ts +17 -16
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +4 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +2 -2
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +2 -2
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +7 -5
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +6 -6
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +2 -2
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +3 -3
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +7 -5
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +18 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.d.ts +97 -0
- package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/cjs/curve/OffsetOptions.js +166 -0
- package/lib/cjs/curve/OffsetOptions.js.map +1 -0
- package/lib/cjs/curve/ParityRegion.d.ts +7 -7
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +19 -11
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +6 -6
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +15 -9
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +5 -7
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +7 -7
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +76 -56
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +83 -60
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +6 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +6 -5
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +17 -8
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/cjs/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +59 -70
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +130 -220
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +89 -178
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +9 -0
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +13 -0
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +32 -5
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.d.ts +41 -32
- package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js +11 -8
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +37 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +8 -9
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -10
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +12 -4
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +18 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +5 -5
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -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/PolylineOps.d.ts +16 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +55 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +134 -94
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +297 -145
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts +69 -0
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/cjs/geometry3d/Ray2d.js +146 -0
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -0
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +10 -3
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +18 -6
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js +16 -107
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +0 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js +5 -5
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +73 -12
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +117 -31
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +30 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -1
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +2 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +2 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +9 -0
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js +3 -3
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -0
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +3 -1
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +3 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +2 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +2 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +62 -42
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +70 -47
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +36 -26
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +46 -39
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +67 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +74 -6
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +9 -7
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +77 -0
- package/lib/esm/curve/CurveOps.d.ts.map +1 -0
- package/lib/esm/curve/CurveOps.js +156 -0
- package/lib/esm/curve/CurveOps.js.map +1 -0
- package/lib/esm/curve/CurvePrimitive.d.ts +17 -16
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +4 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +2 -2
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +2 -2
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +7 -5
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +5 -5
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +2 -2
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +2 -2
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +7 -5
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +18 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.d.ts +97 -0
- package/lib/esm/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/esm/curve/OffsetOptions.js +161 -0
- package/lib/esm/curve/OffsetOptions.js.map +1 -0
- package/lib/esm/curve/ParityRegion.d.ts +7 -7
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +19 -11
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +6 -6
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +15 -9
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +5 -7
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +7 -7
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +76 -56
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +84 -61
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +6 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +6 -5
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +17 -8
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/esm/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +59 -70
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +129 -218
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +86 -173
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +9 -0
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +13 -0
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +51 -55
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +13 -11
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +32 -5
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.d.ts +41 -32
- package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js +11 -8
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +37 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +8 -9
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -10
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +12 -4
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +18 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +5 -5
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +1 -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/PolylineOps.d.ts +16 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +56 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +134 -94
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +297 -145
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts +69 -0
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/esm/geometry3d/Ray2d.js +142 -0
- package/lib/esm/geometry3d/Ray2d.js.map +1 -0
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +10 -3
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +18 -6
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/esm/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js +14 -104
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +0 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js +5 -5
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +73 -12
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +117 -32
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +30 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +2 -7
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -1
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -1
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +2 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +2 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +9 -0
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js +3 -3
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +6 -17
- package/lib/cjs/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/cjs/curve/ChainCollectorContext.js.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.js.map +0 -1
|
@@ -22,16 +22,17 @@ const PolyfaceBuilder_1 = require("../polyface/PolyfaceBuilder");
|
|
|
22
22
|
const Graph_1 = require("../topology/Graph");
|
|
23
23
|
const HalfEdgeGraphSearch_1 = require("../topology/HalfEdgeGraphSearch");
|
|
24
24
|
const Triangulation_1 = require("../topology/Triangulation");
|
|
25
|
-
const ChainCollectorContext_1 = require("./ChainCollectorContext");
|
|
26
25
|
const CurveCollection_1 = require("./CurveCollection");
|
|
27
26
|
const CurveCurve_1 = require("./CurveCurve");
|
|
27
|
+
const CurveOps_1 = require("./CurveOps");
|
|
28
28
|
const CurvePrimitive_1 = require("./CurvePrimitive");
|
|
29
29
|
const CurveWireMomentsXYZ_1 = require("./CurveWireMomentsXYZ");
|
|
30
30
|
const GeometryQuery_1 = require("./GeometryQuery");
|
|
31
|
-
const
|
|
31
|
+
const ChainCollectorContext_1 = require("./internalContexts/ChainCollectorContext");
|
|
32
32
|
const PolygonOffsetContext_1 = require("./internalContexts/PolygonOffsetContext");
|
|
33
33
|
const LineString3d_1 = require("./LineString3d");
|
|
34
34
|
const Loop_1 = require("./Loop");
|
|
35
|
+
const OffsetOptions_1 = require("./OffsetOptions");
|
|
35
36
|
const ParityRegion_1 = require("./ParityRegion");
|
|
36
37
|
const Path_1 = require("./Path");
|
|
37
38
|
const ConsolidateAdjacentPrimitivesContext_1 = require("./Query/ConsolidateAdjacentPrimitivesContext");
|
|
@@ -60,7 +61,8 @@ var RegionBinaryOpType;
|
|
|
60
61
|
* * `ParityRegion` -- a collection of loops, interpreted by parity rules.
|
|
61
62
|
* The common "One outer loop and many Inner loops" is a parity region.
|
|
62
63
|
* * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.
|
|
63
|
-
* * Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has
|
|
64
|
+
* * **NOTE:** Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has
|
|
65
|
+
* been rotated parallel to the xy-plane.
|
|
64
66
|
* @public
|
|
65
67
|
*/
|
|
66
68
|
class RegionOps {
|
|
@@ -79,7 +81,8 @@ class RegionOps {
|
|
|
79
81
|
}
|
|
80
82
|
return undefined;
|
|
81
83
|
}
|
|
82
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Return an area tolerance for a given xy-range and optional distance tolerance.
|
|
83
86
|
* @param range range of planar region to tolerance
|
|
84
87
|
* @param distanceTolerance optional absolute distance tolerance
|
|
85
88
|
*/
|
|
@@ -102,7 +105,8 @@ class RegionOps {
|
|
|
102
105
|
}
|
|
103
106
|
return undefined;
|
|
104
107
|
}
|
|
105
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Return MomentData with the sums of wire moments.
|
|
106
110
|
* * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
|
|
107
111
|
* call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
|
|
108
112
|
* @param root any CurveCollection or CurvePrimitive.
|
|
@@ -115,7 +119,7 @@ class RegionOps {
|
|
|
115
119
|
return result;
|
|
116
120
|
}
|
|
117
121
|
/**
|
|
118
|
-
*
|
|
122
|
+
* Create loops in the graph.
|
|
119
123
|
* @internal
|
|
120
124
|
*/
|
|
121
125
|
static addLoopsToGraph(graph, data, announceIsolatedLoop) {
|
|
@@ -159,7 +163,8 @@ class RegionOps {
|
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Add multiple loops to a graph.
|
|
163
168
|
* * Apply edgeTag and mask to each edge.
|
|
164
169
|
* @internal
|
|
165
170
|
*/
|
|
@@ -178,7 +183,6 @@ class RegionOps {
|
|
|
178
183
|
/**
|
|
179
184
|
* Given a graph just produced by booleans, convert to a polyface
|
|
180
185
|
* * "just produced" implies exterior face markup.
|
|
181
|
-
*
|
|
182
186
|
* @param graph
|
|
183
187
|
* @param triangulate
|
|
184
188
|
*/
|
|
@@ -239,7 +243,8 @@ class RegionOps {
|
|
|
239
243
|
* @param loopsB second set of loops
|
|
240
244
|
* @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA
|
|
241
245
|
* @param mergeTolerance absolute distance tolerance for merging loops
|
|
242
|
-
* @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added
|
|
246
|
+
* @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added
|
|
247
|
+
* to connect interior loops to exterior loops.
|
|
243
248
|
*/
|
|
244
249
|
static regionBooleanXY(loopsA, loopsB, operation, mergeTolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
245
250
|
const result = UnionRegion_1.UnionRegion.create();
|
|
@@ -306,34 +311,33 @@ class RegionOps {
|
|
|
306
311
|
}
|
|
307
312
|
return RegionOps.sortOuterAndHoleLoopsXY(allLoops);
|
|
308
313
|
}
|
|
309
|
-
/**
|
|
310
|
-
*
|
|
311
|
-
* *
|
|
312
|
-
* *
|
|
314
|
+
/**
|
|
315
|
+
* Construct a wire that is offset from the given polyline or polygon.
|
|
316
|
+
* * This is a simple wire offset, not an area offset.
|
|
317
|
+
* * Since z-coordinates are ignored, for best results the input points should lie in (a plane parallel to)
|
|
318
|
+
* the xy-plane.
|
|
319
|
+
* * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not
|
|
320
|
+
* guarantee a simple area offset.
|
|
313
321
|
* @param points a single loop or path
|
|
314
322
|
* @param wrap true to include wraparound
|
|
315
|
-
* @param
|
|
323
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions
|
|
324
|
+
* object.
|
|
316
325
|
*/
|
|
317
|
-
static constructPolygonWireXYOffset(points, wrap,
|
|
326
|
+
static constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions) {
|
|
318
327
|
const context = new PolygonOffsetContext_1.PolygonWireOffsetContext();
|
|
319
|
-
return context.constructPolygonWireXYOffset(points, wrap,
|
|
328
|
+
return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);
|
|
320
329
|
}
|
|
321
330
|
/**
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
* * outside the arc
|
|
330
|
-
* * have uniform turn angle less than `options.maxChamferDegrees`
|
|
331
|
-
* * each line segment (except first and last) touches the arc at its midpoint.
|
|
332
|
-
* @param curves base curves.
|
|
333
|
-
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
|
|
334
|
-
*/
|
|
331
|
+
* Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
|
|
332
|
+
* * The construction will remove "some" local effects of features smaller than the offset distance, but will
|
|
333
|
+
* not detect self intersection among widely separated edges.
|
|
334
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset
|
|
335
|
+
* @param curves base curves.
|
|
336
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
|
|
337
|
+
*/
|
|
335
338
|
static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
|
|
336
|
-
|
|
339
|
+
const offsetOptions = OffsetOptions_1.OffsetOptions.create(offsetDistanceOrOptions);
|
|
340
|
+
return CurveOps_1.CurveOps.constructCurveXYOffset(curves, offsetOptions);
|
|
337
341
|
}
|
|
338
342
|
/**
|
|
339
343
|
* Test if point (x,y) is IN, OUT or ON a region.
|
|
@@ -345,7 +349,8 @@ class RegionOps {
|
|
|
345
349
|
static testPointInOnOutRegionXY(curves, x, y) {
|
|
346
350
|
return InOutTests_1.PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
|
|
347
351
|
}
|
|
348
|
-
/**
|
|
352
|
+
/**
|
|
353
|
+
* Create curve collection of subtype determined by gaps between the input curves.
|
|
349
354
|
* * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.
|
|
350
355
|
* * If all curves connect head-to-tail except for closure, return a `Path`.
|
|
351
356
|
* * If there are internal gaps, return a `BagOfCurves`
|
|
@@ -382,7 +387,9 @@ class RegionOps {
|
|
|
382
387
|
* Announce Checkpoint function for use during booleans
|
|
383
388
|
* @internal
|
|
384
389
|
*/
|
|
385
|
-
static setCheckPointFunction(f) {
|
|
390
|
+
static setCheckPointFunction(f) {
|
|
391
|
+
this._graphCheckPointFunction = f;
|
|
392
|
+
}
|
|
386
393
|
/**
|
|
387
394
|
* Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.
|
|
388
395
|
* * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:
|
|
@@ -397,7 +404,8 @@ class RegionOps {
|
|
|
397
404
|
}
|
|
398
405
|
/**
|
|
399
406
|
* Create paths assembled from many curves.
|
|
400
|
-
* * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by
|
|
407
|
+
* * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by
|
|
408
|
+
* [[cloneCurvesWithXYSplits]].
|
|
401
409
|
* * Return simplest form -- single primitive, single path, or bag of curves.
|
|
402
410
|
*/
|
|
403
411
|
static splitToPathsBetweenBreaks(source, makeClones) {
|
|
@@ -414,27 +422,29 @@ class RegionOps {
|
|
|
414
422
|
return chainCollector.grabResult();
|
|
415
423
|
}
|
|
416
424
|
/**
|
|
417
|
-
* Restructure curve fragments as
|
|
418
|
-
* *
|
|
419
|
-
*
|
|
420
|
-
* @param
|
|
421
|
-
* @param
|
|
425
|
+
* Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.
|
|
426
|
+
* * If the inputs do not form Loop(s), the classification of offsets is suspect.
|
|
427
|
+
* * For best offset results, the inputs should be parallel to the xy-plane.
|
|
428
|
+
* @param fragments fragments to be chained and offset
|
|
429
|
+
* @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.
|
|
430
|
+
* @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail
|
|
422
431
|
* @returns object with named chains, insideOffsets, outsideOffsets
|
|
423
432
|
*/
|
|
424
433
|
static collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance) {
|
|
425
|
-
return
|
|
434
|
+
return CurveOps_1.CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
|
|
426
435
|
}
|
|
427
436
|
/**
|
|
428
|
-
* Restructure curve fragments as
|
|
437
|
+
* Restructure curve fragments as Paths and Loops.
|
|
429
438
|
* @param fragments fragments to be chained
|
|
430
|
-
* @param gapTolerance
|
|
431
|
-
* @returns chains, possibly wrapped in BagOfCurves
|
|
439
|
+
* @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail
|
|
440
|
+
* @returns chains, possibly wrapped in a [[BagOfCurves]].
|
|
432
441
|
*/
|
|
433
442
|
static collectChains(fragments, gapTolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
434
|
-
return
|
|
443
|
+
return CurveOps_1.CurveOps.collectChains(fragments, gapTolerance);
|
|
435
444
|
}
|
|
436
445
|
/**
|
|
437
|
-
* Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments
|
|
446
|
+
* Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments
|
|
447
|
+
* of `curvesToCut`.
|
|
438
448
|
* * Break `curvesToCut` into parts inside, outside, and coincident.
|
|
439
449
|
* @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`
|
|
440
450
|
*/
|
|
@@ -460,7 +470,8 @@ class RegionOps {
|
|
|
460
470
|
}
|
|
461
471
|
return result;
|
|
462
472
|
}
|
|
463
|
-
/**
|
|
473
|
+
/**
|
|
474
|
+
* If `data` is one of several forms of a rectangle, return its edge Transform.
|
|
464
475
|
* * Points are considered a rectangle if, within the first 4 points:
|
|
465
476
|
* * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product
|
|
466
477
|
* * vectors from 0 to 3 and 1 to 2 are the same
|
|
@@ -471,7 +482,8 @@ class RegionOps {
|
|
|
471
482
|
* * Array of Point3d[]
|
|
472
483
|
* * IndexedXYZCollection
|
|
473
484
|
* @param requireClosurePoint whether to require a 5th point equal to the 1st point.
|
|
474
|
-
* @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit
|
|
485
|
+
* @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit
|
|
486
|
+
* normal in z column. If not a rectangle, return undefined.
|
|
475
487
|
*/
|
|
476
488
|
static rectangleEdgeTransform(data, requireClosurePoint = true) {
|
|
477
489
|
if (data instanceof LineString3d_1.LineString3d) {
|
|
@@ -531,9 +543,10 @@ class RegionOps {
|
|
|
531
543
|
* * Contiguous `LineSegment3d` and `LineString3d` objects.
|
|
532
544
|
* * collect all points
|
|
533
545
|
* * eliminate duplicated points
|
|
534
|
-
* * eliminate points colinear with surrounding points
|
|
535
|
-
* *
|
|
546
|
+
* * eliminate points colinear with surrounding points
|
|
547
|
+
* * contiguous concentric circular or elliptic arcs
|
|
536
548
|
* * combine angular ranges
|
|
549
|
+
* * This function can be used to compress adjacent LineSegment3ds into a LineString3d
|
|
537
550
|
* @param curves Path or loop (or larger collection containing paths and loops) to be simplified
|
|
538
551
|
* @param options options for tolerance and selective simplification.
|
|
539
552
|
*/
|
|
@@ -547,8 +560,10 @@ class RegionOps {
|
|
|
547
560
|
* @returns a region that captures the input pointers. This region is a:
|
|
548
561
|
* * `Loop` if there is exactly one input loop. It is oriented counterclockwise.
|
|
549
562
|
* * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.
|
|
550
|
-
* Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented
|
|
551
|
-
*
|
|
563
|
+
* Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented
|
|
564
|
+
* clockwise.
|
|
565
|
+
* * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in
|
|
566
|
+
* the above cases.
|
|
552
567
|
* @see [[PolygonOps.sortOuterAndHoleLoopsXY]]
|
|
553
568
|
*/
|
|
554
569
|
static sortOuterAndHoleLoopsXY(loops) {
|
|
@@ -565,17 +580,22 @@ class RegionOps {
|
|
|
565
580
|
}
|
|
566
581
|
/**
|
|
567
582
|
* Find all areas bounded by the unstructured, possibly intersecting curves.
|
|
568
|
-
* * A common use case of this method is to assemble the bounding "exterior" loop (or loops) containing the
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
583
|
+
* * A common use case of this method is to assemble the bounding "exterior" loop (or loops) containing the
|
|
584
|
+
* input curves.
|
|
585
|
+
* * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop,
|
|
586
|
+
* regardless of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]]
|
|
587
|
+
* to add bridge edges so that [[constructAllXYRegionLoops]] will return outer and inner loops in the same
|
|
588
|
+
* SignedLoops object.
|
|
589
|
+
* @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve
|
|
590
|
+
* primitives.
|
|
573
591
|
* @param tolerance optional distance tolerance for coincidence
|
|
574
592
|
* @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:
|
|
575
|
-
* * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have
|
|
593
|
+
* * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have
|
|
594
|
+
* positive area and counterclockwise orientation.
|
|
576
595
|
* * `negativeAreaLoops` contains (probably just one) "exterior" loop which is ordered clockwise.
|
|
577
596
|
* * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.
|
|
578
|
-
* * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent
|
|
597
|
+
* * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent
|
|
598
|
+
* to the edge and a constituent curve in each.
|
|
579
599
|
*/
|
|
580
600
|
static constructAllXYRegionLoops(curvesAndRegions, tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
581
601
|
const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
|
|
@@ -591,8 +611,10 @@ class RegionOps {
|
|
|
591
611
|
* * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.
|
|
592
612
|
* @param candidates input curves
|
|
593
613
|
* @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.
|
|
594
|
-
* @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If
|
|
595
|
-
*
|
|
614
|
+
* @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If
|
|
615
|
+
* false, push the [[CurveChainWithDistanceIndex]] instead.
|
|
616
|
+
* @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false,
|
|
617
|
+
* push the [[LineString3d]] instead.
|
|
596
618
|
*/
|
|
597
619
|
static collectCurvePrimitives(candidates, collectorArray, smallestPossiblePrimitives = false, explodeLinestrings = false) {
|
|
598
620
|
const results = collectorArray === undefined ? [] : collectorArray;
|
|
@@ -610,7 +632,8 @@ class RegionOps {
|
|
|
610
632
|
return results;
|
|
611
633
|
}
|
|
612
634
|
/**
|
|
613
|
-
* Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed
|
|
635
|
+
* Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed
|
|
636
|
+
* instances of [[LineSegment3d]].
|
|
614
637
|
* @param candidates input curves
|
|
615
638
|
* @return copied (captured) inputs except for the linestrings, which are exploded
|
|
616
639
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionOps.js","sourceRoot":"","sources":["../../../src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,MAAM,CAAC,eAAe,CAAC,IAAS,EAAE,YAAwB;QAC/D,MAAM,KAAK,GAAG,eAAO,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,IAAI,YAAY,6BAAa;YAC/B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;aACnC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC5B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,IAAI,CAAC,YAAY,6BAAa;oBAC5B,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;qBAChC,IAAI,CAAC,YAAY,yBAAO;oBAC3B,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;qBAChC,IAAI,CAAC,YAAY,mCAAgB;oBACpC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;qBACzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACvB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;aAC5D;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAxlBD,8BAwlBC;AAED,gBAAgB;AAChB,SAAS,mBAAmB,CAAC,KAAe,EAAE,MAAc,EAAE,aAAyB,EAAE,MAAkB,EAAE,aAAyB;IACpI,IAAI,MAAM,GAAG,CAAC;QACZ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB,IAAI,MAAM,GAAG,CAAC;QACjB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;QAE1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"../geometry3d/PolylineCompressionByEdgeOffset\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { SortablePolygon } from \"../geometry3d/SortablePolygon\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { MomentData } from \"../geometry4d/MomentData\";\r\nimport { Polyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { LineStringDataVariant, MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\nimport { ChainCollectorContext } from \"./ChainCollectorContext\";\r\nimport { AnyCurve, AnyRegion } from \"./CurveChain\";\r\nimport { BagOfCurves, ConsolidateAdjacentCurvePrimitivesOptions, CurveChain, CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { CurveWireMomentsXYZ } from \"./CurveWireMomentsXYZ\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { OffsetHelpers } from \"./internalContexts/MultiChainCollector\";\r\nimport { CurveChainWireOffsetContext, JointOptions, OffsetOptions, PolygonWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop, SignedLoops } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { Path } from \"./Path\";\r\nimport { ConsolidateAdjacentCurvePrimitivesContext } from \"./Query/ConsolidateAdjacentPrimitivesContext\";\r\nimport { CurveSplitContext } from \"./Query/CurveSplitContext\";\r\nimport { PointInOnOutContext } from \"./Query/InOutTests\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { RegionMomentsXY } from \"./RegionMomentsXY\";\r\nimport { RegionBooleanContext, RegionGroupOpType, RegionOpsFaceToFaceSearch } from \"./RegionOpsClassificationSweeps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * Possible return types from [[splitToPathsBetweenBreaks]], [[collectInsideAndOutsideOffsets]] and [[collectChains]].\r\n * @public\r\n */\r\nexport type ChainTypes = CurvePrimitive | Path | BagOfCurves | Loop | undefined;\r\n\r\n/**\r\n * * `properties` is a string with special characters indicating\r\n * * \"U\" -- contains unmerged stick data\r\n * * \"M\" -- merged\r\n * * \"R\" -- regularized\r\n * * \"X\" -- has exterior markup\r\n * @internal\r\n */\r\nexport type GraphCheckPointFunction = (name: string, graph: HalfEdgeGraph, properties: string, extraData?: any) => any;\r\n/**\r\n * Enumeration of the binary operation types for a booleans among regions\r\n * @public\r\n */\r\nexport enum RegionBinaryOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n AMinusB = 3,\r\n BMinusA = 4,\r\n}\r\n\r\n/**\r\n * Class `RegionOps` has static members for calculations on regions (areas).\r\n * * Regions are represented by these `CurveCollection` subclasses:\r\n * * `Loop` -- a single loop\r\n * * `ParityRegion` -- a collection of loops, interpreted by parity rules.\r\n * The common \"One outer loop and many Inner loops\" is a parity region.\r\n * * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.\r\n * * Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has been rotated parallel to the xy-plane.\r\n * @public\r\n */\r\nexport class RegionOps {\r\n /**\r\n * Return moment sums for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYAreaMoments(root: AnyRegion): MomentData | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /** Return an area tolerance for a given xy-range and optional distance tolerance.\r\n * @param range range of planar region to tolerance\r\n * @param distanceTolerance optional absolute distance tolerance\r\n */\r\n public static computeXYAreaTolerance(range: Range3d, distanceTolerance: number = Geometry.smallMetricDistance): number {\r\n // if A = bh and e is distance tolerance, then A' := (b+e/2)(h+e/2) = A + e/2(b+h+e/2), so A'-A = e/2(b+h+e/2).\r\n const halfDistTol = 0.5 * distanceTolerance;\r\n return halfDistTol * (range.xLength() + range.yLength() + halfDistTol);\r\n }\r\n /**\r\n * Return an xy area for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYArea(root: AnyRegion): number | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n return result.quantitySum;\r\n }\r\n return undefined;\r\n }\r\n /** Return MomentData with the sums of wire moments.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any CurveCollection or CurvePrimitive.\r\n */\r\n public static computeXYZWireMomentSums(root: AnyCurve): MomentData | undefined {\r\n const handler = new CurveWireMomentsXYZ();\r\n handler.visitLeaves(root);\r\n const result = handler.momentData;\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n\r\n /**\r\n * * create loops in the graph.\r\n * @internal\r\n */\r\n public static addLoopsToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, announceIsolatedLoop: (graph: HalfEdgeGraph, seed: HalfEdge) => void) {\r\n if (data instanceof Loop) {\r\n const points = data.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n } else if (data instanceof ParityRegion) {\r\n for (const child of data.children) {\r\n const points = child.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n }\r\n } else if (data instanceof IndexedXYZCollection) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n } else if (Array.isArray(data)) {\r\n if (data.length > 0) {\r\n if (Point3d.isAnyImmediatePointType(data[0])) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data as LineStringDataVariant);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n\r\n } else if (data[0] instanceof IndexedXYZCollection) {\r\n for (const loop of data) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, loop as IndexedXYZCollection);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n }\r\n } else {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addLoopsToGraph(graph, child as MultiLineStringDataVariant, announceIsolatedLoop);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Add multiple loops to a graph.\r\n * * Apply edgeTag and mask to each edge.\r\n * @internal\r\n */\r\n public static addLoopsWithEdgeTagToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, mask: HalfEdgeMask, edgeTag: any): HalfEdge[] | undefined {\r\n const loopSeeds: HalfEdge[] = [];\r\n this.addLoopsToGraph(graph, data, (_graph: HalfEdgeGraph, seed: HalfEdge) => {\r\n if (seed) {\r\n loopSeeds.push(seed);\r\n seed.setMaskAndEdgeTagAroundFace(mask, edgeTag, true);\r\n }\r\n });\r\n if (loopSeeds.length > 0)\r\n return loopSeeds;\r\n return undefined;\r\n }\r\n /**\r\n * Given a graph just produced by booleans, convert to a polyface\r\n * * \"just produced\" implies exterior face markup.\r\n *\r\n * @param graph\r\n * @param triangulate\r\n */\r\n private static finishGraphToPolyface(graph: HalfEdgeGraph | undefined, triangulate: boolean): Polyface | undefined {\r\n if (graph) {\r\n if (triangulate) {\r\n Triangulator.triangulateAllPositiveAreaFaces(graph);\r\n Triangulator.flipTriangles(graph);\r\n }\r\n return PolyfaceBuilder.graphToPolyface(graph);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a polyface containing the area intersection of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA && inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n\r\n /**\r\n * Return a polyface containing the area union of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA || inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area difference of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB,\r\n (inA: boolean, inB: boolean) => (inA && !inB),\r\n this._graphCheckPointFunction);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n\r\n /**\r\n * Return areas defined by a boolean operation.\r\n * * If there are multiple regions in loopsA, they are treated as a union.\r\n * * If there are multiple regions in loopsB, they are treated as a union.\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added to connect interior loops to exterior loops.\r\n */\r\n public static regionBooleanXY(loopsA: AnyRegion | AnyRegion[] | undefined, loopsB: AnyRegion | AnyRegion[] | undefined, operation: RegionBinaryOpType, mergeTolerance: number = Geometry.smallMetricDistance): AnyRegion | undefined {\r\n const result = UnionRegion.create();\r\n const context = RegionBooleanContext.create(RegionGroupOpType.Union, RegionGroupOpType.Union);\r\n context.addMembers(loopsA, loopsB);\r\n context.annotateAndMergeCurvesInGraph(mergeTolerance);\r\n const range = context.groupA.range().union(context.groupB.range());\r\n const areaTol = this.computeXYAreaTolerance(range, mergeTolerance);\r\n context.runClassificationSweep(operation, (_graph: HalfEdgeGraph, face: HalfEdge, faceType: -1 | 0 | 1, area: number) => {\r\n // ignore danglers and null faces, but not 2-edge \"banana\" faces with nonzero area\r\n if (face.countEdgesAroundFace() < 2)\r\n return;\r\n if (Math.abs(area) < areaTol)\r\n return;\r\n if (faceType === 1) {\r\n const loop = PlanarSubdivision.createLoopInFace(face);\r\n if (loop)\r\n result.tryAddChild(loop);\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n /**\r\n * Return a polyface whose facets are a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonBooleanXYToPolyface(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[], triangulate: boolean = false): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union, true);\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return loops of linestrings around areas of a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n */\r\n public static polygonBooleanXYToLoops(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[]): AnyRegion | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union, true);\r\n if (!graph)\r\n return undefined;\r\n const loopEdges = HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, HalfEdgeMask.EXTERIOR);\r\n const allLoops: Loop[] = [];\r\n for (const graphLoop of loopEdges) {\r\n const points = new GrowableXYZArray();\r\n for (const edge of graphLoop)\r\n points.pushXYZ(edge.x, edge.y, edge.z);\r\n points.pushWrap(1);\r\n const loop = Loop.create();\r\n loop.tryAddChild(LineString3d.createCapture(points));\r\n allLoops.push(loop);\r\n }\r\n return RegionOps.sortOuterAndHoleLoopsXY(allLoops);\r\n }\r\n\r\n /** Construct a wire (not area!!) that is offset from given polyline or polygon.\r\n * * This is a simple wire offset, not an area.\r\n * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not guarantee a simple area offset.\r\n * * The construction algorithm is subject to being changed, resulting in different (hopefully better) self-intersection behavior on the future.\r\n * @param points a single loop or path\r\n * @param wrap true to include wraparound\r\n * @param offsetDistance distance of offset from wire. Positive is left.\r\n */\r\n public static constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, offsetDistance: number): CurveCollection | undefined {\r\n const context = new PolygonWireOffsetContext();\r\n return context.constructPolygonWireXYOffset(points, wrap, offsetDistance);\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * When the offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.\r\n * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.\r\n * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:\r\n * * outside the arc\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * each line segment (except first and last) touches the arc at its midpoint.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): CurveCollection | undefined {\r\n return CurveChainWireOffsetContext.constructCurveXYOffset(curves, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Test if point (x,y) is IN, OUT or ON a region.\r\n * @return (1) for in, (-1) for OUT, (0) for ON\r\n * @param curves input region\r\n * @param x x coordinate of point to test\r\n * @param y y coordinate of point to test\r\n */\r\n public static testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number {\r\n return PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);\r\n }\r\n /** Create curve collection of subtype determined by gaps between the input curves.\r\n * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.\r\n * * If all curves connect head-to-tail except for closure, return a `Path`.\r\n * * If there are internal gaps, return a `BagOfCurves`\r\n * * If input array has zero length, return undefined.\r\n * @param curves input curves\r\n * @param wrap whether to create a Loop (true) or Path (false) if maximum gap is minimal\r\n * @param consolidateAdjacentPrimitives whether to simplify the result by calling [[consolidateAdjacentPrimitives]]\r\n */\r\n public static createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap: boolean = true, consolidateAdjacentPrimitives: boolean = false): CurveCollection | undefined {\r\n const n = curves.length;\r\n if (n === 0)\r\n return undefined;\r\n let maxGap = 0.0;\r\n let isPath = false;\r\n if (wrap)\r\n maxGap = Geometry.maxXY(maxGap, curves[0].startPoint().distance(curves[n - 1].endPoint()));\r\n for (let i = 0; i + 1 < n; i++)\r\n maxGap = Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));\r\n let collection: Loop | Path | BagOfCurves;\r\n if (Geometry.isSmallMetricDistance(maxGap)) {\r\n collection = wrap ? Loop.create() : Path.create();\r\n isPath = true;\r\n } else {\r\n collection = BagOfCurves.create();\r\n }\r\n for (const c of curves)\r\n collection.tryAddChild(c);\r\n if (isPath && consolidateAdjacentPrimitives)\r\n RegionOps.consolidateAdjacentPrimitives(collection);\r\n return collection;\r\n }\r\n\r\n private static _graphCheckPointFunction?: GraphCheckPointFunction;\r\n /**\r\n * Announce Checkpoint function for use during booleans\r\n * @internal\r\n */\r\n public static setCheckPointFunction(f?: GraphCheckPointFunction) { this._graphCheckPointFunction = f; }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.\r\n * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:\r\n * * if it is never cut by any `cutter` curve, it will be left unchanged.\r\n * * if cut, the input is downgraded to a set of `Path` curves joining at the cut points.\r\n * * All cutting is \"as viewed in the xy plane\"\r\n * @param curvesToCut input curves to be fragmented at intersections with `cutterCurves`\r\n * @param cutterCurves input curves to intersect with `curvesToCut`\r\n */\r\n public static cloneCurvesWithXYSplits(curvesToCut: AnyCurve | undefined, cutterCurves: CurveCollection): AnyCurve | undefined {\r\n return CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);\r\n }\r\n /**\r\n * Create paths assembled from many curves.\r\n * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by [[cloneCurvesWithXYSplits]].\r\n * * Return simplest form -- single primitive, single path, or bag of curves.\r\n */\r\n public static splitToPathsBetweenBreaks(source: AnyCurve | undefined, makeClones: boolean): ChainTypes {\r\n if (source === undefined)\r\n return undefined;\r\n if (source instanceof CurvePrimitive)\r\n return source;\r\n // source is a collection . ..\r\n const primitives = source.collectCurvePrimitives();\r\n const chainCollector = new ChainCollectorContext(makeClones);\r\n for (const primitive of primitives) {\r\n chainCollector.announceCurvePrimitive(primitive);\r\n }\r\n return chainCollector.grabResult();\r\n }\r\n /**\r\n * Restructure curve fragments as chains, and construct (left and right) chain offsets in the xy-plane.\r\n * * BEWARE that if the input is not a loop, the classification of outputs is suspect.\r\n * @param fragments fragments to be chained, z-coordinates ignored\r\n * @param offsetDistance offset distance\r\n * @param gapTolerance absolute endpoint tolerance for computing chains\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains: ChainTypes } {\r\n return OffsetHelpers.collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance);\r\n }\r\n /**\r\n * Restructure curve fragments as chains.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance absolute endpoint tolerance for computing chains\r\n * @returns chains, possibly wrapped in BagOfCurves if there multiple chains\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance): ChainTypes {\r\n return OffsetHelpers.collectChains(fragments, gapTolerance);\r\n }\r\n\r\n /**\r\n * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments of `curvesToCut`.\r\n * * Break `curvesToCut` into parts inside, outside, and coincident.\r\n * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`\r\n */\r\n public static splitPathsByRegionInOnOutXY(curvesToCut: AnyCurve | undefined, region: AnyRegion): { insideParts: AnyCurve[], outsideParts: AnyCurve[], coincidentParts: AnyCurve[] } {\r\n const result = { insideParts: [], outsideParts: [], coincidentParts: [] };\r\n const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);\r\n const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);\r\n if (splitPaths instanceof CurveCollection) {\r\n for (const child of splitPaths.children) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n } else if (splitPaths instanceof CurvePrimitive) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n return result;\r\n }\r\n /** If `data` is one of several forms of a rectangle, return its edge Transform.\r\n * * Points are considered a rectangle if, within the first 4 points:\r\n * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product\r\n * * vectors from 0 to 3 and 1 to 2 are the same\r\n * @param data points in one of several formats:\r\n * * LineString\r\n * * Loop containing rectangle content\r\n * * Path containing rectangle content\r\n * * Array of Point3d[]\r\n * * IndexedXYZCollection\r\n * @param requireClosurePoint whether to require a 5th point equal to the 1st point.\r\n * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit normal in z column. If not a rectangle, return undefined.\r\n */\r\n public static rectangleEdgeTransform(data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint: boolean = true): Transform | undefined {\r\n if (data instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.packedPoints);\r\n } else if (data instanceof IndexedXYZCollection) {\r\n let dataToUse;\r\n if (requireClosurePoint && data.length === 5) {\r\n if (!Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)!))\r\n return undefined;\r\n dataToUse = data;\r\n } else if (!requireClosurePoint && data.length === 4) {\r\n dataToUse = data;\r\n } else if (data.length < (requireClosurePoint ? 5 : 4)) {\r\n return undefined;\r\n } else {\r\n dataToUse = GrowableXYZArray.create(data);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, Geometry.smallMetricDistance);\r\n if (dataToUse.length < (requireClosurePoint ? 5 : 4))\r\n return undefined;\r\n }\r\n const vector01 = dataToUse.vectorIndexIndex(0, 1)!;\r\n const vector03 = dataToUse.vectorIndexIndex(0, 3)!;\r\n const vector12 = dataToUse.vectorIndexIndex(1, 2)!;\r\n const normalVector = vector01.crossProduct(vector03);\r\n if (normalVector.normalizeInPlace()\r\n && vector12.isAlmostEqual(vector03)\r\n && vector01.isPerpendicularTo(vector03)) {\r\n return Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);\r\n }\r\n } else if (Array.isArray(data)) {\r\n return this.rectangleEdgeTransform(new Point3dArrayCarrier(data), requireClosurePoint);\r\n } else if (data instanceof Loop && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, true);\r\n } else if (data instanceof Path && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);\r\n } else if (data instanceof CurveChain) {\r\n if (!data.checkForNonLinearPrimitives()) {\r\n // const linestring = LineString3d.create();\r\n const strokes = data.getPackedStrokes();\r\n if (strokes) {\r\n return this.rectangleEdgeTransform(strokes);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for and simplify:\r\n * * Contiguous `LineSegment3d` and `LineString3d` objects.\r\n * * collect all points\r\n * * eliminate duplicated points\r\n * * eliminate points colinear with surrounding points.\r\n * * Contiguous concentric circular or elliptic arcs\r\n * * combine angular ranges\r\n * @param curves Path or loop (or larger collection containing paths and loops) to be simplified\r\n * @param options options for tolerance and selective simplification.\r\n */\r\n public static consolidateAdjacentPrimitives(curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions) {\r\n const context = new ConsolidateAdjacentCurvePrimitivesContext(options);\r\n curves.dispatchToGeometryHandler(context);\r\n }\r\n /**\r\n * Reverse and reorder loops in the xy-plane for consistency and containment.\r\n * @param loops multiple loops in any order and orientation, z-coordinates ignored\r\n * @returns a region that captures the input pointers. This region is a:\r\n * * `Loop` if there is exactly one input loop. It is oriented counterclockwise.\r\n * * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.\r\n * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented clockwise.\r\n * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in the above cases.\r\n * @see [[PolygonOps.sortOuterAndHoleLoopsXY]]\r\n */\r\n public static sortOuterAndHoleLoopsXY(loops: Array<Loop | IndexedXYZCollection>): AnyRegion {\r\n const loopAndArea: SortablePolygon[] = [];\r\n for (const candidate of loops) {\r\n if (candidate instanceof Loop)\r\n SortablePolygon.pushLoop(loopAndArea, candidate);\r\n else if (candidate instanceof IndexedXYZCollection) {\r\n const loop = Loop.createPolygon(candidate);\r\n SortablePolygon.pushLoop(loopAndArea, loop);\r\n }\r\n }\r\n return SortablePolygon.sortAsAnyRegion(loopAndArea);\r\n }\r\n /**\r\n * Find all areas bounded by the unstructured, possibly intersecting curves.\r\n * * A common use case of this method is to assemble the bounding \"exterior\" loop (or loops) containing the input curves.\r\n * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop, regardless\r\n * of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]] to add bridge edges so that\r\n * [[constructAllXYRegionLoops]] will return outer and inner loops in the same SignedLoops object.\r\n * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve primitives.\r\n * @param tolerance optional distance tolerance for coincidence\r\n * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:\r\n * * `positiveAreaLoops` contains \"interior\" loops, _including holes in ParityRegion input_. These loops have positive area and counterclockwise orientation.\r\n * * `negativeAreaLoops` contains (probably just one) \"exterior\" loop which is ordered clockwise.\r\n * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.\r\n * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent to the edge and a constituent curve in each.\r\n */\r\n public static constructAllXYRegionLoops(curvesAndRegions: AnyCurve | AnyCurve[], tolerance: number = Geometry.smallMetricDistance): SignedLoops[] {\r\n const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);\r\n const range = this.curveArrayRange(primitives);\r\n const areaTol = this.computeXYAreaTolerance(range, tolerance);\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);\r\n return PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);\r\n }\r\n\r\n /**\r\n * Collect all `CurvePrimitives` in loosely typed input.\r\n * * Always recurses into primitives within explicit collections (Path, Loop, ParityRegion, UnionRegion).\r\n * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.\r\n * @param candidates input curves\r\n * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.\r\n * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If false, push the [[CurveChainWithDistanceIndex]] instead.\r\n * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false, push the [[LineString3d]] instead.\r\n */\r\n public static collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[],\r\n smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n if (candidates instanceof CurvePrimitive) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (candidates instanceof CurveCollection) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (Array.isArray(candidates)) {\r\n for (const c of candidates) {\r\n this.collectCurvePrimitives(c, results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n return results;\r\n }\r\n /**\r\n * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed instances of [[LineSegment3d]].\r\n * @param candidates input curves\r\n * @return copied (captured) inputs except for the linestrings, which are exploded\r\n */\r\n public static expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] {\r\n const result: CurvePrimitive[] = [];\r\n for (const c of candidates) {\r\n if (c instanceof LineString3d) {\r\n for (let i = 0; i + 1 < c.packedPoints.length; i++) {\r\n const q = c.getIndexedSegment(i);\r\n if (q !== undefined)\r\n result.push(q);\r\n }\r\n } else {\r\n result.push(c);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the overall range of given curves.\r\n * @param data candidate curves\r\n * @param worldToLocal transform to apply to data before computing its range\r\n */\r\n public static curveArrayRange(data: any, worldToLocal?: Transform): Range3d {\r\n const range = Range3d.create();\r\n if (data instanceof GeometryQuery)\r\n data.extendRange(range, worldToLocal);\r\n else if (Array.isArray(data)) {\r\n for (const c of data) {\r\n if (c instanceof GeometryQuery)\r\n c.extendRange(range, worldToLocal);\r\n else if (c instanceof Point3d)\r\n range.extendPoint(c, worldToLocal);\r\n else if (c instanceof GrowableXYZArray)\r\n range.extendRange(c.getRange(worldToLocal));\r\n else if (Array.isArray(c))\r\n range.extendRange(this.curveArrayRange(c, worldToLocal));\r\n }\r\n }\r\n return range;\r\n }\r\n}\r\n\r\n/** @internal */\r\nfunction pushToInOnOutArrays(curve: AnyCurve, select: number, arrayNegative: AnyCurve[], array0: AnyCurve[], arrayPositive: AnyCurve[]) {\r\n if (select > 0)\r\n arrayPositive.push(curve);\r\n else if (select < 0)\r\n arrayNegative.push(curve);\r\n else\r\n array0.push(curve);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RegionOps.js","sourceRoot":"","sources":["../../../src/curve/RegionOps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,qEAAk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C;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,IAAS,EAAE,YAAwB;QAC/D,MAAM,KAAK,GAAG,eAAO,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,IAAI,YAAY,6BAAa;YAC/B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;aACnC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC5B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,IAAI,CAAC,YAAY,6BAAa;oBAC5B,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;qBAChC,IAAI,CAAC,YAAY,yBAAO;oBAC3B,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;qBAChC,IAAI,CAAC,YAAY,mCAAgB;oBACpC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;qBACzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACvB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;aAC5D;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AApqBD,8BAoqBC;AACD,gBAAgB;AAChB,SAAS,mBAAmB,CAC1B,KAAe,EAAE,MAAc,EAAE,aAAyB,EAAE,MAAkB,EAAE,aAAyB;IAEzG,IAAI,MAAM,GAAG,CAAC;QACZ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB,IAAI,MAAM,GAAG,CAAC;QACjB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;QAE1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"../geometry3d/PolylineCompressionByEdgeOffset\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { SortablePolygon } from \"../geometry3d/SortablePolygon\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { MomentData } from \"../geometry4d/MomentData\";\r\nimport { Polyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { LineStringDataVariant, MultiLineStringDataVariant, Triangulator } from \"../topology/Triangulation\";\r\nimport { AnyCurve, AnyRegion } from \"./CurveChain\";\r\nimport { BagOfCurves, ConsolidateAdjacentCurvePrimitivesOptions, CurveChain, CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurveOps } from \"./CurveOps\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { CurveWireMomentsXYZ } from \"./CurveWireMomentsXYZ\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { ChainCollectorContext } from \"./internalContexts/ChainCollectorContext\";\r\nimport { PolygonWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop, SignedLoops } from \"./Loop\";\r\nimport { JointOptions, OffsetOptions } from \"./OffsetOptions\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { Path } from \"./Path\";\r\nimport { ConsolidateAdjacentCurvePrimitivesContext } from \"./Query/ConsolidateAdjacentPrimitivesContext\";\r\nimport { CurveSplitContext } from \"./Query/CurveSplitContext\";\r\nimport { PointInOnOutContext } from \"./Query/InOutTests\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { RegionMomentsXY } from \"./RegionMomentsXY\";\r\nimport { RegionBooleanContext, RegionGroupOpType, RegionOpsFaceToFaceSearch } from \"./RegionOpsClassificationSweeps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * Possible return types from [[splitToPathsBetweenBreaks]], [[collectInsideAndOutsideOffsets]] and\r\n * [[collectChains]].\r\n * @public\r\n */\r\nexport type ChainTypes = CurvePrimitive | Path | BagOfCurves | Loop | undefined;\r\n\r\n/**\r\n * * `properties` is a string with special characters indicating\r\n * * \"U\" -- contains unmerged stick data\r\n * * \"M\" -- merged\r\n * * \"R\" -- regularized\r\n * * \"X\" -- has exterior markup\r\n * @internal\r\n */\r\nexport type GraphCheckPointFunction = (name: string, graph: HalfEdgeGraph, properties: string, extraData?: any) => any;\r\n\r\n/**\r\n * Enumeration of the binary operation types for a booleans among regions\r\n * @public\r\n */\r\nexport enum RegionBinaryOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n AMinusB = 3,\r\n BMinusA = 4,\r\n}\r\n\r\n/**\r\n * Class `RegionOps` has static members for calculations on regions (areas).\r\n * * Regions are represented by these `CurveCollection` subclasses:\r\n * * `Loop` -- a single loop\r\n * * `ParityRegion` -- a collection of loops, interpreted by parity rules.\r\n * The common \"One outer loop and many Inner loops\" is a parity region.\r\n * * `UnionRegion` -- a collection of `Loop` and `ParityRegion` objects understood as a (probably disjoint) union.\r\n * * **NOTE:** Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has\r\n * been rotated parallel to the xy-plane.\r\n * @public\r\n */\r\nexport class RegionOps {\r\n /**\r\n * Return moment sums for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYAreaMoments(root: AnyRegion): MomentData | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return an area tolerance for a given xy-range and optional distance tolerance.\r\n * @param range range of planar region to tolerance\r\n * @param distanceTolerance optional absolute distance tolerance\r\n */\r\n public static computeXYAreaTolerance(range: Range3d, distanceTolerance: number = Geometry.smallMetricDistance): number {\r\n // if A = bh and e is distance tolerance, then A' := (b+e/2)(h+e/2) = A + e/2(b+h+e/2), so A'-A = e/2(b+h+e/2).\r\n const halfDistTol = 0.5 * distanceTolerance;\r\n return halfDistTol * (range.xLength() + range.yLength() + halfDistTol);\r\n }\r\n /**\r\n * Return an xy area for a loop, parity region, or union region.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any Loop, ParityRegion, or UnionRegion.\r\n */\r\n public static computeXYArea(root: AnyRegion): number | undefined {\r\n const handler = new RegionMomentsXY();\r\n const result = root.dispatchToGeometryHandler(handler);\r\n if (result instanceof MomentData) {\r\n return result.quantitySum;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return MomentData with the sums of wire moments.\r\n * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with\r\n * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`\r\n * @param root any CurveCollection or CurvePrimitive.\r\n */\r\n public static computeXYZWireMomentSums(root: AnyCurve): MomentData | undefined {\r\n const handler = new CurveWireMomentsXYZ();\r\n handler.visitLeaves(root);\r\n const result = handler.momentData;\r\n result.shiftOriginAndSumsToCentroidOfSums();\r\n return result;\r\n }\r\n /**\r\n * Create loops in the graph.\r\n * @internal\r\n */\r\n public static addLoopsToGraph(\r\n graph: HalfEdgeGraph,\r\n data: MultiLineStringDataVariant,\r\n announceIsolatedLoop: (graph: HalfEdgeGraph, seed: HalfEdge) => void,\r\n ): void {\r\n if (data instanceof Loop) {\r\n const points = data.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n } else if (data instanceof ParityRegion) {\r\n for (const child of data.children) {\r\n const points = child.getPackedStrokes();\r\n if (points)\r\n this.addLoopsToGraph(graph, points, announceIsolatedLoop);\r\n }\r\n } else if (data instanceof IndexedXYZCollection) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n } else if (Array.isArray(data)) {\r\n if (data.length > 0) {\r\n if (Point3d.isAnyImmediatePointType(data[0])) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, data as LineStringDataVariant);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n\r\n } else if (data[0] instanceof IndexedXYZCollection) {\r\n for (const loop of data) {\r\n const loopSeed = Triangulator.directCreateFaceLoopFromCoordinates(graph, loop as IndexedXYZCollection);\r\n if (loopSeed !== undefined)\r\n announceIsolatedLoop(graph, loopSeed);\r\n }\r\n } else {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addLoopsToGraph(graph, child as MultiLineStringDataVariant, announceIsolatedLoop);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Add multiple loops to a graph.\r\n * * Apply edgeTag and mask to each edge.\r\n * @internal\r\n */\r\n public static addLoopsWithEdgeTagToGraph(\r\n graph: HalfEdgeGraph, data: MultiLineStringDataVariant, mask: HalfEdgeMask, edgeTag: any,\r\n ): HalfEdge[] | undefined {\r\n const loopSeeds: HalfEdge[] = [];\r\n this.addLoopsToGraph(graph, data, (_graph: HalfEdgeGraph, seed: HalfEdge) => {\r\n if (seed) {\r\n loopSeeds.push(seed);\r\n seed.setMaskAndEdgeTagAroundFace(mask, edgeTag, true);\r\n }\r\n });\r\n if (loopSeeds.length > 0)\r\n return loopSeeds;\r\n return undefined;\r\n }\r\n /**\r\n * Given a graph just produced by booleans, convert to a polyface\r\n * * \"just produced\" implies exterior face markup.\r\n * @param graph\r\n * @param triangulate\r\n */\r\n private static finishGraphToPolyface(graph: HalfEdgeGraph | undefined, triangulate: boolean): Polyface | undefined {\r\n if (graph) {\r\n if (triangulate) {\r\n Triangulator.triangulateAllPositiveAreaFaces(graph);\r\n Triangulator.flipTriangles(graph);\r\n }\r\n return PolyfaceBuilder.graphToPolyface(graph);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a polyface containing the area intersection of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaIntersectLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA && inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area union of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaUnionLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA || inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return a polyface containing the area difference of two XY regions.\r\n * * Within each region, in and out is determined by parity rules.\r\n * * Any face that is an odd number of crossings from the far outside is IN\r\n * * Any face that is an even number of crossings from the far outside is OUT\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonXYAreaDifferenceLoopsToPolyface(\r\n loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doPolygonBoolean(\r\n loopsA,\r\n loopsB,\r\n (inA: boolean, inB: boolean) => (inA && !inB),\r\n this._graphCheckPointFunction,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return areas defined by a boolean operation.\r\n * * If there are multiple regions in loopsA, they are treated as a union.\r\n * * If there are multiple regions in loopsB, they are treated as a union.\r\n * @param loopsA first set of loops\r\n * @param loopsB second set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n * @returns a region resulting from merging input loops and the boolean operation. May contain bridge edges added\r\n * to connect interior loops to exterior loops.\r\n */\r\n public static regionBooleanXY(\r\n loopsA: AnyRegion | AnyRegion[] | undefined,\r\n loopsB: AnyRegion | AnyRegion[] | undefined,\r\n operation: RegionBinaryOpType,\r\n mergeTolerance: number = Geometry.smallMetricDistance,\r\n ): AnyRegion | undefined {\r\n const result = UnionRegion.create();\r\n const context = RegionBooleanContext.create(RegionGroupOpType.Union, RegionGroupOpType.Union);\r\n context.addMembers(loopsA, loopsB);\r\n context.annotateAndMergeCurvesInGraph(mergeTolerance);\r\n const range = context.groupA.range().union(context.groupB.range());\r\n const areaTol = this.computeXYAreaTolerance(range, mergeTolerance);\r\n context.runClassificationSweep(\r\n operation,\r\n (_graph: HalfEdgeGraph, face: HalfEdge, faceType: -1 | 0 | 1, area: number) => {\r\n // ignore danglers and null faces, but not 2-edge \"banana\" faces with nonzero area\r\n if (face.countEdgesAroundFace() < 2)\r\n return;\r\n if (Math.abs(area) < areaTol)\r\n return;\r\n if (faceType === 1) {\r\n const loop = PlanarSubdivision.createLoopInFace(face);\r\n if (loop)\r\n result.tryAddChild(loop);\r\n }\r\n },\r\n );\r\n return result;\r\n }\r\n /**\r\n * Return a polyface whose facets are a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n * @param triangulate whether to triangulate the result\r\n */\r\n public static polygonBooleanXYToPolyface(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[],\r\n triangulate: boolean = false,\r\n ): Polyface | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA, RegionGroupOpType.Union,\r\n operation,\r\n inputB, RegionGroupOpType.Union,\r\n true,\r\n );\r\n return this.finishGraphToPolyface(graph, triangulate);\r\n }\r\n /**\r\n * Return loops of linestrings around areas of a boolean operation between the input regions.\r\n * * Each of the two inputs is an array of multiple loops or parity regions.\r\n * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union.\r\n * * In each \"array of loops and parity regions\", each entry inputA[i] or inputB[i] is one of:\r\n * * A simple loop, e.g. array of Point3d.\r\n * * Several simple loops, each of which is an array of Point3d.\r\n * @param inputA first set of loops\r\n * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA\r\n * @param inputB second set of loops\r\n */\r\n public static polygonBooleanXYToLoops(\r\n inputA: MultiLineStringDataVariant[],\r\n operation: RegionBinaryOpType,\r\n inputB: MultiLineStringDataVariant[],\r\n ): AnyRegion | undefined {\r\n const graph = RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(\r\n inputA,\r\n RegionGroupOpType.Union,\r\n operation,\r\n inputB,\r\n RegionGroupOpType.Union,\r\n true,\r\n );\r\n if (!graph)\r\n return undefined;\r\n const loopEdges = HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, HalfEdgeMask.EXTERIOR);\r\n const allLoops: Loop[] = [];\r\n for (const graphLoop of loopEdges) {\r\n const points = new GrowableXYZArray();\r\n for (const edge of graphLoop)\r\n points.pushXYZ(edge.x, edge.y, edge.z);\r\n points.pushWrap(1);\r\n const loop = Loop.create();\r\n loop.tryAddChild(LineString3d.createCapture(points));\r\n allLoops.push(loop);\r\n }\r\n return RegionOps.sortOuterAndHoleLoopsXY(allLoops);\r\n }\r\n /**\r\n * Construct a wire that is offset from the given polyline or polygon.\r\n * * This is a simple wire offset, not an area offset.\r\n * * Since z-coordinates are ignored, for best results the input points should lie in (a plane parallel to)\r\n * the xy-plane.\r\n * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not\r\n * guarantee a simple area offset.\r\n * @param points a single loop or path\r\n * @param wrap true to include wraparound\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public static constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, offsetDistanceOrOptions: number | JointOptions,\r\n ): CurveChain | undefined {\r\n const context = new PolygonWireOffsetContext();\r\n return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\r\n ): CurveCollection | undefined {\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n return CurveOps.constructCurveXYOffset(curves, offsetOptions);\r\n }\r\n /**\r\n * Test if point (x,y) is IN, OUT or ON a region.\r\n * @return (1) for in, (-1) for OUT, (0) for ON\r\n * @param curves input region\r\n * @param x x coordinate of point to test\r\n * @param y y coordinate of point to test\r\n */\r\n public static testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number {\r\n return PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);\r\n }\r\n /**\r\n * Create curve collection of subtype determined by gaps between the input curves.\r\n * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`.\r\n * * If all curves connect head-to-tail except for closure, return a `Path`.\r\n * * If there are internal gaps, return a `BagOfCurves`\r\n * * If input array has zero length, return undefined.\r\n * @param curves input curves\r\n * @param wrap whether to create a Loop (true) or Path (false) if maximum gap is minimal\r\n * @param consolidateAdjacentPrimitives whether to simplify the result by calling [[consolidateAdjacentPrimitives]]\r\n */\r\n public static createLoopPathOrBagOfCurves(\r\n curves: CurvePrimitive[], wrap: boolean = true, consolidateAdjacentPrimitives: boolean = false,\r\n ): CurveCollection | undefined {\r\n const n = curves.length;\r\n if (n === 0)\r\n return undefined;\r\n let maxGap = 0.0;\r\n let isPath = false;\r\n if (wrap)\r\n maxGap = Geometry.maxXY(maxGap, curves[0].startPoint().distance(curves[n - 1].endPoint()));\r\n for (let i = 0; i + 1 < n; i++)\r\n maxGap = Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));\r\n let collection: Loop | Path | BagOfCurves;\r\n if (Geometry.isSmallMetricDistance(maxGap)) {\r\n collection = wrap ? Loop.create() : Path.create();\r\n isPath = true;\r\n } else {\r\n collection = BagOfCurves.create();\r\n }\r\n for (const c of curves)\r\n collection.tryAddChild(c);\r\n if (isPath && consolidateAdjacentPrimitives)\r\n RegionOps.consolidateAdjacentPrimitives(collection);\r\n return collection;\r\n }\r\n private static _graphCheckPointFunction?: GraphCheckPointFunction;\r\n /**\r\n * Announce Checkpoint function for use during booleans\r\n * @internal\r\n */\r\n public static setCheckPointFunction(f?: GraphCheckPointFunction) {\r\n this._graphCheckPointFunction = f;\r\n }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`.\r\n * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`:\r\n * * if it is never cut by any `cutter` curve, it will be left unchanged.\r\n * * if cut, the input is downgraded to a set of `Path` curves joining at the cut points.\r\n * * All cutting is \"as viewed in the xy plane\"\r\n * @param curvesToCut input curves to be fragmented at intersections with `cutterCurves`\r\n * @param cutterCurves input curves to intersect with `curvesToCut`\r\n */\r\n public static cloneCurvesWithXYSplits(\r\n curvesToCut: AnyCurve | undefined, cutterCurves: CurveCollection,\r\n ): AnyCurve | undefined {\r\n return CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);\r\n }\r\n /**\r\n * Create paths assembled from many curves.\r\n * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by\r\n * [[cloneCurvesWithXYSplits]].\r\n * * Return simplest form -- single primitive, single path, or bag of curves.\r\n */\r\n public static splitToPathsBetweenBreaks(source: AnyCurve | undefined, makeClones: boolean): ChainTypes {\r\n if (source === undefined)\r\n return undefined;\r\n if (source instanceof CurvePrimitive)\r\n return source;\r\n // source is a collection . ..\r\n const primitives = source.collectCurvePrimitives();\r\n const chainCollector = new ChainCollectorContext(makeClones);\r\n for (const primitive of primitives) {\r\n chainCollector.announceCurvePrimitive(primitive);\r\n }\r\n return chainCollector.grabResult();\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.\r\n * * If the inputs do not form Loop(s), the classification of offsets is suspect.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * @param fragments fragments to be chained and offset\r\n * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideOffsets(\r\n fragments: AnyCurve[], offsetDistance: number, gapTolerance: number,\r\n ): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains: ChainTypes } {\r\n return CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @returns chains, possibly wrapped in a [[BagOfCurves]].\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance): ChainTypes {\r\n return CurveOps.collectChains(fragments, gapTolerance);\r\n }\r\n /**\r\n * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments\r\n * of `curvesToCut`.\r\n * * Break `curvesToCut` into parts inside, outside, and coincident.\r\n * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts`\r\n */\r\n public static splitPathsByRegionInOnOutXY(\r\n curvesToCut: AnyCurve | undefined, region: AnyRegion,\r\n ): { insideParts: AnyCurve[], outsideParts: AnyCurve[], coincidentParts: AnyCurve[] } {\r\n const result = { insideParts: [], outsideParts: [], coincidentParts: [] };\r\n const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);\r\n const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);\r\n if (splitPaths instanceof CurveCollection) {\r\n for (const child of splitPaths.children) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n } else if (splitPaths instanceof CurvePrimitive) {\r\n const pointOnChild = CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);\r\n if (pointOnChild) {\r\n const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);\r\n pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * If `data` is one of several forms of a rectangle, return its edge Transform.\r\n * * Points are considered a rectangle if, within the first 4 points:\r\n * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product\r\n * * vectors from 0 to 3 and 1 to 2 are the same\r\n * @param data points in one of several formats:\r\n * * LineString\r\n * * Loop containing rectangle content\r\n * * Path containing rectangle content\r\n * * Array of Point3d[]\r\n * * IndexedXYZCollection\r\n * @param requireClosurePoint whether to require a 5th point equal to the 1st point.\r\n * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit\r\n * normal in z column. If not a rectangle, return undefined.\r\n */\r\n public static rectangleEdgeTransform(\r\n data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint: boolean = true,\r\n ): Transform | undefined {\r\n if (data instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.packedPoints);\r\n } else if (data instanceof IndexedXYZCollection) {\r\n let dataToUse;\r\n if (requireClosurePoint && data.length === 5) {\r\n if (!Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)!))\r\n return undefined;\r\n dataToUse = data;\r\n } else if (!requireClosurePoint && data.length === 4) {\r\n dataToUse = data;\r\n } else if (data.length < (requireClosurePoint ? 5 : 4)) {\r\n return undefined;\r\n } else {\r\n dataToUse = GrowableXYZArray.create(data);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, Geometry.smallMetricDistance);\r\n if (dataToUse.length < (requireClosurePoint ? 5 : 4))\r\n return undefined;\r\n }\r\n const vector01 = dataToUse.vectorIndexIndex(0, 1)!;\r\n const vector03 = dataToUse.vectorIndexIndex(0, 3)!;\r\n const vector12 = dataToUse.vectorIndexIndex(1, 2)!;\r\n const normalVector = vector01.crossProduct(vector03);\r\n if (normalVector.normalizeInPlace()\r\n && vector12.isAlmostEqual(vector03)\r\n && vector01.isPerpendicularTo(vector03)) {\r\n return Transform.createOriginAndMatrixColumns(\r\n dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector,\r\n );\r\n }\r\n } else if (Array.isArray(data)) {\r\n return this.rectangleEdgeTransform(new Point3dArrayCarrier(data), requireClosurePoint);\r\n } else if (data instanceof Loop && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, true);\r\n } else if (data instanceof Path && data.children.length === 1 && data.children[0] instanceof LineString3d) {\r\n return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);\r\n } else if (data instanceof CurveChain) {\r\n if (!data.checkForNonLinearPrimitives()) {\r\n // const linestring = LineString3d.create();\r\n const strokes = data.getPackedStrokes();\r\n if (strokes) {\r\n return this.rectangleEdgeTransform(strokes);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for and simplify:\r\n * * Contiguous `LineSegment3d` and `LineString3d` objects.\r\n * * collect all points\r\n * * eliminate duplicated points\r\n * * eliminate points colinear with surrounding points\r\n * * contiguous concentric circular or elliptic arcs\r\n * * combine angular ranges\r\n * * This function can be used to compress adjacent LineSegment3ds into a LineString3d\r\n * @param curves Path or loop (or larger collection containing paths and loops) to be simplified\r\n * @param options options for tolerance and selective simplification.\r\n */\r\n public static consolidateAdjacentPrimitives(\r\n curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions,\r\n ): void {\r\n const context = new ConsolidateAdjacentCurvePrimitivesContext(options);\r\n curves.dispatchToGeometryHandler(context);\r\n }\r\n /**\r\n * Reverse and reorder loops in the xy-plane for consistency and containment.\r\n * @param loops multiple loops in any order and orientation, z-coordinates ignored\r\n * @returns a region that captures the input pointers. This region is a:\r\n * * `Loop` if there is exactly one input loop. It is oriented counterclockwise.\r\n * * `ParityRegion` if input consists of exactly one outer loop with at least one hole loop.\r\n * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented\r\n * clockwise.\r\n * * `UnionRegion` if any other input configuration. Its children are individually ordered/oriented as in\r\n * the above cases.\r\n * @see [[PolygonOps.sortOuterAndHoleLoopsXY]]\r\n */\r\n public static sortOuterAndHoleLoopsXY(loops: Array<Loop | IndexedXYZCollection>): AnyRegion {\r\n const loopAndArea: SortablePolygon[] = [];\r\n for (const candidate of loops) {\r\n if (candidate instanceof Loop)\r\n SortablePolygon.pushLoop(loopAndArea, candidate);\r\n else if (candidate instanceof IndexedXYZCollection) {\r\n const loop = Loop.createPolygon(candidate);\r\n SortablePolygon.pushLoop(loopAndArea, loop);\r\n }\r\n }\r\n return SortablePolygon.sortAsAnyRegion(loopAndArea);\r\n }\r\n /**\r\n * Find all areas bounded by the unstructured, possibly intersecting curves.\r\n * * A common use case of this method is to assemble the bounding \"exterior\" loop (or loops) containing the\r\n * input curves.\r\n * * This method does not add bridge edges to connect outer loops to inner loops. Each disconnected loop,\r\n * regardless of its containment, is returned as its own SignedLoops object. Pre-process with [[regionBooleanXY]]\r\n * to add bridge edges so that [[constructAllXYRegionLoops]] will return outer and inner loops in the same\r\n * SignedLoops object.\r\n * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve\r\n * primitives.\r\n * @param tolerance optional distance tolerance for coincidence\r\n * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:\r\n * * `positiveAreaLoops` contains \"interior\" loops, _including holes in ParityRegion input_. These loops have\r\n * positive area and counterclockwise orientation.\r\n * * `negativeAreaLoops` contains (probably just one) \"exterior\" loop which is ordered clockwise.\r\n * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves.\r\n * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent\r\n * to the edge and a constituent curve in each.\r\n */\r\n public static constructAllXYRegionLoops(\r\n curvesAndRegions: AnyCurve | AnyCurve[], tolerance: number = Geometry.smallMetricDistance,\r\n ): SignedLoops[] {\r\n const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);\r\n const range = this.curveArrayRange(primitives);\r\n const areaTol = this.computeXYAreaTolerance(range, tolerance);\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);\r\n return PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);\r\n }\r\n /**\r\n * Collect all `CurvePrimitives` in loosely typed input.\r\n * * Always recurses into primitives within explicit collections (Path, Loop, ParityRegion, UnionRegion).\r\n * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true.\r\n * @param candidates input curves\r\n * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended.\r\n * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If\r\n * false, push the [[CurveChainWithDistanceIndex]] instead.\r\n * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false,\r\n * push the [[LineString3d]] instead.\r\n */\r\n public static collectCurvePrimitives(\r\n candidates: AnyCurve | AnyCurve[],\r\n collectorArray?: CurvePrimitive[],\r\n smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n if (candidates instanceof CurvePrimitive) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (candidates instanceof CurveCollection) {\r\n candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);\r\n } else if (Array.isArray(candidates)) {\r\n for (const c of candidates) {\r\n this.collectCurvePrimitives(c, results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n return results;\r\n }\r\n /**\r\n * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed\r\n * instances of [[LineSegment3d]].\r\n * @param candidates input curves\r\n * @return copied (captured) inputs except for the linestrings, which are exploded\r\n */\r\n public static expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] {\r\n const result: CurvePrimitive[] = [];\r\n for (const c of candidates) {\r\n if (c instanceof LineString3d) {\r\n for (let i = 0; i + 1 < c.packedPoints.length; i++) {\r\n const q = c.getIndexedSegment(i);\r\n if (q !== undefined)\r\n result.push(q);\r\n }\r\n } else {\r\n result.push(c);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the overall range of given curves.\r\n * @param data candidate curves\r\n * @param worldToLocal transform to apply to data before computing its range\r\n */\r\n public static curveArrayRange(data: any, worldToLocal?: Transform): Range3d {\r\n const range = Range3d.create();\r\n if (data instanceof GeometryQuery)\r\n data.extendRange(range, worldToLocal);\r\n else if (Array.isArray(data)) {\r\n for (const c of data) {\r\n if (c instanceof GeometryQuery)\r\n c.extendRange(range, worldToLocal);\r\n else if (c instanceof Point3d)\r\n range.extendPoint(c, worldToLocal);\r\n else if (c instanceof GrowableXYZArray)\r\n range.extendRange(c.getRange(worldToLocal));\r\n else if (Array.isArray(c))\r\n range.extendRange(this.curveArrayRange(c, worldToLocal));\r\n }\r\n }\r\n return range;\r\n }\r\n}\r\n/** @internal */\r\nfunction pushToInOnOutArrays(\r\n curve: AnyCurve, select: number, arrayNegative: AnyCurve[], array0: AnyCurve[], arrayPositive: AnyCurve[],\r\n): void {\r\n if (select > 0)\r\n arrayPositive.push(curve);\r\n else if (select < 0)\r\n arrayNegative.push(curve);\r\n else\r\n array0.push(curve);\r\n}\r\n"]}
|
|
@@ -247,7 +247,7 @@ class RegionOpsFaceToFaceSearch {
|
|
|
247
247
|
const baseMask = Graph_1.HalfEdgeMask.BOUNDARY_EDGE | Graph_1.HalfEdgeMask.PRIMARY_EDGE;
|
|
248
248
|
const callbacks = RegionBooleanContext.create(opA, opB);
|
|
249
249
|
callbacks.graph = graph;
|
|
250
|
-
callbacks.faceAreaFunction = HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.signedFaceArea;
|
|
250
|
+
callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.signedFaceArea(node);
|
|
251
251
|
// Add all the members in groupA ..
|
|
252
252
|
for (const data of dataA) {
|
|
253
253
|
if (data.length > 2) {
|
|
@@ -694,7 +694,7 @@ class GraphComponent {
|
|
|
694
694
|
}
|
|
695
695
|
this.faceAreas.length = 0;
|
|
696
696
|
if (!faceAreaFunction)
|
|
697
|
-
faceAreaFunction = HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.signedFaceArea;
|
|
697
|
+
faceAreaFunction = (node) => HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.signedFaceArea(node);
|
|
698
698
|
for (const f of this.faces) {
|
|
699
699
|
this.faceAreas.push(faceAreaFunction(f));
|
|
700
700
|
}
|