@itwin/core-geometry 5.1.0-dev.9 → 5.2.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -1
- package/lib/cjs/Geometry.d.ts +18 -10
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +13 -3
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.d.ts +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +7 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts +4 -3
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +4 -5
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +9 -5
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +5 -3
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +2 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +2 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +54 -32
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +56 -37
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +40 -1
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +90 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +3 -2
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +6 -5
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +27 -25
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +30 -25
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +9 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +11 -0
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.d.ts +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +2 -0
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +4 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +7 -0
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +15 -3
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +34 -8
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +129 -33
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts +4 -3
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js +20 -9
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.d.ts +2 -1
- package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js +26 -41
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +74 -39
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +146 -46
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +36 -27
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +161 -55
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
- package/lib/cjs/curve/StrokeOptions.js +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
- package/lib/cjs/geometry3d/AngleSweep.d.ts +25 -18
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +32 -18
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -3
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +21 -3
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +11 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +21 -3
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
- package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js +6 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +66 -26
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +38 -2
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +5 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +18 -10
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +32 -10
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js +0 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +7 -9
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +23 -45
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +39 -29
- package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js +49 -35
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -4
- package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js +48 -43
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +21 -2
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +32 -13
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +8 -5
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +27 -16
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +11 -0
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js +129 -73
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
- package/lib/cjs/polyface/FacetOrientation.js +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js +51 -32
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +19 -5
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +18 -2
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +6 -6
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +39 -42
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +119 -78
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +315 -231
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +2 -3
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +2 -4
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +3 -3
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +3 -3
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +5 -5
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +7 -0
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.d.ts.map +1 -1
- package/lib/cjs/solid/Cone.js +6 -0
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -3
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +11 -7
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
- package/lib/cjs/solid/RotationalSweep.js +2 -2
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +5 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +6 -3
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +1 -1
- package/lib/cjs/solid/SweepContour.js +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +4 -0
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.d.ts +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +64 -14
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +149 -32
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -2
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +3 -2
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +0 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +49 -46
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js +2 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +9 -14
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +29 -22
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +18 -10
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +13 -3
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.d.ts +1 -1
- package/lib/esm/bspline/BSpline1dNd.js +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +7 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts +4 -3
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +4 -5
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +7 -5
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +9 -5
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +5 -3
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +2 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +2 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +54 -32
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +56 -37
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +40 -1
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +90 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +3 -2
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +6 -5
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +27 -25
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +30 -25
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +9 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +11 -0
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveTypes.d.ts +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +2 -0
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +4 -0
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +7 -0
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +15 -3
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +34 -8
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +131 -35
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.d.ts +4 -3
- package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js +20 -9
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.d.ts +2 -1
- package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js +26 -41
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +74 -39
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +146 -46
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +36 -27
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +161 -56
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +1 -1
- package/lib/esm/curve/StrokeOptions.js +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
- package/lib/esm/geometry3d/AngleSweep.d.ts +25 -18
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +32 -18
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -3
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +21 -3
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +11 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +21 -3
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
- package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js +6 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +66 -26
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +38 -2
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +5 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +18 -10
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +32 -10
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js +0 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +7 -9
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +23 -45
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts +39 -29
- package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js +47 -33
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -4
- package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js +48 -43
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +21 -2
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +32 -13
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +8 -5
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +27 -16
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +11 -0
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.d.ts +77 -36
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
- package/lib/esm/numerics/SmallSystem.js +129 -73
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
- package/lib/esm/polyface/FacetOrientation.js +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js +51 -32
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +19 -5
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +18 -2
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +6 -6
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +39 -42
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceData.js +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +119 -78
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +316 -232
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +2 -3
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +2 -4
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +3 -3
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +3 -3
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +5 -5
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +7 -0
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.d.ts.map +1 -1
- package/lib/esm/solid/Cone.js +6 -0
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -3
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +11 -7
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -2
- package/lib/esm/solid/RotationalSweep.js +2 -2
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +5 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +6 -3
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +1 -1
- package/lib/esm/solid/SweepContour.js +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +4 -0
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.d.ts +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +64 -14
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +149 -32
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -2
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +3 -2
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +0 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +49 -46
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
- package/lib/esm/topology/RegularizeFace.js +2 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +9 -14
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +29 -22
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +7 -6
|
@@ -31,10 +31,10 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
31
31
|
this.auxData = polyface.data.auxData.createForVisitor();
|
|
32
32
|
if (polyface.data.edgeMateIndex)
|
|
33
33
|
this.edgeMateIndex = [];
|
|
34
|
-
this.reset();
|
|
35
34
|
this._numEdges = 0;
|
|
36
35
|
this._nextFacetIndex = 0;
|
|
37
36
|
this._currentFacetIndex = -1;
|
|
37
|
+
this.reset();
|
|
38
38
|
}
|
|
39
39
|
/** Return the client polyface object. */
|
|
40
40
|
clientPolyface() {
|
|
@@ -71,11 +71,14 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
71
71
|
moveToReadIndex(facetIndex) {
|
|
72
72
|
if (!this._polyface.isValidFacetIndex(facetIndex))
|
|
73
73
|
return false;
|
|
74
|
-
|
|
74
|
+
const numEdges = this._polyface.numEdgeInFacet(facetIndex);
|
|
75
|
+
if (this._currentFacetIndex !== facetIndex || numEdges + this._numWrap !== this.pointCount) {
|
|
76
|
+
this._currentFacetIndex = facetIndex;
|
|
77
|
+
this._numEdges = numEdges;
|
|
78
|
+
this.resizeAllArrays(this._numEdges + this._numWrap);
|
|
79
|
+
this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
|
|
80
|
+
}
|
|
75
81
|
this._nextFacetIndex = facetIndex + 1;
|
|
76
|
-
this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
|
|
77
|
-
this.resizeAllArrays(this._numEdges + this._numWrap);
|
|
78
|
-
this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
|
|
79
82
|
return true;
|
|
80
83
|
}
|
|
81
84
|
/** Advance the iterator to a the 'next' facet in the client polyface. */
|
|
@@ -85,7 +88,7 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
85
88
|
this._nextFacetIndex++;
|
|
86
89
|
return true;
|
|
87
90
|
}
|
|
88
|
-
/**
|
|
91
|
+
/** Restart the visitor at the first facet. */
|
|
89
92
|
reset() {
|
|
90
93
|
this.moveToReadIndex(0);
|
|
91
94
|
this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.
|
|
@@ -184,6 +187,10 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
184
187
|
this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));
|
|
185
188
|
// TODO: auxData? taggedNumericData?
|
|
186
189
|
}
|
|
190
|
+
/** Create a visitor for a subset of the facets visitable by the instance. */
|
|
191
|
+
createSubsetVisitor(facetIndices, numWrap = 0) {
|
|
192
|
+
return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(this._polyface, facetIndices, numWrap);
|
|
193
|
+
}
|
|
187
194
|
}
|
|
188
195
|
/**
|
|
189
196
|
* An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
|
|
@@ -192,38 +199,38 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
192
199
|
* @public
|
|
193
200
|
*/
|
|
194
201
|
export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
constructor(polyface,
|
|
202
|
+
_facetIndices;
|
|
203
|
+
_currentSubsetIndex; // index within _facetIndices
|
|
204
|
+
_nextSubsetIndex; // index within _facetIndices
|
|
205
|
+
constructor(polyface, facetIndices, numWrap) {
|
|
199
206
|
super(polyface, numWrap);
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
207
|
+
this._facetIndices = facetIndices.slice();
|
|
208
|
+
this._currentSubsetIndex = -1;
|
|
209
|
+
this._nextSubsetIndex = 0;
|
|
210
|
+
this.reset();
|
|
203
211
|
}
|
|
204
212
|
isValidSubsetIndex(index) {
|
|
205
|
-
return
|
|
213
|
+
return index >= 0 && index < this._facetIndices.length;
|
|
206
214
|
}
|
|
207
215
|
/**
|
|
208
216
|
* Create a visitor for iterating a subset of the facets of `polyface`.
|
|
209
217
|
* @param polyface reference to the client polyface, supplying facets
|
|
210
|
-
* @param
|
|
218
|
+
* @param facetIndices array of indices of facets in the client polyface to visit. This array is cloned.
|
|
211
219
|
* @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.
|
|
212
220
|
*/
|
|
213
|
-
static createSubsetVisitor(polyface,
|
|
214
|
-
return new IndexedPolyfaceSubsetVisitor(polyface,
|
|
221
|
+
static createSubsetVisitor(polyface, facetIndices, numWrap = 0) {
|
|
222
|
+
return new IndexedPolyfaceSubsetVisitor(polyface, facetIndices, numWrap);
|
|
215
223
|
}
|
|
216
224
|
/**
|
|
217
225
|
* Advance the iterator to a particular facet in the subset of client polyface facets.
|
|
218
|
-
* @param
|
|
219
|
-
* the client polyface.
|
|
226
|
+
* @param subsetIndex index into the subset array, not to be confused with the client facet index.
|
|
220
227
|
* @return whether the iterator was successfully moved.
|
|
221
228
|
*/
|
|
222
|
-
moveToReadIndex(
|
|
223
|
-
if (this.isValidSubsetIndex(
|
|
224
|
-
this.
|
|
225
|
-
this.
|
|
226
|
-
return super.moveToReadIndex(this.
|
|
229
|
+
moveToReadIndex(subsetIndex) {
|
|
230
|
+
if (this.isValidSubsetIndex(subsetIndex)) {
|
|
231
|
+
this._currentSubsetIndex = subsetIndex;
|
|
232
|
+
this._nextSubsetIndex = subsetIndex + 1;
|
|
233
|
+
return super.moveToReadIndex(this._facetIndices[subsetIndex]);
|
|
227
234
|
}
|
|
228
235
|
return false;
|
|
229
236
|
}
|
|
@@ -232,29 +239,31 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
232
239
|
* @return whether the iterator was successfully moved.
|
|
233
240
|
*/
|
|
234
241
|
moveToNextFacet() {
|
|
235
|
-
if (this.
|
|
236
|
-
return this.moveToReadIndex(this.
|
|
237
|
-
this.
|
|
242
|
+
if (this._nextSubsetIndex !== this._currentSubsetIndex)
|
|
243
|
+
return this.moveToReadIndex(this._nextSubsetIndex);
|
|
244
|
+
this._nextSubsetIndex++;
|
|
238
245
|
return true;
|
|
239
246
|
}
|
|
240
|
-
/**
|
|
247
|
+
/** Restart the visitor at the first facet. */
|
|
241
248
|
reset() {
|
|
242
|
-
this.
|
|
243
|
-
|
|
249
|
+
if (this._facetIndices) { // avoid crash during super ctor when we aren't yet initialized
|
|
250
|
+
this.moveToReadIndex(0);
|
|
251
|
+
this._nextSubsetIndex = 0; // so immediate moveToNextFacet stays here.
|
|
252
|
+
}
|
|
244
253
|
}
|
|
245
254
|
/**
|
|
246
|
-
* Return the
|
|
247
|
-
* @param
|
|
248
|
-
* @return valid client polyface facet index, or `undefined` if invalid
|
|
255
|
+
* Return the client polyface facet index (aka "readIndex") for the given subset index.
|
|
256
|
+
* @param subsetIndex index into the subset array. Default is the subset index of the currently visited facet.
|
|
257
|
+
* @return valid client polyface facet index, or `undefined` if invalid subset index.
|
|
249
258
|
*/
|
|
250
|
-
parentFacetIndex(
|
|
251
|
-
if (undefined ===
|
|
252
|
-
|
|
253
|
-
return this.isValidSubsetIndex(
|
|
259
|
+
parentFacetIndex(subsetIndex) {
|
|
260
|
+
if (undefined === subsetIndex)
|
|
261
|
+
subsetIndex = this._currentSubsetIndex;
|
|
262
|
+
return this.isValidSubsetIndex(subsetIndex) ? this._facetIndices[subsetIndex] : undefined;
|
|
254
263
|
}
|
|
255
264
|
/** Return the number of facets this visitor is able to visit. */
|
|
256
265
|
getVisitableFacetCount() {
|
|
257
|
-
return this.
|
|
266
|
+
return this._facetIndices.length;
|
|
258
267
|
}
|
|
259
268
|
/**
|
|
260
269
|
* Create a visitor for those mesh facets with normal in the same half-space as the given vector.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyface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EAAE,OAAO,CAAC,CAAC;QAC9F,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC1C,KAAK,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;YACjD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC;gBACpD,SAAS,CAAC,mBAAmB;YAC/B,IAAI,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,GAAG;gBAC7C,SAAS,CAAC,uCAAuC;YACnD,IAAI,WAAW,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC;gBACzF,SAAS,CAAC,oBAAoB;YAChC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,4BAA4B,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrG,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 Polyface\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { IndexedPolyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\n * @public\n */\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _numEdges: number;\n private _polyface: IndexedPolyface;\n // to be called from static factory method that validates the polyface\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\n this._polyface = polyface;\n this._numWrap = numWrap;\n if (polyface.data.auxData)\n this.auxData = polyface.data.auxData.createForVisitor();\n if (polyface.data.edgeMateIndex)\n this.edgeMateIndex = [];\n this.reset();\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n\n }\n /** Return the client polyface object. */\n public clientPolyface(): IndexedPolyface {\n return this._polyface;\n }\n /** Return the number of facets this visitor is able to visit. */\n public getVisitableFacetCount(): number {\n return this._polyface.facetCount;\n }\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next\n * two points, e.g., to form two adjacent vectors for a cross product.\n */\n public setNumWrap(numWrap: number) {\n this._numWrap = numWrap;\n }\n /**\n * Return the number of edges in the current facet.\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number {\n return this._numEdges;\n }\n /** Create a visitor for iterating the facets of `polyface`. */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\n this.resizeAllArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(\n this._polyface.data,\n this._polyface.facetIndex0(this._currentFacetIndex),\n this._polyface.facetIndex1(this._currentFacetIndex),\n this._numWrap,\n );\n return true;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface. */\n public moveToNextFacet(): boolean {\n if (this._nextFacetIndex !== this._currentFacetIndex)\n return this.moveToReadIndex(this._nextFacetIndex);\n this._nextFacetIndex++;\n return true;\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\n * Returns the distance parameter as a point. Returns `undefined` on failure.\n */\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /**\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\n */\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /** Return the facetIndex of the currently referenced facet in the client polyface. */\n public currentReadIndex(): number {\n return this._currentFacetIndex;\n }\n /** Return the point index of vertex `i` within the currently loaded facet. */\n public clientPointIndex(i: number): number {\n return this.pointIndex[i];\n }\n /** Return the param index of vertex `i` within the currently loaded facet. */\n public clientParamIndex(i: number): number {\n return this.paramIndex ? this.paramIndex[i] : -1;\n }\n /** Return the normal index of vertex `i` within the currently loaded facet. */\n public clientNormalIndex(i: number): number {\n return this.normalIndex ? this.normalIndex[i] : -1;\n }\n /** Return the color index of vertex `i` within the currently loaded facet. */\n public clientColorIndex(i: number): number {\n return this.colorIndex ? this.colorIndex[i] : -1;\n }\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\n public clientAuxIndex(i: number): number {\n return this.auxData ? this.auxData.indices[i] : -1;\n }\n /** Clear the contents of the data arrays. */\n public clearArrays(): void {\n this.point.length = 0;\n this.edgeVisible.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n if (this.color !== undefined)\n this.color.length = 0;\n // TODO: auxData? taggedNumericData?\n }\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n this.edgeVisible.push(other.edgeVisible[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n // TODO: auxData? taggedNumericData?\n }\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n if (index0 > index1)\n this.pushInterpolatedDataFrom(other, index1, 1.0 - fraction, index0);\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n const newVisibility = (((index0 + 1) % other.edgeVisible.length) === index1) ? other.edgeVisible[index0] : false;\n this.edgeVisible.push(newVisibility); // interpolation along an edge preserves visibility of original edge\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\n // TODO: auxData? taggedNumericData?\n }\n}\n/**\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\n * * The subset is defined by an array of facet indices provided when this visitor is created.\n * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array.\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _parentFacetIndices?: number[]; // only undefined during super constructor!\n private _currentActiveIndex: number; // index within _parentFacetIndices, or -1 after construction\n private _nextActiveIndex: number; // index within _parentFacetIndices\n\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._parentFacetIndices = activeFacetIndices.slice();\n this._currentActiveIndex = -1;\n this._nextActiveIndex = 0;\n }\n private isValidSubsetIndex(index: number): boolean {\n return (undefined !== this._parentFacetIndices) && index >= 0 && index < this._parentFacetIndices.length;\n }\n /**\n * Create a visitor for iterating a subset of the facets of `polyface`.\n * @param polyface reference to the client polyface, supplying facets\n * @param activeFacetIndices array of indices of facets in the client polyface to visit. This array is cloned.\n * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.\n */\n public static createSubsetVisitor(\n polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\n }\n /**\n * Advance the iterator to a particular facet in the subset of client polyface facets.\n * @param activeIndex the index of the facet within the subset, not to be confused with the index of the facet within\n * the client polyface.\n * @return whether the iterator was successfully moved.\n */\n public override moveToReadIndex(activeIndex: number): boolean {\n if (this.isValidSubsetIndex(activeIndex)) {\n this._currentActiveIndex = activeIndex;\n this._nextActiveIndex = activeIndex + 1;\n return super.moveToReadIndex(this._parentFacetIndices![activeIndex]);\n }\n return false;\n }\n /**\n * Advance the iterator to the next facet in the subset of client polyface facets.\n * @return whether the iterator was successfully moved.\n */\n public override moveToNextFacet(): boolean {\n if (this._nextActiveIndex !== this._currentActiveIndex)\n return this.moveToReadIndex(this._nextActiveIndex);\n this._nextActiveIndex++;\n return true;\n }\n /** Reset the iterator to start at the first active facet in the subset of client polyface facets. */\n public override reset(): void {\n this.moveToReadIndex(0);\n this._nextActiveIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Return the parent facet index of the indicated index within the subset of client polyface facets.\n * @param activeIndex index of the facet within the subset. Default is the active facet.\n * @return valid client polyface facet index, or `undefined` if invalid input index.\n */\n public parentFacetIndex(activeIndex?: number): number | undefined {\n if (undefined === activeIndex)\n activeIndex = this._currentActiveIndex;\n return this.isValidSubsetIndex(activeIndex) ? this._parentFacetIndices![activeIndex] : undefined;\n }\n /** Return the number of facets this visitor is able to visit. */\n public override getVisitableFacetCount(): number {\n return this._parentFacetIndices ? this._parentFacetIndices.length : 0;\n }\n /**\n * Create a visitor for those mesh facets with normal in the same half-space as the given vector.\n * * For example, to visit the top facets of a tiled terrain mesh but skip the \"skirt\" facets, pass\n * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also\n * filter out *interior* facets that are nearly vertical, not just the \"skirt\" facets on the boundary.\n * @param mesh the mesh from which to select facets\n * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets\n * with normals in the same half-space as this vector. Default is 001.\n * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces.\n * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`.\n * Default is [[Geometry.smallAngleRadians]].\n * @param numWrap optional number of entries replicated in visitor arrays. Default is 0.\n */\n public static createNormalComparison(\n mesh: IndexedPolyface | IndexedPolyfaceVisitor,\n compareVector: Vector3d = Vector3d.unitZ(),\n sideAngle: Angle = Angle.createSmallAngle(),\n numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n if (mesh instanceof IndexedPolyface)\n return this.createNormalComparison(mesh.createVisitor(), compareVector, sideAngle, numWrap);\n const visitor = mesh;\n const facets: number[] = [];\n const facetNormal = Vector3d.createZero();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n if (!PolygonOps.unitNormal(visitor.point, facetNormal))\n continue; // degenerate facet\n if (facetNormal.dotProduct(compareVector) < 0.0)\n continue; // ignore facet facing other half-space\n if (facetNormal.angleFromPerpendicular(compareVector).isMagnitudeLessThanOrEqual(sideAngle))\n continue; // ignore side facet\n facets.push(visitor.currentReadIndex());\n }\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(visitor.clientPolyface(), facets, numWrap);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IAC9C,kBAA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UAAU,EAAE,CAAC;QAC1C,KAAK,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;YACjD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC;gBACpD,SAAS,CAAC,mBAAmB;YAC/B,IAAI,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,GAAG;gBAC7C,SAAS,CAAC,uCAAuC;YACnD,IAAI,WAAW,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC;gBACzF,SAAS,CAAC,oBAAoB;YAChC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,4BAA4B,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrG,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 Polyface\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { IndexedPolyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\n * @public\n */\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _numEdges: number;\n private _polyface: IndexedPolyface;\n // to be called from static factory method that validates the polyface\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\n this._polyface = polyface;\n this._numWrap = numWrap;\n if (polyface.data.auxData)\n this.auxData = polyface.data.auxData.createForVisitor();\n if (polyface.data.edgeMateIndex)\n this.edgeMateIndex = [];\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n this.reset();\n }\n /** Return the client polyface object. */\n public clientPolyface(): IndexedPolyface {\n return this._polyface;\n }\n /** Return the number of facets this visitor is able to visit. */\n public getVisitableFacetCount(): number {\n return this._polyface.facetCount;\n }\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next\n * two points, e.g., to form two adjacent vectors for a cross product.\n */\n public setNumWrap(numWrap: number) {\n this._numWrap = numWrap;\n }\n /**\n * Return the number of edges in the current facet.\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number {\n return this._numEdges;\n }\n /** Create a visitor for iterating the facets of `polyface`. */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n const numEdges = this._polyface.numEdgeInFacet(facetIndex);\n if (this._currentFacetIndex !== facetIndex || numEdges + this._numWrap !== this.pointCount) {\n this._currentFacetIndex = facetIndex;\n this._numEdges = numEdges;\n this.resizeAllArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(\n this._polyface.data,\n this._polyface.facetIndex0(this._currentFacetIndex),\n this._polyface.facetIndex1(this._currentFacetIndex),\n this._numWrap,\n );\n }\n this._nextFacetIndex = facetIndex + 1;\n return true;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface. */\n public moveToNextFacet(): boolean {\n if (this._nextFacetIndex !== this._currentFacetIndex)\n return this.moveToReadIndex(this._nextFacetIndex);\n this._nextFacetIndex++;\n return true;\n }\n /** Restart the visitor at the first facet. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\n * Returns the distance parameter as a point. Returns `undefined` on failure.\n */\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /**\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\n */\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /** Return the facetIndex of the currently referenced facet in the client polyface. */\n public currentReadIndex(): number {\n return this._currentFacetIndex;\n }\n /** Return the point index of vertex `i` within the currently loaded facet. */\n public clientPointIndex(i: number): number {\n return this.pointIndex[i];\n }\n /** Return the param index of vertex `i` within the currently loaded facet. */\n public clientParamIndex(i: number): number {\n return this.paramIndex ? this.paramIndex[i] : -1;\n }\n /** Return the normal index of vertex `i` within the currently loaded facet. */\n public clientNormalIndex(i: number): number {\n return this.normalIndex ? this.normalIndex[i] : -1;\n }\n /** Return the color index of vertex `i` within the currently loaded facet. */\n public clientColorIndex(i: number): number {\n return this.colorIndex ? this.colorIndex[i] : -1;\n }\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\n public clientAuxIndex(i: number): number {\n return this.auxData ? this.auxData.indices[i] : -1;\n }\n /** Clear the contents of the data arrays. */\n public clearArrays(): void {\n this.point.length = 0;\n this.edgeVisible.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n if (this.color !== undefined)\n this.color.length = 0;\n // TODO: auxData? taggedNumericData?\n }\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n this.edgeVisible.push(other.edgeVisible[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n // TODO: auxData? taggedNumericData?\n }\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n if (index0 > index1)\n this.pushInterpolatedDataFrom(other, index1, 1.0 - fraction, index0);\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n const newVisibility = (((index0 + 1) % other.edgeVisible.length) === index1) ? other.edgeVisible[index0] : false;\n this.edgeVisible.push(newVisibility); // interpolation along an edge preserves visibility of original edge\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\n // TODO: auxData? taggedNumericData?\n }\n /** Create a visitor for a subset of the facets visitable by the instance. */\n public createSubsetVisitor(facetIndices: number[], numWrap: number = 0): IndexedPolyfaceSubsetVisitor {\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(this._polyface, facetIndices, numWrap);\n }\n}\n\n/**\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\n * * The subset is defined by an array of facet indices provided when this visitor is created.\n * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array.\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _facetIndices: number[];\n private _currentSubsetIndex: number; // index within _facetIndices\n private _nextSubsetIndex: number; // index within _facetIndices\n\n private constructor(polyface: IndexedPolyface, facetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._facetIndices = facetIndices.slice();\n this._currentSubsetIndex = -1;\n this._nextSubsetIndex = 0;\n this.reset();\n }\n private isValidSubsetIndex(index: number): boolean {\n return index >= 0 && index < this._facetIndices.length;\n }\n /**\n * Create a visitor for iterating a subset of the facets of `polyface`.\n * @param polyface reference to the client polyface, supplying facets\n * @param facetIndices array of indices of facets in the client polyface to visit. This array is cloned.\n * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.\n */\n public static createSubsetVisitor(\n polyface: IndexedPolyface, facetIndices: number[], numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, facetIndices, numWrap);\n }\n /**\n * Advance the iterator to a particular facet in the subset of client polyface facets.\n * @param subsetIndex index into the subset array, not to be confused with the client facet index.\n * @return whether the iterator was successfully moved.\n */\n public override moveToReadIndex(subsetIndex: number): boolean {\n if (this.isValidSubsetIndex(subsetIndex)) {\n this._currentSubsetIndex = subsetIndex;\n this._nextSubsetIndex = subsetIndex + 1;\n return super.moveToReadIndex(this._facetIndices[subsetIndex]);\n }\n return false;\n }\n /**\n * Advance the iterator to the next facet in the subset of client polyface facets.\n * @return whether the iterator was successfully moved.\n */\n public override moveToNextFacet(): boolean {\n if (this._nextSubsetIndex !== this._currentSubsetIndex)\n return this.moveToReadIndex(this._nextSubsetIndex);\n this._nextSubsetIndex++;\n return true;\n }\n /** Restart the visitor at the first facet. */\n public override reset(): void {\n if (this._facetIndices) { // avoid crash during super ctor when we aren't yet initialized\n this.moveToReadIndex(0);\n this._nextSubsetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n }\n /**\n * Return the client polyface facet index (aka \"readIndex\") for the given subset index.\n * @param subsetIndex index into the subset array. Default is the subset index of the currently visited facet.\n * @return valid client polyface facet index, or `undefined` if invalid subset index.\n */\n public parentFacetIndex(subsetIndex?: number): number | undefined {\n if (undefined === subsetIndex)\n subsetIndex = this._currentSubsetIndex;\n return this.isValidSubsetIndex(subsetIndex) ? this._facetIndices[subsetIndex] : undefined;\n }\n /** Return the number of facets this visitor is able to visit. */\n public override getVisitableFacetCount(): number {\n return this._facetIndices.length;\n }\n /**\n * Create a visitor for those mesh facets with normal in the same half-space as the given vector.\n * * For example, to visit the top facets of a tiled terrain mesh but skip the \"skirt\" facets, pass\n * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also\n * filter out *interior* facets that are nearly vertical, not just the \"skirt\" facets on the boundary.\n * @param mesh the mesh from which to select facets\n * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets\n * with normals in the same half-space as this vector. Default is 001.\n * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces.\n * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`.\n * Default is [[Geometry.smallAngleRadians]].\n * @param numWrap optional number of entries replicated in visitor arrays. Default is 0.\n */\n public static createNormalComparison(\n mesh: IndexedPolyface | IndexedPolyfaceVisitor,\n compareVector: Vector3d = Vector3d.unitZ(),\n sideAngle: Angle = Angle.createSmallAngle(),\n numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n if (mesh instanceof IndexedPolyface)\n return this.createNormalComparison(mesh.createVisitor(), compareVector, sideAngle, numWrap);\n const visitor = mesh;\n const facets: number[] = [];\n const facetNormal = Vector3d.createZero();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n if (!PolygonOps.unitNormal(visitor.point, facetNormal))\n continue; // degenerate facet\n if (facetNormal.dotProduct(compareVector) < 0.0)\n continue; // ignore facet facing other half-space\n if (facetNormal.angleFromPerpendicular(compareVector).isMagnitudeLessThanOrEqual(sideAngle))\n continue; // ignore side facet\n facets.push(visitor.currentReadIndex());\n }\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(visitor.clientPolyface(), facets, numWrap);\n }\n}\n"]}
|
|
@@ -43,7 +43,7 @@ import { IndexedPolyface } from "./Polyface";
|
|
|
43
43
|
* * The [[previousAroundVertex]] step is clockwise around the vertex.
|
|
44
44
|
* * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,
|
|
45
45
|
* when that edge is interior. Thus the `edgeMate` step can be seen to iterate an "edge loop" of two locations for an
|
|
46
|
-
* interior
|
|
46
|
+
* interior edge.
|
|
47
47
|
* * Invalid Walkers:
|
|
48
48
|
* * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]
|
|
49
49
|
* returns false. Traversal operations on an invalid walker return an invalid walker.
|
|
@@ -57,6 +57,7 @@ import { IndexedPolyface } from "./Polyface";
|
|
|
57
57
|
* * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than
|
|
58
58
|
* two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and
|
|
59
59
|
* usually indicate a construction problem.
|
|
60
|
+
* * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.
|
|
60
61
|
* * See [[buildEdgeMateIndices]] for further description of the topological relations.
|
|
61
62
|
* @public
|
|
62
63
|
*/
|
|
@@ -74,7 +75,7 @@ export declare class IndexedPolyfaceWalker {
|
|
|
74
75
|
*/
|
|
75
76
|
get edgeIndex(): number | undefined;
|
|
76
77
|
/** Return the polyface of this walker. */
|
|
77
|
-
get polyface(): IndexedPolyface
|
|
78
|
+
get polyface(): IndexedPolyface;
|
|
78
79
|
/**
|
|
79
80
|
* Return true if the walker's edgeIndex is defined.
|
|
80
81
|
* * This method is the opposite of [[isUndefined]].
|
|
@@ -88,6 +89,8 @@ export declare class IndexedPolyfaceWalker {
|
|
|
88
89
|
* * This can also happen when methods that return a walker receive invalid input.
|
|
89
90
|
*/
|
|
90
91
|
get isUndefined(): boolean;
|
|
92
|
+
/** Whether the walker is at a null edge, i.e. an edge with no length. */
|
|
93
|
+
get isNull(): boolean;
|
|
91
94
|
/**
|
|
92
95
|
* Create a walker for a given polyface at an optional edge.
|
|
93
96
|
* @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).
|
|
@@ -115,12 +118,10 @@ export declare class IndexedPolyfaceWalker {
|
|
|
115
118
|
static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet?: number): IndexedPolyfaceWalker;
|
|
116
119
|
/**
|
|
117
120
|
* Create a new IndexedPolyfaceWalker from the instance.
|
|
118
|
-
* * The returned walker refers to the same polyface.
|
|
119
|
-
*
|
|
120
|
-
* * If `edgeIndex` is defined and valid, the returned walker refers to this edge.
|
|
121
|
-
* * If `edgeIndex` is defined but invalid, return undefined.
|
|
121
|
+
* * The returned walker refers to the same polyface and edge as the instance.
|
|
122
|
+
* @param result optional receiver to modify and return.
|
|
122
123
|
*/
|
|
123
|
-
clone(
|
|
124
|
+
clone(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker;
|
|
124
125
|
/**
|
|
125
126
|
* Load the walker's facet into the given visitor.
|
|
126
127
|
* @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.
|
|
@@ -198,29 +199,35 @@ export declare class IndexedPolyfaceWalker {
|
|
|
198
199
|
* Build the edgeMate index array into the polyface's [[PolyfaceData]].
|
|
199
200
|
* After this method:
|
|
200
201
|
* * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.
|
|
201
|
-
* * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the
|
|
202
|
+
* * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edge index on the other side of the
|
|
202
203
|
* edge in the adjacent facet.
|
|
203
204
|
* * The conditions for edgeMate matching are:
|
|
204
205
|
* * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.
|
|
205
|
-
* * Every
|
|
206
|
-
* * The edge with
|
|
207
|
-
* * Let kA be an
|
|
206
|
+
* * Every edge index k in the face loop of facet f satisfies `k0 <= k < k1`.
|
|
207
|
+
* * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.
|
|
208
|
+
* * Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,
|
|
208
209
|
* `kB === (kA + 1 === k1) ? k0 : kA + 1`.
|
|
209
210
|
* * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the
|
|
210
211
|
* start and end of an edge of that facet.
|
|
211
|
-
* * We call kA the
|
|
212
|
-
* * If kA is
|
|
213
|
-
* whose face loop contains
|
|
212
|
+
* * We call kA the _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.
|
|
213
|
+
* * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is
|
|
214
|
+
* an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse
|
|
215
|
+
* order, i.e.,
|
|
214
216
|
* * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`
|
|
215
217
|
* * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`
|
|
216
|
-
* *
|
|
217
|
-
*
|
|
218
|
-
*
|
|
218
|
+
* * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:
|
|
219
|
+
* * `polyface.data.edgeMateIndex[kA] === kC`
|
|
220
|
+
* * `polyface.data.edgeMateIndex[kC] === kA`
|
|
221
|
+
* * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null
|
|
222
|
+
* edge_, and its edge mate is itself.
|
|
223
|
+
* * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent
|
|
224
|
+
* facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in
|
|
225
|
+
* the `edgeMateIndex` array.
|
|
219
226
|
* * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with
|
|
220
227
|
* opposite orientation in an adjacent facet.
|
|
221
228
|
* * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by
|
|
222
|
-
* walking across edges, around faces, and around vertices. Let walkerA have
|
|
223
|
-
* aforementioned
|
|
229
|
+
* walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the
|
|
230
|
+
* aforementioned edge indices:
|
|
224
231
|
* * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.
|
|
225
232
|
* * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.
|
|
226
233
|
* * `walkerB.previousAroundFacet()` moves from kB back to kA.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceWalker.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE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IACI,6BAA6B,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO;IAK3E;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO;IAIxD;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;OAMG;IACI,eAAe,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAa7E;;;;;;OAMG;IACI,mBAAmB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAcjF;;;;;;;OAOG;IACI,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAGtE;;;;;;;;;OASG;IACI,gBAAgB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAI9E;;;;;;;;;OASG;IACI,oBAAoB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAKlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACW,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;CAsCpE"}
|
|
@@ -49,7 +49,7 @@ import { IndexedEdgeMatcher } from "./IndexedEdgeMatcher";
|
|
|
49
49
|
* * The [[previousAroundVertex]] step is clockwise around the vertex.
|
|
50
50
|
* * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,
|
|
51
51
|
* when that edge is interior. Thus the `edgeMate` step can be seen to iterate an "edge loop" of two locations for an
|
|
52
|
-
* interior
|
|
52
|
+
* interior edge.
|
|
53
53
|
* * Invalid Walkers:
|
|
54
54
|
* * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]
|
|
55
55
|
* returns false. Traversal operations on an invalid walker return an invalid walker.
|
|
@@ -63,6 +63,7 @@ import { IndexedEdgeMatcher } from "./IndexedEdgeMatcher";
|
|
|
63
63
|
* * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than
|
|
64
64
|
* two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and
|
|
65
65
|
* usually indicate a construction problem.
|
|
66
|
+
* * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.
|
|
66
67
|
* * See [[buildEdgeMateIndices]] for further description of the topological relations.
|
|
67
68
|
* @public
|
|
68
69
|
*/
|
|
@@ -105,6 +106,10 @@ export class IndexedPolyfaceWalker {
|
|
|
105
106
|
get isUndefined() {
|
|
106
107
|
return this._edgeIndex === undefined;
|
|
107
108
|
}
|
|
109
|
+
/** Whether the walker is at a null edge, i.e. an edge with no length. */
|
|
110
|
+
get isNull() {
|
|
111
|
+
return this.isValid && this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex) === this._edgeIndex;
|
|
112
|
+
}
|
|
108
113
|
/**
|
|
109
114
|
* Create a walker for a given polyface at an optional edge.
|
|
110
115
|
* @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).
|
|
@@ -147,17 +152,16 @@ export class IndexedPolyfaceWalker {
|
|
|
147
152
|
}
|
|
148
153
|
/**
|
|
149
154
|
* Create a new IndexedPolyfaceWalker from the instance.
|
|
150
|
-
* * The returned walker refers to the same polyface.
|
|
151
|
-
*
|
|
152
|
-
* * If `edgeIndex` is defined and valid, the returned walker refers to this edge.
|
|
153
|
-
* * If `edgeIndex` is defined but invalid, return undefined.
|
|
155
|
+
* * The returned walker refers to the same polyface and edge as the instance.
|
|
156
|
+
* @param result optional receiver to modify and return.
|
|
154
157
|
*/
|
|
155
|
-
clone(
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return
|
|
160
|
-
|
|
158
|
+
clone(result) {
|
|
159
|
+
if (result) {
|
|
160
|
+
result._polyface = this._polyface;
|
|
161
|
+
result._edgeIndex = this._edgeIndex;
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
return new IndexedPolyfaceWalker(this._polyface, this._edgeIndex);
|
|
161
165
|
}
|
|
162
166
|
/**
|
|
163
167
|
* Load the walker's facet into the given visitor.
|
|
@@ -286,29 +290,35 @@ export class IndexedPolyfaceWalker {
|
|
|
286
290
|
* Build the edgeMate index array into the polyface's [[PolyfaceData]].
|
|
287
291
|
* After this method:
|
|
288
292
|
* * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.
|
|
289
|
-
* * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the
|
|
293
|
+
* * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edge index on the other side of the
|
|
290
294
|
* edge in the adjacent facet.
|
|
291
295
|
* * The conditions for edgeMate matching are:
|
|
292
296
|
* * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.
|
|
293
|
-
* * Every
|
|
294
|
-
* * The edge with
|
|
295
|
-
* * Let kA be an
|
|
297
|
+
* * Every edge index k in the face loop of facet f satisfies `k0 <= k < k1`.
|
|
298
|
+
* * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.
|
|
299
|
+
* * Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,
|
|
296
300
|
* `kB === (kA + 1 === k1) ? k0 : kA + 1`.
|
|
297
301
|
* * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the
|
|
298
302
|
* start and end of an edge of that facet.
|
|
299
|
-
* * We call kA the
|
|
300
|
-
* * If kA is
|
|
301
|
-
* whose face loop contains
|
|
303
|
+
* * We call kA the _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.
|
|
304
|
+
* * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is
|
|
305
|
+
* an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse
|
|
306
|
+
* order, i.e.,
|
|
302
307
|
* * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`
|
|
303
308
|
* * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`
|
|
304
|
-
* *
|
|
305
|
-
*
|
|
306
|
-
*
|
|
309
|
+
* * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:
|
|
310
|
+
* * `polyface.data.edgeMateIndex[kA] === kC`
|
|
311
|
+
* * `polyface.data.edgeMateIndex[kC] === kA`
|
|
312
|
+
* * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null
|
|
313
|
+
* edge_, and its edge mate is itself.
|
|
314
|
+
* * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent
|
|
315
|
+
* facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in
|
|
316
|
+
* the `edgeMateIndex` array.
|
|
307
317
|
* * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with
|
|
308
318
|
* opposite orientation in an adjacent facet.
|
|
309
319
|
* * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by
|
|
310
|
-
* walking across edges, around faces, and around vertices. Let walkerA have
|
|
311
|
-
* aforementioned
|
|
320
|
+
* walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the
|
|
321
|
+
* aforementioned edge indices:
|
|
312
322
|
* * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.
|
|
313
323
|
* * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.
|
|
314
324
|
* * `walkerB.previousAroundFacet()` moves from kB back to kA.
|
|
@@ -317,31 +327,40 @@ export class IndexedPolyfaceWalker {
|
|
|
317
327
|
* * `walkerD.nextAroundVertex()` moves from kD back to kA.
|
|
318
328
|
*/
|
|
319
329
|
static buildEdgeMateIndices(polyface) {
|
|
330
|
+
if (polyface.isEmpty) {
|
|
331
|
+
polyface.data.edgeMateIndex = undefined;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
320
334
|
const matcher = new IndexedEdgeMatcher();
|
|
321
335
|
const numFacet = polyface.facetCount;
|
|
322
336
|
for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {
|
|
323
337
|
const kStart = polyface.facetIndex0(facetIndex);
|
|
324
338
|
const kEnd = polyface.facetIndex1(facetIndex);
|
|
325
339
|
let k0 = kEnd - 1;
|
|
326
|
-
// sneaky: addEdge 3rd arg is
|
|
340
|
+
// sneaky: addEdge 3rd arg is edge index k0 instead of facetIndex; it gets carried around during matching
|
|
327
341
|
for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)
|
|
328
342
|
matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);
|
|
329
343
|
}
|
|
330
344
|
const matchedPairs = [];
|
|
331
|
-
const singletons = [];
|
|
332
345
|
const nullEdges = [];
|
|
333
|
-
|
|
334
|
-
matcher.sortAndCollectClusters(matchedPairs, singletons, nullEdges, allOtherClusters);
|
|
346
|
+
matcher.sortAndCollectClusters(matchedPairs, undefined, nullEdges, undefined);
|
|
335
347
|
const numIndex = polyface.data.pointIndex.length;
|
|
336
348
|
polyface.data.edgeMateIndex = new Array(numIndex);
|
|
337
349
|
for (let i = 0; i < numIndex; i++)
|
|
338
|
-
polyface.data.edgeMateIndex[i] = undefined;
|
|
350
|
+
polyface.data.edgeMateIndex[i] = undefined; // boundary and non-manifold edges have no mate
|
|
339
351
|
for (const pair of matchedPairs) {
|
|
340
352
|
if (Array.isArray(pair) && pair.length === 2) {
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
polyface.data.edgeMateIndex[
|
|
344
|
-
polyface.data.edgeMateIndex[
|
|
353
|
+
const edgeIndex0 = pair[0].facetIndex;
|
|
354
|
+
const edgeIndex1 = pair[1].facetIndex;
|
|
355
|
+
polyface.data.edgeMateIndex[edgeIndex0] = edgeIndex1; // paired edges point to each other
|
|
356
|
+
polyface.data.edgeMateIndex[edgeIndex1] = edgeIndex0;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
for (const nullEdgeOrCluster of nullEdges) {
|
|
360
|
+
const nullCluster = Array.isArray(nullEdgeOrCluster) ? nullEdgeOrCluster : [nullEdgeOrCluster];
|
|
361
|
+
for (const nullEdge of nullCluster) {
|
|
362
|
+
const edgeIndex = nullEdge.facetIndex;
|
|
363
|
+
polyface.data.edgeMateIndex[edgeIndex] = edgeIndex; // a null edge points to itself
|
|
345
364
|
}
|
|
346
365
|
}
|
|
347
366
|
}
|