@itwin/core-geometry 5.1.0-dev.3 → 5.1.0-dev.32
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 +26 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.d.ts +8 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +10 -0
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +7 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts +2 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +2 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +9 -5
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +5 -3
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +54 -32
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +56 -37
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +33 -1
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +79 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +24 -24
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +24 -24
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +2 -2
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +9 -5
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +27 -11
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.d.ts +15 -21
- package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js +39 -59
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +82 -39
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +154 -48
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +27 -26
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +70 -54
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +24 -17
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +31 -17
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +7 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +2 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +7 -3
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- 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 +2 -0
- package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js +6 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
- 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 +4 -4
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +7 -8
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +66 -26
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +57 -9
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +57 -17
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +5 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +18 -10
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +32 -10
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js +0 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +11 -23
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +21 -2
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +32 -13
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts +7 -7
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +9 -9
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.d.ts +32 -34
- package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js +56 -57
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +7 -4
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +26 -15
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BandedSystem.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +11 -0
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js +129 -73
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
- package/lib/cjs/polyface/FacetOrientation.js +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js +47 -32
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +17 -3
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +16 -0
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +39 -42
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +116 -75
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +312 -228
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +2 -2
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -3
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +2 -3
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
- package/lib/cjs/solid/RotationalSweep.js +2 -2
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.d.ts +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +1 -0
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -0
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +0 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +49 -46
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.d.ts +8 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +10 -0
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +7 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts +2 -1
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +2 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +7 -5
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +9 -5
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +5 -3
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +54 -32
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +56 -37
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +33 -1
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +79 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +24 -24
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +24 -24
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +2 -2
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +9 -5
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +27 -11
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.d.ts +15 -21
- package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js +39 -59
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +82 -39
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +155 -49
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +27 -26
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +70 -54
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +24 -17
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +31 -17
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +7 -2
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +20 -2
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +2 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +7 -3
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- 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 +2 -0
- package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js +6 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
- 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 +4 -4
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +7 -8
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +66 -26
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +57 -9
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +57 -17
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +5 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +18 -10
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +32 -10
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js +0 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +11 -23
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +21 -2
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +32 -13
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts +7 -7
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +9 -9
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.d.ts +32 -34
- package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/esm/geometry4d/MomentData.js +56 -57
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +7 -4
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +26 -15
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BandedSystem.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +11 -0
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.d.ts +77 -36
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/esm/numerics/SmallSystem.js +129 -73
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
- package/lib/esm/polyface/FacetOrientation.js +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js +47 -32
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +17 -3
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +16 -0
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +39 -42
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +116 -75
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +313 -229
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +2 -2
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -3
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +2 -3
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -2
- package/lib/esm/solid/RotationalSweep.js +2 -2
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.d.ts +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +1 -0
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -0
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +0 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +49 -46
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -21,6 +21,7 @@ const CurveCurve_1 = require("./CurveCurve");
|
|
|
21
21
|
const CurveLocationDetail_1 = require("./CurveLocationDetail");
|
|
22
22
|
const GeometryQuery_1 = require("./GeometryQuery");
|
|
23
23
|
const PlaneAltitudeRangeContext_1 = require("./internalContexts/PlaneAltitudeRangeContext");
|
|
24
|
+
const TransferWithSplitArcs_1 = require("./internalContexts/TransferWithSplitArcs");
|
|
24
25
|
const LineSegment3d_1 = require("./LineSegment3d");
|
|
25
26
|
const Loop_1 = require("./Loop");
|
|
26
27
|
const ParityRegion_1 = require("./ParityRegion");
|
|
@@ -43,14 +44,22 @@ const UnionRegion_1 = require("./UnionRegion");
|
|
|
43
44
|
* @internal
|
|
44
45
|
*/
|
|
45
46
|
class RegionOpsFaceToFaceSearchCallbacks {
|
|
46
|
-
/** Announce a representative node on the outer face of a component */
|
|
47
|
-
startComponent(_node) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/** Announce face
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
/** Announce a representative node on the outer face of a component. */
|
|
48
|
+
startComponent(_node) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/** Announce return to outer face. */
|
|
52
|
+
finishComponent(_node) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/** Announce face entry. */
|
|
56
|
+
enterFace(_facePathStack, _newFaceNode) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
/** Announce face exit. */
|
|
60
|
+
leaveFace(_facePathStack, _newFaceNode) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
64
|
/**
|
|
56
65
|
* Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.
|
|
@@ -113,14 +122,14 @@ class RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCall
|
|
|
113
122
|
*/
|
|
114
123
|
class RegionOpsFaceToFaceSearch {
|
|
115
124
|
/**
|
|
116
|
-
*
|
|
125
|
+
* Run a DFS with face-to-face step announcements.
|
|
117
126
|
* * false return from any function terminates search immediately.
|
|
118
127
|
* * all reachable nodes assumed to have both visit masks clear.
|
|
119
128
|
* @param graph containing graph.
|
|
120
129
|
* @param seed first node to visit.
|
|
121
130
|
* @param faceHasBeenVisited mask marking faces that have been seen.
|
|
122
131
|
* @param nodeHasBeenVisited mask marking node-to-node step around face.
|
|
123
|
-
*
|
|
132
|
+
* @param callbacks callbacks.
|
|
124
133
|
*/
|
|
125
134
|
static faceToFaceSearchFromOuterLoop(_graph, seed, faceHasBeenVisited, nodeHasBeenVisited, callbacks) {
|
|
126
135
|
if (seed.isMaskSet(faceHasBeenVisited))
|
|
@@ -134,10 +143,10 @@ class RegionOpsFaceToFaceSearch {
|
|
|
134
143
|
let entryNode = faceWalker;
|
|
135
144
|
let mate = faceWalker.edgeMate;
|
|
136
145
|
if (!mate.isMaskSet(faceHasBeenVisited)) {
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
//
|
|
146
|
+
// The faceWalker seed is always on the base of the stack.
|
|
147
|
+
// The stack then contains even-odd pairs of (entryNode, faceNode).
|
|
148
|
+
// entryNode is the node where a face was entered.
|
|
149
|
+
// faceNode is another node around that face.
|
|
141
150
|
facePathStack.push(faceWalker);
|
|
142
151
|
facePathStack.push(mate);
|
|
143
152
|
let faceNode = mate.faceSuccessor;
|
|
@@ -168,13 +177,13 @@ class RegionOpsFaceToFaceSearch {
|
|
|
168
177
|
entryNode = facePathStack[facePathStack.length - 1];
|
|
169
178
|
}
|
|
170
179
|
if (faceNode.isMaskSet(nodeHasBeenVisited)) {
|
|
171
|
-
// this is disaster
|
|
180
|
+
// this is disaster
|
|
172
181
|
return;
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
}
|
|
177
|
-
// continue at outermost level
|
|
186
|
+
// continue at outermost level
|
|
178
187
|
faceWalker = faceWalker.faceSuccessor;
|
|
179
188
|
} while (faceWalker !== seed);
|
|
180
189
|
callbacks.finishComponent(seed);
|
|
@@ -305,7 +314,9 @@ class RegionGroupMember {
|
|
|
305
314
|
this.parentGroup = parentGroup;
|
|
306
315
|
this.sweepState = 0;
|
|
307
316
|
}
|
|
308
|
-
clearState() {
|
|
317
|
+
clearState() {
|
|
318
|
+
this.sweepState = 0;
|
|
319
|
+
}
|
|
309
320
|
}
|
|
310
321
|
/**
|
|
311
322
|
* A `RegionGroup` is
|
|
@@ -344,8 +355,7 @@ class RegionGroup {
|
|
|
344
355
|
}
|
|
345
356
|
return range;
|
|
346
357
|
}
|
|
347
|
-
/** Ask if the current _numIn count qualifies as an "in" for this operation type.
|
|
348
|
-
*/
|
|
358
|
+
/** Ask if the current _numIn count qualifies as an "in" for this operation type. */
|
|
349
359
|
getInOut() {
|
|
350
360
|
// UNION is true if one or more members are IN
|
|
351
361
|
if (this.groupOpType === RegionGroupOpType.Union)
|
|
@@ -361,8 +371,9 @@ class RegionGroup {
|
|
|
361
371
|
// push new members into the group.
|
|
362
372
|
addMember(data, allowLineSegment = false) {
|
|
363
373
|
if (data instanceof Loop_1.Loop || data instanceof ParityRegion_1.ParityRegion) {
|
|
364
|
-
|
|
374
|
+
let cleanerData = data.clone();
|
|
365
375
|
RegionOps_1.RegionOps.consolidateAdjacentPrimitives(cleanerData);
|
|
376
|
+
cleanerData = TransferWithSplitArcs_1.TransferWithSplitArcs.clone(cleanerData);
|
|
366
377
|
this.members.push(new RegionGroupMember(cleanerData, this));
|
|
367
378
|
}
|
|
368
379
|
else if (data instanceof UnionRegion_1.UnionRegion) {
|
|
@@ -393,28 +404,29 @@ exports.RegionGroup = RegionGroup;
|
|
|
393
404
|
/**
|
|
394
405
|
* A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.
|
|
395
406
|
* * In the binary operation OP (union, intersection, parity, difference), the left and right operands
|
|
396
|
-
*
|
|
407
|
+
* are each a composite union, difference, or parity among multiple inputs, i.e.,
|
|
397
408
|
* * (operationA among Ai) OP (operationB among Bi)
|
|
398
409
|
* * where the Ai are one set of regions, being combined by operationA
|
|
399
|
-
* * and the Bi are the another set of regions, being combined by operationB
|
|
400
|
-
* * Each group of Ai and Bi is a `RegionGroup
|
|
410
|
+
* * and the Bi are the another set of regions, being combined by operationB.
|
|
411
|
+
* * Each group of Ai and Bi is a `RegionGroup`.
|
|
401
412
|
* * This is an extremely delicate structure.
|
|
402
413
|
* * Members are public because of the unique variety of queries, but should only be used for queries.
|
|
403
414
|
* * The graph and curves in the booleans are connected by an extended pointer chain:
|
|
404
|
-
* * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail
|
|
405
|
-
* * (CurveLocationDetail).curve points to a curve
|
|
406
|
-
* * (Curve).parent points to RegionGroupMember
|
|
407
|
-
* * (RegionGroupMember) points to RegionGroup
|
|
408
|
-
* * (RegionGroup) points to RegionBooleanBinaryContext
|
|
409
|
-
* * So
|
|
410
|
-
* * the chain leads to a parity count in the RegionGroupMember
|
|
411
|
-
* * that can change the number of members active in the RegionGroup
|
|
415
|
+
* * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.
|
|
416
|
+
* * (CurveLocationDetail).curve points to a curve.
|
|
417
|
+
* * (Curve).parent points to RegionGroupMember.
|
|
418
|
+
* * (RegionGroupMember) points to RegionGroup.
|
|
419
|
+
* * (RegionGroup) points to RegionBooleanBinaryContext.
|
|
420
|
+
* * So when a graph sweep crosses an edge
|
|
421
|
+
* * the chain leads to a parity count in the RegionGroupMember.
|
|
422
|
+
* * that can change the number of members active in the RegionGroup.
|
|
412
423
|
* * which can change the state of the context.
|
|
413
424
|
* @internal
|
|
414
425
|
*/
|
|
415
426
|
class RegionBooleanContext {
|
|
416
427
|
groupA;
|
|
417
428
|
groupB;
|
|
429
|
+
/** bridge edges */
|
|
418
430
|
extraGeometry;
|
|
419
431
|
graph;
|
|
420
432
|
faceAreaFunction;
|
|
@@ -423,7 +435,7 @@ class RegionBooleanContext {
|
|
|
423
435
|
this.groupA = new RegionGroup(this, groupTypeA);
|
|
424
436
|
this.groupB = new RegionGroup(this, groupTypeB);
|
|
425
437
|
this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);
|
|
426
|
-
this.binaryOp = RegionOps_1.RegionBinaryOpType.Union; //
|
|
438
|
+
this.binaryOp = RegionOps_1.RegionBinaryOpType.Union; // revised in runClassificationSweep
|
|
427
439
|
}
|
|
428
440
|
/**
|
|
429
441
|
* Create a context with both A and B groups empty.
|
|
@@ -437,8 +449,6 @@ class RegionBooleanContext {
|
|
|
437
449
|
addMembers(dataA, dataB) {
|
|
438
450
|
this.groupA.addMember(dataA);
|
|
439
451
|
this.groupB.addMember(dataB);
|
|
440
|
-
// const doConnectives = 1;
|
|
441
|
-
// if (doConnectives !== 0)
|
|
442
452
|
this.addConnectives();
|
|
443
453
|
}
|
|
444
454
|
_workSegment;
|
|
@@ -482,12 +492,12 @@ class RegionBooleanContext {
|
|
|
482
492
|
}
|
|
483
493
|
const ray = Ray3d_1.Ray3d.createZero();
|
|
484
494
|
for (const p of maxPoints) {
|
|
485
|
-
// Make a line from
|
|
486
|
-
//
|
|
487
|
-
//
|
|
488
|
-
// If p came from some inner loop this will
|
|
489
|
-
//
|
|
490
|
-
//
|
|
495
|
+
// Make a line from
|
|
496
|
+
// 1) exactly the max point of the loops to
|
|
497
|
+
// 2) a point clearly outside the big range
|
|
498
|
+
// If p came from some inner loop this will
|
|
499
|
+
// 1) create a bridge from the inner loop through any containing loops (always)
|
|
500
|
+
// 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
|
|
491
501
|
const bridgeLength = margin + Ray3d_1.Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
|
|
492
502
|
const outside = Point3dVector3d_1.Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
|
|
493
503
|
const bridgeLine = LineSegment3d_1.LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
|
|
@@ -504,7 +514,7 @@ class RegionBooleanContext {
|
|
|
504
514
|
*/
|
|
505
515
|
annotateAndMergeCurvesInGraph(mergeTolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
506
516
|
const allPrimitives = [];
|
|
507
|
-
// ASSUME loops have fine-grained types
|
|
517
|
+
// ASSUME loops have fine-grained types (no linestrings)
|
|
508
518
|
for (const group of [this.groupA, this.groupB, this.extraGeometry]) {
|
|
509
519
|
for (const member of group.members) {
|
|
510
520
|
let k = allPrimitives.length;
|
|
@@ -515,7 +525,6 @@ class RegionBooleanContext {
|
|
|
515
525
|
}
|
|
516
526
|
}
|
|
517
527
|
}
|
|
518
|
-
// const range = RegionOps.curveArrayRange(allPrimitives);
|
|
519
528
|
const intersections = CurveCurve_1.CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
|
|
520
529
|
const graph = PlanarSubdivision_1.PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
|
|
521
530
|
this.graph = graph;
|
|
@@ -534,9 +543,8 @@ class RegionBooleanContext {
|
|
|
534
543
|
this._announceFaceFunction = announceFaceFunction;
|
|
535
544
|
this.binaryOp = binaryOp;
|
|
536
545
|
this.graph.clearMask(Graph_1.HalfEdgeMask.EXTERIOR);
|
|
537
|
-
for (const group of [this.groupA, this.groupB])
|
|
546
|
+
for (const group of [this.groupA, this.groupB])
|
|
538
547
|
group.clearState();
|
|
539
|
-
}
|
|
540
548
|
const faceHasBeenVisitedMask = this.graph.grabMask();
|
|
541
549
|
const nodeHasBeenVisitedMask = this.graph.grabMask();
|
|
542
550
|
const componentArray = GraphComponentArray.create(this.graph);
|
|
@@ -617,18 +625,19 @@ class RegionBooleanContext {
|
|
|
617
625
|
return undefined;
|
|
618
626
|
}
|
|
619
627
|
// obligations to act as sweep callback ...
|
|
620
|
-
/** Announce a representative node on the outer face of a component */
|
|
628
|
+
/** Announce a representative node on the outer face of a component. */
|
|
621
629
|
startComponent(outerFaceNode) {
|
|
622
630
|
outerFaceNode.setMaskAroundFace(Graph_1.HalfEdgeMask.EXTERIOR);
|
|
623
631
|
if (this._announceFaceFunction)
|
|
624
632
|
this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));
|
|
625
633
|
return true;
|
|
626
634
|
}
|
|
627
|
-
/** Announce return to outer face */
|
|
635
|
+
/** Announce return to outer face. */
|
|
628
636
|
finishComponent(_node) {
|
|
629
637
|
return true;
|
|
630
638
|
}
|
|
631
|
-
/**
|
|
639
|
+
/**
|
|
640
|
+
* Announce entry to a graph face.
|
|
632
641
|
* * Both both sides of a graph edge are from the same RegionGroupMember.
|
|
633
642
|
* * Hence "crossing that edge" changes the parity count for the RegionGroupMember that owns that edge by 1.
|
|
634
643
|
* * The parity count for other RegionGroupMembers are never affected by this crossing.
|
|
@@ -650,8 +659,9 @@ class RegionBooleanContext {
|
|
|
650
659
|
}
|
|
651
660
|
}
|
|
652
661
|
exports.RegionBooleanContext = RegionBooleanContext;
|
|
653
|
-
/**
|
|
654
|
-
*
|
|
662
|
+
/**
|
|
663
|
+
* Return xy area between (part of) a curve and the x axis through a reference point.
|
|
664
|
+
* If detail is undefined or does not have both start and end fractions, just do trapezoid area.
|
|
655
665
|
*/
|
|
656
666
|
function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
|
|
657
667
|
// area between trapezoid and axis
|
|
@@ -665,15 +675,21 @@ function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
|
|
|
665
675
|
let areaToChord = 0.0;
|
|
666
676
|
if (detail && detail.curve && detail.hasFraction1) {
|
|
667
677
|
if (detail.curve instanceof LineSegment3d_1.LineSegment3d) {
|
|
668
|
-
//
|
|
678
|
+
// nothing to do for a line segment
|
|
669
679
|
}
|
|
670
680
|
else if (detail.curve instanceof Arc3d_1.Arc3d) {
|
|
671
681
|
areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1);
|
|
672
682
|
}
|
|
683
|
+
else {
|
|
684
|
+
const partial = detail.curve.clonePartialCurve(detail.fraction, detail.fraction1);
|
|
685
|
+
areaToChord = partial ?
|
|
686
|
+
RegionOps_1.RegionOps.computeXYArea(Loop_1.Loop.create(partial, LineSegment3d_1.LineSegment3d.create(detail.point1, detail.point))) ?? 0
|
|
687
|
+
: 0;
|
|
688
|
+
}
|
|
673
689
|
}
|
|
674
690
|
return trapezoidArea + areaToChord;
|
|
675
691
|
}
|
|
676
|
-
/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves */
|
|
692
|
+
/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves. */
|
|
677
693
|
function faceAreaFromCurvedEdgeData(faceSeed) {
|
|
678
694
|
let area = 0.0;
|
|
679
695
|
let edge = faceSeed;
|
|
@@ -696,8 +712,7 @@ class GraphComponent {
|
|
|
696
712
|
this.faceAreas = [];
|
|
697
713
|
}
|
|
698
714
|
/**
|
|
699
|
-
*
|
|
700
|
-
*
|
|
715
|
+
* Visit all vertices and edges in the component to build face area array and composite range.
|
|
701
716
|
* @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.
|
|
702
717
|
* @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.
|
|
703
718
|
*/
|
|
@@ -722,7 +737,8 @@ class GraphComponent {
|
|
|
722
737
|
}
|
|
723
738
|
}
|
|
724
739
|
exports.GraphComponent = GraphComponent;
|
|
725
|
-
/**
|
|
740
|
+
/**
|
|
741
|
+
* Build and hold an array of component data for a HalfEdgeGraph.
|
|
726
742
|
* @internal
|
|
727
743
|
*/
|
|
728
744
|
class GraphComponentArray {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionOpsClassificationSweeps.js","sourceRoot":"","sources":["../../../src/curve/RegionOpsClassificationSweeps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAEvC,mEAAkE;AAClE,+CAAuD;AACvD,+CAA4C;AAE5C,6CAAgG;AAChG,yEAAsE;AACtE,iDAAyD;AACzD,+DAAmE;AACnE,mCAAgC;AAChC,6CAA0C;AAC1C,+DAA4D;AAG5D,mDAAgD;AAChD,4FAAyF;AACzF,mDAAgD;AAChD,iCAA8B;AAC9B,iDAA8C;AAC9C,iEAA8D;AAC9D,2CAAqF;AACrF,+CAA4C;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAe,kCAAkC;IAC/C,sEAAsE;IAC/D,cAAc,CAAC,KAAe,IAAa,OAAO,IAAI,CAAC,CAAC,CAAC;IAChE,oCAAoC;IAC7B,eAAe,CAAC,KAAe,IAAa,OAAO,IAAI,CAAC,CAAC,CAAC;IACjE,0BAA0B;IACnB,SAAS,CAAC,cAA0B,EAAE,YAAsB,IAAa,OAAO,IAAI,CAAC,CAAC,CAAC;IAC9F,yBAAyB;IAClB,SAAS,CAAC,cAA0B,EAAE,YAAsB,IAAa,OAAO,IAAI,CAAC,CAAC,CAAC;CAC/F;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,oCAAqC,SAAQ,kCAAkC;IAC3E,mBAAmB,CAA8B;IACjD,YAAY,CAAY;IACxB,aAAa,CAAe;IACpC,YAAmB,kBAA+C,EAAE,YAA0B;QAC5F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,2BAA2B;QACtE,IAAI,CAAC,aAAa,G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,0BAA0B,CAAC,CAAC;YACxE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjBD,kDAiBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range2d, Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, NodeToNumberFunction } from \"../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../topology/Merging\";\nimport { RegularizationContext } from \"../topology/RegularizeFace\";\nimport { Arc3d } from \"./Arc3d\";\nimport { CurveCurve } from \"./CurveCurve\";\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\nimport { CurvePrimitive } from \"./CurvePrimitive\";\nimport { AnyRegion } from \"./CurveTypes\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\nimport { LineSegment3d } from \"./LineSegment3d\";\nimport { Loop } from \"./Loop\";\nimport { ParityRegion } from \"./ParityRegion\";\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\nimport { GraphCheckPointFunction, RegionBinaryOpType, RegionOps } from \"./RegionOps\";\nimport { UnionRegion } from \"./UnionRegion\";\n\n/**\n * base class for callbacks during region sweeps.\n * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.\n * * A Component in this usage is a component that is edge connected when ignoring \"exterior bridge edges\".\n * * As each face is entered, `enterFace(facePathStack, newFaceNode)` is called\n * * facePathStack[0] is the outermost node of the path from the outer face.\n * * facePathStack[1] is its inside mate.\n * * facePathStack[2k] is the outside node at crossing to face at depth k.\n * * facePathStack[2k+1] is the node where face at depth k was entered.\n * * newFaceNode is the entry node (redundant of stack tip)\n * * On retreat from a face, `leaveFace(facePathStack, faceNode)` is called.\n * * At end of component, `finishComponent (node)` is called.\n * * The base class is fully implemented to do nothing during the sweep.\n * @internal\n */\nabstract class RegionOpsFaceToFaceSearchCallbacks {\n /** Announce a representative node on the outer face of a component */\n public startComponent(_node: HalfEdge): boolean { return true; }\n /** Announce return to outer face */\n public finishComponent(_node: HalfEdge): boolean { return true; }\n /** Announce face entry */\n public enterFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean { return true; }\n /** Announce face exit */\n public leaveFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean { return true; }\n}\n/** Function signature to test if a pair of boolean states is to be accepted by area booleans (during face-to-face sweeps)\n * @internal\n */\ntype BinaryBooleanAcceptFunction = (stateA: boolean, stateB: boolean) => boolean;\n/** Function signature ot announce classification of a face.\n * The `faceType` parameters are\n * * -1 for a fully exterior face. This is a negative area face.\n * * 0 for a positive area face classified as \"out\" for the boolean.\n * * 1 for a positive area face classified as \"in\" for the boolean.\n */\ntype AnnounceClassifiedFace = (graph: HalfEdgeGraph, faceSeed: HalfEdge, faceType: -1 | 0 | 1, area: number) => void;\n/**\n * Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.\n * * For this linear-boundary case the boundary geometry is carried entirely from the coordinates in the half edges.\n * * This assumes the each node in the graph has edgeTag set to:\n * * `edgeTag === undefined` if the edge crossing does not change classification.\n * * for example, an edge added by regularization\n * * `edgeTag === 1` if this is a boundary for the first of the boolean input regions\n * * `edgeTag === 2` if this is a boundary for the second of the boolean input regions\n * * constructor\n * * takes caller-supplied function to decide whether to accept a face given its state relative to the two boolean terms.\n * * sets the in/out status of both terms to false.\n * * `startComponent` marks the entire outer face as `EXTERIOR`\n * * `enterFace`\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\n * * ask the faceAcceptFunction if the current term states combine to in/out for the result\n * * if out, set the `EXTERIOR` mask around the face.\n * * `leaveFace`\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\n * * `finishComponent` is not reimplemented.\n * @internal\n */\nclass RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCallbacks {\n private _faceSelectFunction: BinaryBooleanAcceptFunction;\n private _inComponent: boolean[];\n private _exteriorMask: HalfEdgeMask;\n public constructor(acceptFaceFunction: BinaryBooleanAcceptFunction, exteriorMask: HalfEdgeMask) {\n super();\n this._inComponent = [false, false, false]; // entry 0 is never reused.\n this._exteriorMask = exteriorMask;\n this._faceSelectFunction = acceptFaceFunction;\n }\n /** Mark this face as exterior */\n public override startComponent(node: HalfEdge): boolean { node.setMaskAroundFace(this._exteriorMask); return true; }\n /**\n * * If necessary, toggle a term state.\n * * if indicated, mark this face exterior.\n */\n public override enterFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\n const thisFaceIndex = node.edgeTag;\n if (node.edgeTag === 1 || node.edgeTag === 2)\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\n if (!this._faceSelectFunction(this._inComponent[1], this._inComponent[2]))\n node.setMaskAroundFace(this._exteriorMask);\n return true;\n }\n /**\n * * If necessary, toggle a term state.\n */\n public override leaveFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\n const thisFaceIndex = node.edgeTag;\n if (node.edgeTag === 1 || node.edgeTag === 2)\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\n return true;\n }\n}\n/**\n * Low level graph search for face classification.\n * @internal\n */\nexport class RegionOpsFaceToFaceSearch {\n /**\n * run a DFS with face-to-face step announcements.\n * * false return from any function terminates search immediately.\n * * all reachable nodes assumed to have both visit masks clear.\n * @param graph containing graph.\n * @param seed first node to visit.\n * @param faceHasBeenVisited mask marking faces that have been seen.\n * @param nodeHasBeenVisited mask marking node-to-node step around face.\n *\n */\n public static faceToFaceSearchFromOuterLoop(_graph: HalfEdgeGraph, seed: HalfEdge, faceHasBeenVisited: HalfEdgeMask, nodeHasBeenVisited: HalfEdgeMask, callbacks: RegionOpsFaceToFaceSearchCallbacks) {\n if (seed.isMaskSet(faceHasBeenVisited))\n return;\n if (!callbacks.startComponent(seed))\n return;\n const facePathStack = [];\n seed.setMaskAroundFace(faceHasBeenVisited);\n let faceWalker = seed;\n do {\n let entryNode = faceWalker;\n let mate = faceWalker.edgeMate;\n if (!mate.isMaskSet(faceHasBeenVisited)) {\n // the faceWalker seed is always on the base of the stack.\n // the stack then contains even-odd pairs of (entryNode, currentNode)\n // * entryNode is the node where a face was entered.\n // * faceNode is another node around that face.\n facePathStack.push(faceWalker);\n facePathStack.push(mate);\n let faceNode = mate.faceSuccessor;\n mate.setMaskAroundFace(faceHasBeenVisited);\n entryNode = mate;\n if (callbacks.enterFace(facePathStack, mate)) {\n for (; ;) {\n mate = faceNode.edgeMate;\n if (!mate.isMaskSet(faceHasBeenVisited)) {\n mate.setMaskAroundFace(faceHasBeenVisited);\n if (!callbacks.enterFace(facePathStack, mate))\n return;\n facePathStack.push(faceNode);\n facePathStack.push(mate);\n faceNode = mate;\n entryNode = mate;\n }\n faceNode.setMask(nodeHasBeenVisited);\n faceNode = faceNode.faceSuccessor;\n if (faceNode === entryNode) {\n callbacks.leaveFace(facePathStack, faceNode);\n if (facePathStack.length <= 2) {\n break;\n }\n facePathStack.pop();\n faceNode = facePathStack[facePathStack.length - 1];\n facePathStack.pop();\n entryNode = facePathStack[facePathStack.length - 1];\n }\n if (faceNode.isMaskSet(nodeHasBeenVisited)) {\n // this is disaster !!!\n return;\n }\n }\n }\n }\n // continue at outermost level .....\n faceWalker = faceWalker.faceSuccessor;\n } while (faceWalker !== seed);\n callbacks.finishComponent(seed);\n }\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\n * * Each of the binary input terms is a collection of loops\n * * Within the binary term, in/out is determined by edge-crossing parity rules.\n * * Processing steps are\n * * Build the loops for each set.\n * * Each edge labeled with 1 or 2 as binary term identifier.\n * * find crossings among the edges.\n * * Edges are split as needed, but split preserves the edgeTag\n * * sort edges around vertices\n * * add regularization edges so holes are connected to their parent.\n */\n public static doPolygonBoolean(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, faceSelectFunction: (inA: boolean, inB: boolean) => boolean, graphCheckPoint?: GraphCheckPointFunction): HalfEdgeGraph | undefined {\n const graph = new HalfEdgeGraph();\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\n const seedA = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsA, baseMask, 1);\n const seedB = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsB, baseMask, 2);\n if (graphCheckPoint)\n graphCheckPoint(\"unmerged loops\", graph, \"U\");\n if (seedA || seedB) {\n // split edges where they cross . . .\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\n if (graphCheckPoint)\n graphCheckPoint(\"After splitIntersectingEdges\", graph, \"S\");\n // sort radially around vertices.\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\n if (graphCheckPoint)\n graphCheckPoint(\"After clusterAndMergeXYTheta\", graph, \"M\");\n // add edges to connect various components (e.g. holes!!!)\n const context = new RegularizationContext(graph);\n context.regularizeGraph(true, true);\n if (graphCheckPoint)\n graphCheckPoint(\"After regularize\", graph, \"MR\");\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(graph);\n if (exteriorHalfEdge === undefined)\n return undefined;\n const exteriorMask = HalfEdgeMask.EXTERIOR;\n const faceVisitedMask = graph.grabMask();\n const nodeVisitedMask = graph.grabMask();\n const allMasksToClear = exteriorMask | faceVisitedMask | nodeVisitedMask;\n graph.clearMask(allMasksToClear);\n const callbacks = new RegionOpsBinaryBooleanSweepCallbacks(faceSelectFunction, exteriorMask);\n this.faceToFaceSearchFromOuterLoop(graph, exteriorHalfEdge, faceVisitedMask, nodeVisitedMask, callbacks);\n if (graphCheckPoint)\n graphCheckPoint(\"After faceToFaceSearchFromOuterLoop\", graph, \"MRX\");\n graph.dropMask(faceVisitedMask);\n graph.dropMask(nodeVisitedMask);\n return graph;\n }\n return undefined;\n }\n\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\n * * the manyLoopsAndParitySets input is an array.\n * * Each entry is one or more loops.\n * * An entry that is \"just points\" is a simple loop.\n * * An entry that is itself an array of arrays of points is a set of loops with \"parity\" -- relation:\n * * typically the first is an outer loop an others are holes.\n * * but if there is self intersection or multiple outer loops, parity rules are applied to decide inner and outer.\n * * Processing steps are\n * * Build the loops for each set.\n * * Each edge labeled with index to the outer array.\n * * find crossings among the edges.\n * * Edges are split as needed, but split preserves the edgeTag\n * * sort edges around vertices\n * * add regularization edges so holes are connected to their parent.\n * * assign inside/outside by parity within each set and overall union.\n */\n public static doBinaryBooleanBetweenMultiLoopInputs(\n dataA: MultiLineStringDataVariant[],\n opA: RegionGroupOpType,\n binaryOp: RegionBinaryOpType,\n dataB: MultiLineStringDataVariant[],\n opB: RegionGroupOpType,\n purgeSliverExteriorFaces: boolean,\n ): HalfEdgeGraph | undefined {\n const graph = new HalfEdgeGraph();\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\n const callbacks = RegionBooleanContext.create(opA, opB);\n callbacks.graph = graph;\n callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\n\n // Add all the members in groupA ..\n for (const data of dataA) {\n if (data.length > 2) {\n const member = new RegionGroupMember(data, callbacks.groupA);\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\n }\n }\n for (const data of dataB) {\n if (data.length > 2) {\n const member = new RegionGroupMember(data, callbacks.groupB);\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\n }\n }\n // split edges where they cross . . .\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\n // sort radially around vertices.\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\n // add edges to connect various components (e.g. holes!!!)\n const context = new RegularizationContext(graph);\n context.regularizeGraph(true, true);\n callbacks.runClassificationSweep(binaryOp);\n if (purgeSliverExteriorFaces)\n callbacks.unmaskMaskedNullFaces(HalfEdgeMask.EXTERIOR);\n return graph;\n }\n}\n\n/**\n * Enumeration of operation types \"within a group operand\" for a `RegionBooleanContext`.\n * @internal\n */\nexport enum RegionGroupOpType {\n Union = 0,\n Parity = 1,\n Intersection = 2,\n NonBounding = -1,\n}\n/**\n * Each loop or parity region in a `RegionBooleanContext` is recorded as a `RegionGroupMember`, which carries\n * * the Loop or parityRegion object\n * * a numeric indication of the sweep state (parity) during the classification search.\n * * a reference to the parent group (which in turn leads back to the `RegionBooleanContext`)\n * @internal\n */\nclass RegionGroupMember {\n public region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant;\n public sweepState: number;\n public parentGroup: RegionGroup;\n public constructor(region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant, parentGroup: RegionGroup) {\n this.region = region;\n this.parentGroup = parentGroup;\n this.sweepState = 0;\n }\n public clearState() { this.sweepState = 0; }\n}\n/**\n * A `RegionGroup` is\n * * An array of `RegionGroupMembers`, carrying the regions of the Ai or Bi part of the boolean expression.\n * * The `RegionGroupOpType` to be applied among those members.\n * * Pointer to the containing context\n * * The count of number of regions known to be \"in\" as the search progresses.\n * @internal\n */\nexport class RegionGroup {\n public members: RegionGroupMember[];\n public groupOpType: RegionGroupOpType;\n public parent: RegionBooleanContext;\n private _numIn: number;\n public constructor(parent: RegionBooleanContext, groupOpType: RegionGroupOpType) {\n this.members = [];\n this.parent = parent;\n this.groupOpType = groupOpType;\n this._numIn = 0;\n }\n /** deep clear of state data -- group header plus all members */\n public clearState() {\n for (const member of this.members)\n member.clearState();\n this._numIn = 0;\n }\n public range(): Range3d {\n const range = Range3d.createNull();\n for (const m of this.members) {\n if (m.region instanceof GeometryQuery)\n m.region.extendRange(range);\n else {\n const range1 = Range3d.createFromVariantData(m.region);\n range.extendRange(range1);\n }\n }\n return range;\n }\n /** Ask if the current _numIn count qualifies as an \"in\" for this operation type.\n */\n public getInOut(): boolean {\n // UNION is true if one or more members are IN\n if (this.groupOpType === RegionGroupOpType.Union)\n return this._numIn > 0;\n // PARITY is true if an odd number of regions are IN\n if (this.groupOpType === RegionGroupOpType.Parity)\n return Geometry.isOdd(this._numIn);\n // INTERSECTION is true if ALL the regions are IN\n if (this.groupOpType === RegionGroupOpType.Intersection)\n return this._numIn === this.members.length;\n return false;\n }\n // push new members into the group.\n public addMember(data: AnyRegion | AnyRegion[] | LineSegment3d | undefined, allowLineSegment: boolean = false) {\n if (data instanceof Loop || data instanceof ParityRegion) {\n const cleanerData = data.clone() as (ParityRegion | Loop);\n RegionOps.consolidateAdjacentPrimitives(cleanerData);\n this.members.push(new RegionGroupMember(cleanerData, this));\n } else if (data instanceof UnionRegion) {\n for (const child of data.children) {\n this.addMember(child);\n }\n } else if (Array.isArray(data)) {\n for (const item of data) {\n this.addMember(item);\n }\n } else if (allowLineSegment && data instanceof LineSegment3d) {\n this.members.push(new RegionGroupMember(data, this));\n\n }\n }\n // update the \"in\" count _numIn according to old and new states (parity counts) for some member region.\n public recordMemberStateChange(oldState: number, newState: number) {\n const oldIn = Geometry.isOdd(oldState);\n const newIn = Geometry.isOdd(newState);\n if (!oldIn && newIn)\n this._numIn++;\n else if (oldIn && !newIn)\n this._numIn--;\n }\n}\n/**\n * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.\n * * In the binary operation OP (union, intersection, parity, difference), the left and right operands\n * are each a composite union, difference, or parity among multiple inputs, i.e.\n * * (operationA among Ai) OP (operationB among Bi)\n * * where the Ai are one set of regions, being combined by operationA\n * * and the Bi are the another set of regions, being combined by operationB\n * * Each group of Ai and Bi is a `RegionGroup`\n * * This is an extremely delicate structure.\n * * Members are public because of the unique variety of queries, but should only be used for queries.\n * * The graph and curves in the booleans are connected by an extended pointer chain:\n * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail\n * * (CurveLocationDetail).curve points to a curve\n * * (Curve).parent points to RegionGroupMember\n * * (RegionGroupMember) points to RegionGroup\n * * (RegionGroup) points to RegionBooleanBinaryContext\n * * So..when a graph sweep crosses an edge,\n * * the chain leads to a parity count in the RegionGroupMember\n * * that can change the number of members active in the RegionGroup\n * * which can change the state of the context.\n * @internal\n */\nexport class RegionBooleanContext implements RegionOpsFaceToFaceSearchCallbacks {\n public groupA!: RegionGroup;\n public groupB!: RegionGroup;\n public extraGeometry!: RegionGroup;\n public graph!: HalfEdgeGraph;\n public faceAreaFunction!: NodeToNumberFunction;\n public binaryOp: RegionBinaryOpType;\n\n private constructor(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType) {\n this.groupA = new RegionGroup(this, groupTypeA);\n this.groupB = new RegionGroup(this, groupTypeB);\n this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);\n this.binaryOp = RegionBinaryOpType.Union; // it will be revised on can calls.\n }\n /**\n * Create a context with both A and B groups empty.\n * * Caller follows up by calls to `context.groupA.addMember (loopOrParityRegion)` or `context.groupB.addMember (loopOrParityRegion)`\n * @param groupTypeA\n * @param groupTypeB\n */\n public static create(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType): RegionBooleanContext {\n return new RegionBooleanContext(groupTypeA, groupTypeB);\n }\n public addMembers(dataA: AnyRegion | AnyRegion[] | undefined, dataB: AnyRegion | AnyRegion[] | undefined) {\n this.groupA.addMember(dataA);\n this.groupB.addMember(dataB);\n // const doConnectives = 1;\n // if (doConnectives !== 0)\n this.addConnectives();\n }\n\n private _workSegment?: LineSegment3d;\n private static _bridgeDirection = Vector3d.createNormalized(1.0, -0.12328974132467)!; // magic unit direction to minimize vertex hits\n /**\n * The sweep operations require access to all geometry by edge crossings and face walk.\n * If input loops are non-overlapping, there may be disconnected islands not reachable.\n * This method:\n * * finds the total range\n * * creates parallel rays from the extreme point of each loop and extending beyond the overall range\n * * places those lines in the extraGeometry group\n */\n public addConnectives() {\n const rangeA = this.groupA.range();\n const rangeB = this.groupB.range();\n const rangeAB = rangeA.union(rangeB);\n const areaTol = RegionOps.computeXYAreaTolerance(rangeAB);\n let margin = 0.1;\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);\n if (this._workSegment)\n margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray\n\n const maxPoints: Point3d[] = [];\n const findExtremePointsInLoop = (region: Loop) => {\n const area = RegionOps.computeXYArea(region);\n if (area === undefined || Math.abs(area) < areaTol)\n return; // avoid bridging trivial faces\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);\n if (this._workSegment)\n maxPoints.push(this._workSegment.point1Ref);\n };\n\n for (const groupMembers of [this.groupA.members, this.groupB.members]) {\n for (const m of groupMembers) {\n if (m.region instanceof Loop) {\n findExtremePointsInLoop(m.region);\n } else if (m.region instanceof ParityRegion) {\n for (const loop of m.region.children)\n findExtremePointsInLoop(loop);\n }\n }\n }\n\n const ray = Ray3d.createZero();\n for (const p of maxPoints) {\n // Make a line from...\n // 1) exactly the max point of the loops to\n // 2) a point clearly outside the big range\n // If p came from some inner loop this will...\n // 1) create a bridge from the inner loop through any containing loops (always)\n // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)\n const bridgeLength = margin + Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;\n const outside = Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);\n const bridgeLine = LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);\n this.extraGeometry.addMember(bridgeLine, true);\n }\n }\n\n /**\n * Markup and assembly steps for geometry in the RegionGroups.\n * * Annotate connection from group to curves.\n * * groups with point data but no curves get no further annotation.\n * * compute intersections.\n * * assemble and merge the HalfEdgeGraph.\n * @param mergeTolerance absolute distance tolerance for merging loops\n */\n public annotateAndMergeCurvesInGraph(mergeTolerance: number = Geometry.smallMetricDistance) {\n const allPrimitives: CurvePrimitive[] = [];\n // ASSUME loops have fine-grained types -- no linestrings !!\n for (const group of [this.groupA, this.groupB, this.extraGeometry]) {\n for (const member of group.members) {\n let k = allPrimitives.length;\n if (member.region instanceof GeometryQuery) {\n RegionOps.collectCurvePrimitives(member.region, allPrimitives, true, true);\n for (; k < allPrimitives.length; k++)\n allPrimitives[k].parent = member;\n }\n }\n }\n // const range = RegionOps.curveArrayRange(allPrimitives);\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);\n this.graph = graph;\n this.faceAreaFunction = faceAreaFromCurvedEdgeData;\n }\n private _announceFaceFunction?: AnnounceClassifiedFace;\n /**\n * Sweep through the graph to assign in/out classifications to all faces.\n * * the classification is announced in two ways:\n * * the EXTERNAL mask is set on all half edges that are NOT interior faces.\n * * the announceFaceFunction is called once for each face.\n * @param binaryOp\n * @param announceFaceFunction\n */\n public runClassificationSweep(\n binaryOp: RegionBinaryOpType,\n announceFaceFunction?: AnnounceClassifiedFace) {\n this._announceFaceFunction = announceFaceFunction;\n this.binaryOp = binaryOp;\n this.graph.clearMask(HalfEdgeMask.EXTERIOR);\n for (const group of [this.groupA, this.groupB]) {\n group.clearState();\n }\n const faceHasBeenVisitedMask = this.graph.grabMask();\n const nodeHasBeenVisitedMask = this.graph.grabMask();\n const componentArray = GraphComponentArray.create(this.graph);\n for (const component of componentArray.components) {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(component.faces, this.faceAreaFunction);\n if (exteriorHalfEdge) {\n const exteriorMask = HalfEdgeMask.EXTERIOR;\n const allMasksToClear = exteriorMask | faceHasBeenVisitedMask | nodeHasBeenVisitedMask;\n this.graph.clearMask(allMasksToClear);\n RegionOpsFaceToFaceSearch.faceToFaceSearchFromOuterLoop(this.graph, exteriorHalfEdge, faceHasBeenVisitedMask, nodeHasBeenVisitedMask, this);\n }\n }\n this.graph.dropMask(faceHasBeenVisitedMask);\n this.graph.dropMask(nodeHasBeenVisitedMask);\n }\n // search the graph for faces with\n // .. exactly 2 edges\n // .. both with given mask\n // .. at least one mate is not exterior.\n // .. clear that mark\n public unmaskMaskedNullFaces(mask: number) {\n for (const nodeA of this.graph.allHalfEdges) {\n const nodeB = nodeA.faceSuccessor;\n if (nodeB.faceSuccessor === nodeA) {\n if (nodeA.getMask(mask) && nodeB.getMask(mask)) {\n if (!nodeA.edgeMate.getMask(mask) || !nodeB.edgeMate.getMask(mask)) {\n nodeA.clearMask(mask);\n nodeB.clearMask(mask);\n }\n }\n }\n }\n }\n private getInOut(): boolean {\n if (this.binaryOp === RegionBinaryOpType.Union)\n return this.groupA.getInOut() || this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.Intersection)\n return this.groupA.getInOut() && this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.AMinusB)\n return this.groupA.getInOut() && !this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.BMinusA)\n return !this.groupA.getInOut() && this.groupB.getInOut();\n if (this.binaryOp === RegionBinaryOpType.Parity)\n return this.groupA.getInOut() !== this.groupB.getInOut();\n return false;\n }\n /**\n * Record transition across an edge as entry or exit from a RegionGroup.\n * * Work backward from the node to a RegionGroup. This path can be:\n * * If the node points to a CurveLocationDetail of a (possibly partial) curve, the path is (take a deep breath)\n * * node points to CurveLocation Detail\n * * CurveLocationDetail points to curve\n * * curve points to RegionGroupMember\n * * If the node points directly to a RegionGroup, it's ready to go!!!\n * @param node\n * @param delta\n */\n private recordTransitionAcrossEdge(node: HalfEdge, delta: number): RegionGroupMember | undefined {\n const updateRegionGroupMemberState = (member: RegionGroupMember): RegionGroupMember => {\n if (member.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\n return member; // no transition across a bridge edge\n if (delta !== 0) {\n const oldSweepState = member.sweepState;\n member.sweepState += delta;\n member.parentGroup.recordMemberStateChange(oldSweepState, member.sweepState);\n }\n return member;\n };\n\n const data = node.edgeTag;\n if (data instanceof RegionGroupMember)\n return updateRegionGroupMemberState(data);\n\n if (data instanceof CurveLocationDetail) {\n // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.\n const member = data.curve!.parent;\n if (member instanceof RegionGroupMember)\n return updateRegionGroupMemberState(member);\n }\n return undefined;\n }\n // obligations to act as sweep callback ...\n /** Announce a representative node on the outer face of a component */\n public startComponent(outerFaceNode: HalfEdge): boolean {\n outerFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\n if (this._announceFaceFunction)\n this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));\n return true;\n }\n /** Announce return to outer face */\n public finishComponent(_node: HalfEdge): boolean {\n return true;\n }\n /** Announce entry to a graph face.\n * * Both both sides of a graph edge are from the same RegionGroupMember.\n * * Hence \"crossing that edge\" changes the parity count for the RegionGroupMember that owns that edge by 1.\n * * The parity count for other RegionGroupMembers are never affected by this crossing.\n * * Crossing a bridge edge does not change the parity count.\n */\n public enterFace(_facePathStack: HalfEdge[], newFaceNode: HalfEdge): boolean {\n this.recordTransitionAcrossEdge(newFaceNode, 1);\n const state = this.getInOut();\n if (!state)\n newFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\n if (this._announceFaceFunction)\n this._announceFaceFunction(this.graph, newFaceNode, state ? 1 : 0, faceAreaFromCurvedEdgeData(newFaceNode));\n return true;\n }\n /** Announce face exit */\n public leaveFace(_facePathStack: HalfEdge[], oldFaceNode: HalfEdge): boolean {\n this.recordTransitionAcrossEdge(oldFaceNode, -1);\n return true;\n }\n}\n/** return xy area between a (part of a) curve and the x axis through a reference point.\n * If detail is undefined or does not have both start and end fractions, just do trapezoid area\n */\nfunction areaUnderPartialCurveXY(detail: CurveLocationDetail | undefined, xyStart: XAndY, xyEnd: XAndY, referencePoint: XAndY): number {\n // area between trapezoid and axis\n let trapezoidArea;\n if (detail && detail.point1) {\n trapezoidArea = -(detail.point1.x - detail.point.x) * (0.5 * (detail.point.y + detail.point1.y) - referencePoint.y);\n } else {\n trapezoidArea = -(xyEnd.x - xyStart.x) * (0.5 * (xyStart.y + xyEnd.y) - referencePoint.y);\n }\n let areaToChord = 0.0;\n if (detail && detail.curve && detail.hasFraction1) {\n\n if (detail.curve instanceof LineSegment3d) {\n // ah .. nothing to do for a line segment\n } else if (detail.curve instanceof Arc3d) {\n areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1!);\n }\n }\n return trapezoidArea + areaToChord;\n}\n/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves */\nfunction faceAreaFromCurvedEdgeData(faceSeed: HalfEdge): number {\n let area = 0.0;\n let edge = faceSeed;\n do {\n area += (edge.sortData as number) * areaUnderPartialCurveXY((edge.edgeTag as CurveLocationDetail), edge, edge.faceSuccessor, faceSeed);\n } while ((edge = edge.faceSuccessor) !== faceSeed);\n return area;\n}\n\n/**\n * Function to accumulate area under edges\n * Array of nodes representing faces in a subset of a graph.\n * @internal\n */\nexport type NodeAndRangeFunction = (edge: HalfEdge, range: Range2d) => void;\n/**\n * Array of nodes representing faces in a subset of a graph.\n * @internal\n */\nexport class GraphComponent {\n public faces: HalfEdge[];\n public faceAreas: number[];\n public range: Range2d;\n public constructor(faces: HalfEdge[]) {\n this.faces = faces;\n this.range = Range2d.createNull();\n this.faceAreas = [];\n }\n /**\n * visit all vertices and edges in the component to build face area array and composite range.\n *\n * @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.\n * @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.\n */\n public buildFaceData(extendRangeForEdge: NodeAndRangeFunction | undefined, faceAreaFunction: NodeToNumberFunction | undefined) {\n const vertexFunction = (node: HalfEdge) => {\n if (extendRangeForEdge)\n extendRangeForEdge(node, this.range);\n else\n this.range.extendXY(node.x, node.y);\n return 0;\n };\n this.range.setNull();\n for (const f of this.faces) {\n f.sumAroundFace(vertexFunction);\n }\n this.faceAreas.length = 0;\n if (!faceAreaFunction)\n faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\n for (const f of this.faces) {\n this.faceAreas.push(faceAreaFunction(f));\n }\n }\n}\n/** build and hold an array of component data for a HalfEdgeGraph.\n * @internal\n */\nexport class GraphComponentArray {\n public components: GraphComponent[];\n public graph: HalfEdgeGraph;\n private constructor(graph: HalfEdgeGraph) {\n this.graph = graph;\n this.components = [];\n }\n public static create(graph: HalfEdgeGraph, extendRangeForEdge?: (edge: HalfEdge, range: Range2d) => void): GraphComponentArray {\n const result = new GraphComponentArray(graph);\n const componentArrays = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n for (const componentFaces of componentArrays) {\n const component = new GraphComponent(componentFaces);\n component.buildFaceData(extendRangeForEdge, faceAreaFromCurvedEdgeData);\n result.components.push(component);\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RegionOpsClassificationSweeps.js","sourceRoot":"","sources":["../../../src/curve/RegionOpsClassificationSweeps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAEvC,mEAAkE;AAClE,+CAAuD;AACvD,+CAA4C;AAE5C,6CAAgG;AAChG,yEAAsE;AACtE,iDAAyD;AACzD,+DAAmE;AACnE,mCAAgC;AAChC,6CAA0C;AAC1C,+DAA4D;AAG5D,mDAAgD;AAChD,4FAAyF;AACzF,oFAAiF;AACjF,mDAAgD;AAChD,iCAA8B;AAC9B,iDAA8C;AAC9C,iEAA8D;AAC9D,2CAAq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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range2d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, NodeToNumberFunction } from \"../topology/Graph\";\r\nimport { HalfEdgeGraphSearch } from \"../topology/HalfEdgeGraphSearch\";\r\nimport { HalfEdgeGraphMerge } from \"../topology/Merging\";\r\nimport { RegularizationContext } from \"../topology/RegularizeFace\";\r\nimport { Arc3d } from \"./Arc3d\";\r\nimport { CurveCurve } from \"./CurveCurve\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { TransferWithSplitArcs } from \"./internalContexts/TransferWithSplitArcs\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { PlanarSubdivision } from \"./Query/PlanarSubdivision\";\r\nimport { GraphCheckPointFunction, RegionBinaryOpType, RegionOps } from \"./RegionOps\";\r\nimport { UnionRegion } from \"./UnionRegion\";\r\n\r\n/**\r\n * base class for callbacks during region sweeps.\r\n * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.\r\n * * A Component in this usage is a component that is edge connected when ignoring \"exterior bridge edges\".\r\n * * As each face is entered, `enterFace(facePathStack, newFaceNode)` is called\r\n * * facePathStack[0] is the outermost node of the path from the outer face.\r\n * * facePathStack[1] is its inside mate.\r\n * * facePathStack[2k] is the outside node at crossing to face at depth k.\r\n * * facePathStack[2k+1] is the node where face at depth k was entered.\r\n * * newFaceNode is the entry node (redundant of stack tip)\r\n * * On retreat from a face, `leaveFace(facePathStack, faceNode)` is called.\r\n * * At end of component, `finishComponent (node)` is called.\r\n * * The base class is fully implemented to do nothing during the sweep.\r\n * @internal\r\n */\r\nabstract class RegionOpsFaceToFaceSearchCallbacks {\r\n /** Announce a representative node on the outer face of a component. */\r\n public startComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce return to outer face. */\r\n public finishComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce face entry. */\r\n public enterFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean {\r\n return true;\r\n }\r\n /** Announce face exit. */\r\n public leaveFace(_facePathStack: HalfEdge[], _newFaceNode: HalfEdge): boolean {\r\n return true;\r\n }\r\n}\r\n/** Function signature to test if a pair of boolean states is to be accepted by area booleans (during face-to-face sweeps)\r\n * @internal\r\n */\r\ntype BinaryBooleanAcceptFunction = (stateA: boolean, stateB: boolean) => boolean;\r\n/** Function signature ot announce classification of a face.\r\n * The `faceType` parameters are\r\n * * -1 for a fully exterior face. This is a negative area face.\r\n * * 0 for a positive area face classified as \"out\" for the boolean.\r\n * * 1 for a positive area face classified as \"in\" for the boolean.\r\n */\r\ntype AnnounceClassifiedFace = (graph: HalfEdgeGraph, faceSeed: HalfEdge, faceType: -1 | 0 | 1, area: number) => void;\r\n/**\r\n * Implementation of `RegionOpsFaceToFaceSearchCallbacks` for binary boolean sweep with polygonal regions.\r\n * * For this linear-boundary case the boundary geometry is carried entirely from the coordinates in the half edges.\r\n * * This assumes the each node in the graph has edgeTag set to:\r\n * * `edgeTag === undefined` if the edge crossing does not change classification.\r\n * * for example, an edge added by regularization\r\n * * `edgeTag === 1` if this is a boundary for the first of the boolean input regions\r\n * * `edgeTag === 2` if this is a boundary for the second of the boolean input regions\r\n * * constructor\r\n * * takes caller-supplied function to decide whether to accept a face given its state relative to the two boolean terms.\r\n * * sets the in/out status of both terms to false.\r\n * * `startComponent` marks the entire outer face as `EXTERIOR`\r\n * * `enterFace`\r\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\r\n * * ask the faceAcceptFunction if the current term states combine to in/out for the result\r\n * * if out, set the `EXTERIOR` mask around the face.\r\n * * `leaveFace`\r\n * * if this is a bounding edge (according to `node.faceTag`) toggle the in/out status if this boolean term.\r\n * * `finishComponent` is not reimplemented.\r\n * @internal\r\n */\r\nclass RegionOpsBinaryBooleanSweepCallbacks extends RegionOpsFaceToFaceSearchCallbacks {\r\n private _faceSelectFunction: BinaryBooleanAcceptFunction;\r\n private _inComponent: boolean[];\r\n private _exteriorMask: HalfEdgeMask;\r\n public constructor(acceptFaceFunction: BinaryBooleanAcceptFunction, exteriorMask: HalfEdgeMask) {\r\n super();\r\n this._inComponent = [false, false, false]; // entry 0 is never reused.\r\n this._exteriorMask = exteriorMask;\r\n this._faceSelectFunction = acceptFaceFunction;\r\n }\r\n /** Mark this face as exterior */\r\n public override startComponent(node: HalfEdge): boolean { node.setMaskAroundFace(this._exteriorMask); return true; }\r\n /**\r\n * * If necessary, toggle a term state.\r\n * * if indicated, mark this face exterior.\r\n */\r\n public override enterFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\r\n const thisFaceIndex = node.edgeTag;\r\n if (node.edgeTag === 1 || node.edgeTag === 2)\r\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\r\n if (!this._faceSelectFunction(this._inComponent[1], this._inComponent[2]))\r\n node.setMaskAroundFace(this._exteriorMask);\r\n return true;\r\n }\r\n /**\r\n * * If necessary, toggle a term state.\r\n */\r\n public override leaveFace(_facePathStack: HalfEdge[], node: HalfEdge): boolean {\r\n const thisFaceIndex = node.edgeTag;\r\n if (node.edgeTag === 1 || node.edgeTag === 2)\r\n this._inComponent[thisFaceIndex] = !this._inComponent[thisFaceIndex];\r\n return true;\r\n }\r\n}\r\n/**\r\n * Low level graph search for face classification.\r\n * @internal\r\n */\r\nexport class RegionOpsFaceToFaceSearch {\r\n /**\r\n * Run a DFS with face-to-face step announcements.\r\n * * false return from any function terminates search immediately.\r\n * * all reachable nodes assumed to have both visit masks clear.\r\n * @param graph containing graph.\r\n * @param seed first node to visit.\r\n * @param faceHasBeenVisited mask marking faces that have been seen.\r\n * @param nodeHasBeenVisited mask marking node-to-node step around face.\r\n * @param callbacks callbacks.\r\n */\r\n public static faceToFaceSearchFromOuterLoop(\r\n _graph: HalfEdgeGraph,\r\n seed: HalfEdge,\r\n faceHasBeenVisited: HalfEdgeMask,\r\n nodeHasBeenVisited: HalfEdgeMask,\r\n callbacks: RegionOpsFaceToFaceSearchCallbacks,\r\n ): void {\r\n if (seed.isMaskSet(faceHasBeenVisited))\r\n return;\r\n if (!callbacks.startComponent(seed))\r\n return;\r\n const facePathStack = [];\r\n seed.setMaskAroundFace(faceHasBeenVisited);\r\n let faceWalker = seed;\r\n do {\r\n let entryNode = faceWalker;\r\n let mate = faceWalker.edgeMate;\r\n if (!mate.isMaskSet(faceHasBeenVisited)) {\r\n // The faceWalker seed is always on the base of the stack.\r\n // The stack then contains even-odd pairs of (entryNode, faceNode).\r\n // entryNode is the node where a face was entered.\r\n // faceNode is another node around that face.\r\n facePathStack.push(faceWalker);\r\n facePathStack.push(mate);\r\n let faceNode = mate.faceSuccessor;\r\n mate.setMaskAroundFace(faceHasBeenVisited);\r\n entryNode = mate;\r\n if (callbacks.enterFace(facePathStack, mate)) {\r\n for (; ;) {\r\n mate = faceNode.edgeMate;\r\n if (!mate.isMaskSet(faceHasBeenVisited)) {\r\n mate.setMaskAroundFace(faceHasBeenVisited);\r\n if (!callbacks.enterFace(facePathStack, mate))\r\n return;\r\n facePathStack.push(faceNode);\r\n facePathStack.push(mate);\r\n faceNode = mate;\r\n entryNode = mate;\r\n }\r\n faceNode.setMask(nodeHasBeenVisited);\r\n faceNode = faceNode.faceSuccessor;\r\n if (faceNode === entryNode) {\r\n callbacks.leaveFace(facePathStack, faceNode);\r\n if (facePathStack.length <= 2) {\r\n break;\r\n }\r\n facePathStack.pop();\r\n faceNode = facePathStack[facePathStack.length - 1];\r\n facePathStack.pop();\r\n entryNode = facePathStack[facePathStack.length - 1];\r\n }\r\n if (faceNode.isMaskSet(nodeHasBeenVisited)) {\r\n // this is disaster\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // continue at outermost level\r\n faceWalker = faceWalker.faceSuccessor;\r\n } while (faceWalker !== seed);\r\n callbacks.finishComponent(seed);\r\n }\r\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\r\n * * Each of the binary input terms is a collection of loops\r\n * * Within the binary term, in/out is determined by edge-crossing parity rules.\r\n * * Processing steps are\r\n * * Build the loops for each set.\r\n * * Each edge labeled with 1 or 2 as binary term identifier.\r\n * * find crossings among the edges.\r\n * * Edges are split as needed, but split preserves the edgeTag\r\n * * sort edges around vertices\r\n * * add regularization edges so holes are connected to their parent.\r\n */\r\n public static doPolygonBoolean(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, faceSelectFunction: (inA: boolean, inB: boolean) => boolean, graphCheckPoint?: GraphCheckPointFunction): HalfEdgeGraph | undefined {\r\n const graph = new HalfEdgeGraph();\r\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\r\n const seedA = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsA, baseMask, 1);\r\n const seedB = RegionOps.addLoopsWithEdgeTagToGraph(graph, loopsB, baseMask, 2);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"unmerged loops\", graph, \"U\");\r\n if (seedA || seedB) {\r\n // split edges where they cross . . .\r\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After splitIntersectingEdges\", graph, \"S\");\r\n // sort radially around vertices.\r\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After clusterAndMergeXYTheta\", graph, \"M\");\r\n // add edges to connect various components (e.g. holes!!!)\r\n const context = new RegularizationContext(graph);\r\n context.regularizeGraph(true, true);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After regularize\", graph, \"MR\");\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(graph);\r\n if (exteriorHalfEdge === undefined)\r\n return undefined;\r\n const exteriorMask = HalfEdgeMask.EXTERIOR;\r\n const faceVisitedMask = graph.grabMask();\r\n const nodeVisitedMask = graph.grabMask();\r\n const allMasksToClear = exteriorMask | faceVisitedMask | nodeVisitedMask;\r\n graph.clearMask(allMasksToClear);\r\n const callbacks = new RegionOpsBinaryBooleanSweepCallbacks(faceSelectFunction, exteriorMask);\r\n this.faceToFaceSearchFromOuterLoop(graph, exteriorHalfEdge, faceVisitedMask, nodeVisitedMask, callbacks);\r\n if (graphCheckPoint)\r\n graphCheckPoint(\"After faceToFaceSearchFromOuterLoop\", graph, \"MRX\");\r\n graph.dropMask(faceVisitedMask);\r\n graph.dropMask(nodeVisitedMask);\r\n return graph;\r\n }\r\n return undefined;\r\n }\r\n /** Complete multi-step process for polygon binary booleans starting with arrays of coordinates.\r\n * * the manyLoopsAndParitySets input is an array.\r\n * * Each entry is one or more loops.\r\n * * An entry that is \"just points\" is a simple loop.\r\n * * An entry that is itself an array of arrays of points is a set of loops with \"parity\" -- relation:\r\n * * typically the first is an outer loop an others are holes.\r\n * * but if there is self intersection or multiple outer loops, parity rules are applied to decide inner and outer.\r\n * * Processing steps are\r\n * * Build the loops for each set.\r\n * * Each edge labeled with index to the outer array.\r\n * * find crossings among the edges.\r\n * * Edges are split as needed, but split preserves the edgeTag\r\n * * sort edges around vertices\r\n * * add regularization edges so holes are connected to their parent.\r\n * * assign inside/outside by parity within each set and overall union.\r\n */\r\n public static doBinaryBooleanBetweenMultiLoopInputs(\r\n dataA: MultiLineStringDataVariant[],\r\n opA: RegionGroupOpType,\r\n binaryOp: RegionBinaryOpType,\r\n dataB: MultiLineStringDataVariant[],\r\n opB: RegionGroupOpType,\r\n purgeSliverExteriorFaces: boolean,\r\n ): HalfEdgeGraph | undefined {\r\n const graph = new HalfEdgeGraph();\r\n const baseMask = HalfEdgeMask.BOUNDARY_EDGE | HalfEdgeMask.PRIMARY_EDGE;\r\n const callbacks = RegionBooleanContext.create(opA, opB);\r\n callbacks.graph = graph;\r\n callbacks.faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\r\n\r\n // Add all the members in groupA ..\r\n for (const data of dataA) {\r\n if (data.length > 2) {\r\n const member = new RegionGroupMember(data, callbacks.groupA);\r\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\r\n }\r\n }\r\n for (const data of dataB) {\r\n if (data.length > 2) {\r\n const member = new RegionGroupMember(data, callbacks.groupB);\r\n RegionOps.addLoopsWithEdgeTagToGraph(graph, data, baseMask, member);\r\n }\r\n }\r\n // split edges where they cross . . .\r\n HalfEdgeGraphMerge.splitIntersectingEdges(graph);\r\n // sort radially around vertices.\r\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph);\r\n // add edges to connect various components (e.g. holes!!!)\r\n const context = new RegularizationContext(graph);\r\n context.regularizeGraph(true, true);\r\n callbacks.runClassificationSweep(binaryOp);\r\n if (purgeSliverExteriorFaces)\r\n callbacks.unmaskMaskedNullFaces(HalfEdgeMask.EXTERIOR);\r\n return graph;\r\n }\r\n}\r\n\r\n/**\r\n * Enumeration of operation types \"within a group operand\" for a `RegionBooleanContext`.\r\n * @internal\r\n */\r\nexport enum RegionGroupOpType {\r\n Union = 0,\r\n Parity = 1,\r\n Intersection = 2,\r\n NonBounding = -1,\r\n}\r\n\r\n/**\r\n * Each loop or parity region in a `RegionBooleanContext` is recorded as a `RegionGroupMember`, which carries\r\n * * the Loop or parityRegion object\r\n * * a numeric indication of the sweep state (parity) during the classification search.\r\n * * a reference to the parent group (which in turn leads back to the `RegionBooleanContext`)\r\n * @internal\r\n */\r\nclass RegionGroupMember {\r\n public region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant;\r\n public sweepState: number;\r\n public parentGroup: RegionGroup;\r\n public constructor(region: Loop | ParityRegion | CurvePrimitive | MultiLineStringDataVariant, parentGroup: RegionGroup) {\r\n this.region = region;\r\n this.parentGroup = parentGroup;\r\n this.sweepState = 0;\r\n }\r\n public clearState() {\r\n this.sweepState = 0;\r\n }\r\n}\r\n\r\n/**\r\n * A `RegionGroup` is\r\n * * An array of `RegionGroupMembers`, carrying the regions of the Ai or Bi part of the boolean expression.\r\n * * The `RegionGroupOpType` to be applied among those members.\r\n * * Pointer to the containing context\r\n * * The count of number of regions known to be \"in\" as the search progresses.\r\n * @internal\r\n */\r\nexport class RegionGroup {\r\n public members: RegionGroupMember[];\r\n public groupOpType: RegionGroupOpType;\r\n public parent: RegionBooleanContext;\r\n private _numIn: number;\r\n public constructor(parent: RegionBooleanContext, groupOpType: RegionGroupOpType) {\r\n this.members = [];\r\n this.parent = parent;\r\n this.groupOpType = groupOpType;\r\n this._numIn = 0;\r\n }\r\n /** deep clear of state data -- group header plus all members */\r\n public clearState() {\r\n for (const member of this.members)\r\n member.clearState();\r\n this._numIn = 0;\r\n }\r\n public range(): Range3d {\r\n const range = Range3d.createNull();\r\n for (const m of this.members) {\r\n if (m.region instanceof GeometryQuery)\r\n m.region.extendRange(range);\r\n else {\r\n const range1 = Range3d.createFromVariantData(m.region);\r\n range.extendRange(range1);\r\n }\r\n }\r\n return range;\r\n }\r\n /** Ask if the current _numIn count qualifies as an \"in\" for this operation type. */\r\n public getInOut(): boolean {\r\n // UNION is true if one or more members are IN\r\n if (this.groupOpType === RegionGroupOpType.Union)\r\n return this._numIn > 0;\r\n // PARITY is true if an odd number of regions are IN\r\n if (this.groupOpType === RegionGroupOpType.Parity)\r\n return Geometry.isOdd(this._numIn);\r\n // INTERSECTION is true if ALL the regions are IN\r\n if (this.groupOpType === RegionGroupOpType.Intersection)\r\n return this._numIn === this.members.length;\r\n return false;\r\n }\r\n // push new members into the group.\r\n public addMember(data: AnyRegion | AnyRegion[] | LineSegment3d | undefined, allowLineSegment: boolean = false) {\r\n if (data instanceof Loop || data instanceof ParityRegion) {\r\n let cleanerData = data.clone() as (ParityRegion | Loop);\r\n RegionOps.consolidateAdjacentPrimitives(cleanerData);\r\n cleanerData = TransferWithSplitArcs.clone(cleanerData) as (ParityRegion | Loop);\r\n this.members.push(new RegionGroupMember(cleanerData, this));\r\n } else if (data instanceof UnionRegion) {\r\n for (const child of data.children) {\r\n this.addMember(child);\r\n }\r\n } else if (Array.isArray(data)) {\r\n for (const item of data) {\r\n this.addMember(item);\r\n }\r\n } else if (allowLineSegment && data instanceof LineSegment3d) {\r\n this.members.push(new RegionGroupMember(data, this));\r\n }\r\n }\r\n // update the \"in\" count _numIn according to old and new states (parity counts) for some member region.\r\n public recordMemberStateChange(oldState: number, newState: number) {\r\n const oldIn = Geometry.isOdd(oldState);\r\n const newIn = Geometry.isOdd(newState);\r\n if (!oldIn && newIn)\r\n this._numIn++;\r\n else if (oldIn && !newIn)\r\n this._numIn--;\r\n }\r\n}\r\n/**\r\n * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.\r\n * * In the binary operation OP (union, intersection, parity, difference), the left and right operands\r\n * are each a composite union, difference, or parity among multiple inputs, i.e.,\r\n * * (operationA among Ai) OP (operationB among Bi)\r\n * * where the Ai are one set of regions, being combined by operationA\r\n * * and the Bi are the another set of regions, being combined by operationB.\r\n * * Each group of Ai and Bi is a `RegionGroup`.\r\n * * This is an extremely delicate structure.\r\n * * Members are public because of the unique variety of queries, but should only be used for queries.\r\n * * The graph and curves in the booleans are connected by an extended pointer chain:\r\n * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.\r\n * * (CurveLocationDetail).curve points to a curve.\r\n * * (Curve).parent points to RegionGroupMember.\r\n * * (RegionGroupMember) points to RegionGroup.\r\n * * (RegionGroup) points to RegionBooleanBinaryContext.\r\n * * So when a graph sweep crosses an edge\r\n * * the chain leads to a parity count in the RegionGroupMember.\r\n * * that can change the number of members active in the RegionGroup.\r\n * * which can change the state of the context.\r\n * @internal\r\n */\r\nexport class RegionBooleanContext implements RegionOpsFaceToFaceSearchCallbacks {\r\n public groupA!: RegionGroup;\r\n public groupB!: RegionGroup;\r\n /** bridge edges */\r\n public extraGeometry!: RegionGroup;\r\n public graph!: HalfEdgeGraph;\r\n public faceAreaFunction!: NodeToNumberFunction;\r\n public binaryOp: RegionBinaryOpType;\r\n private constructor(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType) {\r\n this.groupA = new RegionGroup(this, groupTypeA);\r\n this.groupB = new RegionGroup(this, groupTypeB);\r\n this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);\r\n this.binaryOp = RegionBinaryOpType.Union; // revised in runClassificationSweep\r\n }\r\n /**\r\n * Create a context with both A and B groups empty.\r\n * * Caller follows up by calls to `context.groupA.addMember (loopOrParityRegion)` or `context.groupB.addMember (loopOrParityRegion)`\r\n * @param groupTypeA\r\n * @param groupTypeB\r\n */\r\n public static create(groupTypeA: RegionGroupOpType, groupTypeB: RegionGroupOpType): RegionBooleanContext {\r\n return new RegionBooleanContext(groupTypeA, groupTypeB);\r\n }\r\n public addMembers(dataA: AnyRegion | AnyRegion[] | undefined, dataB: AnyRegion | AnyRegion[] | undefined) {\r\n this.groupA.addMember(dataA);\r\n this.groupB.addMember(dataB);\r\n this.addConnectives();\r\n }\r\n private _workSegment?: LineSegment3d;\r\n private static _bridgeDirection = Vector3d.createNormalized(1.0, -0.12328974132467)!; // magic unit direction to minimize vertex hits\r\n /**\r\n * The sweep operations require access to all geometry by edge crossings and face walk.\r\n * If input loops are non-overlapping, there may be disconnected islands not reachable.\r\n * This method:\r\n * * finds the total range\r\n * * creates parallel rays from the extreme point of each loop and extending beyond the overall range\r\n * * places those lines in the extraGeometry group\r\n */\r\n public addConnectives() {\r\n const rangeA = this.groupA.range();\r\n const rangeB = this.groupB.range();\r\n const rangeAB = rangeA.union(rangeB);\r\n const areaTol = RegionOps.computeXYAreaTolerance(rangeAB);\r\n let margin = 0.1;\r\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);\r\n if (this._workSegment)\r\n margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray\r\n const maxPoints: Point3d[] = [];\r\n const findExtremePointsInLoop = (region: Loop) => {\r\n const area = RegionOps.computeXYArea(region);\r\n if (area === undefined || Math.abs(area) < areaTol)\r\n return; // avoid bridging trivial faces\r\n this._workSegment = PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);\r\n if (this._workSegment)\r\n maxPoints.push(this._workSegment.point1Ref);\r\n };\r\n for (const groupMembers of [this.groupA.members, this.groupB.members]) {\r\n for (const m of groupMembers) {\r\n if (m.region instanceof Loop) {\r\n findExtremePointsInLoop(m.region);\r\n } else if (m.region instanceof ParityRegion) {\r\n for (const loop of m.region.children)\r\n findExtremePointsInLoop(loop);\r\n }\r\n }\r\n }\r\n const ray = Ray3d.createZero();\r\n for (const p of maxPoints) {\r\n // Make a line from\r\n // 1) exactly the max point of the loops to\r\n // 2) a point clearly outside the big range\r\n // If p came from some inner loop this will\r\n // 1) create a bridge from the inner loop through any containing loops (always)\r\n // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)\r\n const bridgeLength = margin + Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;\r\n const outside = Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);\r\n const bridgeLine = LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);\r\n this.extraGeometry.addMember(bridgeLine, true);\r\n }\r\n }\r\n /**\r\n * Markup and assembly steps for geometry in the RegionGroups.\r\n * * Annotate connection from group to curves.\r\n * * groups with point data but no curves get no further annotation.\r\n * * compute intersections.\r\n * * assemble and merge the HalfEdgeGraph.\r\n * @param mergeTolerance absolute distance tolerance for merging loops\r\n */\r\n public annotateAndMergeCurvesInGraph(mergeTolerance: number = Geometry.smallMetricDistance) {\r\n const allPrimitives: CurvePrimitive[] = [];\r\n // ASSUME loops have fine-grained types (no linestrings)\r\n for (const group of [this.groupA, this.groupB, this.extraGeometry]) {\r\n for (const member of group.members) {\r\n let k = allPrimitives.length;\r\n if (member.region instanceof GeometryQuery) {\r\n RegionOps.collectCurvePrimitives(member.region, allPrimitives, true, true);\r\n for (; k < allPrimitives.length; k++)\r\n allPrimitives[k].parent = member;\r\n }\r\n }\r\n }\r\n const intersections = CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);\r\n const graph = PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);\r\n this.graph = graph;\r\n this.faceAreaFunction = faceAreaFromCurvedEdgeData;\r\n }\r\n private _announceFaceFunction?: AnnounceClassifiedFace;\r\n /**\r\n * Sweep through the graph to assign in/out classifications to all faces.\r\n * * the classification is announced in two ways:\r\n * * the EXTERNAL mask is set on all half edges that are NOT interior faces.\r\n * * the announceFaceFunction is called once for each face.\r\n * @param binaryOp\r\n * @param announceFaceFunction\r\n */\r\n public runClassificationSweep(binaryOp: RegionBinaryOpType, announceFaceFunction?: AnnounceClassifiedFace): void {\r\n this._announceFaceFunction = announceFaceFunction;\r\n this.binaryOp = binaryOp;\r\n this.graph.clearMask(HalfEdgeMask.EXTERIOR);\r\n for (const group of [this.groupA, this.groupB])\r\n group.clearState();\r\n const faceHasBeenVisitedMask = this.graph.grabMask();\r\n const nodeHasBeenVisitedMask = this.graph.grabMask();\r\n const componentArray = GraphComponentArray.create(this.graph);\r\n for (const component of componentArray.components) {\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(component.faces, this.faceAreaFunction);\r\n if (exteriorHalfEdge) {\r\n const exteriorMask = HalfEdgeMask.EXTERIOR;\r\n const allMasksToClear = exteriorMask | faceHasBeenVisitedMask | nodeHasBeenVisitedMask;\r\n this.graph.clearMask(allMasksToClear);\r\n RegionOpsFaceToFaceSearch.faceToFaceSearchFromOuterLoop(\r\n this.graph, exteriorHalfEdge, faceHasBeenVisitedMask, nodeHasBeenVisitedMask, this,\r\n );\r\n }\r\n }\r\n this.graph.dropMask(faceHasBeenVisitedMask);\r\n this.graph.dropMask(nodeHasBeenVisitedMask);\r\n }\r\n // search the graph for faces with\r\n // .. exactly 2 edges\r\n // .. both with given mask\r\n // .. at least one mate is not exterior.\r\n // .. clear that mark\r\n public unmaskMaskedNullFaces(mask: number) {\r\n for (const nodeA of this.graph.allHalfEdges) {\r\n const nodeB = nodeA.faceSuccessor;\r\n if (nodeB.faceSuccessor === nodeA) {\r\n if (nodeA.getMask(mask) && nodeB.getMask(mask)) {\r\n if (!nodeA.edgeMate.getMask(mask) || !nodeB.edgeMate.getMask(mask)) {\r\n nodeA.clearMask(mask);\r\n nodeB.clearMask(mask);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n private getInOut(): boolean {\r\n if (this.binaryOp === RegionBinaryOpType.Union)\r\n return this.groupA.getInOut() || this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.Intersection)\r\n return this.groupA.getInOut() && this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.AMinusB)\r\n return this.groupA.getInOut() && !this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.BMinusA)\r\n return !this.groupA.getInOut() && this.groupB.getInOut();\r\n if (this.binaryOp === RegionBinaryOpType.Parity)\r\n return this.groupA.getInOut() !== this.groupB.getInOut();\r\n return false;\r\n }\r\n /**\r\n * Record transition across an edge as entry or exit from a RegionGroup.\r\n * * Work backward from the node to a RegionGroup. This path can be:\r\n * * If the node points to a CurveLocationDetail of a (possibly partial) curve, the path is (take a deep breath)\r\n * * node points to CurveLocation Detail\r\n * * CurveLocationDetail points to curve\r\n * * curve points to RegionGroupMember\r\n * * If the node points directly to a RegionGroup, it's ready to go!!!\r\n * @param node\r\n * @param delta\r\n */\r\n private recordTransitionAcrossEdge(node: HalfEdge, delta: number): RegionGroupMember | undefined {\r\n const updateRegionGroupMemberState = (member: RegionGroupMember): RegionGroupMember => {\r\n if (member.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\r\n return member; // no transition across a bridge edge\r\n if (delta !== 0) {\r\n const oldSweepState = member.sweepState;\r\n member.sweepState += delta;\r\n member.parentGroup.recordMemberStateChange(oldSweepState, member.sweepState);\r\n }\r\n return member;\r\n };\r\n\r\n const data = node.edgeTag;\r\n if (data instanceof RegionGroupMember)\r\n return updateRegionGroupMemberState(data);\r\n\r\n if (data instanceof CurveLocationDetail) {\r\n // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.\r\n const member = data.curve!.parent;\r\n if (member instanceof RegionGroupMember)\r\n return updateRegionGroupMemberState(member);\r\n }\r\n return undefined;\r\n }\r\n // obligations to act as sweep callback ...\r\n /** Announce a representative node on the outer face of a component. */\r\n public startComponent(outerFaceNode: HalfEdge): boolean {\r\n outerFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\r\n if (this._announceFaceFunction)\r\n this._announceFaceFunction(this.graph, outerFaceNode, -1, faceAreaFromCurvedEdgeData(outerFaceNode));\r\n return true;\r\n }\r\n /** Announce return to outer face. */\r\n public finishComponent(_node: HalfEdge): boolean {\r\n return true;\r\n }\r\n /**\r\n * Announce entry to a graph face.\r\n * * Both both sides of a graph edge are from the same RegionGroupMember.\r\n * * Hence \"crossing that edge\" changes the parity count for the RegionGroupMember that owns that edge by 1.\r\n * * The parity count for other RegionGroupMembers are never affected by this crossing.\r\n * * Crossing a bridge edge does not change the parity count.\r\n */\r\n public enterFace(_facePathStack: HalfEdge[], newFaceNode: HalfEdge): boolean {\r\n this.recordTransitionAcrossEdge(newFaceNode, 1);\r\n const state = this.getInOut();\r\n if (!state)\r\n newFaceNode.setMaskAroundFace(HalfEdgeMask.EXTERIOR);\r\n if (this._announceFaceFunction)\r\n this._announceFaceFunction(this.graph, newFaceNode, state ? 1 : 0, faceAreaFromCurvedEdgeData(newFaceNode));\r\n return true;\r\n }\r\n /** Announce face exit */\r\n public leaveFace(_facePathStack: HalfEdge[], oldFaceNode: HalfEdge): boolean {\r\n this.recordTransitionAcrossEdge(oldFaceNode, -1);\r\n return true;\r\n }\r\n}\r\n/**\r\n * Return xy area between (part of) a curve and the x axis through a reference point.\r\n * If detail is undefined or does not have both start and end fractions, just do trapezoid area.\r\n */\r\nfunction areaUnderPartialCurveXY(\r\n detail: CurveLocationDetail | undefined, xyStart: XAndY, xyEnd: XAndY, referencePoint: XAndY,\r\n): number {\r\n // area between trapezoid and axis\r\n let trapezoidArea;\r\n if (detail && detail.point1) {\r\n trapezoidArea = -(detail.point1.x - detail.point.x) * (0.5 * (detail.point.y + detail.point1.y) - referencePoint.y);\r\n } else {\r\n trapezoidArea = -(xyEnd.x - xyStart.x) * (0.5 * (xyStart.y + xyEnd.y) - referencePoint.y);\r\n }\r\n let areaToChord = 0.0;\r\n if (detail && detail.curve && detail.hasFraction1) {\r\n if (detail.curve instanceof LineSegment3d) {\r\n // nothing to do for a line segment\r\n } else if (detail.curve instanceof Arc3d) {\r\n areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1!);\r\n } else {\r\n const partial = detail.curve.clonePartialCurve(detail.fraction, detail.fraction1!);\r\n areaToChord = partial ?\r\n RegionOps.computeXYArea(Loop.create(partial, LineSegment3d.create(detail.point1!, detail.point))) ?? 0\r\n : 0;\r\n }\r\n }\r\n return trapezoidArea + areaToChord;\r\n}\r\n/** Compute face area for a face whose edges are decorated with CurveLocationDetail for their (partial) curves. */\r\nfunction faceAreaFromCurvedEdgeData(faceSeed: HalfEdge): number {\r\n let area = 0.0;\r\n let edge = faceSeed;\r\n do {\r\n area += (edge.sortData as number) * areaUnderPartialCurveXY((edge.edgeTag as CurveLocationDetail), edge, edge.faceSuccessor, faceSeed);\r\n } while ((edge = edge.faceSuccessor) !== faceSeed);\r\n return area;\r\n}\r\n\r\n/**\r\n * Function to accumulate area under edges.\r\n * Array of nodes representing faces in a subset of a graph.\r\n * @internal\r\n */\r\nexport type NodeAndRangeFunction = (edge: HalfEdge, range: Range2d) => void;\r\n/**\r\n * Array of nodes representing faces in a subset of a graph.\r\n * @internal\r\n */\r\nexport class GraphComponent {\r\n public faces: HalfEdge[];\r\n public faceAreas: number[];\r\n public range: Range2d;\r\n public constructor(faces: HalfEdge[]) {\r\n this.faces = faces;\r\n this.range = Range2d.createNull();\r\n this.faceAreas = [];\r\n }\r\n /**\r\n * Visit all vertices and edges in the component to build face area array and composite range.\r\n * @param extendRangeForEdge optional function to compute edge range. If undefined, linear edge is assumed.\r\n * @param faceAreaFunction optional function to compute face area. If undefined, linear edges are assumed.\r\n */\r\n public buildFaceData(extendRangeForEdge: NodeAndRangeFunction | undefined, faceAreaFunction: NodeToNumberFunction | undefined) {\r\n const vertexFunction = (node: HalfEdge) => {\r\n if (extendRangeForEdge)\r\n extendRangeForEdge(node, this.range);\r\n else\r\n this.range.extendXY(node.x, node.y);\r\n return 0;\r\n };\r\n this.range.setNull();\r\n for (const f of this.faces) {\r\n f.sumAroundFace(vertexFunction);\r\n }\r\n this.faceAreas.length = 0;\r\n if (!faceAreaFunction)\r\n faceAreaFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node);\r\n for (const f of this.faces) {\r\n this.faceAreas.push(faceAreaFunction(f));\r\n }\r\n }\r\n}\r\n/**\r\n * Build and hold an array of component data for a HalfEdgeGraph.\r\n * @internal\r\n */\r\nexport class GraphComponentArray {\r\n public components: GraphComponent[];\r\n public graph: HalfEdgeGraph;\r\n private constructor(graph: HalfEdgeGraph) {\r\n this.graph = graph;\r\n this.components = [];\r\n }\r\n public static create(\r\n graph: HalfEdgeGraph, extendRangeForEdge?: (edge: HalfEdge, range: Range2d) => void,\r\n ): GraphComponentArray {\r\n const result = new GraphComponentArray(graph);\r\n const componentArrays = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\r\n for (const componentFaces of componentArrays) {\r\n const component = new GraphComponent(componentFaces);\r\n component.buildFaceData(extendRangeForEdge, faceAreaFromCurvedEdgeData);\r\n result.components.push(component);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
|