@itwin/core-geometry 5.2.0-dev.8 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.d.ts +30 -10
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +74 -10
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.d.ts +19 -6
- package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js +21 -5
- 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 +3 -3
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +6 -6
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -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.d.ts +2 -2
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +4 -6
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts +27 -17
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +17 -7
- 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 +19 -6
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +17 -2
- 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 +14 -1
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +21 -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 +14 -11
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +23 -16
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +27 -17
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +66 -42
- 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 +1 -0
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +1 -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.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +8 -7
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +48 -1
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js +94 -3
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- 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.d.ts +4 -4
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +8 -8
- 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.js +3 -3
- 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 +51 -12
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +106 -83
- 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.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +49 -25
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +79 -39
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +8 -8
- 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 +1 -0
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +104 -93
- 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.d.ts +4 -4
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +21 -18
- 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 +30 -50
- 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.js.map +1 -1
- 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.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -2
- 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.d.ts +5 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +0 -3
- 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 +6 -2
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +12 -3
- 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.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +14 -18
- 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.d.ts +2 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +2 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +2 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +2 -1
- 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 +9 -16
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +3 -3
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +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.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- 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 +18 -2
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +37 -4
- 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 +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +1 -0
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.d.ts +8 -0
- package/lib/cjs/geometry3d/PointStreaming.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js +18 -2
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +53 -26
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +14 -3
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +20 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +34 -32
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +28 -21
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts +16 -6
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js +28 -4
- 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 +3 -4
- 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 +1 -1
- package/lib/cjs/geometry3d/Transform.js +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.d.ts +12 -1
- package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js +17 -2
- 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 +16 -0
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +26 -0
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- 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.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +5 -9
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js +2 -2
- 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 +13 -7
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js +13 -7
- 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.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +1 -3
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +2 -6
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +25 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +59 -8
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +7 -3
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +8 -10
- 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.d.ts +8 -5
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +9 -12
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
- 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.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 +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +2 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +2 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +38 -12
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +91 -23
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +20 -11
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +43 -39
- 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 +22 -11
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +31 -21
- 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.d.ts +13 -11
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +40 -36
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/Voronoi.d.ts +195 -0
- package/lib/cjs/topology/Voronoi.d.ts.map +1 -0
- package/lib/cjs/topology/Voronoi.js +700 -0
- package/lib/cjs/topology/Voronoi.js.map +1 -0
- package/lib/cjs/topology/XYParitySearchContext.d.ts +1 -1
- package/lib/cjs/topology/XYParitySearchContext.d.ts.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 +30 -10
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +74 -10
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.d.ts +19 -6
- package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js +21 -5
- 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 +3 -3
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +6 -6
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -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.d.ts +2 -2
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +4 -6
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.d.ts +27 -17
- package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +17 -7
- 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 +19 -6
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +17 -2
- 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 +14 -1
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +21 -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 +14 -11
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +23 -16
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +27 -17
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +66 -42
- 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 +1 -0
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +1 -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.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +8 -7
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +48 -1
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js +95 -4
- package/lib/esm/curve/CurveOps.js.map +1 -1
- 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.d.ts +4 -4
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +8 -8
- 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.js +3 -3
- 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 +51 -12
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +106 -83
- 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.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +49 -25
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +77 -37
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +8 -8
- 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 +1 -0
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +104 -93
- 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.d.ts +4 -4
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +21 -18
- 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 +30 -50
- 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.js.map +1 -1
- 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.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -2
- 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.d.ts +5 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +0 -3
- 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 +6 -2
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +12 -3
- 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.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +14 -18
- 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.d.ts +2 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +2 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +2 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +2 -1
- 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 +9 -16
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +3 -3
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +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.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- 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 +18 -2
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +37 -4
- 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 +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +1 -0
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.d.ts +8 -0
- package/lib/esm/geometry3d/PointStreaming.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js +18 -2
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +53 -26
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +8 -2
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +10 -4
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +14 -3
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +20 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +34 -32
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +28 -21
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts +16 -6
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js +28 -4
- 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 +3 -4
- 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 +1 -1
- package/lib/esm/geometry3d/Transform.js +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.d.ts +12 -1
- package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js +16 -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 +16 -0
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +26 -0
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- 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.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +5 -9
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js +2 -2
- 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 +13 -7
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/esm/numerics/SmallSystem.js +13 -7
- 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.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +1 -3
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +2 -6
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +25 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +59 -8
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +7 -3
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +8 -10
- 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.d.ts +8 -5
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +8 -4
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts +3 -3
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +4 -2
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js +9 -12
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts +8 -3
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +13 -6
- 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.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 +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +2 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +2 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +38 -12
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +92 -24
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +5 -4
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +6 -5
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +20 -11
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +43 -39
- 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 +22 -11
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +32 -22
- 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.d.ts +13 -11
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +40 -36
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/Voronoi.d.ts +195 -0
- package/lib/esm/topology/Voronoi.d.ts.map +1 -0
- package/lib/esm/topology/Voronoi.js +696 -0
- package/lib/esm/topology/Voronoi.js.map +1 -0
- package/lib/esm/topology/XYParitySearchContext.d.ts +1 -1
- package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -34,20 +34,21 @@ export class HalfEdgeGraphFromIndexedLoopsContext {
|
|
|
34
34
|
* * One of that mated pair becomes a HalfEdge in this loop.
|
|
35
35
|
* * The other is "unmatched" and gets the EXTERIOR mask.
|
|
36
36
|
* * When announceMatedHalfEdges(halfEdge) is called:
|
|
37
|
-
* * halfEdge and its mate are "new"
|
|
38
|
-
* * all coordinates are zeros.
|
|
37
|
+
* * halfEdge and its mate are "new".
|
|
39
38
|
* * each contains (as its `i` property) one index of the [indexA,indexB] pair.
|
|
40
|
-
* *
|
|
39
|
+
* * all coordinates are zeros.
|
|
40
|
+
* * these coordinates and indices will never be referenced again by this construction sequence.
|
|
41
|
+
* * typically the caller sets the halfEdge/mate coordinates in this callback.
|
|
41
42
|
* * if [indexB, indexA] appeared previously (and its outer HalfEdge was left "unmatched"),
|
|
42
43
|
* the "unmatched" HalfEdge is used in the loop being constructed, and its EXTERIOR mask is cleared.
|
|
43
44
|
* @param indices Array of indices around the loop. This is accessed cyclically, so first and last indices should be different.
|
|
44
45
|
* @param announceMatedHalfEdges optional function to be called as mated pairs are created. At the call,
|
|
45
|
-
* the given HalfEdge and its mate will have a pair of successive indices from the array.
|
|
46
|
+
* the given HalfEdge and its mate will have a pair of successive indices from the array in their `i` property.
|
|
46
47
|
*/
|
|
47
48
|
insertLoop(indices, announceMatedHalfEdges) {
|
|
48
49
|
const n = indices.length;
|
|
49
50
|
if (n > 2) {
|
|
50
|
-
let index0 = indices[
|
|
51
|
+
let index0 = indices[n - 1];
|
|
51
52
|
this._halfEdgesAroundCurrentLoop.length = 0;
|
|
52
53
|
for (const index1 of indices) {
|
|
53
54
|
const insideString = this.indexPairToString(index0, index1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphFromIndexedLoopsContext.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphFromIndexedLoopsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhE;;GAEG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAO,oCAAoC;IAC/C;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAG,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,EAAG,CAAC;QACnC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC;IACxC,CAAC;IACO,eAAe,CAAwB;IACvC,MAAM,CAAgB;IAC9B,IAAW,KAAK,KAAmB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC;IAEvD,oCAAoC;IAC5B,2BAA2B,CAAa;IACxC,iBAAiB,CAAC,MAAc,EAAE,MAAc;QACtD,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IACrD,CAAC;IACD
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphFromIndexedLoopsContext.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphFromIndexedLoopsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhE;;GAEG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAO,oCAAoC;IAC/C;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAG,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,EAAG,CAAC;QAC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AAQ,CAAC,CAAC;oBACzE,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAE,qBAAqB,CAAC,CAAC;oBAC9D,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;gBACjE,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAE,6CAA6C,CAAC,CAAC;oBACtF,6CAA6C,CAAC,SAAS,CAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAClF,CAAC;gBACD,MAAM,GAAG,MAAM,CAAC;YAClB,CAAC;YACD,IAAI,SAAS,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,2BAA2B,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC9F,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,2BAA2B,EAAC,CAAC;gBACxD,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC;gBAC1C,QAAQ,CAAC,KAAK,CAAE,SAAS,EAAE,SAAS,CAAC,CAAC;gBACtC,SAAS,GAAG,SAAS,CAAC;YACxB,CAAC;YACD,OAAO,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\n\r\n/**\r\n * Context for building a half edge graph from loops defined only by indices.\r\n * * Direct use case:\r\n * * Create the context.\r\n * * Repeatedly call insertLoop(indicesAroundLoop) to announce various loops.\r\n * * Finish by accessing the graph property.\r\n * @internal\r\n */\r\nexport class HalfEdgeGraphFromIndexedLoopsContext {\r\n public constructor(){\r\n this._unmatchedEdges = new Map ();\r\n this._graph = new HalfEdgeGraph ();\r\n this._halfEdgesAroundCurrentLoop = [];\r\n }\r\n private _unmatchedEdges: Map<string, HalfEdge>;\r\n private _graph: HalfEdgeGraph;\r\n public get graph(): HalfEdgeGraph {return this._graph;}\r\n\r\n // for multiple uses by insert loop.\r\n private _halfEdgesAroundCurrentLoop: HalfEdge[];\r\n private indexPairToString(index0: number, index1: number): string{\r\n return `${index0.toString()},${index1.toString()}`;\r\n }\r\n /** Create a loop with specified indices at its vertices.\r\n * * For an edge with index pair [indexA, indexB]:\r\n * * if [indexB, indexA] has never appeared, a HalfEdge mated pair is created.\r\n * * One of that mated pair becomes a HalfEdge in this loop.\r\n * * The other is \"unmatched\" and gets the EXTERIOR mask.\r\n * * When announceMatedHalfEdges(halfEdge) is called:\r\n * * halfEdge and its mate are \"new\".\r\n * * each contains (as its `i` property) one index of the [indexA,indexB] pair.\r\n * * all coordinates are zeros.\r\n * * these coordinates and indices will never be referenced again by this construction sequence.\r\n * * typically the caller sets the halfEdge/mate coordinates in this callback.\r\n * * if [indexB, indexA] appeared previously (and its outer HalfEdge was left \"unmatched\"),\r\n * the \"unmatched\" HalfEdge is used in the loop being constructed, and its EXTERIOR mask is cleared.\r\n * @param indices Array of indices around the loop. This is accessed cyclically, so first and last indices should be different.\r\n * @param announceMatedHalfEdges optional function to be called as mated pairs are created. At the call,\r\n * the given HalfEdge and its mate will have a pair of successive indices from the array in their `i` property.\r\n */\r\n public insertLoop(indices: number[], announceMatedHalfEdges?: (halfEdge: HalfEdge) => void): HalfEdge | undefined{\r\n const n = indices.length;\r\n if (n > 2) {\r\n let index0 = indices[n - 1];\r\n this._halfEdgesAroundCurrentLoop.length = 0;\r\n for (const index1 of indices) {\r\n const insideString = this.indexPairToString (index0, index1);\r\n const halfEdgePreviouslyConstructedFromOppositeSide: HalfEdge | undefined = this._unmatchedEdges.get (insideString);\r\n if (halfEdgePreviouslyConstructedFromOppositeSide === undefined) {\r\n // This is the first appearance of this edge in either direction.\r\n const outsideString = this.indexPairToString (index1, index0); // string referencing the \"other\" side of the new edge.\r\n const newHalfEdgeAroundLoop = this._graph.createEdgeIdId (index0, index1);\r\n if (announceMatedHalfEdges !== undefined)\r\n announceMatedHalfEdges (newHalfEdgeAroundLoop);\r\n this._unmatchedEdges.set (outsideString, newHalfEdgeAroundLoop.edgeMate);\r\n this._halfEdgesAroundCurrentLoop.push (newHalfEdgeAroundLoop);\r\n newHalfEdgeAroundLoop.edgeMate.setMask (HalfEdgeMask.EXTERIOR);\r\n } else {\r\n this._halfEdgesAroundCurrentLoop.push (halfEdgePreviouslyConstructedFromOppositeSide);\r\n halfEdgePreviouslyConstructedFromOppositeSide.clearMask (HalfEdgeMask.EXTERIOR);\r\n }\r\n index0 = index1;\r\n }\r\n let halfEdgeA = this._halfEdgesAroundCurrentLoop[this._halfEdgesAroundCurrentLoop.length - 1];\r\n for (const halfEdgeB of this._halfEdgesAroundCurrentLoop){\r\n const halfEdgeC = halfEdgeA.faceSuccessor;\r\n HalfEdge.pinch (halfEdgeB, halfEdgeC);\r\n halfEdgeA = halfEdgeB;\r\n }\r\n return this._halfEdgesAroundCurrentLoop[0];\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -109,17 +109,25 @@ export declare class HalfEdgeGraphSearch {
|
|
|
109
109
|
*/
|
|
110
110
|
static collectConnectedComponentsWithExteriorParityMasks(graph: HalfEdgeGraph, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask?: HalfEdgeMask): HalfEdge[][];
|
|
111
111
|
/**
|
|
112
|
-
* Breadth
|
|
113
|
-
* @param component
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @
|
|
112
|
+
* Breadth-first search through the connected component defined by `seed` and `ignoreMask`.
|
|
113
|
+
* @param seed a HalfEdge in the component from which to start the search.
|
|
114
|
+
* @param visitMask a mask to apply to visited nodes. Assumed cleared throughout component before first call.
|
|
115
|
+
* @param ignoreMask (optional) mask preset on faces that are to be treated as _outside_ the component.
|
|
116
|
+
* Default value is `HalfEdgeMask.EXTERIOR` to ignore exterior faces.
|
|
117
|
+
* Pass `HalfEdgeMask.NULL_MASK` to process all faces of the component.
|
|
118
|
+
* Note that if `ignoreMask` is set on both sides of an edge, both adjacent faces will be ignored; thus it
|
|
119
|
+
* is generally more useful if set on only one side of an edge.
|
|
120
|
+
* @param maxFaceCount (optional) maximum number of faces to search in the component. If nonpositive or
|
|
121
|
+
* `undefined`, `Infinity` is used.
|
|
122
|
+
* @param result optional array to append with HalfEdges and return as the `faces` array. This array is not
|
|
123
|
+
* emptied first, so callers can send it into a subsequent call to continue searching the component at `nextSeed`.
|
|
124
|
+
* @returns `faces` consists of one edge per face of the component; `nextSeed` is the seed at which to start
|
|
125
|
+
* the next call if `maxFaceCount` is exceeded (otherwise it is `undefined`).
|
|
121
126
|
*/
|
|
122
|
-
|
|
127
|
+
static exploreComponent(seed: HalfEdge, visitMask: HalfEdgeMask, ignoreMask?: HalfEdgeMask, maxFaceCount?: number, result?: HalfEdge[]): {
|
|
128
|
+
faces: HalfEdge[];
|
|
129
|
+
nextSeed: HalfEdge | undefined;
|
|
130
|
+
};
|
|
123
131
|
/**
|
|
124
132
|
* Collect connected components of the graph (via Breadth First Search).
|
|
125
133
|
* @param graph graph to inspect.
|
|
@@ -133,12 +141,13 @@ export declare class HalfEdgeGraphSearch {
|
|
|
133
141
|
static collectConnectedComponents(graph: HalfEdgeGraph, maxFaceCount?: number, ignoreMask?: HalfEdgeMask): HalfEdge[][];
|
|
134
142
|
/**
|
|
135
143
|
* Test if test point (xTest,yTest) is inside/outside a face or on an edge.
|
|
144
|
+
* * NOTE: a point outside the graph (in the exterior face) returns -1.
|
|
136
145
|
* @param seedNode any node on the face loop.
|
|
137
146
|
* @param xTest x coordinate of the test point.
|
|
138
147
|
* @param yTest y coordinate of the test point.
|
|
139
148
|
* @returns 0 if ON, 1 if IN, -1 if OUT.
|
|
140
149
|
*/
|
|
141
|
-
static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number
|
|
150
|
+
static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number;
|
|
142
151
|
/**
|
|
143
152
|
* Collect boundary edges starting from `seed`.
|
|
144
153
|
* * If `seed` is not a boundary node or is already visited, the function exists early.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphSearch.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphSearch.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAChC;AACD;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,YAAY,CAAU;IAC9B;;;;OAIG;gBACgB,IAAI,EAAE,YAAY,EAAE,WAAW,GAAE,OAAc;IAIlE,0EAA0E;IACnE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;CAGzC;AACD;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;;;OAIG;WACW,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM;IAGpD;;;;;;OAMG;WACW,sBAAsB,CAClC,MAAM,EAAE,aAAa,GAAG,QAAQ,EAAE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Q,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IA2BzF;;;;;;;;OAQG;WACW,mCAAmC,CAC/C,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,yBAAyB,EACzC,sBAAsB,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChE,IAAI;IAoBP;;;;;;;;;OASG;WACW,mCAAmC,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,GAAG,QAAQ,EAAE,EAAE;CAkBlH"}
|
|
@@ -227,53 +227,55 @@ export class HalfEdgeGraphSearch {
|
|
|
227
227
|
return components;
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
|
-
* Breadth
|
|
231
|
-
* @param component
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* @
|
|
230
|
+
* Breadth-first search through the connected component defined by `seed` and `ignoreMask`.
|
|
231
|
+
* @param seed a HalfEdge in the component from which to start the search.
|
|
232
|
+
* @param visitMask a mask to apply to visited nodes. Assumed cleared throughout component before first call.
|
|
233
|
+
* @param ignoreMask (optional) mask preset on faces that are to be treated as _outside_ the component.
|
|
234
|
+
* Default value is `HalfEdgeMask.EXTERIOR` to ignore exterior faces.
|
|
235
|
+
* Pass `HalfEdgeMask.NULL_MASK` to process all faces of the component.
|
|
236
|
+
* Note that if `ignoreMask` is set on both sides of an edge, both adjacent faces will be ignored; thus it
|
|
237
|
+
* is generally more useful if set on only one side of an edge.
|
|
238
|
+
* @param maxFaceCount (optional) maximum number of faces to search in the component. If nonpositive or
|
|
239
|
+
* `undefined`, `Infinity` is used.
|
|
240
|
+
* @param result optional array to append with HalfEdges and return as the `faces` array. This array is not
|
|
241
|
+
* emptied first, so callers can send it into a subsequent call to continue searching the component at `nextSeed`.
|
|
242
|
+
* @returns `faces` consists of one edge per face of the component; `nextSeed` is the seed at which to start
|
|
243
|
+
* the next call if `maxFaceCount` is exceeded (otherwise it is `undefined`).
|
|
239
244
|
*/
|
|
240
|
-
static exploreComponent(
|
|
245
|
+
static exploreComponent(seed, visitMask, ignoreMask = HalfEdgeMask.EXTERIOR, maxFaceCount = Infinity, result) {
|
|
241
246
|
if (maxFaceCount <= 0)
|
|
242
247
|
maxFaceCount = Infinity;
|
|
243
248
|
const boundaryMask = visitMask | ignoreMask;
|
|
244
249
|
let numFaces = 0;
|
|
245
250
|
const candidates = []; // the queue
|
|
251
|
+
const faces = result ? result : [];
|
|
246
252
|
candidates.push(seed);
|
|
247
|
-
while (candidates.length
|
|
248
|
-
// shift is O(n)
|
|
249
|
-
// queue by circular array or
|
|
253
|
+
while (candidates.length > 0 && numFaces < maxFaceCount) {
|
|
254
|
+
// TODO: shift is O(n) thus inefficient for large queues. If needed, we can
|
|
255
|
+
// replace the queue by a circular array or use 2 stacks; both are O(1).
|
|
250
256
|
const node = candidates.shift();
|
|
251
|
-
if (node.isMaskSet(boundaryMask))
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
node.collectAroundFace(enqueueNeighboringFaces);
|
|
257
|
+
if (node && !node.isMaskSet(boundaryMask)) {
|
|
258
|
+
faces.push(node);
|
|
259
|
+
++numFaces;
|
|
260
|
+
node.collectAroundFace((he) => {
|
|
261
|
+
he.setMask(visitMask);
|
|
262
|
+
const neighbor = he.vertexSuccessor;
|
|
263
|
+
if (!neighbor.isMaskSet(boundaryMask))
|
|
264
|
+
candidates.push(neighbor); // enqueue neighboring face
|
|
265
|
+
});
|
|
266
|
+
}
|
|
262
267
|
}
|
|
263
268
|
if (candidates.length === 0)
|
|
264
|
-
return undefined;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return node;
|
|
272
|
-
if (node.edgeMate.isMaskSet(ignoreMask))
|
|
273
|
-
return node;
|
|
269
|
+
return { faces, nextSeed: undefined };
|
|
270
|
+
// try to find a node at the boundary of the current component and the next
|
|
271
|
+
let nextSeed = candidates[0];
|
|
272
|
+
for (const candidate of candidates) {
|
|
273
|
+
if (candidate.vertexSuccessor.isMaskSet(ignoreMask) || candidate.edgeMate.isMaskSet(ignoreMask)) {
|
|
274
|
+
nextSeed = candidate;
|
|
275
|
+
break;
|
|
274
276
|
}
|
|
275
|
-
return front;
|
|
276
277
|
}
|
|
278
|
+
return { faces, nextSeed };
|
|
277
279
|
}
|
|
278
280
|
/**
|
|
279
281
|
* Collect connected components of the graph (via Breadth First Search).
|
|
@@ -290,6 +292,7 @@ export class HalfEdgeGraphSearch {
|
|
|
290
292
|
if (graph.countMask(ignoreMask) === 0)
|
|
291
293
|
ignoreMask = HalfEdgeMask.NULL_MASK;
|
|
292
294
|
const visitMask = HalfEdgeMask.VISITED;
|
|
295
|
+
graph.clearMask(visitMask);
|
|
293
296
|
const boundaryMask = visitMask | ignoreMask;
|
|
294
297
|
// Starting with the input node, look ahead for a boundary face. Failing that, return the input node.
|
|
295
298
|
// Starting all floods at the boundary reduces the chance of ending up with a ring-shaped component at the boundary.
|
|
@@ -309,10 +312,10 @@ export class HalfEdgeGraphSearch {
|
|
|
309
312
|
const i0 = findNextFloodSeed(i);
|
|
310
313
|
let seed = graph.allHalfEdges[i0];
|
|
311
314
|
do { // flood this component
|
|
312
|
-
const
|
|
313
|
-
seed =
|
|
314
|
-
if (
|
|
315
|
-
components.push(
|
|
315
|
+
const result = HalfEdgeGraphSearch.exploreComponent(seed, visitMask, ignoreMask, maxFaceCount);
|
|
316
|
+
seed = result.nextSeed;
|
|
317
|
+
if (result.faces.length > 0)
|
|
318
|
+
components.push(result.faces); // each sub-component of length <= maxFaceCount is treated as a component
|
|
316
319
|
} while (seed !== undefined);
|
|
317
320
|
if (!graph.allHalfEdges[i].isMaskSet(visitMask))
|
|
318
321
|
--i; // reprocess this node
|
|
@@ -321,6 +324,7 @@ export class HalfEdgeGraphSearch {
|
|
|
321
324
|
}
|
|
322
325
|
/**
|
|
323
326
|
* Test if test point (xTest,yTest) is inside/outside a face or on an edge.
|
|
327
|
+
* * NOTE: a point outside the graph (in the exterior face) returns -1.
|
|
324
328
|
* @param seedNode any node on the face loop.
|
|
325
329
|
* @param xTest x coordinate of the test point.
|
|
326
330
|
* @param yTest y coordinate of the test point.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAY,aAAa,EAAE,YAAY,EAAiE,MAAM,SAAS,CAAC;AAC/H,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAShE;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,WAAW,CAAe;IAC1B,YAAY,CAAU;IAC9B;;;;OAIG;IACH,YAAmB,IAAkB,EAAE,cAAuB,IAAI;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IACD,0EAA0E;IACnE,QAAQ,CAAC,IAAc;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,IAAc;QACzC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC;IACD;;;;;;OAM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;;;;;;OASG;IACI,MAAM,CAAC,mCAAmC,CAAC,KAAoB,EAAE,YAA0B;QAChG,+EAA+E;QAC/E,MAAM,KAAK,GAAiB,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAW,EAAE;YACjD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvF,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,OAAe,EAAE,EAAE;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;QACpG,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF","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 Topology\n */\nimport { Range1d } from \"../geometry3d/Range\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeFunction, NodeToNumberFunction } from \"./Graph\";\nimport { SignedDataSummary } from \"./SignedDataSummary\";\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\n\n/**\n * Interface for an object that executes boolean tests on edges.\n * @internal\n */\nexport interface HalfEdgeTestObject {\n testEdge(h: HalfEdge): boolean;\n}\n/**\n * Class to test match of half edge mask.\n * @internal\n */\nexport class HalfEdgeMaskTester {\n private _targetMask: HalfEdgeMask;\n private _targetValue: boolean;\n /**\n * Constructor\n * @param mask mask to test in `testEdge` function\n * @param targetValue value to match for true return\n */\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\n this._targetMask = mask;\n this._targetValue = targetValue;\n }\n /** Return true if the value of the targetMask matches the targetValue. */\n public testEdge(edge: HalfEdge): boolean {\n return edge.isMaskSet(this._targetMask) === this._targetValue;\n }\n}\n/**\n * Class for different types of searches for HalfEdgeGraph.\n * @internal\n */\nexport class HalfEdgeGraphSearch {\n /**\n * Static method for face area computation -- useful as function parameter in `collectFaceAreaSummary`.\n * * This simply calls `node.signedFaceArea()`\n * @param node instance for signedFaceArea call.\n */\n public static signedFaceArea(node: HalfEdge): number {\n return node.signedFaceArea();\n }\n /**\n * Return a summary of face data (e.g., area) as computed by the callback on the faces of the graph.\n * * Callers with curved edge graphs must supply their own area function.\n * @param source graph or array of nodes to examine.\n * @param collectAllNodes flag to pass to the `SignedDataSummary` constructor to control collection of nodes.\n * @param areaFunction function to obtain area (or other numeric value). Default computes polygonal face area.\n */\n public static collectFaceAreaSummary(\n source: HalfEdgeGraph | HalfEdge[],\n collectAllNodes: boolean = false,\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node),\n ): SignedDataSummary<HalfEdge> {\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n for (const node of allFaces) {\n const area = areaFunction(node);\n result.announceItem(node, area);\n }\n return result;\n }\n /**\n * Search the graph for the face with the most negative area.\n * * If the graph has exactly one connected component, this is its outer face.\n * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.\n * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.\n */\n public static findMinimumAreaFace(\n oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction,\n ): HalfEdge | undefined {\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\n return summary.largestNegativeItem;\n }\n /**\n * Test if the graph is triangulated.\n * * Return `false` if:\n * * number of positive area faces with more than 3 edges is larger than `numPositiveExceptionsAllowed`.\n * * graph has more than 1 negative area face when `allowMultipleNegativeAreaFaces` is `false`.\n * * 2-edge faces are ignored.\n */\n public static isTriangulatedCCW(\n source: HalfEdgeGraph | HalfEdge[],\n allowMultipleNegativeAreaFaces: boolean = true,\n numPositiveExceptionsAllowed: number = 0,\n ): boolean {\n let allFaces: HalfEdge[];\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n let numNegative = 0;\n let numPositiveExceptions = 0;\n for (const node of allFaces) {\n const numEdges = node.countEdgesAroundFace();\n if (numEdges >= 3) {\n const area = node.signedFaceArea();\n if (area > 0) {\n if (numEdges > 3) {\n numPositiveExceptions++;\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\n return false;\n }\n } else {\n numNegative++;\n if (numNegative > 1) {\n if (!allowMultipleNegativeAreaFaces)\n return false;\n }\n }\n }\n }\n return true;\n }\n /**\n * Process a face during graph traversal.\n * @param faceSeed a node in the face.\n * @param mask mask to set on each node of the face.\n * @param allNodeStack array appended with each node of the face.\n * @param onePerFaceStack array appended with `faceSeed`.\n */\n private static pushAndMaskAllNodesInFace(\n faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[],\n ): void {\n onePerFaceStack.push(faceSeed);\n faceSeed.collectAroundFace((node: HalfEdge) => {\n node.setMask(mask);\n allNodeStack.push(node);\n });\n }\n /**\n * Traverse (via Depth First Search) to all accessible faces from the given seed.\n * @param faceSeed first node to start the traverse.\n * @param visitMask mask applied to all faces as visited.\n * @param parityEdgeTester function to test if an edge is adjacent to two faces of opposite parity, e.g., a boundary\n * edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not supplied and `parityMask`\n * is supplied, the default parity rule is to alternate parity state in a \"bullseye\" pattern starting at the seed face,\n * with each successive concentric ring of faces at constant topological distance from the seed face receiving the\n * opposite parity state of the previous ring.\n * @param parityMask mask to apply to the first face and faces that share the same parity as the first face, as\n * determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If (non-null) parity mask\n * is given, on return it is entirely set or entirely clear around each face.\n * @returns an array that contains one representative node in each face of the connected component.\n */\n private static parityFloodFromSeed(\n faceSeed: HalfEdge,\n visitMask: HalfEdgeMask,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask,\n ): HalfEdge[] {\n const faces: HalfEdge[] = [];\n if (faceSeed.isMaskSet(visitMask))\n return faces; // empty array\n const allMasks = parityMask | visitMask;\n const stack: HalfEdge[] = [];\n // the seed face is arbitrarily assigned the parity mask\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(faceSeed, allMasks, stack, faces);\n while (stack.length > 0) {\n const p = stack.pop()!;\n const mate = p.edgeMate;\n if (!mate)\n continue;\n if (!mate.isMaskSet(visitMask)) {\n let newState = p.isMaskSet(parityMask);\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\n newState = !newState;\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\n }\n }\n return faces;\n }\n /**\n * * Correct the parity mask in the faces of a component.\n * * It is assumed that the parity mask is applied _consistently_ throughout the supplied faces, but maybe\n * not _correctly_.\n * * A consistently applied parity mask is \"correct\" if it is set on the negative area (\"exterior\") face of\n * a connected component.\n * * This method finds a face with negative area and toggles the mask throughout the input faces if this face\n * lacks the parity mask.\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\n */\n private static correctParityInSingleComponent(parityMask: HalfEdgeMask, faces: HalfEdge[]): void {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\n if (!exteriorHalfEdge) {\n // graph has all degenerate faces; do nothing\n } else if (exteriorHalfEdge.isMaskSet(parityMask)) {\n // all should be well; nothing to do\n } else {\n for (const faceSeed of faces) {\n if (faceSeed.isMaskSet(parityMask)) {\n faceSeed.clearMaskAroundFace(parityMask);\n } else {\n faceSeed.setMaskAroundFace(parityMask);\n }\n }\n }\n }\n /** Apply `correctParityInSingleComponent` to each array in components (quick exit if `parityMask` is `NULL_MASK`). */\n private static correctParityInComponentArrays(parityMask: HalfEdgeMask, components: HalfEdge[][]): void {\n if (parityMask === HalfEdgeMask.NULL_MASK)\n return;\n for (const facesInComponent of components)\n HalfEdgeGraphSearch.correctParityInSingleComponent(parityMask, facesInComponent);\n }\n /**\n * Collect connected components of the graph (via Depth First Search).\n * @param graph graph to inspect.\n * @param parityEdgeTester (optional) function to test if an edge is adjacent to two faces of opposite parity,\n * e.g., a boundary edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not\n * supplied and `parityMask` is supplied, the default parity rule is to alternate parity state in a \"bullseye\"\n * pattern starting at the seed face, with each successive concentric ring of faces at constant topological\n * distance from the seed face receiving the opposite parity state of the previous ring.\n * @param parityMask (optional) mask to apply to the first face and faces that share the same parity as the\n * first face, as determined by the parity rule. If this is `NULL_MASK` (default), there is no record of parity.\n * If (non-null) parity mask is given, on return it is entirely set or entirely clear around each face.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponentsWithExteriorParityMasks(\n graph: HalfEdgeGraph,\n parityEdgeTester: HalfEdgeTestObject | undefined,\n parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK,\n ): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const components = [];\n const visitMask = HalfEdgeMask.VISITED;\n const allMasks = parityMask | visitMask;\n graph.clearMask(allMasks);\n for (const faceSeed of graph.allHalfEdges) {\n if (!faceSeed.isMaskSet(visitMask)) {\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\n // parityFloodFromSeed does not return an empty array because it is called on an unvisited faceSeed\n components.push(newFaces);\n }\n }\n HalfEdgeGraphSearch.correctParityInComponentArrays(parityMask, components);\n return components;\n }\n /**\n * Breadth First Search through connected component of a graph.\n * @param component vector of nodes, one per face.\n * @param seed seed node in component.\n * @param visitMask mask to apply to visited nodes. Assumed cleared throughout component.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to\n * ignore exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @param maxFaceCount (optional) maximum number of faces in the component. Should be positive; otherwise\n * `Infinity` is used.\n * @returns node at which to start next component if maximum face count exceeded, or undefined.\n */\n private static exploreComponent(\n component: HalfEdge[],\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n maxFaceCount: number = Infinity,\n ): HalfEdge | undefined {\n if (maxFaceCount <= 0)\n maxFaceCount = Infinity;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n let numFaces = 0;\n const candidates: HalfEdge[] = []; // the queue\n candidates.push(seed);\n while (candidates.length !== 0 && numFaces < maxFaceCount) {\n // shift is O(n) and may be inefficient for large queues; if needed, we can replace\n // queue by circular array or implement the queue using 2 stacks; both are O(1)\n const node = candidates.shift()!;\n if (node.isMaskSet(boundaryMask))\n continue;\n component.push(node);\n ++numFaces;\n const enqueueNeighboringFaces: NodeFunction = (heNode: HalfEdge) => {\n heNode.setMask(visitMask);\n const neighbor = heNode.vertexSuccessor;\n if (!neighbor.isMaskSet(boundaryMask))\n candidates.push(neighbor);\n };\n node.collectAroundFace(enqueueNeighboringFaces);\n }\n if (candidates.length === 0)\n return undefined;\n else {\n const front = candidates[0];\n while (candidates.length !== 0) {\n // try to find a node at the boundary of both the geometry and previous component\n const node = candidates.shift()!; // shift may be inefficient for large queues\n if (node.vertexSuccessor.isMaskSet(ignoreMask))\n return node;\n if (node.edgeMate.isMaskSet(ignoreMask))\n return node;\n }\n return front;\n }\n }\n /**\n * Collect connected components of the graph (via Breadth First Search).\n * @param graph graph to inspect.\n * @param maxFaceCount (optional) maximum number of faces in each component. Should be positive; otherwise\n * `Infinity` is used.\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to ignore\n * exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\n */\n public static collectConnectedComponents(\n graph: HalfEdgeGraph,\n maxFaceCount: number = Infinity,\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\n ): HalfEdge[][] {\n const components: HalfEdge[][] = [];\n if (graph.countMask(ignoreMask) === 0)\n ignoreMask = HalfEdgeMask.NULL_MASK;\n const visitMask = HalfEdgeMask.VISITED;\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\n // Starting with the input node, look ahead for a boundary face. Failing that, return the input node.\n // Starting all floods at the boundary reduces the chance of ending up with a ring-shaped component at the boundary.\n const findNextFloodSeed = (index: number) => {\n for (let i = index; i < graph.countNodes(); ++i) {\n if (!graph.allHalfEdges[i].isMaskSet(boundaryMask)\n && graph.allHalfEdges[i].edgeMate.isMaskSet(boundaryMask)) {\n index = i;\n break;\n }\n }\n return index;\n };\n for (let i = 0; i < graph.countNodes(); ++i) {\n if (graph.allHalfEdges[i].isMaskSet(boundaryMask))\n continue;\n const i0 = findNextFloodSeed(i);\n let seed: HalfEdge | undefined = graph.allHalfEdges[i0];\n do { // flood this component\n const component: HalfEdge[] = [];\n seed = HalfEdgeGraphSearch.exploreComponent(component, seed, visitMask, ignoreMask, maxFaceCount);\n if (component.length !== 0)\n components.push(component);\n } while (seed !== undefined);\n if (!graph.allHalfEdges[i].isMaskSet(visitMask))\n --i; // reprocess this node\n }\n return components;\n }\n /**\n * Test if test point (xTest,yTest) is inside/outside a face or on an edge.\n * @param seedNode any node on the face loop.\n * @param xTest x coordinate of the test point.\n * @param yTest y coordinate of the test point.\n * @returns 0 if ON, 1 if IN, -1 if OUT.\n */\n public static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number | undefined {\n const context = new XYParitySearchContext(xTest, yTest);\n // walk around looking for an accepted node to start the search (seedNode is usually ok)\n let nodeA = seedNode;\n let nodeB = seedNode.faceSuccessor;\n for (; ; nodeA = nodeB) {\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\n break;\n if (nodeB === seedNode) {\n // the test point and the face are all on line \"y = yTest\"\n const range = Range1d.createXX(nodeB.x, nodeB.faceSuccessor.x);\n return range.containsX(xTest) ? 0 : -1;\n }\n nodeB = nodeA.faceSuccessor;\n }\n // nodeB is the real start node for search, so stop when we revisit it. For each edge, accumulate parity and hits\n let nodeC = nodeB.faceSuccessor;\n for (; ;) {\n if (!context.advance(nodeC.x, nodeC.y)) {\n return context.classifyCounts();\n }\n if (nodeC === nodeB)\n break;\n nodeC = nodeC.faceSuccessor;\n }\n return context.classifyCounts();\n }\n /**\n * Collect boundary edges starting from `seed`.\n * * If `seed` is not a boundary node or is already visited, the function exists early.\n * @param seed start node.\n * @param visitMask mask to set on processed nodes.\n * @param isBoundaryEdge function to test if an edge in a boundary edge.\n * @param announceEdgeInBoundary callback invoked on each edge in the boundary loop in order. The counter is zero\n * for the first edge, and incremented with each successive edge.\n */\n public static collectExtendedBoundaryLoopFromSeed(\n seed: HalfEdge,\n visitMask: HalfEdgeMask,\n isBoundaryEdge: HalfEdgeToBooleanFunction,\n announceEdgeInBoundary: (edge: HalfEdge, counter: number) => void,\n ): void {\n let counter = 0;\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\n announceEdgeInBoundary(seed, counter++);\n seed.setMask(visitMask);\n const vertexBase = seed.faceSuccessor;\n let candidateAroundVertex = vertexBase;\n for (; ;) {\n if (candidateAroundVertex.getMask(visitMask)) // end of boundary loop\n return;\n if (isBoundaryEdge(candidateAroundVertex)) {\n seed = candidateAroundVertex;\n break;\n }\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\n if (candidateAroundVertex === vertexBase)\n break; // prevent infinite loop in case exteriorMask is not set on the edge mate of the boundary edge\n }\n }\n }\n /**\n * Collect boundary edges in the graph.\n * * A boundary edge is defined by `exteriorMask` being set on only its \"exterior\" edge mate.\n * * Each boundary edge is identified in the output by its edge mate that lacks `exteriorMask`.\n * * Each inner array is ordered in the output so that its boundary edges form a connected path. If `exteriorMask`\n * is preset consistently around each \"exterior\" face, these paths are loops.\n * @param graph the graph to query\n * @param exteriorMask mask preset on exactly one side of boundary edges\n * @returns array of boundary loops, each loop an array of the unmasked mates of boundary edges\n */\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\n const loops: HalfEdge[][] = [];\n const visitMask = graph.grabMask(true);\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\n };\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\n if (counter === 0)\n loops.push([]);\n loops[loops.length - 1].push(edge);\n };\n for (const seed of graph.allHalfEdges) {\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\n }\n graph.dropMask(visitMask);\n return loops;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,OAAO,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Y,CAAC,KAAK,CAAC,CAAC;QACvF,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,OAAe,EAAE,EAAE;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;QACpG,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\nimport { Range1d } from \"../geometry3d/Range\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeToNumberFunction } from \"./Graph\";\r\nimport { SignedDataSummary } from \"./SignedDataSummary\";\r\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\r\n\r\n/**\r\n * Interface for an object that executes boolean tests on edges.\r\n * @internal\r\n */\r\nexport interface HalfEdgeTestObject {\r\n testEdge(h: HalfEdge): boolean;\r\n}\r\n/**\r\n * Class to test match of half edge mask.\r\n * @internal\r\n */\r\nexport class HalfEdgeMaskTester {\r\n private _targetMask: HalfEdgeMask;\r\n private _targetValue: boolean;\r\n /**\r\n * Constructor\r\n * @param mask mask to test in `testEdge` function\r\n * @param targetValue value to match for true return\r\n */\r\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\r\n this._targetMask = mask;\r\n this._targetValue = targetValue;\r\n }\r\n /** Return true if the value of the targetMask matches the targetValue. */\r\n public testEdge(edge: HalfEdge): boolean {\r\n return edge.isMaskSet(this._targetMask) === this._targetValue;\r\n }\r\n}\r\n/**\r\n * Class for different types of searches for HalfEdgeGraph.\r\n * @internal\r\n */\r\nexport class HalfEdgeGraphSearch {\r\n /**\r\n * Static method for face area computation -- useful as function parameter in `collectFaceAreaSummary`.\r\n * * This simply calls `node.signedFaceArea()`\r\n * @param node instance for signedFaceArea call.\r\n */\r\n public static signedFaceArea(node: HalfEdge): number {\r\n return node.signedFaceArea();\r\n }\r\n /**\r\n * Return a summary of face data (e.g., area) as computed by the callback on the faces of the graph.\r\n * * Callers with curved edge graphs must supply their own area function.\r\n * @param source graph or array of nodes to examine.\r\n * @param collectAllNodes flag to pass to the `SignedDataSummary` constructor to control collection of nodes.\r\n * @param areaFunction function to obtain area (or other numeric value). Default computes polygonal face area.\r\n */\r\n public static collectFaceAreaSummary(\r\n source: HalfEdgeGraph | HalfEdge[],\r\n collectAllNodes: boolean = false,\r\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node),\r\n ): SignedDataSummary<HalfEdge> {\r\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\r\n let allFaces: HalfEdge[];\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n for (const node of allFaces) {\r\n const area = areaFunction(node);\r\n result.announceItem(node, area);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Search the graph for the face with the most negative area.\r\n * * If the graph has exactly one connected component, this is its outer face.\r\n * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.\r\n * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.\r\n */\r\n public static findMinimumAreaFace(\r\n oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction,\r\n ): HalfEdge | undefined {\r\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\r\n return summary.largestNegativeItem;\r\n }\r\n /**\r\n * Test if the graph is triangulated.\r\n * * Return `false` if:\r\n * * number of positive area faces with more than 3 edges is larger than `numPositiveExceptionsAllowed`.\r\n * * graph has more than 1 negative area face when `allowMultipleNegativeAreaFaces` is `false`.\r\n * * 2-edge faces are ignored.\r\n */\r\n public static isTriangulatedCCW(\r\n source: HalfEdgeGraph | HalfEdge[],\r\n allowMultipleNegativeAreaFaces: boolean = true,\r\n numPositiveExceptionsAllowed: number = 0,\r\n ): boolean {\r\n let allFaces: HalfEdge[];\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n let numNegative = 0;\r\n let numPositiveExceptions = 0;\r\n for (const node of allFaces) {\r\n const numEdges = node.countEdgesAroundFace();\r\n if (numEdges >= 3) {\r\n const area = node.signedFaceArea();\r\n if (area > 0) {\r\n if (numEdges > 3) {\r\n numPositiveExceptions++;\r\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\r\n return false;\r\n }\r\n } else {\r\n numNegative++;\r\n if (numNegative > 1) {\r\n if (!allowMultipleNegativeAreaFaces)\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Process a face during graph traversal.\r\n * @param faceSeed a node in the face.\r\n * @param mask mask to set on each node of the face.\r\n * @param allNodeStack array appended with each node of the face.\r\n * @param onePerFaceStack array appended with `faceSeed`.\r\n */\r\n private static pushAndMaskAllNodesInFace(\r\n faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[],\r\n ): void {\r\n onePerFaceStack.push(faceSeed);\r\n faceSeed.collectAroundFace((node: HalfEdge) => {\r\n node.setMask(mask);\r\n allNodeStack.push(node);\r\n });\r\n }\r\n /**\r\n * Traverse (via Depth First Search) to all accessible faces from the given seed.\r\n * @param faceSeed first node to start the traverse.\r\n * @param visitMask mask applied to all faces as visited.\r\n * @param parityEdgeTester function to test if an edge is adjacent to two faces of opposite parity, e.g., a boundary\r\n * edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not supplied and `parityMask`\r\n * is supplied, the default parity rule is to alternate parity state in a \"bullseye\" pattern starting at the seed face,\r\n * with each successive concentric ring of faces at constant topological distance from the seed face receiving the\r\n * opposite parity state of the previous ring.\r\n * @param parityMask mask to apply to the first face and faces that share the same parity as the first face, as\r\n * determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If (non-null) parity mask\r\n * is given, on return it is entirely set or entirely clear around each face.\r\n * @returns an array that contains one representative node in each face of the connected component.\r\n */\r\n private static parityFloodFromSeed(\r\n faceSeed: HalfEdge,\r\n visitMask: HalfEdgeMask,\r\n parityEdgeTester: HalfEdgeTestObject | undefined,\r\n parityMask: HalfEdgeMask,\r\n ): HalfEdge[] {\r\n const faces: HalfEdge[] = [];\r\n if (faceSeed.isMaskSet(visitMask))\r\n return faces; // empty array\r\n const allMasks = parityMask | visitMask;\r\n const stack: HalfEdge[] = [];\r\n // the seed face is arbitrarily assigned the parity mask\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(faceSeed, allMasks, stack, faces);\r\n while (stack.length > 0) {\r\n const p = stack.pop()!;\r\n const mate = p.edgeMate;\r\n if (!mate)\r\n continue;\r\n if (!mate.isMaskSet(visitMask)) {\r\n let newState = p.isMaskSet(parityMask);\r\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\r\n newState = !newState;\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\r\n }\r\n }\r\n return faces;\r\n }\r\n /**\r\n * * Correct the parity mask in the faces of a component.\r\n * * It is assumed that the parity mask is applied _consistently_ throughout the supplied faces, but maybe\r\n * not _correctly_.\r\n * * A consistently applied parity mask is \"correct\" if it is set on the negative area (\"exterior\") face of\r\n * a connected component.\r\n * * This method finds a face with negative area and toggles the mask throughout the input faces if this face\r\n * lacks the parity mask.\r\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\r\n */\r\n private static correctParityInSingleComponent(parityMask: HalfEdgeMask, faces: HalfEdge[]): void {\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\r\n if (!exteriorHalfEdge) {\r\n // graph has all degenerate faces; do nothing\r\n } else if (exteriorHalfEdge.isMaskSet(parityMask)) {\r\n // all should be well; nothing to do\r\n } else {\r\n for (const faceSeed of faces) {\r\n if (faceSeed.isMaskSet(parityMask)) {\r\n faceSeed.clearMaskAroundFace(parityMask);\r\n } else {\r\n faceSeed.setMaskAroundFace(parityMask);\r\n }\r\n }\r\n }\r\n }\r\n /** Apply `correctParityInSingleComponent` to each array in components (quick exit if `parityMask` is `NULL_MASK`). */\r\n private static correctParityInComponentArrays(parityMask: HalfEdgeMask, components: HalfEdge[][]): void {\r\n if (parityMask === HalfEdgeMask.NULL_MASK)\r\n return;\r\n for (const facesInComponent of components)\r\n HalfEdgeGraphSearch.correctParityInSingleComponent(parityMask, facesInComponent);\r\n }\r\n /**\r\n * Collect connected components of the graph (via Depth First Search).\r\n * @param graph graph to inspect.\r\n * @param parityEdgeTester (optional) function to test if an edge is adjacent to two faces of opposite parity,\r\n * e.g., a boundary edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not\r\n * supplied and `parityMask` is supplied, the default parity rule is to alternate parity state in a \"bullseye\"\r\n * pattern starting at the seed face, with each successive concentric ring of faces at constant topological\r\n * distance from the seed face receiving the opposite parity state of the previous ring.\r\n * @param parityMask (optional) mask to apply to the first face and faces that share the same parity as the\r\n * first face, as determined by the parity rule. If this is `NULL_MASK` (default), there is no record of parity.\r\n * If (non-null) parity mask is given, on return it is entirely set or entirely clear around each face.\r\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\r\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\r\n */\r\n public static collectConnectedComponentsWithExteriorParityMasks(\r\n graph: HalfEdgeGraph,\r\n parityEdgeTester: HalfEdgeTestObject | undefined,\r\n parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK,\r\n ): HalfEdge[][] {\r\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\r\n const components = [];\r\n const visitMask = HalfEdgeMask.VISITED;\r\n const allMasks = parityMask | visitMask;\r\n graph.clearMask(allMasks);\r\n for (const faceSeed of graph.allHalfEdges) {\r\n if (!faceSeed.isMaskSet(visitMask)) {\r\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\r\n // parityFloodFromSeed does not return an empty array because it is called on an unvisited faceSeed\r\n components.push(newFaces);\r\n }\r\n }\r\n HalfEdgeGraphSearch.correctParityInComponentArrays(parityMask, components);\r\n return components;\r\n }\r\n /**\r\n * Breadth-first search through the connected component defined by `seed` and `ignoreMask`.\r\n * @param seed a HalfEdge in the component from which to start the search.\r\n * @param visitMask a mask to apply to visited nodes. Assumed cleared throughout component before first call.\r\n * @param ignoreMask (optional) mask preset on faces that are to be treated as _outside_ the component.\r\n * Default value is `HalfEdgeMask.EXTERIOR` to ignore exterior faces.\r\n * Pass `HalfEdgeMask.NULL_MASK` to process all faces of the component.\r\n * Note that if `ignoreMask` is set on both sides of an edge, both adjacent faces will be ignored; thus it\r\n * is generally more useful if set on only one side of an edge.\r\n * @param maxFaceCount (optional) maximum number of faces to search in the component. If nonpositive or\r\n * `undefined`, `Infinity` is used.\r\n * @param result optional array to append with HalfEdges and return as the `faces` array. This array is not\r\n * emptied first, so callers can send it into a subsequent call to continue searching the component at `nextSeed`.\r\n * @returns `faces` consists of one edge per face of the component; `nextSeed` is the seed at which to start\r\n * the next call if `maxFaceCount` is exceeded (otherwise it is `undefined`).\r\n */\r\n public static exploreComponent(\r\n seed: HalfEdge,\r\n visitMask: HalfEdgeMask,\r\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\r\n maxFaceCount: number = Infinity,\r\n result?: HalfEdge[],\r\n ): { faces: HalfEdge[], nextSeed: HalfEdge | undefined} {\r\n if (maxFaceCount <= 0)\r\n maxFaceCount = Infinity;\r\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\r\n let numFaces = 0;\r\n const candidates: HalfEdge[] = []; // the queue\r\n const faces: HalfEdge[] = result ? result : [];\r\n candidates.push(seed);\r\n while (candidates.length > 0 && numFaces < maxFaceCount) {\r\n // TODO: shift is O(n) thus inefficient for large queues. If needed, we can\r\n // replace the queue by a circular array or use 2 stacks; both are O(1).\r\n const node = candidates.shift();\r\n if (node && !node.isMaskSet(boundaryMask)) {\r\n faces.push(node);\r\n ++numFaces;\r\n node.collectAroundFace((he: HalfEdge) => {\r\n he.setMask(visitMask);\r\n const neighbor = he.vertexSuccessor;\r\n if (!neighbor.isMaskSet(boundaryMask))\r\n candidates.push(neighbor); // enqueue neighboring face\r\n });\r\n }\r\n }\r\n if (candidates.length === 0)\r\n return { faces, nextSeed: undefined };\r\n\r\n // try to find a node at the boundary of the current component and the next\r\n let nextSeed = candidates[0];\r\n for (const candidate of candidates) {\r\n if (candidate.vertexSuccessor.isMaskSet(ignoreMask) || candidate.edgeMate.isMaskSet(ignoreMask)) {\r\n nextSeed = candidate;\r\n break;\r\n }\r\n }\r\n return { faces, nextSeed };\r\n }\r\n /**\r\n * Collect connected components of the graph (via Breadth First Search).\r\n * @param graph graph to inspect.\r\n * @param maxFaceCount (optional) maximum number of faces in each component. Should be positive; otherwise\r\n * `Infinity` is used.\r\n * @param ignoreMask (optional) mask preset on faces to ignore. Default value is `HalfEdgeMask.EXTERIOR` to ignore\r\n * exterior faces. Pass `HalfEdgeMask.NULL_MASK` to process all faces.\r\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\r\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\r\n */\r\n public static collectConnectedComponents(\r\n graph: HalfEdgeGraph,\r\n maxFaceCount: number = Infinity,\r\n ignoreMask: HalfEdgeMask = HalfEdgeMask.EXTERIOR,\r\n ): HalfEdge[][] {\r\n const components: HalfEdge[][] = [];\r\n if (graph.countMask(ignoreMask) === 0)\r\n ignoreMask = HalfEdgeMask.NULL_MASK;\r\n const visitMask = HalfEdgeMask.VISITED;\r\n graph.clearMask(visitMask);\r\n const boundaryMask: HalfEdgeMask = visitMask | ignoreMask;\r\n // Starting with the input node, look ahead for a boundary face. Failing that, return the input node.\r\n // Starting all floods at the boundary reduces the chance of ending up with a ring-shaped component at the boundary.\r\n const findNextFloodSeed = (index: number) => {\r\n for (let i = index; i < graph.countNodes(); ++i) {\r\n if (!graph.allHalfEdges[i].isMaskSet(boundaryMask)\r\n && graph.allHalfEdges[i].edgeMate.isMaskSet(boundaryMask)) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n return index;\r\n };\r\n for (let i = 0; i < graph.countNodes(); ++i) {\r\n if (graph.allHalfEdges[i].isMaskSet(boundaryMask))\r\n continue;\r\n const i0 = findNextFloodSeed(i);\r\n let seed: HalfEdge | undefined = graph.allHalfEdges[i0];\r\n do { // flood this component\r\n const result = HalfEdgeGraphSearch.exploreComponent(seed, visitMask, ignoreMask, maxFaceCount);\r\n seed = result.nextSeed;\r\n if (result.faces.length > 0)\r\n components.push(result.faces); // each sub-component of length <= maxFaceCount is treated as a component\r\n } while (seed !== undefined);\r\n if (!graph.allHalfEdges[i].isMaskSet(visitMask))\r\n --i; // reprocess this node\r\n }\r\n return components;\r\n }\r\n /**\r\n * Test if test point (xTest,yTest) is inside/outside a face or on an edge.\r\n * * NOTE: a point outside the graph (in the exterior face) returns -1.\r\n * @param seedNode any node on the face loop.\r\n * @param xTest x coordinate of the test point.\r\n * @param yTest y coordinate of the test point.\r\n * @returns 0 if ON, 1 if IN, -1 if OUT.\r\n */\r\n public static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number {\r\n const context = new XYParitySearchContext(xTest, yTest);\r\n // walk around looking for an accepted node to start the search (seedNode is usually ok)\r\n let nodeA = seedNode;\r\n let nodeB = seedNode.faceSuccessor;\r\n for (; ; nodeA = nodeB) {\r\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\r\n break;\r\n if (nodeB === seedNode) {\r\n // the test point and the face are all on line \"y = yTest\"\r\n const range = Range1d.createXX(nodeB.x, nodeB.faceSuccessor.x);\r\n return range.containsX(xTest) ? 0 : -1;\r\n }\r\n nodeB = nodeA.faceSuccessor;\r\n }\r\n // nodeB is the real start node for search, so stop when we revisit it. For each edge, accumulate parity and hits\r\n let nodeC = nodeB.faceSuccessor;\r\n for (; ;) {\r\n if (!context.advance(nodeC.x, nodeC.y)) {\r\n return context.classifyCounts();\r\n }\r\n if (nodeC === nodeB)\r\n break;\r\n nodeC = nodeC.faceSuccessor;\r\n }\r\n return context.classifyCounts();\r\n }\r\n /**\r\n * Collect boundary edges starting from `seed`.\r\n * * If `seed` is not a boundary node or is already visited, the function exists early.\r\n * @param seed start node.\r\n * @param visitMask mask to set on processed nodes.\r\n * @param isBoundaryEdge function to test if an edge in a boundary edge.\r\n * @param announceEdgeInBoundary callback invoked on each edge in the boundary loop in order. The counter is zero\r\n * for the first edge, and incremented with each successive edge.\r\n */\r\n public static collectExtendedBoundaryLoopFromSeed(\r\n seed: HalfEdge,\r\n visitMask: HalfEdgeMask,\r\n isBoundaryEdge: HalfEdgeToBooleanFunction,\r\n announceEdgeInBoundary: (edge: HalfEdge, counter: number) => void,\r\n ): void {\r\n let counter = 0;\r\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\r\n announceEdgeInBoundary(seed, counter++);\r\n seed.setMask(visitMask);\r\n const vertexBase = seed.faceSuccessor;\r\n let candidateAroundVertex = vertexBase;\r\n for (; ;) {\r\n if (candidateAroundVertex.getMask(visitMask)) // end of boundary loop\r\n return;\r\n if (isBoundaryEdge(candidateAroundVertex)) {\r\n seed = candidateAroundVertex;\r\n break;\r\n }\r\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\r\n if (candidateAroundVertex === vertexBase)\r\n break; // prevent infinite loop in case exteriorMask is not set on the edge mate of the boundary edge\r\n }\r\n }\r\n }\r\n /**\r\n * Collect boundary edges in the graph.\r\n * * A boundary edge is defined by `exteriorMask` being set on only its \"exterior\" edge mate.\r\n * * Each boundary edge is identified in the output by its edge mate that lacks `exteriorMask`.\r\n * * Each inner array is ordered in the output so that its boundary edges form a connected path. If `exteriorMask`\r\n * is preset consistently around each \"exterior\" face, these paths are loops.\r\n * @param graph the graph to query\r\n * @param exteriorMask mask preset on exactly one side of boundary edges\r\n * @returns array of boundary loops, each loop an array of the unmasked mates of boundary edges\r\n */\r\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\r\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\r\n const loops: HalfEdge[][] = [];\r\n const visitMask = graph.grabMask(true);\r\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\r\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\r\n };\r\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\r\n if (counter === 0)\r\n loops.push([]);\r\n loops[loops.length - 1].push(edge);\r\n };\r\n for (const seed of graph.allHalfEdges) {\r\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\r\n }\r\n graph.dropMask(visitMask);\r\n return loops;\r\n }\r\n}\r\n"]}
|