@itwin/core-geometry 5.2.0-dev.20 → 5.2.0-dev.21
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 +6 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- 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.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.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.js.map +1 -1
- 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.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.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.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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.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.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.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.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.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.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.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.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.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.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.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.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.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.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- 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.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.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.js.map +1 -1
- 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.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.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.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.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.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.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.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.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.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.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.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.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.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.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.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.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.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.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,a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G,EAAE,CAAC;QACtB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,mBAAmB,EAAE,CAAC;YACxB,IAAI,sBAAsB;gBACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;;gBAEhD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,mBAAmB,EAAE,CAAC;YACxB,IAAI,sBAAsB;gBACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;;gBAE/C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,uHAAuH;IAChH,SAAS,CAAC,mBAA4B;QAC3C,MAAM,QAAQ,GAAG,CAAC,mBAAmB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3F,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC","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/** @packageDocumentation\n * @module Bspline\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../Geometry\";\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\n\n/**\n * B-spline curve and surface types in this library are non-periodic. But they can be created from legacy periodic data.\n * This enumeration lists the possible ways a B-spline object can have been created from legacy periodic data.\n * @public\n */\nexport enum BSplineWrapMode {\n /** No conversion performed. */\n None = 0,\n /**\n * The legacy periodic B-spline data was opened up by adding `degree` wrap-around poles.\n * * This is typical of B-spline curves and surfaces constructed with maximum `degree - 1` continuity.\n * * Knots are unaffected by this conversion.\n */\n OpenByAddingControlPoints = 1,\n /**\n * The legacy periodic B-spline data was opened up by removing `degree` exterior knots.\n * * This is typical of rational B-spline curves representing full circles and ellipses.\n * * Poles are unaffected by this conversion.\n */\n OpenByRemovingKnots = 2,\n}\n/**\n * Array of non-decreasing numbers acting as a knot vector for B-spline curves and surfaces.\n *\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\n * * Various B-spline libraries have confusion over how many \"end knots\" are needed. Many libraries (including MicroStation\n * and Parasolid) demand order knots at each end for clamping. However, only order-1 are really needed. This class uses the\n * order-1 convention.\n * * A span is a single interval of the knots.\n * * The left knot of the span with index `k>=0` is the knot with index `k+degree-1`.\n * * A knot vector is clamped when the first `degree` knots are equal and the last `degree` knots are equal.\n * * The \"active knot interval\" is the subset of the knot vector sans its first and last `degree-1` knots, and serves as\n * the parametric domain of the associated B-spline object.\n * * This class provides queries to convert among spanIndex, knotIndex, spanFraction, fraction of knot range, and knot.\n * * Callers need to distinguish core computational inputs such as left knot index, knot value, span index, and span fraction.\n * @public\n */\nexport class KnotVector {\n /** The simple array of knot values. */\n public knots: Float64Array;\n /** The degree of basis functions defined in these knots. */\n public degree: number;\n /** The leftmost knot value (of the active interval, ignoring unclamped leading knots). */\n private _knot0: number;\n /** The rightmost knot value (of the active interval, ignoring unclamped leading knots). */\n private _knot1: number;\n private _wrapMode?: BSplineWrapMode;\n /** Tolerance for considering two knots to be the same. */\n public static readonly knotTolerance = 1.0e-9;\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots). */\n public get leftKnot() {\n return this._knot0;\n }\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots). */\n public get rightKnot() {\n return this._knot1;\n }\n /** Return the index of the leftmost knot of the active interval. */\n public get leftKnotIndex() {\n return this.degree - 1;\n }\n /** Return the index of the rightmost knot of the active interval. */\n public get rightKnotIndex() {\n return this.knots.length - this.degree;\n }\n /**\n * Whether this KnotVector was created by converting legacy periodic data during deserialization. The conversion used\n * is specified by BSplineWrapMode, and is reversed at serialization time.\n */\n public get wrappable() {\n return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode;\n }\n public set wrappable(value: BSplineWrapMode) {\n this._wrapMode = value;\n }\n /** Return the number of Bezier spans. Note that this includes zero-length spans if there are repeated knots. */\n public get numSpans() {\n return this.rightKnotIndex - this.leftKnotIndex;\n }\n /**\n * Private constructor.\n * * If `knots` is a number array or Float64Array, then its values are copied to the instance array.\n * * If `knots` is a number, the instance array is allocated to this size but left as zeros.\n */\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\n this.degree = degree;\n this._wrapMode = wrapMode;\n // default values to satisfy compiler; real values happen in setupFixedValues or the final else clause defers to user\n this._knot0 = 0.0;\n this._knot1 = 1.0;\n if (Array.isArray(knots)) {\n this.knots = new Float64Array(knots.length);\n this.setKnots(knots);\n this.setupFixedValues();\n } else if (knots instanceof Float64Array) {\n this.knots = knots.slice();\n this.setupFixedValues();\n } else { // caller is responsible for filling array separately\n const knotSize = knots;\n this.knots = new Float64Array(knotSize);\n }\n }\n /** Copy degree and knots to a new KnotVector. */\n public clone(): KnotVector {\n return new KnotVector(this.knots, this.degree, this.wrappable);\n }\n private setupFixedValues() {\n if (this.degree > 0 && this.knots.length > this.degree) {\n this._knot0 = this.knots[this.degree - 1];\n this._knot1 = this.knots[this.knots.length - this.degree];\n }\n }\n /**\n * Return the length of the active knot interval.\n * * This is the size of (one dimension of) the parametric domain for the associated B-spline object.\n */\n public get knotLength01(): number {\n return this._knot1 - this._knot0;\n }\n /**\n * Returns true if all numeric values have wraparound conditions that allow the knots to be closed with specified\n * wrap mode.\n * @param mode optional test mode. If undefined, use this.wrappable.\n */\n public testClosable(mode?: BSplineWrapMode): boolean {\n if (mode === undefined)\n mode = this.wrappable;\n const degree = this.degree;\n const leftKnotIndex = this.leftKnotIndex;\n const rightKnotIndex = this.rightKnotIndex;\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\n // maximum continuity mode: we expect degree periodically extended knots at each end\n const period = this.rightKnot - this.leftKnot;\n const indexDelta = rightKnotIndex - leftKnotIndex;\n for (let k0 = 0; k0 < leftKnotIndex + degree; k0++) {\n const k1 = k0 + indexDelta;\n if (Math.abs(this.knots[k0] + period - this.knots[k1]) >= KnotVector.knotTolerance)\n return false;\n }\n return true;\n }\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\n // legacy periodic mode: we expect multiplicity degree knots at each end\n const numRepeated = degree - 1;\n const leftKnot = this.leftKnot;\n const rightKnot = this.rightKnot;\n for (let i = 0; i < numRepeated; i++) {\n if (Math.abs(leftKnot - this.knots[leftKnotIndex - i - 1]) >= KnotVector.knotTolerance)\n return false;\n if (Math.abs(rightKnot - this.knots[rightKnotIndex + i + 1]) >= KnotVector.knotTolerance)\n return false;\n }\n return true;\n }\n return false;\n }\n /** Test matching degree and knot values. */\n public isAlmostEqual(other: KnotVector): boolean {\n if (this.degree !== other.degree)\n return false;\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\n }\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\n public getKnotMultiplicity(knot: number): number {\n let m = 0;\n for (const k of this.knots) {\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m;\n else if (knot < k)\n break;\n }\n return m;\n }\n /** Compute the multiplicity of the knot at the given index. */\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\n let m = 0;\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\n const knot = this.knots[knotIndex];\n ++m; // count this knot\n for (let i = knotIndex - 1; i >= 0; --i) {\n const k = this.knots[i];\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m; // found multiple to left of knot\n else if (knot > k)\n break;\n }\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\n const k = this.knots[i];\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m; // found multiple to right of knot\n else if (knot < k)\n break;\n }\n }\n return m;\n }\n /**\n * Transform knots such that the active knot range becomes [0,1].\n * @returns false if and only if `this.knotLength01` is trivial.\n */\n public normalize(): boolean {\n if (this.knotLength01 < KnotVector.knotTolerance)\n return false;\n const divisor = 1.0 / this.knotLength01;\n const leftKnot = this.leftKnot;\n for (let i = 0; i < this.knots.length; ++i)\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i)\n this.knots[i] = 1.0;\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i)\n this.knots[i] = 1.0;\n this.knots[this.rightKnotIndex] = 1.0;\n this.setupFixedValues();\n return true;\n }\n /** Install knot values from an array, optionally ignoring first and last. */\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\n if (numAllocate !== this.knots.length)\n this.knots = new Float64Array(numAllocate);\n if (skipFirstAndLast) {\n for (let i = 1; i + 1 < knots.length; i++)\n this.knots[i - 1] = knots[i];\n } else {\n for (let i = 0; i < knots.length; i++)\n this.knots[i] = knots[i];\n }\n this.setupFixedValues();\n }\n /** Set knots to input array (CAPTURED). */\n public setKnotsCapture(knots: Float64Array) {\n this.knots = knots;\n this.setupFixedValues();\n }\n /**\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\n * @param numPoles number of poles.\n * @param degree degree of polynomial.\n * @param a0 left knot value for active interval.\n * @param a1 right knot value for active interval.\n */\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\n const knots = new KnotVector(numPoles + degree - 1, degree);\n let k = 0;\n for (let m = 0; m < degree; m++)\n knots.knots[k++] = a0;\n const du = 1.0 / (numPoles - degree);\n for (let i = 1; i + degree < numPoles; i++)\n knots.knots[k++] = a0 + i * du * (a1 - a0);\n for (let m = 0; m < degree; m++)\n knots.knots[k++] = a1;\n knots.setupFixedValues();\n return knots;\n }\n /**\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\n * @param numInterval the number of intervals into which to uniformly divide the active knot interval `[a0,a1]`,\n * creating `numInterval-1` equally spaced interior knots between `a0` and `a1`.\n * This number is equal to the number of Bezier spans in the associated B-spline object.\n * It is _not_ the pole count.\n * @param degree degree of polynomial.\n * @param a0 left knot value for active interval.\n * @param a1 right knot value for active interval.\n */\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\n const du = 1.0 / numInterval;\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++)\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\n knots.setupFixedValues();\n return knots;\n }\n /**\n * Create knot vector with given knot values and degree.\n * @param knotArray knot values.\n * @param degree degree of polynomial.\n * @param skipFirstAndLast true to skip copying the first and last knot values.\n */\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\n const knots = new KnotVector(numAllocate, degree);\n knots.setKnots(knotArray, skipFirstAndLast);\n return knots;\n }\n /**\n * Return the average of degree consecutive knots beginning at knotIndex.\n * * If `knotIndex` is negative, return `leftKnot`.\n * * If `knotIndex > rightKnotIndex` return `rightKnot`.\n */\n public grevilleKnot(knotIndex: number): number {\n if (knotIndex < 0)\n return this.leftKnot;\n if (knotIndex > this.rightKnotIndex)\n return this.rightKnot;\n knotIndex = Math.floor(knotIndex);\n let sum = 0.0;\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\n sum += this.knots[i];\n return sum / this.degree;\n }\n /** Return an array of size `degree + 1`, e.g., to hold the set of relevant basis function values at a parameter. */\n public createBasisArray(): Float64Array {\n return new Float64Array(this.degree + 1);\n }\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\n const knot0 = this.knots[knotIndex0];\n localFraction = Geometry.clamp(localFraction, 0, 1);\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\n }\n /** Convert localFraction within an indexed bezier span to a knot value. */\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\n localFraction = Geometry.clamp(localFraction, 0, 1);\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\n }\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\n }\n /** Return fraction of active knot range to knot value. */\n public fractionToKnot(fraction: number): number {\n fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\n }\n private isKnotInValidSpan(knotIndex0: number, u: number): boolean {\n const spanIsValid = knotIndex0 >= this.degree - 1 && knotIndex0 + this.degree < this.knots.length;\n const uIsInSpan = this.knots[knotIndex0] <= u && u <= this.knots[knotIndex0 + 1];\n return spanIsValid && uIsInSpan;\n }\n /**\n * Evaluate the B-spline basis functions f[] at a parameter u in a knot span.\n * * This method implements the Mansfield-Cox-de Boor recurrence relation.\n * @param knotIndex0 index of the left knot of the span.\n * @param u value in the knot span: knot[knotIndex0] <= u <= knot[knotIndex0 + 1].\n * @param f preallocated output array of order basis function values.\n * @returns true if and only if output array is sufficiently sized.\n */\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array): boolean {\n if (f.length < this.degree + 1)\n return false;\n assert(() => this.isKnotInValidSpan(knotIndex0, u), \"knot is in a valid span\");\n f[0] = 1.0;\n if (this.degree < 1)\n return true;\n // direct compute for linear part\n const u0 = this.knots[knotIndex0];\n const u1 = this.knots[knotIndex0 + 1];\n f[1] = (u - u0) / (u1 - u0);\n f[0] = 1.0 - f[1];\n if (this.degree < 2)\n return true;\n // each iteration of the outer loop evaluates the basis functions of degree depth+1 using\n // one or two values of the basis functions of one less degree from the preceding iteration\n for (let depth = 1; depth < this.degree; depth++) {\n let kLeft = knotIndex0 - depth;\n let kRight = knotIndex0 + 1;\n let gCarry = 0.0;\n for (let step = 0; step <= depth; step++) {\n const tLeft = this.knots[kLeft++];\n const tRight = this.knots[kRight++];\n const fraction = (u - tLeft) / (tRight - tLeft);\n const g1 = f[step] * fraction;\n const g0 = f[step] * (1.0 - fraction);\n f[step] = gCarry + g0;\n gCarry = g1;\n }\n f[depth + 1] = gCarry;\n // at this point, the head of f[] contains the depth+2 values at u\n // of the basis functions of degree depth+1 with support over [u0,u1)\n }\n return true;\n }\n /**\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at a parameter u\n * in a knot span.\n * @param knotIndex0 index of the left knot of the span.\n * @param u value in the knot span: knot[knotIndex0] <= u <= knot[knotIndex0 + 1].\n * @param f preallocated output array of order basis function values.\n * @param df preallocated output array of order basis derivative values.\n * @param ddf optional preallocated output array of order basis second derivative values.\n * @returns true if and only if output arrays are sufficiently sized.\n */\n public evaluateBasisFunctions1(\n knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array,\n ): boolean {\n if (f.length < this.degree + 1)\n return false;\n if (df.length < this.degree + 1)\n return false;\n if (ddf && ddf.length < this.degree + 1)\n return false;\n assert(() => this.isKnotInValidSpan(knotIndex0, u), \"knot is in a valid span\");\n f[0] = 1.0;\n df[0] = 0.0;\n if (this.degree < 1)\n return true;\n // direct compute for linear part\n const u0 = this.knots[knotIndex0];\n const u1 = this.knots[knotIndex0 + 1];\n // ah = 1/(u1-u0) is the derivative of fraction0\n // -ah is the derivative of fraction1\n let ah = 1.0 / (u1 - u0);\n f[1] = (u - u0) * ah;\n f[0] = 1.0 - f[1];\n df[0] = -ah; df[1] = ah;\n if (ddf) { // first derivative started constant, second derivative started zero.\n ddf[0] = 0.0;\n ddf[1] = 0.0;\n }\n if (this.degree < 2)\n return true;\n for (let depth = 1; depth < this.degree; depth++) {\n let kLeft = knotIndex0 - depth;\n let kRight = kLeft + depth + 1;\n let gCarry = 0.0;\n let dgCarry = 0.0;\n let ddgCarry = 0.0;\n // f, df, ddf, are each row vectors with product of `step` linear terms.\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\n // Hence fnew = f * V\n // dfnew = df * V + f * dV\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\n // but ddV is zero so\n // ddfnew = ddf * V + 2 * df * dV\n for (let step = 0; step <= depth; step++) {\n const tLeft = this.knots[kLeft++];\n const tRight = this.knots[kRight++];\n ah = 1.0 / (tRight - tLeft);\n const fraction = (u - tLeft) * ah;\n const fraction1 = 1.0 - fraction;\n const g1 = f[step] * fraction;\n const g0 = f[step] * fraction1;\n const dg1 = df[step] * fraction + f[step] * ah;\n const dg0 = df[step] * fraction1 - f[step] * ah;\n const dfSave = 2.0 * df[step] * ah;\n f[step] = gCarry + g0;\n df[step] = dgCarry + dg0;\n gCarry = g1;\n dgCarry = dg1;\n if (ddf) { // do the backward reference to df before rewriting df\n const ddg1 = ddf[step] * fraction + dfSave;\n const ddg0 = ddf[step] * fraction1 - dfSave;\n ddf[step] = ddgCarry + ddg0;\n ddgCarry = ddg1;\n }\n }\n f[depth + 1] = gCarry;\n df[depth + 1] = dgCarry;\n if (ddf)\n ddf[depth + 1] = ddgCarry;\n }\n return true;\n }\n /**\n * Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\n * @param u value to bracket.\n */\n public knotToLeftKnotIndex(u: number): number {\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\n if (u < this.knots[i + 1])\n return i;\n }\n // for u >= rightKnot, return left index of last nontrivial span\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\n return i - 1;\n }\n return this.rightKnotIndex - 1; // shouldn't get here\n }\n /**\n * Given a span index, return the index of the knot at its left.\n * @param spanIndex index of span.\n */\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\n const d = this.degree;\n if (spanIndex <= 0.0)\n return d - 1;\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\n }\n /** Return the knot interval length of indexed bezier span. */\n public spanIndexToSpanLength(spanIndex: number): number {\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\n return this.knots[k + 1] - this.knots[k];\n }\n /**\n * Given a span index, test if it is within range and has nonzero length.\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span)\n * followed by more real spans\n * @param spanIndex index of span to test.\n */\n public isIndexOfRealSpan(spanIndex: number): boolean {\n if (spanIndex >= 0 && spanIndex < this.numSpans)\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\n return false;\n }\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths are reversed. */\n public reflectKnots(): void {\n const a = this.leftKnot;\n const b = this.rightKnot;\n const numKnots = this.knots.length;\n for (let i = 0; i < numKnots; i++)\n this.knots[i] = a + (b - this.knots[i]);\n this.knots.reverse();\n }\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\n public static copyKnots(\n knots: number[] | Float64Array, degree: number, includeExtraEndKnot?: boolean, wrapMode?: BSplineWrapMode,\n ): number[] {\n const isExtraEndKnotPeriodic = (includeExtraEndKnot && wrapMode === BSplineWrapMode.OpenByAddingControlPoints);\n const leftIndex = degree - 1;\n const rightIndex = knots.length - degree;\n const a0 = knots[leftIndex];\n const a1 = knots[rightIndex];\n const delta = a1 - a0;\n const values: number[] = [];\n if (includeExtraEndKnot) {\n if (isExtraEndKnotPeriodic)\n values.push(knots[rightIndex - degree] - delta);\n else\n values.push(knots[0]);\n }\n for (const u of knots) {\n values.push(u);\n }\n if (includeExtraEndKnot) {\n if (isExtraEndKnotPeriodic)\n values.push(knots[leftIndex + degree] + delta);\n else\n values.push(knots[knots.length - 1]);\n }\n return values;\n }\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\n public copyKnots(includeExtraEndKnot: boolean): number[] {\n const wrapMode = (includeExtraEndKnot && this.testClosable()) ? this.wrappable : undefined;\n return KnotVector.copyKnots(this.knots, this.degree, includeExtraEndKnot, wrapMode);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB,+BAA+B;IAC/B,qDAAQ,CAAA;IACR;;;;OAIG;IACH,+FAA6B,CAAA;IAC7B;;;;OAIG;IACH,mFAAuB,CAAA;AACzB,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B;AACD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,UAAU;IACrB,uCAAuC;IAChC,KAAK,CAAe;IAC3B,4DAA4D;IACrD,MAAM,CAAS;IACtB,0FAA0F;IAClF,MAAM,CAAS;IACvB,2FAA2F;IACnF,MAAM,CAAS;IACf,SAAS,CAAmB;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,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;;gBAE/C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,uHAAuH;IAChH,SAAS,CAAC,mBAA4B;QAC3C,MAAM,QAAQ,GAAG,CAAC,mBAAmB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3F,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * B-spline curve and surface types in this library are non-periodic. But they can be created from legacy periodic data.\r\n * This enumeration lists the possible ways a B-spline object can have been created from legacy periodic data.\r\n * @public\r\n */\r\nexport enum BSplineWrapMode {\r\n /** No conversion performed. */\r\n None = 0,\r\n /**\r\n * The legacy periodic B-spline data was opened up by adding `degree` wrap-around poles.\r\n * * This is typical of B-spline curves and surfaces constructed with maximum `degree - 1` continuity.\r\n * * Knots are unaffected by this conversion.\r\n */\r\n OpenByAddingControlPoints = 1,\r\n /**\r\n * The legacy periodic B-spline data was opened up by removing `degree` exterior knots.\r\n * * This is typical of rational B-spline curves representing full circles and ellipses.\r\n * * Poles are unaffected by this conversion.\r\n */\r\n OpenByRemovingKnots = 2,\r\n}\r\n/**\r\n * Array of non-decreasing numbers acting as a knot vector for B-spline curves and surfaces.\r\n *\r\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\r\n * * Various B-spline libraries have confusion over how many \"end knots\" are needed. Many libraries (including MicroStation\r\n * and Parasolid) demand order knots at each end for clamping. However, only order-1 are really needed. This class uses the\r\n * order-1 convention.\r\n * * A span is a single interval of the knots.\r\n * * The left knot of the span with index `k>=0` is the knot with index `k+degree-1`.\r\n * * A knot vector is clamped when the first `degree` knots are equal and the last `degree` knots are equal.\r\n * * The \"active knot interval\" is the subset of the knot vector sans its first and last `degree-1` knots, and serves as\r\n * the parametric domain of the associated B-spline object.\r\n * * This class provides queries to convert among spanIndex, knotIndex, spanFraction, fraction of knot range, and knot.\r\n * * Callers need to distinguish core computational inputs such as left knot index, knot value, span index, and span fraction.\r\n * @public\r\n */\r\nexport class KnotVector {\r\n /** The simple array of knot values. */\r\n public knots: Float64Array;\r\n /** The degree of basis functions defined in these knots. */\r\n public degree: number;\r\n /** The leftmost knot value (of the active interval, ignoring unclamped leading knots). */\r\n private _knot0: number;\r\n /** The rightmost knot value (of the active interval, ignoring unclamped leading knots). */\r\n private _knot1: number;\r\n private _wrapMode?: BSplineWrapMode;\r\n /** Tolerance for considering two knots to be the same. */\r\n public static readonly knotTolerance = 1.0e-9;\r\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots). */\r\n public get leftKnot() {\r\n return this._knot0;\r\n }\r\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots). */\r\n public get rightKnot() {\r\n return this._knot1;\r\n }\r\n /** Return the index of the leftmost knot of the active interval. */\r\n public get leftKnotIndex() {\r\n return this.degree - 1;\r\n }\r\n /** Return the index of the rightmost knot of the active interval. */\r\n public get rightKnotIndex() {\r\n return this.knots.length - this.degree;\r\n }\r\n /**\r\n * Whether this KnotVector was created by converting legacy periodic data during deserialization. The conversion used\r\n * is specified by BSplineWrapMode, and is reversed at serialization time.\r\n */\r\n public get wrappable() {\r\n return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode;\r\n }\r\n public set wrappable(value: BSplineWrapMode) {\r\n this._wrapMode = value;\r\n }\r\n /** Return the number of Bezier spans. Note that this includes zero-length spans if there are repeated knots. */\r\n public get numSpans() {\r\n return this.rightKnotIndex - this.leftKnotIndex;\r\n }\r\n /**\r\n * Private constructor.\r\n * * If `knots` is a number array or Float64Array, then its values are copied to the instance array.\r\n * * If `knots` is a number, the instance array is allocated to this size but left as zeros.\r\n */\r\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\r\n this.degree = degree;\r\n this._wrapMode = wrapMode;\r\n // default values to satisfy compiler; real values happen in setupFixedValues or the final else clause defers to user\r\n this._knot0 = 0.0;\r\n this._knot1 = 1.0;\r\n if (Array.isArray(knots)) {\r\n this.knots = new Float64Array(knots.length);\r\n this.setKnots(knots);\r\n this.setupFixedValues();\r\n } else if (knots instanceof Float64Array) {\r\n this.knots = knots.slice();\r\n this.setupFixedValues();\r\n } else { // caller is responsible for filling array separately\r\n const knotSize = knots;\r\n this.knots = new Float64Array(knotSize);\r\n }\r\n }\r\n /** Copy degree and knots to a new KnotVector. */\r\n public clone(): KnotVector {\r\n return new KnotVector(this.knots, this.degree, this.wrappable);\r\n }\r\n private setupFixedValues() {\r\n if (this.degree > 0 && this.knots.length > this.degree) {\r\n this._knot0 = this.knots[this.degree - 1];\r\n this._knot1 = this.knots[this.knots.length - this.degree];\r\n }\r\n }\r\n /**\r\n * Return the length of the active knot interval.\r\n * * This is the size of (one dimension of) the parametric domain for the associated B-spline object.\r\n */\r\n public get knotLength01(): number {\r\n return this._knot1 - this._knot0;\r\n }\r\n /**\r\n * Returns true if all numeric values have wraparound conditions that allow the knots to be closed with specified\r\n * wrap mode.\r\n * @param mode optional test mode. If undefined, use this.wrappable.\r\n */\r\n public testClosable(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.wrappable;\r\n const degree = this.degree;\r\n const leftKnotIndex = this.leftKnotIndex;\r\n const rightKnotIndex = this.rightKnotIndex;\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\r\n // maximum continuity mode: we expect degree periodically extended knots at each end\r\n const period = this.rightKnot - this.leftKnot;\r\n const indexDelta = rightKnotIndex - leftKnotIndex;\r\n for (let k0 = 0; k0 < leftKnotIndex + degree; k0++) {\r\n const k1 = k0 + indexDelta;\r\n if (Math.abs(this.knots[k0] + period - this.knots[k1]) >= KnotVector.knotTolerance)\r\n return false;\r\n }\r\n return true;\r\n }\r\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\r\n // legacy periodic mode: we expect multiplicity degree knots at each end\r\n const numRepeated = degree - 1;\r\n const leftKnot = this.leftKnot;\r\n const rightKnot = this.rightKnot;\r\n for (let i = 0; i < numRepeated; i++) {\r\n if (Math.abs(leftKnot - this.knots[leftKnotIndex - i - 1]) >= KnotVector.knotTolerance)\r\n return false;\r\n if (Math.abs(rightKnot - this.knots[rightKnotIndex + i + 1]) >= KnotVector.knotTolerance)\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Test matching degree and knot values. */\r\n public isAlmostEqual(other: KnotVector): boolean {\r\n if (this.degree !== other.degree)\r\n return false;\r\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\r\n }\r\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\r\n public getKnotMultiplicity(knot: number): number {\r\n let m = 0;\r\n for (const k of this.knots) {\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m;\r\n else if (knot < k)\r\n break;\r\n }\r\n return m;\r\n }\r\n /** Compute the multiplicity of the knot at the given index. */\r\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\r\n let m = 0;\r\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\r\n const knot = this.knots[knotIndex];\r\n ++m; // count this knot\r\n for (let i = knotIndex - 1; i >= 0; --i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to left of knot\r\n else if (knot > k)\r\n break;\r\n }\r\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to right of knot\r\n else if (knot < k)\r\n break;\r\n }\r\n }\r\n return m;\r\n }\r\n /**\r\n * Transform knots such that the active knot range becomes [0,1].\r\n * @returns false if and only if `this.knotLength01` is trivial.\r\n */\r\n public normalize(): boolean {\r\n if (this.knotLength01 < KnotVector.knotTolerance)\r\n return false;\r\n const divisor = 1.0 / this.knotLength01;\r\n const leftKnot = this.leftKnot;\r\n for (let i = 0; i < this.knots.length; ++i)\r\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\r\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\r\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i)\r\n this.knots[i] = 1.0;\r\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i)\r\n this.knots[i] = 1.0;\r\n this.knots[this.rightKnotIndex] = 1.0;\r\n this.setupFixedValues();\r\n return true;\r\n }\r\n /** Install knot values from an array, optionally ignoring first and last. */\r\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\r\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\r\n if (numAllocate !== this.knots.length)\r\n this.knots = new Float64Array(numAllocate);\r\n if (skipFirstAndLast) {\r\n for (let i = 1; i + 1 < knots.length; i++)\r\n this.knots[i - 1] = knots[i];\r\n } else {\r\n for (let i = 0; i < knots.length; i++)\r\n this.knots[i] = knots[i];\r\n }\r\n this.setupFixedValues();\r\n }\r\n /** Set knots to input array (CAPTURED). */\r\n public setKnotsCapture(knots: Float64Array) {\r\n this.knots = knots;\r\n this.setupFixedValues();\r\n }\r\n /**\r\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\r\n * @param numPoles number of poles.\r\n * @param degree degree of polynomial.\r\n * @param a0 left knot value for active interval.\r\n * @param a1 right knot value for active interval.\r\n */\r\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numPoles + degree - 1, degree);\r\n let k = 0;\r\n for (let m = 0; m < degree; m++)\r\n knots.knots[k++] = a0;\r\n const du = 1.0 / (numPoles - degree);\r\n for (let i = 1; i + degree < numPoles; i++)\r\n knots.knots[k++] = a0 + i * du * (a1 - a0);\r\n for (let m = 0; m < degree; m++)\r\n knots.knots[k++] = a1;\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n /**\r\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\r\n * @param numInterval the number of intervals into which to uniformly divide the active knot interval `[a0,a1]`,\r\n * creating `numInterval-1` equally spaced interior knots between `a0` and `a1`.\r\n * This number is equal to the number of Bezier spans in the associated B-spline object.\r\n * It is _not_ the pole count.\r\n * @param degree degree of polynomial.\r\n * @param a0 left knot value for active interval.\r\n * @param a1 right knot value for active interval.\r\n */\r\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\r\n const du = 1.0 / numInterval;\r\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++)\r\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n /**\r\n * Create knot vector with given knot values and degree.\r\n * @param knotArray knot values.\r\n * @param degree degree of polynomial.\r\n * @param skipFirstAndLast true to skip copying the first and last knot values.\r\n */\r\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\r\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\r\n const knots = new KnotVector(numAllocate, degree);\r\n knots.setKnots(knotArray, skipFirstAndLast);\r\n return knots;\r\n }\r\n /**\r\n * Return the average of degree consecutive knots beginning at knotIndex.\r\n * * If `knotIndex` is negative, return `leftKnot`.\r\n * * If `knotIndex > rightKnotIndex` return `rightKnot`.\r\n */\r\n public grevilleKnot(knotIndex: number): number {\r\n if (knotIndex < 0)\r\n return this.leftKnot;\r\n if (knotIndex > this.rightKnotIndex)\r\n return this.rightKnot;\r\n knotIndex = Math.floor(knotIndex);\r\n let sum = 0.0;\r\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\r\n sum += this.knots[i];\r\n return sum / this.degree;\r\n }\r\n /** Return an array of size `degree + 1`, e.g., to hold the set of relevant basis function values at a parameter. */\r\n public createBasisArray(): Float64Array {\r\n return new Float64Array(this.degree + 1);\r\n }\r\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\r\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\r\n const knot0 = this.knots[knotIndex0];\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\r\n }\r\n /** Convert localFraction within an indexed bezier span to a knot value. */\r\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\r\n }\r\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\r\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\r\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\r\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\r\n }\r\n /** Return fraction of active knot range to knot value. */\r\n public fractionToKnot(fraction: number): number {\r\n fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable\r\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\r\n }\r\n private isKnotInValidSpan(knotIndex0: number, u: number): boolean {\r\n const spanIsValid = knotIndex0 >= this.degree - 1 && knotIndex0 + this.degree < this.knots.length;\r\n const uIsInSpan = this.knots[knotIndex0] <= u && u <= this.knots[knotIndex0 + 1];\r\n return spanIsValid && uIsInSpan;\r\n }\r\n /**\r\n * Evaluate the B-spline basis functions f[] at a parameter u in a knot span.\r\n * * This method implements the Mansfield-Cox-de Boor recurrence relation.\r\n * @param knotIndex0 index of the left knot of the span.\r\n * @param u value in the knot span: knot[knotIndex0] <= u <= knot[knotIndex0 + 1].\r\n * @param f preallocated output array of order basis function values.\r\n * @returns true if and only if output array is sufficiently sized.\r\n */\r\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array): boolean {\r\n if (f.length < this.degree + 1)\r\n return false;\r\n assert(() => this.isKnotInValidSpan(knotIndex0, u), \"knot is in a valid span\");\r\n f[0] = 1.0;\r\n if (this.degree < 1)\r\n return true;\r\n // direct compute for linear part\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n f[1] = (u - u0) / (u1 - u0);\r\n f[0] = 1.0 - f[1];\r\n if (this.degree < 2)\r\n return true;\r\n // each iteration of the outer loop evaluates the basis functions of degree depth+1 using\r\n // one or two values of the basis functions of one less degree from the preceding iteration\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = knotIndex0 + 1;\r\n let gCarry = 0.0;\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n const fraction = (u - tLeft) / (tRight - tLeft);\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * (1.0 - fraction);\r\n f[step] = gCarry + g0;\r\n gCarry = g1;\r\n }\r\n f[depth + 1] = gCarry;\r\n // at this point, the head of f[] contains the depth+2 values at u\r\n // of the basis functions of degree depth+1 with support over [u0,u1)\r\n }\r\n return true;\r\n }\r\n /**\r\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at a parameter u\r\n * in a knot span.\r\n * @param knotIndex0 index of the left knot of the span.\r\n * @param u value in the knot span: knot[knotIndex0] <= u <= knot[knotIndex0 + 1].\r\n * @param f preallocated output array of order basis function values.\r\n * @param df preallocated output array of order basis derivative values.\r\n * @param ddf optional preallocated output array of order basis second derivative values.\r\n * @returns true if and only if output arrays are sufficiently sized.\r\n */\r\n public evaluateBasisFunctions1(\r\n knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array,\r\n ): boolean {\r\n if (f.length < this.degree + 1)\r\n return false;\r\n if (df.length < this.degree + 1)\r\n return false;\r\n if (ddf && ddf.length < this.degree + 1)\r\n return false;\r\n assert(() => this.isKnotInValidSpan(knotIndex0, u), \"knot is in a valid span\");\r\n f[0] = 1.0;\r\n df[0] = 0.0;\r\n if (this.degree < 1)\r\n return true;\r\n // direct compute for linear part\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n // ah = 1/(u1-u0) is the derivative of fraction0\r\n // -ah is the derivative of fraction1\r\n let ah = 1.0 / (u1 - u0);\r\n f[1] = (u - u0) * ah;\r\n f[0] = 1.0 - f[1];\r\n df[0] = -ah; df[1] = ah;\r\n if (ddf) { // first derivative started constant, second derivative started zero.\r\n ddf[0] = 0.0;\r\n ddf[1] = 0.0;\r\n }\r\n if (this.degree < 2)\r\n return true;\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n let dgCarry = 0.0;\r\n let ddgCarry = 0.0;\r\n // f, df, ddf, are each row vectors with product of `step` linear terms.\r\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\r\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\r\n // Hence fnew = f * V\r\n // dfnew = df * V + f * dV\r\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\r\n // but ddV is zero so\r\n // ddfnew = ddf * V + 2 * df * dV\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n ah = 1.0 / (tRight - tLeft);\r\n const fraction = (u - tLeft) * ah;\r\n const fraction1 = 1.0 - fraction;\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * fraction1;\r\n const dg1 = df[step] * fraction + f[step] * ah;\r\n const dg0 = df[step] * fraction1 - f[step] * ah;\r\n const dfSave = 2.0 * df[step] * ah;\r\n f[step] = gCarry + g0;\r\n df[step] = dgCarry + dg0;\r\n gCarry = g1;\r\n dgCarry = dg1;\r\n if (ddf) { // do the backward reference to df before rewriting df\r\n const ddg1 = ddf[step] * fraction + dfSave;\r\n const ddg0 = ddf[step] * fraction1 - dfSave;\r\n ddf[step] = ddgCarry + ddg0;\r\n ddgCarry = ddg1;\r\n }\r\n }\r\n f[depth + 1] = gCarry;\r\n df[depth + 1] = dgCarry;\r\n if (ddf)\r\n ddf[depth + 1] = ddgCarry;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\r\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\r\n * @param u value to bracket.\r\n */\r\n public knotToLeftKnotIndex(u: number): number {\r\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\r\n if (u < this.knots[i + 1])\r\n return i;\r\n }\r\n // for u >= rightKnot, return left index of last nontrivial span\r\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\r\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\r\n return i - 1;\r\n }\r\n return this.rightKnotIndex - 1; // shouldn't get here\r\n }\r\n /**\r\n * Given a span index, return the index of the knot at its left.\r\n * @param spanIndex index of span.\r\n */\r\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\r\n const d = this.degree;\r\n if (spanIndex <= 0.0)\r\n return d - 1;\r\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\r\n }\r\n /** Return the knot interval length of indexed bezier span. */\r\n public spanIndexToSpanLength(spanIndex: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n return this.knots[k + 1] - this.knots[k];\r\n }\r\n /**\r\n * Given a span index, test if it is within range and has nonzero length.\r\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span)\r\n * followed by more real spans\r\n * @param spanIndex index of span to test.\r\n */\r\n public isIndexOfRealSpan(spanIndex: number): boolean {\r\n if (spanIndex >= 0 && spanIndex < this.numSpans)\r\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\r\n return false;\r\n }\r\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths are reversed. */\r\n public reflectKnots(): void {\r\n const a = this.leftKnot;\r\n const b = this.rightKnot;\r\n const numKnots = this.knots.length;\r\n for (let i = 0; i < numKnots; i++)\r\n this.knots[i] = a + (b - this.knots[i]);\r\n this.knots.reverse();\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public static copyKnots(\r\n knots: number[] | Float64Array, degree: number, includeExtraEndKnot?: boolean, wrapMode?: BSplineWrapMode,\r\n ): number[] {\r\n const isExtraEndKnotPeriodic = (includeExtraEndKnot && wrapMode === BSplineWrapMode.OpenByAddingControlPoints);\r\n const leftIndex = degree - 1;\r\n const rightIndex = knots.length - degree;\r\n const a0 = knots[leftIndex];\r\n const a1 = knots[rightIndex];\r\n const delta = a1 - a0;\r\n const values: number[] = [];\r\n if (includeExtraEndKnot) {\r\n if (isExtraEndKnotPeriodic)\r\n values.push(knots[rightIndex - degree] - delta);\r\n else\r\n values.push(knots[0]);\r\n }\r\n for (const u of knots) {\r\n values.push(u);\r\n }\r\n if (includeExtraEndKnot) {\r\n if (isExtraEndKnotPeriodic)\r\n values.push(knots[leftIndex + degree] + delta);\r\n else\r\n values.push(knots[knots.length - 1]);\r\n }\r\n return values;\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n const wrapMode = (includeExtraEndKnot && this.testClosable()) ? this.wrappable : undefined;\r\n return KnotVector.copyKnots(this.knots, this.degree, includeExtraEndKnot, wrapMode);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceLocationDetail.js","sourceRoot":"","sources":["../../../src/bspline/SurfaceLocationDetail.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAClC,kCAAkC;IAC3B,OAAO,CAAa;IAC3B,oCAAoC;IAC7B,EAAE,CAAU;IACnB,+BAA+B;IACxB,KAAK,CAAU;IACtB,2DAA2D;IACpD,CAAC,CAAS;IACjB,iCAAiC;IACjC,YAAmB,OAAmB,EAAE,EAAY,EAAE,KAAe;QACnE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAClD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IACf,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,oBAAoB,CAAC,OAA8B,EAAE,EAAW,EAAE,KAAc;QAC5F,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,EAAE;YACJ,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,2BAA2B,CAAC,OAA8B,EAAE,CAAS,EAAE,CAAS,EAAE,KAAc;QAC5G,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAChB,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AACD;;;GAGG;AACH,MAAM,OAAO,6BAA6B;IACxC,qCAAqC;IAC9B,WAAW,CAAsB;IACxC,uCAAuC;IAChC,aAAa,CAA0B;IAC9C,+BAA+B;IAC/B,YAAmB,WAAgC,EAAE,aAAsC;QACzF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,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/** @packageDocumentation\n * @module Curve\n */\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\nimport { UVSurface } from \"../geometry3d/GeometryHandler\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\n\n/**\n * CurveLocationDetail carries point and paramter data about a point evaluated on a curve.\n * * These are returned by a variety of queries.\n * * Particular contents can vary among the queries.\n * @public\n */\nexport class UVSurfaceLocationDetail {\n /** The surface being evaluated */\n public surface?: UVSurface;\n /** uv coordinates in the surface */\n public uv: Point2d;\n /** The point on the surface */\n public point: Point3d;\n /** A context-specific numeric value. (E.g. a distance) */\n public a: number;\n /** Construct with empty data. */\n public constructor(surface?: UVSurface, uv?: Point2d, point?: Point3d) {\n this.surface = surface;\n this.point = point ? point : Point3d.createZero();\n this.uv = uv ? uv : Point2d.createZero();\n this.a = 0.0;\n }\n /**\n * Create a new detail structure.\n * @param surface\n * @param uv coordinates to copy (not capture) into the `detail.uv`\n * @param point coordinates to copy (not capture) into the `detail.point`\n */\n public static createSurfaceUVPoint(surface: UVSurface | undefined, uv: Point2d, point: Point3d): UVSurfaceLocationDetail {\n const detail = new UVSurfaceLocationDetail(surface);\n if (uv)\n detail.uv.setFrom(uv);\n detail.point.setFromPoint3d(point);\n return detail;\n }\n /**\n * Create a new detail structure.\n * @param surface\n * @param uv coordinates to copy (not capture) into the `detail.uv`\n * @param point coordinates to copy (not capture) into the `detail.point`\n */\n public static createSurfaceUVNumbersPoint(surface: UVSurface | undefined, u: number, v: number, point: Point3d): UVSurfaceLocationDetail {\n const detail = new UVSurfaceLocationDetail(surface);\n detail.uv.x = u;\n detail.uv.y = v;\n detail.point.setFromPoint3d(point);\n return detail;\n }\n\n}\n/**\n * Carrier for both curve and surface data, e.g. from intersection calculations.\n * @public\n */\nexport class CurveAndSurfaceLocationDetail {\n /** detailed location on the curve */\n public curveDetail: CurveLocationDetail;\n /** detailed location on the surface */\n public surfaceDetail: UVSurfaceLocationDetail;\n /** CAPTURE both details . . */\n public constructor(curveDetail: CurveLocationDetail, surfaceDetail: UVSurfaceLocationDetail) {\n this.curveDetail = curveDetail;\n this.surfaceDetail = surfaceDetail;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SurfaceLocationDetail.js","sourceRoot":"","sources":["../../../src/bspline/SurfaceLocationDetail.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAClC,kCAAkC;IAC3B,OAAO,CAAa;IAC3B,oCAAoC;IAC7B,EAAE,CAAU;I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AA+B;IAC/B,YAAmB,WAAgC,EAAE,aAAsC;QACzF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,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/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { UVSurface } from \"../geometry3d/GeometryHandler\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\n\r\n/**\r\n * CurveLocationDetail carries point and paramter data about a point evaluated on a curve.\r\n * * These are returned by a variety of queries.\r\n * * Particular contents can vary among the queries.\r\n * @public\r\n */\r\nexport class UVSurfaceLocationDetail {\r\n /** The surface being evaluated */\r\n public surface?: UVSurface;\r\n /** uv coordinates in the surface */\r\n public uv: Point2d;\r\n /** The point on the surface */\r\n public point: Point3d;\r\n /** A context-specific numeric value. (E.g. a distance) */\r\n public a: number;\r\n /** Construct with empty data. */\r\n public constructor(surface?: UVSurface, uv?: Point2d, point?: Point3d) {\r\n this.surface = surface;\r\n this.point = point ? point : Point3d.createZero();\r\n this.uv = uv ? uv : Point2d.createZero();\r\n this.a = 0.0;\r\n }\r\n /**\r\n * Create a new detail structure.\r\n * @param surface\r\n * @param uv coordinates to copy (not capture) into the `detail.uv`\r\n * @param point coordinates to copy (not capture) into the `detail.point`\r\n */\r\n public static createSurfaceUVPoint(surface: UVSurface | undefined, uv: Point2d, point: Point3d): UVSurfaceLocationDetail {\r\n const detail = new UVSurfaceLocationDetail(surface);\r\n if (uv)\r\n detail.uv.setFrom(uv);\r\n detail.point.setFromPoint3d(point);\r\n return detail;\r\n }\r\n /**\r\n * Create a new detail structure.\r\n * @param surface\r\n * @param uv coordinates to copy (not capture) into the `detail.uv`\r\n * @param point coordinates to copy (not capture) into the `detail.point`\r\n */\r\n public static createSurfaceUVNumbersPoint(surface: UVSurface | undefined, u: number, v: number, point: Point3d): UVSurfaceLocationDetail {\r\n const detail = new UVSurfaceLocationDetail(surface);\r\n detail.uv.x = u;\r\n detail.uv.y = v;\r\n detail.point.setFromPoint3d(point);\r\n return detail;\r\n }\r\n\r\n}\r\n/**\r\n * Carrier for both curve and surface data, e.g. from intersection calculations.\r\n * @public\r\n */\r\nexport class CurveAndSurfaceLocationDetail {\r\n /** detailed location on the curve */\r\n public curveDetail: CurveLocationDetail;\r\n /** detailed location on the surface */\r\n public surfaceDetail: UVSurfaceLocationDetail;\r\n /** CAPTURE both details . . */\r\n public constructor(curveDetail: CurveLocationDetail, surfaceDetail: UVSurfaceLocationDetail) {\r\n this.curveDetail = curveDetail;\r\n this.surfaceDetail = surfaceDetail;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlternatingConvexClipTree.js","sourceRoot":"","sources":["../../../src/clipping/AlternatingConvexClipTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OA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AC,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAChF,CAAC;IACH,CAAC","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 CartesianGeometry\n */\n\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Range1dArray } from \"../numerics/Range1dArray\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { ClipUtilities, PolygonClipper } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\n\n/**\n * An AlternatingConvexClipTreeNode is a node in a tree structure in which\n * <ul>\n * <li>Each node contains a ConvexClipPlaneSet.\n * <li>Each node contains an array of children which are also AlternatingConvexClipTreeNode.\n * <li>The rule for an in/out decision is that a point is IN the subtree under a node if\n * <ul>\n * <li>It is IN the node's ConvexClipPlaneSet.\n * <li>It is NOT IN any of the children.\n * </ul>\n * <li>Applying \"NOT IN any of the children\" locally to children at each level means that the ConvexClipPlaneSet\n * at adjacent levels flip between being positive areas and holes.\n * <li>Use an AlternatingConvexClipTreeNodeBuilder to construct the tree from a polygon.\n * <li>It is possible for the root clip plane set to be empty. An empty clip plane set returns \"true\"\n * for all point tests, so the meaning is just that holes are to be subtracted from the rest\n * of space.\n * <li>Although the interpretation of in/out alternates with tree levels, the ConvexClipPlaneSets\n * at each level are all \"enclosing\" planes in the usual way.\n * </ul>\n */\nexport class AlternatingCCTreeNode implements PolygonClipper {\n public points: Point3d[] = [];\n public planes: ConvexClipPlaneSet = ConvexClipPlaneSet.createEmpty();\n public children: AlternatingCCTreeNode[] = [];\n public startIdx: number = -1; // Start index into the master array (not the local points array)\n public numPoints: number = -1; // Number of points used in the master array\n\n private constructor() { }\n\n /** Initialize this node with index data referencing the parent polygon. */\n public static createWithIndices(index0: number, numPoints: number, result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\n result = result ? result : new AlternatingCCTreeNode();\n result.startIdx = index0;\n result.numPoints = numPoints;\n result.children.length = 0;\n return result;\n }\n /**\n * <ul>\n * <li>Build the tree for a polygon.\n * <li>Caller creates the root node with empty constructor AlternatingConvexClipTreeNode.\n * </ul>\n */\n public static createTreeForPolygon(points: Point3d[], result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\n result = result ? result : new AlternatingCCTreeNode();\n result.empty();\n const builder = AlternatingCCTreeBuilder.createPointsRef(points);\n builder.buildHullTree(result); // <-- Currently ALWAYS returns true\n return result;\n }\n /** Build the outer convex hull with inlets as first level children. */\n public static createHullAndInletsForPolygon(points: Point3d[], result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\n result = result ? result : new AlternatingCCTreeNode();\n result.empty();\n const builder = AlternatingCCTreeBuilder.createPointsRef(points);\n builder.buildHullAndInletsForPolygon(result); // <-- Currently ALWAYS returns true\n return result;\n }\n private extractLoopsGo(loops: Point3d[][]) {\n loops.push(Point3dArray.clonePoint3dArray(this.points));\n for (const c of this.children)\n c.extractLoopsGo(loops);\n }\n /**\n * Return an array with all the loops in the tree.\n * This loses the alternating structure of the tree, but the collection still matches well-formed polygons by\n * parity rules.\n */\n public extractLoops(): Point3d[][] {\n const loops: Point3d[][] = [];\n this.extractLoopsGo(loops);\n return loops;\n }\n /** Resets this AlternatingConvexClipTreeNode to a newly-created state. */\n public empty() {\n this.points.length = 0;\n this.planes.planes.length = 0;\n this.children.length = 0;\n this.startIdx = -1;\n this.numPoints = -1;\n }\n /** Creates a deep copy of this node (expensive - copies Geometry, and is recursive for children array). */\n public clone(result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\n result = result ? result : new AlternatingCCTreeNode();\n for (const point of this.points)\n result.points.push(point.clone());\n result.planes = ConvexClipPlaneSet.createEmpty();\n for (const plane of this.planes.planes)\n result.planes.planes.push(plane.clone());\n for (const node of this.children)\n result.children.push(node.clone());\n result.startIdx = this.startIdx;\n result.numPoints = this.numPoints;\n return result;\n }\n /** Add a new child that has an empty plane set and given indices. */\n public addEmptyChild(index0: number, numPoints: number) {\n const newNode = AlternatingCCTreeNode.createWithIndices(index0, numPoints);\n this.children.push(newNode);\n }\n /** Add a plane to the ConvexClipPlaneSet. */\n public addPlane(plane: ClipPlane) {\n this.planes.addPlaneToConvexSet(plane);\n }\n /** Search with alternating in and out semantics. */\n public isPointOnOrInside(point: Point3d): boolean {\n const inRoot = this.planes.isPointOnOrInside(point, 0.0);\n if (!inRoot)\n return false;\n for (const child of this.children) {\n if (child.isPointOnOrInside(point))\n return false;\n }\n return true;\n }\n /**\n * Add an AlternatingConvexClipTreeNode as a child of this one -- i.e. a hole.\n * * The child pointer is pushed directly to the tree -- not cloned.\n */\n public captureConvexClipPlaneSetAsVoid(child: AlternatingCCTreeNode) {\n this.children.push(child);\n }\n /** Append start-end positions for curve intervals classified as inside or outside. */\n public appendCurvePrimitiveClipIntervals(\n curve: CurvePrimitive, insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[],\n ): void {\n const clipper = new AlternatingCCTreeNodeCurveClipper();\n clipper.appendSingleClipPrimitive(this, curve, insideIntervals, outsideIntervals);\n }\n /** Append start-end positions for curve intervals classified as inside or outside. */\n public appendCurveCollectionClipIntervals(\n curves: CurveCollection, insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[],\n ): void {\n const clipper = new AlternatingCCTreeNodeCurveClipper();\n clipper.appendCurveCollectionClip(this, curves, insideIntervals, outsideIntervals);\n }\n /**\n * @param xyz input polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\n * the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n // At first level ..\n // newInside is subject to re-clip by children.\n // outside is definitively outside\n const oldOutsideCount = outsideFragments.length;\n const newInside = this.planes.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\n if (newInside === undefined) {\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(outsideFragments, oldOutsideCount, xyz, arrayCache);\n } else {\n let carryForwardA = [newInside];\n let carryForwardB: GrowableXYZArray[] = [];\n let tempAB;\n let shard;\n for (const c of this.children) {\n carryForwardB.length = 0;\n while (undefined !== (shard = carryForwardA.pop())) {\n // Anything inside this child is truly outside ...\n c.appendPolygonClip(shard, outsideFragments, carryForwardB, arrayCache);\n arrayCache.dropToCache(shard);\n }\n tempAB = carryForwardB;\n carryForwardB = carryForwardA; // and that is empty\n carryForwardA = tempAB;\n }\n while (undefined !== (shard = carryForwardA.pop())) {\n insideFragments.push(shard);\n }\n }\n }\n public depth(): number {\n const myDepth = 1;\n let maxChildDepth = 0;\n for (const c of this.children) {\n maxChildDepth = Math.max(maxChildDepth, c.depth());\n }\n return myDepth + maxChildDepth;\n }\n}\n\n/**\n * Context structure for building an AlternatingConvexClipTreeNode from a polygon.\n * <ul>\n * <li> The polygon is copied to the local m_points structure.\n * <li> During construction, m_stack contains indices of a sequence of points with uniform concavity.\n * </ul>\n */\nexport class AlternatingCCTreeBuilder {\n private _points: Point3d[] = [];\n private _stack: number[] = [];\n\n private constructor() { }\n\n public static createPointsRef(points: Point3d[], result?: AlternatingCCTreeBuilder): AlternatingCCTreeBuilder {\n result = result ? result : new AlternatingCCTreeBuilder();\n result._points = points;\n if (PolygonOps.areaXY(points) < 0.0)\n result._points.reverse();\n if (result._points[result._points.length - 1].isAlmostEqualMetric(result._points[0]))\n result._points.pop();\n return result;\n }\n public get period(): number {\n return this._points.length;\n }\n public indexAfter(i: number) {\n return (i + 1) % this._points.length;\n }\n public indexBefore(i: number) {\n return (i + this._points.length - 1) % this._points.length;\n }\n public pushIndex(primaryPointIndex: number) {\n this._stack.push(primaryPointIndex);\n }\n private static cross(pointA: Point3d, pointB: Point3d, pointC: Point3d): number {\n return pointA.crossProductToPointsXY(pointB, pointC);\n }\n /*\n public isInsideTurn(pointA: Point3d, pointB: Point3d, pointC: Point3d, sign: number) {\n return sign * AlternatingCCTreeBuilder.cross(pointA, pointB, pointC) > 0;\n }\n */\n public cyclicStackPoint(cyclicIndex: number): Point3d { // SIGNED index -- but negatives must be in first 10 periods?\n let stackIndex: number;\n const stack = this._stack;\n if (cyclicIndex > 0)\n stackIndex = cyclicIndex;\n else\n stackIndex = cyclicIndex + 10 * stack.length;\n stackIndex = stackIndex % stack.length;\n return this._points[stack[stackIndex]];\n }\n public signFromStackTip(pointIndex: number, sign: number) {\n const pointA = this.cyclicStackPoint(-2);\n const pointB = this.cyclicStackPoint(-1);\n const pointC = this._points[pointIndex];\n return sign * AlternatingCCTreeBuilder.cross(pointA, pointB, pointC) >= 0.0 ? 1 : -1;\n }\n /*\n * Test of xyz is in the convex region bounded by stack points:\n * <ul>\n * <li>polygon[i0]..polygon[i1]\n * <li>polygon[j0]..polygon[j1]\n * <li>polygon[i0]..polygon[i1]\n * </ul>\n * with \"inside\" controlled by sign multiplier.\n public isConvexContinuation(point: Point3d, i0: number, i1: number, j0: number, j1: number, sign: number): boolean {\n const points = this.points;\n const stack = this.stack;\n return this.isInsideTurn(points[stack[i0]], points[stack[i1]], point, sign)\n && this.isInsideTurn(points[stack[i0]], points[stack[j0]], point, sign)\n && this.isInsideTurn(points[stack[j1]], points[stack[i1]], point, sign);\n }\n */\n public get indexOfMaxX() {\n let k = 0;\n const points = this._points;\n const nPoints = this._points.length;\n for (let i = 1; i < nPoints; i++) {\n if (points[i].x > points[k].x)\n k = i;\n }\n return k;\n }\n /** Pop from the stack until the sign condition is satisfied */\n public extendHullChain(k: number, sign: number, pushAfterPops: boolean) {\n while (this._stack.length > 1 && this.signFromStackTip(k, sign) < 0.0)\n this._stack.pop();\n if (pushAfterPops)\n this.pushIndex(k);\n }\n public collectHullChain(kStart: number, numK: number, sign: number) {\n this._stack.length = 0;\n if (numK > 2) {\n let k = kStart;\n for (let i = 0; i < numK; i++) {\n this.extendHullChain(k, sign, true);\n k = this.indexAfter(k);\n }\n }\n }\n public collectHullPointsInArray(points: Point3d[], kStart: number, numK: number, _sign: number) {\n points.length = 0;\n if (numK > 2) {\n let k = kStart;\n for (let i = 0; i < numK; i++) {\n points.push(this._points[k]);\n k = this.indexAfter(k);\n }\n }\n }\n private buildHullTreeGo(\n root: AlternatingCCTreeNode, isPositiveArea: boolean, recurseToChildren: boolean = true,\n ): boolean {\n this.collectHullChain(root.startIdx, root.numPoints, isPositiveArea ? 1.0 : -1.0);\n root.points.length = 0;\n const stack = this._stack;\n const points = this._points;\n const stackLen = stack.length;\n\n for (let i = 0; i < stackLen; i++) {\n const k0 = stack[i];\n root.points.push(points[k0]);\n if (i + 1 < stackLen) {\n let k1 = stack[i + 1];\n if (k1 === this.indexAfter(k0)) {\n // two original points in sequence -- need a clip plane right here!!!\n const plane = ClipPlane.createEdgeAndUpVector(\n points[k0], points[k1], Vector3d.create(0, 0, 1), Angle.createRadians(0),\n );\n if (plane !== undefined) {\n if (isPositiveArea)\n plane.negateInPlace();\n root.addPlane(plane);\n }\n } else {\n if (k1 < k0)\n k1 += this.period;\n root.addEmptyChild(k0, k1 - k0 + 1);\n }\n }\n }\n if (recurseToChildren) {\n for (const child of root.children)\n this.buildHullTreeGo(child, !isPositiveArea);\n } else {\n for (const child of root.children)\n this.collectHullPointsInArray(child.points, child.startIdx, child.numPoints, isPositiveArea ? -1.0 : 1.0);\n }\n return true; // Are there failure modes? What happens with crossing data?..\n }\n /**\n * <ul>\n * <li> Input a ClipTreeRoot that has start and count data\n * <li> Build the hull for that data range\n * <li> Store the hull points in the root\n * <li> Add children with start and count data\n * <li> Recursively move to children\n * </ul>\n */\n public buildHullAndInletsForPolygon(root: AlternatingCCTreeNode): boolean {\n AlternatingCCTreeNode.createWithIndices(this.indexOfMaxX, this.period + 1, root);\n return this.buildHullTreeGo(root, true, false);\n }\n /**\n * <ul>\n * <li> Input a ClipTreeRoot that has start and count data\n * <li> Build the hull for that data range\n * <li> Store the hull points in the root\n * <li> Add children with start and count data\n * <li> Recursively move to children\n * </ul>\n */\n public buildHullTree(root: AlternatingCCTreeNode): boolean {\n AlternatingCCTreeNode.createWithIndices(this.indexOfMaxX, this.period + 1, root);\n return this.buildHullTreeGo(root, true);\n }\n}\n\nexport class AlternatingCCTreeNodeCurveClipper {\n private _curve: CurvePrimitive | undefined;\n private _intervalStack: Range1d[][];\n private _stackDepth: number;\n\n public constructor() {\n this._stackDepth = 0;\n this._intervalStack = [];\n }\n\n private setCurveRef(curve: CurvePrimitive) { this._curve = curve; }\n private popSegmentFrame() {\n if (this._stackDepth > 0) {\n this._topOfStack.length = 0; // formality.\n this._stackDepth -= 1;\n }\n }\n private clearSegmentStack() {\n while (this._stackDepth > 0)\n this.popSegmentFrame(); // and that will reduce stack depth\n }\n private pushEmptySegmentFrame() {\n this._stackDepth += 1;\n while (this._intervalStack.length < this._stackDepth)\n this._intervalStack.push([]);\n this._topOfStack.length = 0;\n }\n private get _topOfStack(): Range1d[] { return this._intervalStack[this._stackDepth - 1]; }\n // set the top of the stack (as defined by stackDepth -- not array length)\n private set _topOfStack(value: Range1d[]) {\n const n = this._stackDepth;\n if (n > 0)\n this._intervalStack[n - 1] = value;\n }\n /** Access entry [topOfStack() - numSkip] */\n private stackEntry(numSkip: number): Range1d[] {\n if (numSkip <= this._stackDepth)\n return this._intervalStack[this._stackDepth - 1 - numSkip];\n else\n return [];\n }\n private isTopOfStackEmpty(): boolean {\n return this._topOfStack.length === 0;\n }\n // Is re-used by method calls\n private static _fractionIntervals: number[] = [];\n private appendSingleClipToStack(planes: ConvexClipPlaneSet, insideSegments: Range1d[]): boolean {\n const fractionIntervals = AlternatingCCTreeNodeCurveClipper._fractionIntervals;\n\n if (this._curve instanceof LineSegment3d) {\n const segment = this._curve;\n let f0: number;\n let f1: number;\n if (segment.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => { f0 = a0; f1 = a1; })) {\n insideSegments.push(Range1d.createXX(f0!, f1!));\n }\n return true;\n\n } else if (this._curve instanceof Arc3d) {\n const arc = this._curve;\n fractionIntervals.length = 0;\n arc.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => {\n fractionIntervals.push(a0); fractionIntervals.push(a1);\n });\n for (let i = 0; i < fractionIntervals.length; i += 2)\n insideSegments.push(Range1d.createXX(fractionIntervals[i], fractionIntervals[i + 1]));\n return true;\n\n } else if (this._curve instanceof LineString3d && (this._curve).points.length > 1) {\n const linestring = this._curve;\n let f0: number;\n let f1: number;\n const nPoints = linestring.points.length;\n const df = 1.0 / (nPoints - 1);\n for (let i = 0; i < nPoints - 1; i++) {\n const segment = LineSegment3d.create(linestring.points[i], linestring.points[i + 1]);\n if (segment.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => { f0 = a0; f1 = a1; })) {\n insideSegments.push(Range1d.createXX((i + f0!) * df, (i + f1!) * df));\n }\n }\n return true;\n\n } else if (this._curve instanceof BSplineCurve3d) {\n const bcurve = this._curve;\n fractionIntervals.length = 0;\n bcurve.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => {\n fractionIntervals.push(a0); fractionIntervals.push(a1);\n });\n for (let i = 0; i < fractionIntervals.length; i += 2)\n insideSegments.push(Range1d.createXX(fractionIntervals[i], fractionIntervals[i + 1]));\n return true;\n }\n\n return false;\n }\n /**\n * Run one level of recursion. On return, the stack is one level deeper than at entry and the new top of the stack\n * has clip for this node (expensive -- must clone items of arrays during \"swaps\").\n */\n private recurse(node: AlternatingCCTreeNode) {\n this.pushEmptySegmentFrame();\n this.appendSingleClipToStack(node.planes, this._topOfStack);\n Range1dArray.sort(this._topOfStack);\n if (this.isTopOfStackEmpty())\n return;\n for (const child of node.children) {\n this.recurse(child);\n if (!this.isTopOfStackEmpty()) {\n const ranges = Range1dArray.differenceSorted(this.stackEntry(1), this.stackEntry(0));\n this.popSegmentFrame();\n this._topOfStack = ranges;\n } else {\n this.popSegmentFrame();\n }\n if (this.isTopOfStackEmpty())\n break;\n }\n }\n /**\n * Modifies the insideIntervals array given in place.\n * Note: curve given is passed by reference and stored.\n */\n public appendSingleClipPrimitive(root: AlternatingCCTreeNode, curve: CurvePrimitive,\n insideIntervals: CurveLocationDetailPair[], _outsideIntervals: CurveLocationDetailPair[]) {\n this.setCurveRef(curve);\n this.clearSegmentStack();\n this.recurse(root);\n if (this._stackDepth !== 1)\n return;\n const intervals = this._topOfStack;\n for (const interval of intervals) {\n const f0 = interval.low;\n const f1 = interval.high;\n const xyz0 = curve.fractionToPoint(f0);\n const xyz1 = curve.fractionToPoint(f1);\n insideIntervals.push(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveFractionPoint(curve, f0, xyz0),\n CurveLocationDetail.createCurveFractionPoint(curve, f1, xyz1),\n ));\n }\n this.popSegmentFrame();\n }\n /**\n * Modifies the insideIntervals array given in place.\n * Note: curve given is passed by reference and stored.\n */\n public appendCurveCollectionClip(root: AlternatingCCTreeNode, curve: CurveCollection,\n insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[]) {\n for (const cp of curve.children) {\n if (cp instanceof CurvePrimitive)\n this.appendSingleClipPrimitive(root, cp, insideIntervals, outsideIntervals);\n else if (cp instanceof CurveCollection)\n this.appendCurveCollectionClip(root, cp, insideIntervals, outsideIntervals);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AlternatingConvexClipTree.js","sourceRoot":"","sources":["../../../src/clipping/AlternatingConvexClipTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,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,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;QACnC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC;YACxB,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;YACzB,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;YACvC,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;YACvC,eAAe,CAAC,IAAI,CAAC,uBAAuB,CAAC,aAAa,CACxD,mBAAmB,CAAC,wBAAwB,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAC7D,mBAAmB,CAAC,wBAAwB,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAC9D,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACD;;;OAGG;IACI,yBAAyB,CAAC,IAA2B,EAAE,KAAsB,EAClF,eAA0C,EAAE,gBAA2C;QACvF,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,EAAE,YAAY,cAAc;gBAC9B,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;iBACzE,IAAI,EAAE,YAAY,eAAe;gBACpC,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAChF,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { Range1d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Range1dArray } from \"../numerics/Range1dArray\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\n\r\n/**\r\n * An AlternatingConvexClipTreeNode is a node in a tree structure in which\r\n * <ul>\r\n * <li>Each node contains a ConvexClipPlaneSet.\r\n * <li>Each node contains an array of children which are also AlternatingConvexClipTreeNode.\r\n * <li>The rule for an in/out decision is that a point is IN the subtree under a node if\r\n * <ul>\r\n * <li>It is IN the node's ConvexClipPlaneSet.\r\n * <li>It is NOT IN any of the children.\r\n * </ul>\r\n * <li>Applying \"NOT IN any of the children\" locally to children at each level means that the ConvexClipPlaneSet\r\n * at adjacent levels flip between being positive areas and holes.\r\n * <li>Use an AlternatingConvexClipTreeNodeBuilder to construct the tree from a polygon.\r\n * <li>It is possible for the root clip plane set to be empty. An empty clip plane set returns \"true\"\r\n * for all point tests, so the meaning is just that holes are to be subtracted from the rest\r\n * of space.\r\n * <li>Although the interpretation of in/out alternates with tree levels, the ConvexClipPlaneSets\r\n * at each level are all \"enclosing\" planes in the usual way.\r\n * </ul>\r\n */\r\nexport class AlternatingCCTreeNode implements PolygonClipper {\r\n public points: Point3d[] = [];\r\n public planes: ConvexClipPlaneSet = ConvexClipPlaneSet.createEmpty();\r\n public children: AlternatingCCTreeNode[] = [];\r\n public startIdx: number = -1; // Start index into the master array (not the local points array)\r\n public numPoints: number = -1; // Number of points used in the master array\r\n\r\n private constructor() { }\r\n\r\n /** Initialize this node with index data referencing the parent polygon. */\r\n public static createWithIndices(index0: number, numPoints: number, result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\r\n result = result ? result : new AlternatingCCTreeNode();\r\n result.startIdx = index0;\r\n result.numPoints = numPoints;\r\n result.children.length = 0;\r\n return result;\r\n }\r\n /**\r\n * <ul>\r\n * <li>Build the tree for a polygon.\r\n * <li>Caller creates the root node with empty constructor AlternatingConvexClipTreeNode.\r\n * </ul>\r\n */\r\n public static createTreeForPolygon(points: Point3d[], result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\r\n result = result ? result : new AlternatingCCTreeNode();\r\n result.empty();\r\n const builder = AlternatingCCTreeBuilder.createPointsRef(points);\r\n builder.buildHullTree(result); // <-- Currently ALWAYS returns true\r\n return result;\r\n }\r\n /** Build the outer convex hull with inlets as first level children. */\r\n public static createHullAndInletsForPolygon(points: Point3d[], result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\r\n result = result ? result : new AlternatingCCTreeNode();\r\n result.empty();\r\n const builder = AlternatingCCTreeBuilder.createPointsRef(points);\r\n builder.buildHullAndInletsForPolygon(result); // <-- Currently ALWAYS returns true\r\n return result;\r\n }\r\n private extractLoopsGo(loops: Point3d[][]) {\r\n loops.push(Point3dArray.clonePoint3dArray(this.points));\r\n for (const c of this.children)\r\n c.extractLoopsGo(loops);\r\n }\r\n /**\r\n * Return an array with all the loops in the tree.\r\n * This loses the alternating structure of the tree, but the collection still matches well-formed polygons by\r\n * parity rules.\r\n */\r\n public extractLoops(): Point3d[][] {\r\n const loops: Point3d[][] = [];\r\n this.extractLoopsGo(loops);\r\n return loops;\r\n }\r\n /** Resets this AlternatingConvexClipTreeNode to a newly-created state. */\r\n public empty() {\r\n this.points.length = 0;\r\n this.planes.planes.length = 0;\r\n this.children.length = 0;\r\n this.startIdx = -1;\r\n this.numPoints = -1;\r\n }\r\n /** Creates a deep copy of this node (expensive - copies Geometry, and is recursive for children array). */\r\n public clone(result?: AlternatingCCTreeNode): AlternatingCCTreeNode {\r\n result = result ? result : new AlternatingCCTreeNode();\r\n for (const point of this.points)\r\n result.points.push(point.clone());\r\n result.planes = ConvexClipPlaneSet.createEmpty();\r\n for (const plane of this.planes.planes)\r\n result.planes.planes.push(plane.clone());\r\n for (const node of this.children)\r\n result.children.push(node.clone());\r\n result.startIdx = this.startIdx;\r\n result.numPoints = this.numPoints;\r\n return result;\r\n }\r\n /** Add a new child that has an empty plane set and given indices. */\r\n public addEmptyChild(index0: number, numPoints: number) {\r\n const newNode = AlternatingCCTreeNode.createWithIndices(index0, numPoints);\r\n this.children.push(newNode);\r\n }\r\n /** Add a plane to the ConvexClipPlaneSet. */\r\n public addPlane(plane: ClipPlane) {\r\n this.planes.addPlaneToConvexSet(plane);\r\n }\r\n /** Search with alternating in and out semantics. */\r\n public isPointOnOrInside(point: Point3d): boolean {\r\n const inRoot = this.planes.isPointOnOrInside(point, 0.0);\r\n if (!inRoot)\r\n return false;\r\n for (const child of this.children) {\r\n if (child.isPointOnOrInside(point))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Add an AlternatingConvexClipTreeNode as a child of this one -- i.e. a hole.\r\n * * The child pointer is pushed directly to the tree -- not cloned.\r\n */\r\n public captureConvexClipPlaneSetAsVoid(child: AlternatingCCTreeNode) {\r\n this.children.push(child);\r\n }\r\n /** Append start-end positions for curve intervals classified as inside or outside. */\r\n public appendCurvePrimitiveClipIntervals(\r\n curve: CurvePrimitive, insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[],\r\n ): void {\r\n const clipper = new AlternatingCCTreeNodeCurveClipper();\r\n clipper.appendSingleClipPrimitive(this, curve, insideIntervals, outsideIntervals);\r\n }\r\n /** Append start-end positions for curve intervals classified as inside or outside. */\r\n public appendCurveCollectionClipIntervals(\r\n curves: CurveCollection, insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[],\r\n ): void {\r\n const clipper = new AlternatingCCTreeNodeCurveClipper();\r\n clipper.appendCurveCollectionClip(this, curves, insideIntervals, outsideIntervals);\r\n }\r\n /**\r\n * @param xyz input polygon. This is not changed.\r\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed from\r\n * the cache. This is NOT cleared.\r\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\r\n * from the cache. This is NOT cleared.\r\n * @param arrayCache cache for reusable GrowableXYZArray.\r\n */\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ): void {\r\n // At first level ..\r\n // newInside is subject to re-clip by children.\r\n // outside is definitively outside\r\n const oldOutsideCount = outsideFragments.length;\r\n const newInside = this.planes.clipInsidePushOutside(xyz, outsideFragments, arrayCache);\r\n if (newInside === undefined) {\r\n ClipUtilities.restoreSingletonInPlaceOfMultipleShards(outsideFragments, oldOutsideCount, xyz, arrayCache);\r\n } else {\r\n let carryForwardA = [newInside];\r\n let carryForwardB: GrowableXYZArray[] = [];\r\n let tempAB;\r\n let shard;\r\n for (const c of this.children) {\r\n carryForwardB.length = 0;\r\n while (undefined !== (shard = carryForwardA.pop())) {\r\n // Anything inside this child is truly outside ...\r\n c.appendPolygonClip(shard, outsideFragments, carryForwardB, arrayCache);\r\n arrayCache.dropToCache(shard);\r\n }\r\n tempAB = carryForwardB;\r\n carryForwardB = carryForwardA; // and that is empty\r\n carryForwardA = tempAB;\r\n }\r\n while (undefined !== (shard = carryForwardA.pop())) {\r\n insideFragments.push(shard);\r\n }\r\n }\r\n }\r\n public depth(): number {\r\n const myDepth = 1;\r\n let maxChildDepth = 0;\r\n for (const c of this.children) {\r\n maxChildDepth = Math.max(maxChildDepth, c.depth());\r\n }\r\n return myDepth + maxChildDepth;\r\n }\r\n}\r\n\r\n/**\r\n * Context structure for building an AlternatingConvexClipTreeNode from a polygon.\r\n * <ul>\r\n * <li> The polygon is copied to the local m_points structure.\r\n * <li> During construction, m_stack contains indices of a sequence of points with uniform concavity.\r\n * </ul>\r\n */\r\nexport class AlternatingCCTreeBuilder {\r\n private _points: Point3d[] = [];\r\n private _stack: number[] = [];\r\n\r\n private constructor() { }\r\n\r\n public static createPointsRef(points: Point3d[], result?: AlternatingCCTreeBuilder): AlternatingCCTreeBuilder {\r\n result = result ? result : new AlternatingCCTreeBuilder();\r\n result._points = points;\r\n if (PolygonOps.areaXY(points) < 0.0)\r\n result._points.reverse();\r\n if (result._points[result._points.length - 1].isAlmostEqualMetric(result._points[0]))\r\n result._points.pop();\r\n return result;\r\n }\r\n public get period(): number {\r\n return this._points.length;\r\n }\r\n public indexAfter(i: number) {\r\n return (i + 1) % this._points.length;\r\n }\r\n public indexBefore(i: number) {\r\n return (i + this._points.length - 1) % this._points.length;\r\n }\r\n public pushIndex(primaryPointIndex: number) {\r\n this._stack.push(primaryPointIndex);\r\n }\r\n private static cross(pointA: Point3d, pointB: Point3d, pointC: Point3d): number {\r\n return pointA.crossProductToPointsXY(pointB, pointC);\r\n }\r\n /*\r\n public isInsideTurn(pointA: Point3d, pointB: Point3d, pointC: Point3d, sign: number) {\r\n return sign * AlternatingCCTreeBuilder.cross(pointA, pointB, pointC) > 0;\r\n }\r\n */\r\n public cyclicStackPoint(cyclicIndex: number): Point3d { // SIGNED index -- but negatives must be in first 10 periods?\r\n let stackIndex: number;\r\n const stack = this._stack;\r\n if (cyclicIndex > 0)\r\n stackIndex = cyclicIndex;\r\n else\r\n stackIndex = cyclicIndex + 10 * stack.length;\r\n stackIndex = stackIndex % stack.length;\r\n return this._points[stack[stackIndex]];\r\n }\r\n public signFromStackTip(pointIndex: number, sign: number) {\r\n const pointA = this.cyclicStackPoint(-2);\r\n const pointB = this.cyclicStackPoint(-1);\r\n const pointC = this._points[pointIndex];\r\n return sign * AlternatingCCTreeBuilder.cross(pointA, pointB, pointC) >= 0.0 ? 1 : -1;\r\n }\r\n /*\r\n * Test of xyz is in the convex region bounded by stack points:\r\n * <ul>\r\n * <li>polygon[i0]..polygon[i1]\r\n * <li>polygon[j0]..polygon[j1]\r\n * <li>polygon[i0]..polygon[i1]\r\n * </ul>\r\n * with \"inside\" controlled by sign multiplier.\r\n public isConvexContinuation(point: Point3d, i0: number, i1: number, j0: number, j1: number, sign: number): boolean {\r\n const points = this.points;\r\n const stack = this.stack;\r\n return this.isInsideTurn(points[stack[i0]], points[stack[i1]], point, sign)\r\n && this.isInsideTurn(points[stack[i0]], points[stack[j0]], point, sign)\r\n && this.isInsideTurn(points[stack[j1]], points[stack[i1]], point, sign);\r\n }\r\n */\r\n public get indexOfMaxX() {\r\n let k = 0;\r\n const points = this._points;\r\n const nPoints = this._points.length;\r\n for (let i = 1; i < nPoints; i++) {\r\n if (points[i].x > points[k].x)\r\n k = i;\r\n }\r\n return k;\r\n }\r\n /** Pop from the stack until the sign condition is satisfied */\r\n public extendHullChain(k: number, sign: number, pushAfterPops: boolean) {\r\n while (this._stack.length > 1 && this.signFromStackTip(k, sign) < 0.0)\r\n this._stack.pop();\r\n if (pushAfterPops)\r\n this.pushIndex(k);\r\n }\r\n public collectHullChain(kStart: number, numK: number, sign: number) {\r\n this._stack.length = 0;\r\n if (numK > 2) {\r\n let k = kStart;\r\n for (let i = 0; i < numK; i++) {\r\n this.extendHullChain(k, sign, true);\r\n k = this.indexAfter(k);\r\n }\r\n }\r\n }\r\n public collectHullPointsInArray(points: Point3d[], kStart: number, numK: number, _sign: number) {\r\n points.length = 0;\r\n if (numK > 2) {\r\n let k = kStart;\r\n for (let i = 0; i < numK; i++) {\r\n points.push(this._points[k]);\r\n k = this.indexAfter(k);\r\n }\r\n }\r\n }\r\n private buildHullTreeGo(\r\n root: AlternatingCCTreeNode, isPositiveArea: boolean, recurseToChildren: boolean = true,\r\n ): boolean {\r\n this.collectHullChain(root.startIdx, root.numPoints, isPositiveArea ? 1.0 : -1.0);\r\n root.points.length = 0;\r\n const stack = this._stack;\r\n const points = this._points;\r\n const stackLen = stack.length;\r\n\r\n for (let i = 0; i < stackLen; i++) {\r\n const k0 = stack[i];\r\n root.points.push(points[k0]);\r\n if (i + 1 < stackLen) {\r\n let k1 = stack[i + 1];\r\n if (k1 === this.indexAfter(k0)) {\r\n // two original points in sequence -- need a clip plane right here!!!\r\n const plane = ClipPlane.createEdgeAndUpVector(\r\n points[k0], points[k1], Vector3d.create(0, 0, 1), Angle.createRadians(0),\r\n );\r\n if (plane !== undefined) {\r\n if (isPositiveArea)\r\n plane.negateInPlace();\r\n root.addPlane(plane);\r\n }\r\n } else {\r\n if (k1 < k0)\r\n k1 += this.period;\r\n root.addEmptyChild(k0, k1 - k0 + 1);\r\n }\r\n }\r\n }\r\n if (recurseToChildren) {\r\n for (const child of root.children)\r\n this.buildHullTreeGo(child, !isPositiveArea);\r\n } else {\r\n for (const child of root.children)\r\n this.collectHullPointsInArray(child.points, child.startIdx, child.numPoints, isPositiveArea ? -1.0 : 1.0);\r\n }\r\n return true; // Are there failure modes? What happens with crossing data?..\r\n }\r\n /**\r\n * <ul>\r\n * <li> Input a ClipTreeRoot that has start and count data\r\n * <li> Build the hull for that data range\r\n * <li> Store the hull points in the root\r\n * <li> Add children with start and count data\r\n * <li> Recursively move to children\r\n * </ul>\r\n */\r\n public buildHullAndInletsForPolygon(root: AlternatingCCTreeNode): boolean {\r\n AlternatingCCTreeNode.createWithIndices(this.indexOfMaxX, this.period + 1, root);\r\n return this.buildHullTreeGo(root, true, false);\r\n }\r\n /**\r\n * <ul>\r\n * <li> Input a ClipTreeRoot that has start and count data\r\n * <li> Build the hull for that data range\r\n * <li> Store the hull points in the root\r\n * <li> Add children with start and count data\r\n * <li> Recursively move to children\r\n * </ul>\r\n */\r\n public buildHullTree(root: AlternatingCCTreeNode): boolean {\r\n AlternatingCCTreeNode.createWithIndices(this.indexOfMaxX, this.period + 1, root);\r\n return this.buildHullTreeGo(root, true);\r\n }\r\n}\r\n\r\nexport class AlternatingCCTreeNodeCurveClipper {\r\n private _curve: CurvePrimitive | undefined;\r\n private _intervalStack: Range1d[][];\r\n private _stackDepth: number;\r\n\r\n public constructor() {\r\n this._stackDepth = 0;\r\n this._intervalStack = [];\r\n }\r\n\r\n private setCurveRef(curve: CurvePrimitive) { this._curve = curve; }\r\n private popSegmentFrame() {\r\n if (this._stackDepth > 0) {\r\n this._topOfStack.length = 0; // formality.\r\n this._stackDepth -= 1;\r\n }\r\n }\r\n private clearSegmentStack() {\r\n while (this._stackDepth > 0)\r\n this.popSegmentFrame(); // and that will reduce stack depth\r\n }\r\n private pushEmptySegmentFrame() {\r\n this._stackDepth += 1;\r\n while (this._intervalStack.length < this._stackDepth)\r\n this._intervalStack.push([]);\r\n this._topOfStack.length = 0;\r\n }\r\n private get _topOfStack(): Range1d[] { return this._intervalStack[this._stackDepth - 1]; }\r\n // set the top of the stack (as defined by stackDepth -- not array length)\r\n private set _topOfStack(value: Range1d[]) {\r\n const n = this._stackDepth;\r\n if (n > 0)\r\n this._intervalStack[n - 1] = value;\r\n }\r\n /** Access entry [topOfStack() - numSkip] */\r\n private stackEntry(numSkip: number): Range1d[] {\r\n if (numSkip <= this._stackDepth)\r\n return this._intervalStack[this._stackDepth - 1 - numSkip];\r\n else\r\n return [];\r\n }\r\n private isTopOfStackEmpty(): boolean {\r\n return this._topOfStack.length === 0;\r\n }\r\n // Is re-used by method calls\r\n private static _fractionIntervals: number[] = [];\r\n private appendSingleClipToStack(planes: ConvexClipPlaneSet, insideSegments: Range1d[]): boolean {\r\n const fractionIntervals = AlternatingCCTreeNodeCurveClipper._fractionIntervals;\r\n\r\n if (this._curve instanceof LineSegment3d) {\r\n const segment = this._curve;\r\n let f0: number;\r\n let f1: number;\r\n if (segment.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => { f0 = a0; f1 = a1; })) {\r\n insideSegments.push(Range1d.createXX(f0!, f1!));\r\n }\r\n return true;\r\n\r\n } else if (this._curve instanceof Arc3d) {\r\n const arc = this._curve;\r\n fractionIntervals.length = 0;\r\n arc.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => {\r\n fractionIntervals.push(a0); fractionIntervals.push(a1);\r\n });\r\n for (let i = 0; i < fractionIntervals.length; i += 2)\r\n insideSegments.push(Range1d.createXX(fractionIntervals[i], fractionIntervals[i + 1]));\r\n return true;\r\n\r\n } else if (this._curve instanceof LineString3d && (this._curve).points.length > 1) {\r\n const linestring = this._curve;\r\n let f0: number;\r\n let f1: number;\r\n const nPoints = linestring.points.length;\r\n const df = 1.0 / (nPoints - 1);\r\n for (let i = 0; i < nPoints - 1; i++) {\r\n const segment = LineSegment3d.create(linestring.points[i], linestring.points[i + 1]);\r\n if (segment.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => { f0 = a0; f1 = a1; })) {\r\n insideSegments.push(Range1d.createXX((i + f0!) * df, (i + f1!) * df));\r\n }\r\n }\r\n return true;\r\n\r\n } else if (this._curve instanceof BSplineCurve3d) {\r\n const bcurve = this._curve;\r\n fractionIntervals.length = 0;\r\n bcurve.announceClipIntervals(planes, (a0: number, a1: number, _cp: CurvePrimitive) => {\r\n fractionIntervals.push(a0); fractionIntervals.push(a1);\r\n });\r\n for (let i = 0; i < fractionIntervals.length; i += 2)\r\n insideSegments.push(Range1d.createXX(fractionIntervals[i], fractionIntervals[i + 1]));\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n /**\r\n * Run one level of recursion. On return, the stack is one level deeper than at entry and the new top of the stack\r\n * has clip for this node (expensive -- must clone items of arrays during \"swaps\").\r\n */\r\n private recurse(node: AlternatingCCTreeNode) {\r\n this.pushEmptySegmentFrame();\r\n this.appendSingleClipToStack(node.planes, this._topOfStack);\r\n Range1dArray.sort(this._topOfStack);\r\n if (this.isTopOfStackEmpty())\r\n return;\r\n for (const child of node.children) {\r\n this.recurse(child);\r\n if (!this.isTopOfStackEmpty()) {\r\n const ranges = Range1dArray.differenceSorted(this.stackEntry(1), this.stackEntry(0));\r\n this.popSegmentFrame();\r\n this._topOfStack = ranges;\r\n } else {\r\n this.popSegmentFrame();\r\n }\r\n if (this.isTopOfStackEmpty())\r\n break;\r\n }\r\n }\r\n /**\r\n * Modifies the insideIntervals array given in place.\r\n * Note: curve given is passed by reference and stored.\r\n */\r\n public appendSingleClipPrimitive(root: AlternatingCCTreeNode, curve: CurvePrimitive,\r\n insideIntervals: CurveLocationDetailPair[], _outsideIntervals: CurveLocationDetailPair[]) {\r\n this.setCurveRef(curve);\r\n this.clearSegmentStack();\r\n this.recurse(root);\r\n if (this._stackDepth !== 1)\r\n return;\r\n const intervals = this._topOfStack;\r\n for (const interval of intervals) {\r\n const f0 = interval.low;\r\n const f1 = interval.high;\r\n const xyz0 = curve.fractionToPoint(f0);\r\n const xyz1 = curve.fractionToPoint(f1);\r\n insideIntervals.push(CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createCurveFractionPoint(curve, f0, xyz0),\r\n CurveLocationDetail.createCurveFractionPoint(curve, f1, xyz1),\r\n ));\r\n }\r\n this.popSegmentFrame();\r\n }\r\n /**\r\n * Modifies the insideIntervals array given in place.\r\n * Note: curve given is passed by reference and stored.\r\n */\r\n public appendCurveCollectionClip(root: AlternatingCCTreeNode, curve: CurveCollection,\r\n insideIntervals: CurveLocationDetailPair[], outsideIntervals: CurveLocationDetailPair[]) {\r\n for (const cp of curve.children) {\r\n if (cp instanceof CurvePrimitive)\r\n this.appendSingleClipPrimitive(root, cp, insideIntervals, outsideIntervals);\r\n else if (cp instanceof CurveCollection)\r\n this.appendCurveCollectionClip(root, cp, insideIntervals, outsideIntervals);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanClipFactory.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipFactory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAW,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,QAA6B,EAAE,UAAmB;QACjF,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,yBAAyB,CAAC,QAA6B,EAAE,UAAmB;QACxF,MAAM,MAAM,GAAG,IAAI,2BAA2B,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,mBAAmB,CAAC,QAA6B,EAAE,UAAmB;QAClF,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;;;OAQG;IACI,MAAM,CAAC,uBAAuB,C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AC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,gBAAgB,CAAC,OAAY;QACzC,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM;gBAChB,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,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 CartesianGeometry\n */\nimport { BooleanClipNodeIntersection, BooleanClipNodeParity, BooleanClipNodeUnion } from \"./BooleanClipNode\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { Clipper, ClipUtilities } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\n\n/**\n * A BooleanClipFactory is a factory to create objects that implement interior nodes of a tree of boolean clip operations.\n * * These methods create specific clip tree types:\n * * Union\n * * Intersection\n * * Parity\n * * Difference\n * * Each construction has a `keepInside` flag that optionally negates the initial result of the parity, intersection,\n * parity, or difference:\n * * if `keepInside === true`, accept the \"inside\" of the initial result.\n * * if `keepInside === false`, accept the \"outside\" of the initial result.\n * * These methods create various other specialized clippers.\n * @public\n */\nexport class BooleanClipFactory {\n /**\n * Create a boolean clipper which performs a union over its children.\n * * if `keepInside === true`, accept the \"inside\" of the union result.\n * * if `keepInside === false`, accept the \"outside\" of the union result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureUnion(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeUnion(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs an intersection over its children.\n * * if `keepInside === true`, accept the \"inside\" of the intersection result.\n * * if `keepInside === false`, accept the \"outside\" of the intersection result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureIntersection(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeIntersection(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs a parity over its children.\n * * if `keepInside === true`, accept the \"inside\" of the parity result.\n * * if `keepInside === false`, accept the \"outside\" of the parity result.\n * @param clippers clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureParity(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\n const result = new BooleanClipNodeParity(keepInside);\n result.captureChild(clippers);\n return result;\n }\n /**\n * Create a boolean clipper which performs a difference operation for points \"inside `primaryClipper`\" and\n * \"outside `excludedClipper`\".\n * * if `keepInside === true`, accept the \"inside\" of the difference.\n * * if `keepInside === false`, accept the \"outside\" of the difference.\n * @param primaryClipper any clip object whose output is treated as positive.\n * @param excludeClip any clipper whose output is treated as negative.\n * @param keepInside flag to select results inside or outside the initial `primary minus excludeClipper` clippers.\n */\n public static createCaptureDifference(primaryClipper: Clipper, excludedClipper: Clipper, keepInside: boolean): Clipper {\n const mask = this.createCaptureUnion(excludedClipper, false);\n return this.createCaptureIntersection([primaryClipper, mask], keepInside);\n }\n /**\n * Create a boolean clipper which performs the reverse of that of `primaryClipper`.\n * @param primaryClipper clip objects to capture.\n * @param keepInside flag to select results inside or outside the clippers.\n */\n public static createCaptureClipOutside(primaryClipper: Clipper): Clipper {\n return this.createCaptureUnion([primaryClipper], false);\n }\n /**\n * Convert `source` to an array of clipper objects.\n * * ANY TYPE OF Clipper is accepted.\n * * REMARK: This is normally called only from the primary public method `parseToClipper`.\n */\n public static parseToClipperArray(source: any): Clipper[] | undefined {\n if (Array.isArray(source)) {\n const clippers = [];\n for (const c of source) {\n const c1 = this.parseToClipper(c);\n if (!c1)\n return undefined;\n clippers.push(c1);\n }\n if (clippers.length === 0)\n return undefined;\n return clippers;\n } else {\n // accept singleton to singleton array\n const c = this.parseToClipper(source);\n if (c)\n return [c];\n }\n return undefined;\n }\n /**\n * Look for content that represents a clipper.\n * * Possible outputs are\n * * `ClipPlane`\n * * `ConvexClipPlaneSet`\n * * `UnionOfConvexClipPlaneSets`\n * * One of the `ClipBoolean` derived classes\n * * `ClipBooleanXOR`\n * * `ClipBooleanOR`\n * * `ClipBooleanAND`\n * @param source json object\n * @public\n */\n public static parseToClipper(source?: object): Clipper | undefined {\n if (!source)\n return undefined;\n\n if (source.hasOwnProperty(\"normal\") && source.hasOwnProperty(\"dist\")) {\n return ClipPlane.fromJSON(source);\n } else if (Array.isArray(source)) {\n const clippers: Clipper[] = [];\n let numPlanes = 0;\n let numConvexSets = 0;\n for (const c of source) {\n const c1 = this.parseToClipper(c);\n if (!c1)\n return undefined;\n clippers.push(c1);\n if (c1 instanceof ClipPlane)\n numPlanes++;\n else if (c1 instanceof ConvexClipPlaneSet)\n numConvexSets++;\n else\n return undefined;\n }\n if (clippers.length === 0)\n return undefined;\n if (numPlanes === source.length) {\n // array of planes is a convex clip plane set.\n return ConvexClipPlaneSet.createPlanes(clippers as ClipPlane[]);\n } else if (numConvexSets === source.length) {\n return UnionOfConvexClipPlaneSets.createConvexSets(clippers as ConvexClipPlaneSet[]);\n }\n // array of mixed types should not occur. fall out to undefined.\n } else if (source.hasOwnProperty(\"OR\")) {\n const clippers = this.parseToClipperArray((source as any).OR);\n if (clippers)\n return this.createCaptureUnion(clippers, true);\n } else if (source.hasOwnProperty(\"NOR\")) {\n const clippers = this.parseToClipperArray((source as any).NOR);\n if (clippers)\n return this.createCaptureUnion(clippers, false);\n } else if (source.hasOwnProperty(\"AND\")) {\n const clippers = this.parseToClipperArray((source as any).AND);\n if (clippers)\n return this.createCaptureIntersection(clippers, true);\n } else if (source.hasOwnProperty(\"NAND\")) {\n const clippers = this.parseToClipperArray((source as any).NAND);\n if (clippers)\n return this.createCaptureIntersection(clippers, true);\n } else if (source.hasOwnProperty(\"XOR\")) {\n const clippers = this.parseToClipperArray((source as any).XOR);\n if (clippers)\n return this.createCaptureParity(clippers, true);\n } else if (source.hasOwnProperty(\"NXOR\")) {\n const clippers = this.parseToClipperArray((source as any).NXOR);\n if (clippers)\n return this.createCaptureParity(clippers, true);\n }\n return undefined;\n }\n /** Choose a `toJSON` method appropriate to the clipper */\n public static anyClipperToJSON(clipper: any): any {\n if (ClipUtilities.isClipper(clipper)) {\n if (clipper.toJSON)\n return clipper.toJSON();\n }\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BooleanClipFactory.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipFactory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAW,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,QAA6B,EAAE,UAAmB;QACjF,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,yBAAyB,CAAC,QAA6B,EAAE,UAAmB;QACxF,MAAM,MAAM,GAAG,IAAI,2BAA2B,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,CAAC,YAAY,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AQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,gBAAgB,CAAC,OAAY;QACzC,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM;gBAChB,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5B,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\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\nimport { BooleanClipNodeIntersection, BooleanClipNodeParity, BooleanClipNodeUnion } from \"./BooleanClipNode\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipUtilities } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets } from \"./UnionOfConvexClipPlaneSets\";\r\n\r\n/**\r\n * A BooleanClipFactory is a factory to create objects that implement interior nodes of a tree of boolean clip operations.\r\n * * These methods create specific clip tree types:\r\n * * Union\r\n * * Intersection\r\n * * Parity\r\n * * Difference\r\n * * Each construction has a `keepInside` flag that optionally negates the initial result of the parity, intersection,\r\n * parity, or difference:\r\n * * if `keepInside === true`, accept the \"inside\" of the initial result.\r\n * * if `keepInside === false`, accept the \"outside\" of the initial result.\r\n * * These methods create various other specialized clippers.\r\n * @public\r\n */\r\nexport class BooleanClipFactory {\r\n /**\r\n * Create a boolean clipper which performs a union over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the union result.\r\n * * if `keepInside === false`, accept the \"outside\" of the union result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureUnion(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeUnion(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs an intersection over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the intersection result.\r\n * * if `keepInside === false`, accept the \"outside\" of the intersection result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureIntersection(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeIntersection(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs a parity over its children.\r\n * * if `keepInside === true`, accept the \"inside\" of the parity result.\r\n * * if `keepInside === false`, accept the \"outside\" of the parity result.\r\n * @param clippers clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureParity(clippers: Clipper | Clipper[], keepInside: boolean): Clipper {\r\n const result = new BooleanClipNodeParity(keepInside);\r\n result.captureChild(clippers);\r\n return result;\r\n }\r\n /**\r\n * Create a boolean clipper which performs a difference operation for points \"inside `primaryClipper`\" and\r\n * \"outside `excludedClipper`\".\r\n * * if `keepInside === true`, accept the \"inside\" of the difference.\r\n * * if `keepInside === false`, accept the \"outside\" of the difference.\r\n * @param primaryClipper any clip object whose output is treated as positive.\r\n * @param excludeClip any clipper whose output is treated as negative.\r\n * @param keepInside flag to select results inside or outside the initial `primary minus excludeClipper` clippers.\r\n */\r\n public static createCaptureDifference(primaryClipper: Clipper, excludedClipper: Clipper, keepInside: boolean): Clipper {\r\n const mask = this.createCaptureUnion(excludedClipper, false);\r\n return this.createCaptureIntersection([primaryClipper, mask], keepInside);\r\n }\r\n /**\r\n * Create a boolean clipper which performs the reverse of that of `primaryClipper`.\r\n * @param primaryClipper clip objects to capture.\r\n * @param keepInside flag to select results inside or outside the clippers.\r\n */\r\n public static createCaptureClipOutside(primaryClipper: Clipper): Clipper {\r\n return this.createCaptureUnion([primaryClipper], false);\r\n }\r\n /**\r\n * Convert `source` to an array of clipper objects.\r\n * * ANY TYPE OF Clipper is accepted.\r\n * * REMARK: This is normally called only from the primary public method `parseToClipper`.\r\n */\r\n public static parseToClipperArray(source: any): Clipper[] | undefined {\r\n if (Array.isArray(source)) {\r\n const clippers = [];\r\n for (const c of source) {\r\n const c1 = this.parseToClipper(c);\r\n if (!c1)\r\n return undefined;\r\n clippers.push(c1);\r\n }\r\n if (clippers.length === 0)\r\n return undefined;\r\n return clippers;\r\n } else {\r\n // accept singleton to singleton array\r\n const c = this.parseToClipper(source);\r\n if (c)\r\n return [c];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Look for content that represents a clipper.\r\n * * Possible outputs are\r\n * * `ClipPlane`\r\n * * `ConvexClipPlaneSet`\r\n * * `UnionOfConvexClipPlaneSets`\r\n * * One of the `ClipBoolean` derived classes\r\n * * `ClipBooleanXOR`\r\n * * `ClipBooleanOR`\r\n * * `ClipBooleanAND`\r\n * @param source json object\r\n * @public\r\n */\r\n public static parseToClipper(source?: object): Clipper | undefined {\r\n if (!source)\r\n return undefined;\r\n\r\n if (source.hasOwnProperty(\"normal\") && source.hasOwnProperty(\"dist\")) {\r\n return ClipPlane.fromJSON(source);\r\n } else if (Array.isArray(source)) {\r\n const clippers: Clipper[] = [];\r\n let numPlanes = 0;\r\n let numConvexSets = 0;\r\n for (const c of source) {\r\n const c1 = this.parseToClipper(c);\r\n if (!c1)\r\n return undefined;\r\n clippers.push(c1);\r\n if (c1 instanceof ClipPlane)\r\n numPlanes++;\r\n else if (c1 instanceof ConvexClipPlaneSet)\r\n numConvexSets++;\r\n else\r\n return undefined;\r\n }\r\n if (clippers.length === 0)\r\n return undefined;\r\n if (numPlanes === source.length) {\r\n // array of planes is a convex clip plane set.\r\n return ConvexClipPlaneSet.createPlanes(clippers as ClipPlane[]);\r\n } else if (numConvexSets === source.length) {\r\n return UnionOfConvexClipPlaneSets.createConvexSets(clippers as ConvexClipPlaneSet[]);\r\n }\r\n // array of mixed types should not occur. fall out to undefined.\r\n } else if (source.hasOwnProperty(\"OR\")) {\r\n const clippers = this.parseToClipperArray((source as any).OR);\r\n if (clippers)\r\n return this.createCaptureUnion(clippers, true);\r\n } else if (source.hasOwnProperty(\"NOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).NOR);\r\n if (clippers)\r\n return this.createCaptureUnion(clippers, false);\r\n } else if (source.hasOwnProperty(\"AND\")) {\r\n const clippers = this.parseToClipperArray((source as any).AND);\r\n if (clippers)\r\n return this.createCaptureIntersection(clippers, true);\r\n } else if (source.hasOwnProperty(\"NAND\")) {\r\n const clippers = this.parseToClipperArray((source as any).NAND);\r\n if (clippers)\r\n return this.createCaptureIntersection(clippers, true);\r\n } else if (source.hasOwnProperty(\"XOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).XOR);\r\n if (clippers)\r\n return this.createCaptureParity(clippers, true);\r\n } else if (source.hasOwnProperty(\"NXOR\")) {\r\n const clippers = this.parseToClipperArray((source as any).NXOR);\r\n if (clippers)\r\n return this.createCaptureParity(clippers, true);\r\n }\r\n return undefined;\r\n }\r\n /** Choose a `toJSON` method appropriate to the clipper */\r\n public static anyClipperToJSON(clipper: any): any {\r\n if (ClipUtilities.isClipper(clipper)) {\r\n if (clipper.toJSON)\r\n return clipper.toJSON();\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanClipNode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AAO,YAAY,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IACM,iBAAiB,CACtB,GAAyB,EACzB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QAGjC,aAAa,CAAC,qBAAqB,CACjC,GAAG,EACH,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,EACrD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,EACrD,SAAS,EACT,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,QAAQ,EACvB,UAAU,CACX,CAAC;IACJ,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 CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range1d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Range1dArray } from \"../numerics/Range1dArray\";\nimport { Clipper, ClipStepAction, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/** BooleanClipNode is an abstract base class for boolean actions by an array of clippers.\n * * Derived class must implement\n * * The single point test `isPointOnOrInsideChildren`\n * * Boolean operation on 1d intervals `combineIntervals`\n * * The `keepInside` flag controls an additional optional flip of the boolean result.\n * * if `keepInside === true`, accept the \"inside\" of the clip clippers\n * * if `keepInside === false`, accept the \"outside\" of the child clippers.\n * * Hence the combinations of derived classes for (OR, AND, XOR) and keepInside are\n * * (OR, true) = simple union (OR), i.e. \"in\" one or more clips\n * * (OR, false) = complement of union (NOR), i.e. \"outside\" all clips\n * * (AND, true) = simple intersection (AND), i.e. \"in\" all clips\n * * (AND, false) = complement of intersection (NAND), i.e. \"outside\" one or more clips\n * * (XOR,true) = simple parity, i.e. \"in\" an odd number of clips\n * * (XOR,false) = complement of parity ), i.e. \"in\" an even number of clips\n * @internal\n */\nexport abstract class BooleanClipNode implements Clipper {\n protected _clippers: Clipper[];\n protected _intervalsA: Range1d[];\n protected _intervalsB: Range1d[];\n protected _keepInside: boolean;\n\n public constructor(keepInside: boolean) {\n this._keepInside = keepInside;\n this._clippers = [];\n this._intervalsA = [];\n this._intervalsB = [];\n }\n protected abstract isPointOnOrInsideChildren(point: Point3d): boolean;\n protected abstract combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[];\n public abstract get operationName(): string;\n public toJSON(): any {\n const data = [];\n for (const c of this._clippers) {\n const c1 = c as any;\n if (c1.toJSON)\n data.push(c1.toJSON());\n }\n // return this.formatJSON(data);\n const s = this.operationName;\n const json: { [opType: string]: any[] } = {};\n json[s] = data;\n return json;\n }\n /** Capture a (reference to a) child node or nodes */\n public captureChild(child: Clipper | Clipper[]) {\n if (Array.isArray(child)) {\n for (const c of child) this.captureChild(c);\n } else {\n this._clippers.push(child);\n }\n }\n /** Toggle the \"keepInside\" behavior. Return the prior value. */\n public toggleResult(): boolean {\n return this.selectResult(!this._keepInside);\n }\n /** Set the \"keepInside\" behavior */\n public selectResult(keepInside: boolean): boolean {\n const s = this._keepInside;\n this._keepInside = keepInside;\n return s;\n }\n /**\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1).\n * * Return 0 if not called, 1 if called.\n */\n protected testedAnnounceNN(a0: number, a1: number, announce?: AnnounceNumberNumber): number {\n if (a0 < a1) {\n if (announce)\n announce(a0, a1);\n return 1;\n }\n return 0;\n }\n /**\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1, cp).\n * * Return 0 if not called, 1 if called.\n */\n protected testedAnnounceNNC(\n a0: number, a1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\n ): number {\n if (a0 < a1) {\n if (announce)\n announce(a0, a1, cp);\n return 1;\n }\n return 0;\n }\n /** Swap the _intervalsA and _intervalsB */\n protected swapAB(): void {\n const q = this._intervalsA;\n this._intervalsA = this._intervalsB;\n this._intervalsB = q;\n }\n /**\n * Announce all \"outside intervals\" --not masked by intervals\n * * Return true if any intervals announced.\n */\n protected announcePartsNN(\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, announce?: AnnounceNumberNumber,\n ): boolean {\n let numAnnounce = 0;\n if (!keepInside) {\n let lowFraction = f0;\n for (const interval of intervals) {\n numAnnounce += this.testedAnnounceNN(lowFraction, interval.low, announce);\n lowFraction = interval.high;\n }\n numAnnounce += this.testedAnnounceNN(lowFraction, f1, announce);\n } else {\n for (const interval of intervals) {\n // use f0..f1 ?\n numAnnounce += this.testedAnnounceNN(interval.low, interval.high, announce);\n }\n }\n return numAnnounce > 0;\n }\n /**\n * Announce all \"outside intervals\" --not masked by intervals\n * * Return true if any intervals announced.\n */\n protected announcePartsNNC(\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\n ): boolean {\n let numAnnounce = 0;\n if (!keepInside) {\n let lowFraction = f0;\n for (const interval of intervals) {\n numAnnounce += this.testedAnnounceNNC(lowFraction, interval.low, cp, announce);\n lowFraction = interval.high;\n }\n numAnnounce += this.testedAnnounceNNC(lowFraction, f1, cp, announce);\n } else {\n for (const interval of intervals) {\n // use f0..f1 ?\n numAnnounce += this.testedAnnounceNNC(interval.low, interval.high, cp, announce);\n }\n }\n return numAnnounce > 0;\n }\n /** Invoke callback to test if a point is \"in\" this clipper */\n public isPointOnOrInside(point: Point3d): boolean {\n const q = this.isPointOnOrInsideChildren(point);\n return this._keepInside ? q : !q;\n }\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\n ): boolean {\n this._intervalsA.length = 0;\n const announceIntervalB = (a0: number, a1: number) => {\n this._intervalsB.push(Range1d.createXX(a0, a1));\n };\n // Strategy:\n // _intervalsA is the accumulated UNION of from clippers\n // _intervalsB is the current clipper.\n // announceIntervalB appends single new interval to _intervalB\n // at end, output gaps in _intervalsA\n //\n let i = 0;\n for (const c of this._clippers) {\n this._intervalsB.length = 0;\n c.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announceIntervalB);\n Range1dArray.simplifySortUnion(this._intervalsB);\n if (i === 0) {\n this.swapAB();\n } else {\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\n }\n i++;\n }\n return this.announcePartsNN(this._keepInside, this._intervalsA, f0, f1, announce);\n }\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n this._intervalsA.length = 0;\n const announceIntervalB = (a0: number, a1: number) => {\n this._intervalsB.push(Range1d.createXX(a0, a1));\n };\n let i = 0;\n for (const c of this._clippers) {\n this._intervalsB.length = 0;\n c.announceClippedArcIntervals(arc, announceIntervalB);\n Range1dArray.simplifySortUnion(this._intervalsB);\n if (i === 0) {\n this.swapAB();\n } else {\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\n }\n i++;\n }\n return this.announcePartsNNC(this._keepInside, this._intervalsA, 0, 1, arc, announce);\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeUnion extends BooleanClipNode {\n public get operationName(): string { return this._keepInside ? \"OR\" : \"NOR\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return true if inside any child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n for (const clipper of this._clippers) {\n if (clipper.isPointOnOrInside(point))\n return true;\n }\n return false;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.unionSorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n ClipUtilities.doPolygonClipSequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n undefined,\n ClipStepAction.acceptIn,\n ClipStepAction.passToNextStep,\n ClipStepAction.acceptOut,\n arrayCache,\n );\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeParity extends BooleanClipNode {\n public get operationName(): string { return this._keepInside ? \"XOR\" : \"NXOR\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return true if inside an odd number of clippers child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n let q = false;\n for (const clipper of this._clippers) {\n if (clipper.isPointOnOrInside(point))\n q = !q;\n }\n return q;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.paritySorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n ClipUtilities.doPolygonClipParitySequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n arrayCache,\n );\n }\n}\n\n/**\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\n * @internal\n */\nexport class BooleanClipNodeIntersection extends BooleanClipNode implements PolygonClipper {\n public get operationName(): string { return this._keepInside ? \"AND\" : \"NAND\"; }\n public constructor(keepInside: boolean) {\n super(keepInside);\n }\n /** Return false if outside of any child clipper */\n public isPointOnOrInsideChildren(point: Point3d): boolean {\n for (const clipper of this._clippers) {\n if (!clipper.isPointOnOrInside(point))\n return false;\n }\n return true;\n }\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\n return Range1dArray.intersectSorted(operandA, operandB);\n }\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ) {\n\n ClipUtilities.doPolygonClipSequence(\n xyz,\n this._clippers,\n this._keepInside ? insideFragments : outsideFragments,\n this._keepInside ? outsideFragments : insideFragments,\n undefined,\n ClipStepAction.passToNextStep,\n ClipStepAction.acceptOut,\n ClipStepAction.acceptIn,\n arrayCache,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BooleanClipNode.js","sourceRoot":"","sources":["../../../src/clipping/BooleanClipNode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAW/F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAW,cAAc,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAErF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAgB,eAAe;IACzB,SAAS,CAAY;IACrB,WAAW,CAAY;IACvB,WAAW,CAAY;IACvB,WAAW,CAAU;IAE/B,YAAmB,UAAmB;QACpC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAIM,MAAM;QACX,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM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,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,EACrD,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,eAAe;IAC9D,IAAW,aAAa,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,YAAmB,UAAmB;QACpC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpB,CAAC;IACD,mDAAmD;IAC5C,yBAAyB,CAAC,KAAc;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC;gBACnC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACM,gBAAgB,CAAC,QAAmB,EAAE,QAAmB;QAC9D,OAAO,YAAY,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IACM,iBAAiB,CACtB,GAAyB,EACzB,eAAmC,EACnC,gBAAoC,EACpC,UAAiC;QAGjC,aAAa,CAAC,qBAAqB,CACjC,GAAG,EACH,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,EACrD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,EACrD,SAAS,EACT,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,QAAQ,EACvB,UAAU,CACX,CAAC;IACJ,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 CartesianGeometry\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../geometry3d/Range\";\r\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\r\nimport { Range1dArray } from \"../numerics/Range1dArray\";\r\nimport { Clipper, ClipStepAction, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\r\n\r\n/** BooleanClipNode is an abstract base class for boolean actions by an array of clippers.\r\n * * Derived class must implement\r\n * * The single point test `isPointOnOrInsideChildren`\r\n * * Boolean operation on 1d intervals `combineIntervals`\r\n * * The `keepInside` flag controls an additional optional flip of the boolean result.\r\n * * if `keepInside === true`, accept the \"inside\" of the clip clippers\r\n * * if `keepInside === false`, accept the \"outside\" of the child clippers.\r\n * * Hence the combinations of derived classes for (OR, AND, XOR) and keepInside are\r\n * * (OR, true) = simple union (OR), i.e. \"in\" one or more clips\r\n * * (OR, false) = complement of union (NOR), i.e. \"outside\" all clips\r\n * * (AND, true) = simple intersection (AND), i.e. \"in\" all clips\r\n * * (AND, false) = complement of intersection (NAND), i.e. \"outside\" one or more clips\r\n * * (XOR,true) = simple parity, i.e. \"in\" an odd number of clips\r\n * * (XOR,false) = complement of parity ), i.e. \"in\" an even number of clips\r\n * @internal\r\n */\r\nexport abstract class BooleanClipNode implements Clipper {\r\n protected _clippers: Clipper[];\r\n protected _intervalsA: Range1d[];\r\n protected _intervalsB: Range1d[];\r\n protected _keepInside: boolean;\r\n\r\n public constructor(keepInside: boolean) {\r\n this._keepInside = keepInside;\r\n this._clippers = [];\r\n this._intervalsA = [];\r\n this._intervalsB = [];\r\n }\r\n protected abstract isPointOnOrInsideChildren(point: Point3d): boolean;\r\n protected abstract combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[];\r\n public abstract get operationName(): string;\r\n public toJSON(): any {\r\n const data = [];\r\n for (const c of this._clippers) {\r\n const c1 = c as any;\r\n if (c1.toJSON)\r\n data.push(c1.toJSON());\r\n }\r\n // return this.formatJSON(data);\r\n const s = this.operationName;\r\n const json: { [opType: string]: any[] } = {};\r\n json[s] = data;\r\n return json;\r\n }\r\n /** Capture a (reference to a) child node or nodes */\r\n public captureChild(child: Clipper | Clipper[]) {\r\n if (Array.isArray(child)) {\r\n for (const c of child) this.captureChild(c);\r\n } else {\r\n this._clippers.push(child);\r\n }\r\n }\r\n /** Toggle the \"keepInside\" behavior. Return the prior value. */\r\n public toggleResult(): boolean {\r\n return this.selectResult(!this._keepInside);\r\n }\r\n /** Set the \"keepInside\" behavior */\r\n public selectResult(keepInside: boolean): boolean {\r\n const s = this._keepInside;\r\n this._keepInside = keepInside;\r\n return s;\r\n }\r\n /**\r\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1).\r\n * * Return 0 if not called, 1 if called.\r\n */\r\n protected testedAnnounceNN(a0: number, a1: number, announce?: AnnounceNumberNumber): number {\r\n if (a0 < a1) {\r\n if (announce)\r\n announce(a0, a1);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n /**\r\n * Conditionally (if a1 > a0 strictly) call announce (a0, a1, cp).\r\n * * Return 0 if not called, 1 if called.\r\n */\r\n protected testedAnnounceNNC(\r\n a0: number, a1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): number {\r\n if (a0 < a1) {\r\n if (announce)\r\n announce(a0, a1, cp);\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n /** Swap the _intervalsA and _intervalsB */\r\n protected swapAB(): void {\r\n const q = this._intervalsA;\r\n this._intervalsA = this._intervalsB;\r\n this._intervalsB = q;\r\n }\r\n /**\r\n * Announce all \"outside intervals\" --not masked by intervals\r\n * * Return true if any intervals announced.\r\n */\r\n protected announcePartsNN(\r\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n let numAnnounce = 0;\r\n if (!keepInside) {\r\n let lowFraction = f0;\r\n for (const interval of intervals) {\r\n numAnnounce += this.testedAnnounceNN(lowFraction, interval.low, announce);\r\n lowFraction = interval.high;\r\n }\r\n numAnnounce += this.testedAnnounceNN(lowFraction, f1, announce);\r\n } else {\r\n for (const interval of intervals) {\r\n // use f0..f1 ?\r\n numAnnounce += this.testedAnnounceNN(interval.low, interval.high, announce);\r\n }\r\n }\r\n return numAnnounce > 0;\r\n }\r\n /**\r\n * Announce all \"outside intervals\" --not masked by intervals\r\n * * Return true if any intervals announced.\r\n */\r\n protected announcePartsNNC(\r\n keepInside: boolean, intervals: Range1d[], f0: number, f1: number, cp: CurvePrimitive, announce?: AnnounceNumberNumberCurvePrimitive,\r\n ): boolean {\r\n let numAnnounce = 0;\r\n if (!keepInside) {\r\n let lowFraction = f0;\r\n for (const interval of intervals) {\r\n numAnnounce += this.testedAnnounceNNC(lowFraction, interval.low, cp, announce);\r\n lowFraction = interval.high;\r\n }\r\n numAnnounce += this.testedAnnounceNNC(lowFraction, f1, cp, announce);\r\n } else {\r\n for (const interval of intervals) {\r\n // use f0..f1 ?\r\n numAnnounce += this.testedAnnounceNNC(interval.low, interval.high, cp, announce);\r\n }\r\n }\r\n return numAnnounce > 0;\r\n }\r\n /** Invoke callback to test if a point is \"in\" this clipper */\r\n public isPointOnOrInside(point: Point3d): boolean {\r\n const q = this.isPointOnOrInsideChildren(point);\r\n return this._keepInside ? q : !q;\r\n }\r\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this._intervalsA.length = 0;\r\n const announceIntervalB = (a0: number, a1: number) => {\r\n this._intervalsB.push(Range1d.createXX(a0, a1));\r\n };\r\n // Strategy:\r\n // _intervalsA is the accumulated UNION of from clippers\r\n // _intervalsB is the current clipper.\r\n // announceIntervalB appends single new interval to _intervalB\r\n // at end, output gaps in _intervalsA\r\n //\r\n let i = 0;\r\n for (const c of this._clippers) {\r\n this._intervalsB.length = 0;\r\n c.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announceIntervalB);\r\n Range1dArray.simplifySortUnion(this._intervalsB);\r\n if (i === 0) {\r\n this.swapAB();\r\n } else {\r\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\r\n }\r\n i++;\r\n }\r\n return this.announcePartsNN(this._keepInside, this._intervalsA, f0, f1, announce);\r\n }\r\n /** Announce \"in\" portions of a line segment. See `Clipper.announceClippedSegmentIntervals` */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this._intervalsA.length = 0;\r\n const announceIntervalB = (a0: number, a1: number) => {\r\n this._intervalsB.push(Range1d.createXX(a0, a1));\r\n };\r\n let i = 0;\r\n for (const c of this._clippers) {\r\n this._intervalsB.length = 0;\r\n c.announceClippedArcIntervals(arc, announceIntervalB);\r\n Range1dArray.simplifySortUnion(this._intervalsB);\r\n if (i === 0) {\r\n this.swapAB();\r\n } else {\r\n this._intervalsA = this.combineIntervals(this._intervalsA, this._intervalsB);\r\n }\r\n i++;\r\n }\r\n return this.announcePartsNNC(this._keepInside, this._intervalsA, 0, 1, arc, announce);\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeUnion extends BooleanClipNode {\r\n public get operationName(): string { return this._keepInside ? \"OR\" : \"NOR\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return true if inside any child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n for (const clipper of this._clippers) {\r\n if (clipper.isPointOnOrInside(point))\r\n return true;\r\n }\r\n return false;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.unionSorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n ClipUtilities.doPolygonClipSequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n undefined,\r\n ClipStepAction.acceptIn,\r\n ClipStepAction.passToNextStep,\r\n ClipStepAction.acceptOut,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeParity extends BooleanClipNode {\r\n public get operationName(): string { return this._keepInside ? \"XOR\" : \"NXOR\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return true if inside an odd number of clippers child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n let q = false;\r\n for (const clipper of this._clippers) {\r\n if (clipper.isPointOnOrInside(point))\r\n q = !q;\r\n }\r\n return q;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.paritySorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n ClipUtilities.doPolygonClipParitySequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Implement [BooleanClipNode] virtual methods for intersection (boolean OR) among children\r\n * @internal\r\n */\r\nexport class BooleanClipNodeIntersection extends BooleanClipNode implements PolygonClipper {\r\n public get operationName(): string { return this._keepInside ? \"AND\" : \"NAND\"; }\r\n public constructor(keepInside: boolean) {\r\n super(keepInside);\r\n }\r\n /** Return false if outside of any child clipper */\r\n public isPointOnOrInsideChildren(point: Point3d): boolean {\r\n for (const clipper of this._clippers) {\r\n if (!clipper.isPointOnOrInside(point))\r\n return false;\r\n }\r\n return true;\r\n }\r\n public combineIntervals(operandA: Range1d[], operandB: Range1d[]): Range1d[] {\r\n return Range1dArray.intersectSorted(operandA, operandB);\r\n }\r\n public appendPolygonClip(\r\n xyz: IndexedXYZCollection,\r\n insideFragments: GrowableXYZArray[],\r\n outsideFragments: GrowableXYZArray[],\r\n arrayCache: GrowableXYZArrayCache,\r\n ) {\r\n\r\n ClipUtilities.doPolygonClipSequence(\r\n xyz,\r\n this._clippers,\r\n this._keepInside ? insideFragments : outsideFragments,\r\n this._keepInside ? outsideFragments : insideFragments,\r\n undefined,\r\n ClipStepAction.passToNextStep,\r\n ClipStepAction.acceptOut,\r\n ClipStepAction.acceptIn,\r\n arrayCache,\r\n );\r\n }\r\n}\r\n"]}
|