@itwin/core-geometry 3.5.0-dev.8 → 3.6.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -1
- package/lib/cjs/Geometry.d.ts +26 -10
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +32 -17
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +11 -5
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +47 -18
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +12 -4
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +4 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +3 -0
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +10 -4
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +17 -5
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +15 -7
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +46 -29
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +13 -4
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +23 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +4 -3
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js +8 -6
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +20 -18
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +58 -339
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +9 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +18 -2
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +39 -23
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +4 -0
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +5 -0
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +17 -3
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +9 -6
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +55 -47
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +66 -42
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +201 -99
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +102 -60
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +191 -106
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +67 -15
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +1 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +86 -25
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +230 -81
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +14 -4
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +15 -5
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +121 -67
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +318 -137
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +1 -2
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +1 -2
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +5 -5
- package/lib/cjs/geometry3d/Ray3d.js +5 -5
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +0 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +4 -4
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +3 -3
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +7 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +8 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +36 -8
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +112 -31
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -1
- package/lib/cjs/solid/Sphere.js +3 -3
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +17 -13
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +67 -38
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +1 -1
- package/lib/cjs/topology/Graph.js +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +9 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +26 -10
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +32 -17
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +11 -5
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +47 -18
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +12 -4
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +4 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +3 -0
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +10 -4
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +17 -5
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +15 -7
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +46 -29
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +13 -4
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +23 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +4 -3
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js +8 -6
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +20 -18
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +52 -333
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +8 -2
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +9 -0
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +18 -2
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +39 -23
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +9 -7
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +4 -0
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +5 -0
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +17 -3
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +9 -6
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +56 -48
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +66 -42
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +201 -99
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +102 -60
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +191 -106
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +67 -15
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +1 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +86 -25
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +230 -81
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +14 -4
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +15 -5
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +121 -67
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +318 -137
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +1 -2
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +1 -2
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +5 -5
- package/lib/esm/geometry3d/Ray3d.js +5 -5
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +0 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +4 -4
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +3 -3
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +7 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +8 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +36 -8
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +113 -32
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +4 -3
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -1
- package/lib/esm/solid/Sphere.js +3 -3
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +17 -13
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +67 -38
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +1 -1
- package/lib/esm/topology/Graph.js +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +9 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Curve
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AppendPlaneIntersectionStrokeHandler = void 0;
|
|
11
|
+
const Geometry_1 = require("../../Geometry");
|
|
12
|
+
const Ray3d_1 = require("../../geometry3d/Ray3d");
|
|
13
|
+
const BezierPolynomials_1 = require("../../numerics/BezierPolynomials");
|
|
14
|
+
const Newton_1 = require("../../numerics/Newton");
|
|
15
|
+
const CurveLocationDetail_1 = require("../CurveLocationDetail");
|
|
16
|
+
const NewtonRtoRStrokeHandler_1 = require("./NewtonRtoRStrokeHandler");
|
|
17
|
+
/**
|
|
18
|
+
* Context for computing intersections of a CurvePrimitive with a plane.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStrokeHandler {
|
|
22
|
+
constructor(plane, intersections) {
|
|
23
|
+
super();
|
|
24
|
+
this._fractionA = 0;
|
|
25
|
+
this._functionA = 0;
|
|
26
|
+
// private derivativeA: number; <---- Not currently used
|
|
27
|
+
this._functionB = 0;
|
|
28
|
+
this._fractionB = 0;
|
|
29
|
+
this._derivativeB = 0;
|
|
30
|
+
this._numThisCurve = 0;
|
|
31
|
+
this._plane = plane;
|
|
32
|
+
this._intersections = intersections;
|
|
33
|
+
this.startCurvePrimitive(undefined);
|
|
34
|
+
this._ray = Ray3d_1.Ray3d.createZero();
|
|
35
|
+
this._newtonSolver = new Newton_1.Newton1dUnboundedApproximateDerivative(this);
|
|
36
|
+
}
|
|
37
|
+
// Return the first defined curve among: this.parentCurvePrimitive, this.curve;
|
|
38
|
+
effectiveCurve() {
|
|
39
|
+
if (this._parentCurvePrimitive)
|
|
40
|
+
return this._parentCurvePrimitive;
|
|
41
|
+
return this._curve;
|
|
42
|
+
}
|
|
43
|
+
get getDerivativeB() {
|
|
44
|
+
return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error
|
|
45
|
+
}
|
|
46
|
+
startCurvePrimitive(curve) {
|
|
47
|
+
this._curve = curve;
|
|
48
|
+
this._fractionA = 0.0;
|
|
49
|
+
this._numThisCurve = 0;
|
|
50
|
+
this._functionA = 0.0;
|
|
51
|
+
// this.derivativeA = 0.0;
|
|
52
|
+
}
|
|
53
|
+
endCurvePrimitive() {
|
|
54
|
+
}
|
|
55
|
+
announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
|
|
56
|
+
this.startCurvePrimitive(cp);
|
|
57
|
+
if (numStrokes < 1)
|
|
58
|
+
numStrokes = 1;
|
|
59
|
+
const df = 1.0 / numStrokes;
|
|
60
|
+
for (let i = 0; i <= numStrokes; i++) {
|
|
61
|
+
const fraction = Geometry_1.Geometry.interpolate(fraction0, i * df, fraction1);
|
|
62
|
+
cp.fractionToPointAndDerivative(fraction, this._ray);
|
|
63
|
+
this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
|
|
67
|
+
const h0 = this._plane.altitude(point0);
|
|
68
|
+
const h1 = this._plane.altitude(point1);
|
|
69
|
+
if (h0 * h1 > 0.0)
|
|
70
|
+
return;
|
|
71
|
+
const fraction01 = BezierPolynomials_1.Order2Bezier.solveCoffs(h0, h1);
|
|
72
|
+
// let numIntersection = 0;
|
|
73
|
+
if (fraction01 !== undefined) {
|
|
74
|
+
// numIntersection++;
|
|
75
|
+
const fraction = Geometry_1.Geometry.interpolate(fraction0, fraction01, fraction1);
|
|
76
|
+
this._newtonSolver.setX(fraction);
|
|
77
|
+
if (this._newtonSolver.runIterations()) {
|
|
78
|
+
this.announceSolutionFraction(this._newtonSolver.getX());
|
|
79
|
+
}
|
|
80
|
+
// this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
announceSolutionFraction(fraction) {
|
|
84
|
+
const curve = this.effectiveCurve();
|
|
85
|
+
if (curve) {
|
|
86
|
+
this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
|
|
87
|
+
this._intersections.push(CurveLocationDetail_1.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
evaluate(fraction) {
|
|
91
|
+
const curve = this.effectiveCurve();
|
|
92
|
+
if (!curve)
|
|
93
|
+
return false;
|
|
94
|
+
this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
|
|
99
|
+
* * If function value changed sign between, interpolate an approximate root and improve it with
|
|
100
|
+
* the newton solver.
|
|
101
|
+
*/
|
|
102
|
+
searchInterval() {
|
|
103
|
+
if (this._functionA * this._functionB > 0)
|
|
104
|
+
return;
|
|
105
|
+
if (this._functionA === 0)
|
|
106
|
+
this.announceSolutionFraction(this._fractionA);
|
|
107
|
+
if (this._functionB === 0)
|
|
108
|
+
this.announceSolutionFraction(this._fractionB);
|
|
109
|
+
if (this._functionA * this._functionB < 0) {
|
|
110
|
+
const fraction = Geometry_1.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
|
|
111
|
+
if (fraction) {
|
|
112
|
+
this._newtonSolver.setX(fraction);
|
|
113
|
+
if (this._newtonSolver.runIterations())
|
|
114
|
+
this.announceSolutionFraction(this._newtonSolver.getX());
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** Evaluate and save _functionB, _derivativeB, and _fractionB. */
|
|
119
|
+
evaluateB(xyz, fraction, tangent) {
|
|
120
|
+
this._functionB = this._plane.altitude(xyz);
|
|
121
|
+
this._derivativeB = this._plane.velocity(tangent);
|
|
122
|
+
this._fractionB = fraction;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Announce point and tangent for evaluations.
|
|
126
|
+
* * The function evaluation is saved as the "B" function point.
|
|
127
|
+
* * The function point count is incremented
|
|
128
|
+
* * If function point count is greater than 1, the current interval is searched.
|
|
129
|
+
* * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
|
|
130
|
+
* @param xyz
|
|
131
|
+
* @param fraction
|
|
132
|
+
* @param tangent
|
|
133
|
+
*/
|
|
134
|
+
announcePointTangent(xyz, fraction, tangent) {
|
|
135
|
+
this.evaluateB(xyz, fraction, tangent);
|
|
136
|
+
if (this._numThisCurve++ > 0)
|
|
137
|
+
this.searchInterval();
|
|
138
|
+
this._functionA = this._functionB;
|
|
139
|
+
this._fractionA = this._fractionB;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.AppendPlaneIntersectionStrokeHandler = AppendPlaneIntersectionStrokeHandler;
|
|
143
|
+
//# sourceMappingURL=AppendPlaneIntersectionStrokeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppendPlaneIntersectionStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAAkE;AAGlE,kDAA+C;AAC/C,wEAAgE;AAChE,kDAA+E;AAC/E,gEAA6D;AAE7D,uEAAoE;AAEpE;;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Z,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;oBACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5D;SACF;IACH,CAAC;IAED,kEAAkE;IAC1D,SAAS,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;OASG;IACI,oBAAoB,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QAC3E,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;CACF;AA/ID,oFA+IC","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\n\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Order2Bezier } from \"../../numerics/BezierPolynomials\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for computing intersections of a CurvePrimitive with a plane.\r\n * @internal\r\n */\r\nexport class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _plane: PlaneAltitudeEvaluator;\r\n private _intersections: CurveLocationDetail[];\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // private derivativeA: number; <---- Not currently used\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _derivativeB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _ray: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\r\n public effectiveCurve(): CurvePrimitive | undefined {\r\n if (this._parentCurvePrimitive)\r\n return this._parentCurvePrimitive;\r\n return this._curve;\r\n }\r\n\r\n public get getDerivativeB() {\r\n return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error\r\n }\r\n\r\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\r\n super();\r\n this._plane = plane;\r\n this._intersections = intersections;\r\n this.startCurvePrimitive(undefined);\r\n this._ray = Ray3d.createZero();\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n // this.derivativeA = 0.0;\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._ray);\r\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\r\n }\r\n }\r\n\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const h0 = this._plane.altitude(point0);\r\n const h1 = this._plane.altitude(point1);\r\n if (h0 * h1 > 0.0)\r\n return;\r\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\r\n // let numIntersection = 0;\r\n if (fraction01 !== undefined) {\r\n // numIntersection++;\r\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations()) {\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\r\n }\r\n }\r\n\r\n private announceSolutionFraction(fraction: number) {\r\n const curve = this.effectiveCurve();\r\n if (curve) {\r\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\r\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\r\n }\r\n }\r\n\r\n public evaluate(fraction: number): boolean {\r\n const curve = this.effectiveCurve();\r\n if (!curve)\r\n return false;\r\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\r\n return true;\r\n }\r\n\r\n /**\r\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\r\n * * If function value changed sign between, interpolate an approximate root and improve it with\r\n * the newton solver.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n\r\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\r\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\r\n this._functionB = this._plane.altitude(xyz);\r\n this._derivativeB = this._plane.velocity(tangent);\r\n this._fractionB = fraction;\r\n }\r\n\r\n /**\r\n * Announce point and tangent for evaluations.\r\n * * The function evaluation is saved as the \"B\" function point.\r\n * * The function point count is incremented\r\n * * If function point count is greater than 1, the current interval is searched.\r\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\r\n * @param xyz\r\n * @param fraction\r\n * @param tangent\r\n */\r\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\r\n this.evaluateB(xyz, fraction, tangent);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Curve
|
|
3
|
+
*/
|
|
4
|
+
import { IStrokeHandler } from "../../geometry3d/GeometryHandler";
|
|
5
|
+
import { Point3d, Vector3d } from "../../geometry3d/Point3dVector3d";
|
|
6
|
+
import { Ray3d } from "../../geometry3d/Ray3d";
|
|
7
|
+
import { VariantCurveExtendParameter } from "../CurveExtendMode";
|
|
8
|
+
import { CurveLocationDetail } from "../CurveLocationDetail";
|
|
9
|
+
import { CurvePrimitive } from "../CurvePrimitive";
|
|
10
|
+
import { NewtonRtoRStrokeHandler } from "./NewtonRtoRStrokeHandler";
|
|
11
|
+
/**
|
|
12
|
+
* Context for searching for the closest point to a CurvePrimitive.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {
|
|
16
|
+
private _curve;
|
|
17
|
+
private _closestPoint;
|
|
18
|
+
private _spacePoint;
|
|
19
|
+
private _extend;
|
|
20
|
+
private _fractionA;
|
|
21
|
+
private _functionA;
|
|
22
|
+
private _functionB;
|
|
23
|
+
private _fractionB;
|
|
24
|
+
private _numThisCurve;
|
|
25
|
+
private _workPoint;
|
|
26
|
+
private _workRay;
|
|
27
|
+
private _newtonSolver;
|
|
28
|
+
constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter);
|
|
29
|
+
claimResult(): CurveLocationDetail | undefined;
|
|
30
|
+
needPrimaryGeometryForStrokes(): boolean;
|
|
31
|
+
startCurvePrimitive(curve: CurvePrimitive | undefined): void;
|
|
32
|
+
endCurvePrimitive(): void;
|
|
33
|
+
announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void;
|
|
34
|
+
private announceCandidate;
|
|
35
|
+
announceSegmentInterval(cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void;
|
|
36
|
+
private searchInterval;
|
|
37
|
+
private evaluateB;
|
|
38
|
+
private announceSolutionFraction;
|
|
39
|
+
evaluate(fraction: number): boolean;
|
|
40
|
+
announceRay(fraction: number, data: Ray3d): void;
|
|
41
|
+
announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ClosestPointStrokeHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClosestPointStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/Clos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AAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAgBrJ,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,wBAAwB;IAKzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAYnC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;IAOhD,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;CAIhF"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Curve
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ClosestPointStrokeHandler = void 0;
|
|
11
|
+
const Geometry_1 = require("../../Geometry");
|
|
12
|
+
const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
|
|
13
|
+
const Ray3d_1 = require("../../geometry3d/Ray3d");
|
|
14
|
+
const Newton_1 = require("../../numerics/Newton");
|
|
15
|
+
const CurveExtendMode_1 = require("../CurveExtendMode");
|
|
16
|
+
const CurveLocationDetail_1 = require("../CurveLocationDetail");
|
|
17
|
+
const NewtonRtoRStrokeHandler_1 = require("./NewtonRtoRStrokeHandler");
|
|
18
|
+
/**
|
|
19
|
+
* Context for searching for the closest point to a CurvePrimitive.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStrokeHandler {
|
|
23
|
+
constructor(spacePoint, extend) {
|
|
24
|
+
super();
|
|
25
|
+
this._fractionA = 0;
|
|
26
|
+
this._functionA = 0;
|
|
27
|
+
this._functionB = 0;
|
|
28
|
+
this._fractionB = 0;
|
|
29
|
+
this._numThisCurve = 0;
|
|
30
|
+
this._spacePoint = spacePoint;
|
|
31
|
+
this._workPoint = Point3dVector3d_1.Point3d.create();
|
|
32
|
+
this._workRay = Ray3d_1.Ray3d.createZero();
|
|
33
|
+
this._closestPoint = undefined;
|
|
34
|
+
this._extend = extend;
|
|
35
|
+
this.startCurvePrimitive(undefined);
|
|
36
|
+
this._newtonSolver = new Newton_1.Newton1dUnboundedApproximateDerivative(this);
|
|
37
|
+
}
|
|
38
|
+
claimResult() {
|
|
39
|
+
if (this._closestPoint) {
|
|
40
|
+
this._newtonSolver.setX(this._closestPoint.fraction);
|
|
41
|
+
this._curve = this._closestPoint.curve;
|
|
42
|
+
if (this._newtonSolver.runIterations()) {
|
|
43
|
+
let fraction = this._newtonSolver.getX();
|
|
44
|
+
fraction = CurveExtendMode_1.CurveExtendOptions.correctFraction(this._extend, fraction);
|
|
45
|
+
this.announceSolutionFraction(fraction);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return this._closestPoint;
|
|
49
|
+
}
|
|
50
|
+
needPrimaryGeometryForStrokes() {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
startCurvePrimitive(curve) {
|
|
54
|
+
this._curve = curve;
|
|
55
|
+
this._fractionA = 0.0;
|
|
56
|
+
this._numThisCurve = 0;
|
|
57
|
+
this._functionA = 0.0;
|
|
58
|
+
}
|
|
59
|
+
endCurvePrimitive() {
|
|
60
|
+
}
|
|
61
|
+
announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
|
|
62
|
+
this.startCurvePrimitive(cp);
|
|
63
|
+
this.announceSolutionFraction(0.0); // test start point as closest
|
|
64
|
+
this.announceSolutionFraction(1.0); // test end point as closest
|
|
65
|
+
if (numStrokes < 1)
|
|
66
|
+
numStrokes = 1;
|
|
67
|
+
const df = 1.0 / numStrokes;
|
|
68
|
+
for (let i = 0; i <= numStrokes; i++) {
|
|
69
|
+
const fraction = Geometry_1.Geometry.interpolate(fraction0, i * df, fraction1);
|
|
70
|
+
cp.fractionToPointAndDerivative(fraction, this._workRay);
|
|
71
|
+
this.announceRay(fraction, this._workRay);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
announceCandidate(cp, fraction, point) {
|
|
75
|
+
const distance = this._spacePoint.distance(point);
|
|
76
|
+
if (this._closestPoint && distance > this._closestPoint.a)
|
|
77
|
+
return;
|
|
78
|
+
this._closestPoint = CurveLocationDetail_1.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
|
|
79
|
+
this._closestPoint.a = distance;
|
|
80
|
+
if (this._parentCurvePrimitive !== undefined)
|
|
81
|
+
this._closestPoint.curve = this._parentCurvePrimitive;
|
|
82
|
+
}
|
|
83
|
+
announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
|
|
84
|
+
let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
|
|
85
|
+
// only consider extending the segment if the immediate caller says we are at endpoints ...
|
|
86
|
+
if (!this._extend)
|
|
87
|
+
localFraction = Geometry_1.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
|
|
88
|
+
else {
|
|
89
|
+
if (fraction0 !== 0.0)
|
|
90
|
+
localFraction = Math.max(localFraction, 0.0);
|
|
91
|
+
if (fraction1 !== 1.0)
|
|
92
|
+
localFraction = Math.min(localFraction, 1.0);
|
|
93
|
+
}
|
|
94
|
+
this._workPoint = point0.interpolate(localFraction, point1);
|
|
95
|
+
const globalFraction = Geometry_1.Geometry.interpolate(fraction0, localFraction, fraction1);
|
|
96
|
+
this.announceCandidate(cp, globalFraction, this._workPoint);
|
|
97
|
+
}
|
|
98
|
+
searchInterval() {
|
|
99
|
+
if (this._functionA * this._functionB > 0)
|
|
100
|
+
return;
|
|
101
|
+
if (this._functionA === 0)
|
|
102
|
+
this.announceSolutionFraction(this._fractionA);
|
|
103
|
+
if (this._functionB === 0)
|
|
104
|
+
this.announceSolutionFraction(this._fractionB);
|
|
105
|
+
if (this._functionA * this._functionB < 0) {
|
|
106
|
+
const fraction = Geometry_1.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
|
|
107
|
+
if (fraction) {
|
|
108
|
+
this._newtonSolver.setX(fraction);
|
|
109
|
+
if (this._newtonSolver.runIterations())
|
|
110
|
+
this.announceSolutionFraction(this._newtonSolver.getX());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
evaluateB(fractionB, dataB) {
|
|
115
|
+
this._functionB = dataB.dotProductToPoint(this._spacePoint);
|
|
116
|
+
this._fractionB = fractionB;
|
|
117
|
+
}
|
|
118
|
+
announceSolutionFraction(fraction) {
|
|
119
|
+
if (this._curve)
|
|
120
|
+
this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
|
|
121
|
+
}
|
|
122
|
+
evaluate(fraction) {
|
|
123
|
+
let curve = this._curve;
|
|
124
|
+
if (this._parentCurvePrimitive)
|
|
125
|
+
curve = this._parentCurvePrimitive;
|
|
126
|
+
if (curve) {
|
|
127
|
+
this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
|
|
128
|
+
this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
announceRay(fraction, data) {
|
|
134
|
+
this.evaluateB(fraction, data);
|
|
135
|
+
if (this._numThisCurve++ > 0)
|
|
136
|
+
this.searchInterval();
|
|
137
|
+
this._functionA = this._functionB;
|
|
138
|
+
this._fractionA = this._fractionB;
|
|
139
|
+
}
|
|
140
|
+
announcePointTangent(point, fraction, tangent) {
|
|
141
|
+
this._workRay.set(point, tangent);
|
|
142
|
+
this.announceRay(fraction, this._workRay);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.ClosestPointStrokeHandler = ClosestPointStrokeHandler;
|
|
146
|
+
//# sourceMappingURL=ClosestPointStrokeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAA+E;AAC/E,wDAAqF;AACrF,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iDAAuB;IAepE,YAAmB,UAAmB,EAAE,MAAmC;QACzE,KAAK,EAAE,CAAC;QAXF,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,kBAAa,GAAW,CAAC,CAAC;QAQhC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,+CAAsC,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC;IAEM,WAAW;QAChB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACrD,IAA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* 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\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = undefined;\r\n this._extend = extend;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n\r\n public announceSegmentInterval(cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints ...\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n\r\n private evaluateB(fractionB: number, dataB: Ray3d) {\r\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\r\n this._fractionB = fractionB;\r\n }\r\n\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n if (curve) {\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public announceRay(fraction: number, data: Ray3d): void {\r\n this.evaluateB(fraction, data);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Curve
|
|
3
|
+
*/
|
|
4
|
+
import { IStrokeHandler } from "../../geometry3d/GeometryHandler";
|
|
5
|
+
import { Point3d, Vector3d } from "../../geometry3d/Point3dVector3d";
|
|
6
|
+
import { CurvePrimitive } from "../CurvePrimitive";
|
|
7
|
+
/**
|
|
8
|
+
* Context for computing the length of a CurvePrimitive.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class CurveLengthContext implements IStrokeHandler {
|
|
12
|
+
private _curve;
|
|
13
|
+
private _summedLength;
|
|
14
|
+
private _ray;
|
|
15
|
+
private _fraction0;
|
|
16
|
+
private _fraction1;
|
|
17
|
+
private _gaussMapper;
|
|
18
|
+
private tangentMagnitude;
|
|
19
|
+
/** Return the fraction0 installed at construction time. */
|
|
20
|
+
get getFraction0(): number;
|
|
21
|
+
/** Return the fraction1 installed at construction time. */
|
|
22
|
+
get getFraction1(): number;
|
|
23
|
+
getSum(): number;
|
|
24
|
+
constructor(fraction0?: number, fraction1?: number, numGaussPoints?: number);
|
|
25
|
+
startCurvePrimitive(curve: CurvePrimitive | undefined): void;
|
|
26
|
+
startParentCurvePrimitive(_curve: CurvePrimitive): void;
|
|
27
|
+
endParentCurvePrimitive(_curve: CurvePrimitive): void;
|
|
28
|
+
endCurvePrimitive(): void;
|
|
29
|
+
announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void;
|
|
30
|
+
announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void;
|
|
31
|
+
announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=CurveLengthContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurveLengthContext.d.ts","sourceR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AAI;CAGxF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Curve
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CurveLengthContext = void 0;
|
|
11
|
+
const Range_1 = require("../../geometry3d/Range");
|
|
12
|
+
const Ray3d_1 = require("../../geometry3d/Ray3d");
|
|
13
|
+
const Quadrature_1 = require("../../numerics/Quadrature");
|
|
14
|
+
/**
|
|
15
|
+
* Context for computing the length of a CurvePrimitive.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
class CurveLengthContext {
|
|
19
|
+
constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
|
|
20
|
+
this.startCurvePrimitive(undefined);
|
|
21
|
+
this._summedLength = 0.0;
|
|
22
|
+
this._ray = Ray3d_1.Ray3d.createZero();
|
|
23
|
+
if (fraction0 < fraction1) {
|
|
24
|
+
this._fraction0 = fraction0;
|
|
25
|
+
this._fraction1 = fraction1;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this._fraction0 = fraction1;
|
|
29
|
+
this._fraction1 = fraction0;
|
|
30
|
+
}
|
|
31
|
+
this._gaussMapper = new Quadrature_1.GaussMapper(numGaussPoints);
|
|
32
|
+
}
|
|
33
|
+
tangentMagnitude(fraction) {
|
|
34
|
+
this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
|
|
35
|
+
return this._ray.direction.magnitude();
|
|
36
|
+
}
|
|
37
|
+
/** Return the fraction0 installed at construction time. */
|
|
38
|
+
get getFraction0() {
|
|
39
|
+
return this._fraction0;
|
|
40
|
+
}
|
|
41
|
+
/** Return the fraction1 installed at construction time. */
|
|
42
|
+
get getFraction1() {
|
|
43
|
+
return this._fraction1;
|
|
44
|
+
}
|
|
45
|
+
getSum() {
|
|
46
|
+
return this._summedLength;
|
|
47
|
+
}
|
|
48
|
+
startCurvePrimitive(curve) {
|
|
49
|
+
this._curve = curve;
|
|
50
|
+
}
|
|
51
|
+
startParentCurvePrimitive(_curve) {
|
|
52
|
+
}
|
|
53
|
+
endParentCurvePrimitive(_curve) {
|
|
54
|
+
}
|
|
55
|
+
endCurvePrimitive() {
|
|
56
|
+
}
|
|
57
|
+
announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
|
|
58
|
+
const range = Range_1.Range1d.createXX(fraction0, fraction1);
|
|
59
|
+
range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
|
|
60
|
+
if (!range.isNull) {
|
|
61
|
+
this.startCurvePrimitive(cp);
|
|
62
|
+
if (numStrokes < 1)
|
|
63
|
+
numStrokes = 1;
|
|
64
|
+
const df = 1.0 / numStrokes;
|
|
65
|
+
for (let i = 1; i <= numStrokes; i++) {
|
|
66
|
+
const fractionA = range.fractionToPoint((i - 1) * df);
|
|
67
|
+
const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);
|
|
68
|
+
const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
|
|
69
|
+
for (let k = 0; k < numGauss; k++) {
|
|
70
|
+
this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
|
|
76
|
+
const segmentLength = point0.distance(point1);
|
|
77
|
+
if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
|
|
78
|
+
this._summedLength += segmentLength;
|
|
79
|
+
else {
|
|
80
|
+
const range = Range_1.Range1d.createXX(fraction0, fraction1);
|
|
81
|
+
range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
|
|
82
|
+
if (!range.isNull)
|
|
83
|
+
this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
announcePointTangent(_xyz, _fraction, _tangent) {
|
|
87
|
+
// uh oh -- need to retain point for next interval
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.CurveLengthContext = CurveLengthContext;
|
|
91
|
+
//# sourceMappingURL=CurveLengthContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurveLengthContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveLengthContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,kDAAiD;AACjD,kDAA+C;AAC/C,0DAAwD;AAGxD;;;GAGG;AACH,MAAa,kBAAkB;IA2B7B,YAAmB,YAAoB,GAAG,EAAE,YAAoB,GAAG,EAAE,iBAAyB,CAAC;QAC7F,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,SAAS,GAAG,SAAS,EAAE;YACzB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,wBAAW,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IA/BO,gBAAgB,CAAC,QAAgB;QACvC,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC,MAAyB,CAAC,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAA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C,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;gBAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;oBACjC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxG;aACF;SACF;IACH,CAAC;IAEM,uBAAuB,CAAC,GAAmB,EAAE,MAAe,EAAE,MAAe,EAAE,WAAmB,EAAE,SAAiB,EAAE,SAAiB;QAC7I,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,IAAI,CAAC,UAAU,IAAI,SAAS,IAAI,SAAS,IAAI,IAAI,CAAC,UAAU;YAC9D,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC;aACjC;YACH,MAAM,KAAK,GAAG,eAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACrD,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,MAAM;gBACf,IAAI,CAAC,aAAa,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;SAClF;IACH,CAAC;IAEM,oBAAoB,CAAC,IAAa,EAAE,SAAiB,EAAE,QAAkB;QAC9E,kDAAkD;IACpD,CAAC;CACF;AAxFD,gDAwFC","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\n\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { GaussMapper } from \"../../numerics/Quadrature\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\n/**\r\n * Context for computing the length of a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class CurveLengthContext implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _summedLength: number;\r\n private _ray: Ray3d;\r\n private _fraction0: number;\r\n private _fraction1: number;\r\n private _gaussMapper: GaussMapper;\r\n\r\n private tangentMagnitude(fraction: number): number {\r\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\r\n return this._ray.direction.magnitude();\r\n }\r\n\r\n /** Return the fraction0 installed at construction time. */\r\n public get getFraction0(): number {\r\n return this._fraction0;\r\n }\r\n\r\n /** Return the fraction1 installed at construction time. */\r\n public get getFraction1(): number {\r\n return this._fraction1;\r\n }\r\n\r\n public getSum() {\r\n return this._summedLength;\r\n }\r\n\r\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\r\n this.startCurvePrimitive(undefined);\r\n this._summedLength = 0.0;\r\n this._ray = Ray3d.createZero();\r\n if (fraction0 < fraction1) {\r\n this._fraction0 = fraction0;\r\n this._fraction1 = fraction1;\r\n } else {\r\n this._fraction0 = fraction1;\r\n this._fraction1 = fraction0;\r\n }\r\n this._gaussMapper = new GaussMapper(numGaussPoints);\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n }\r\n\r\n public startParentCurvePrimitive(_curve: CurvePrimitive) {\r\n }\r\n\r\n public endParentCurvePrimitive(_curve: CurvePrimitive) {\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n const range = Range1d.createXX(fraction0, fraction1);\r\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\r\n if (!range.isNull) {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 1; i <= numStrokes; i++) {\r\n const fractionA = range.fractionToPoint((i - 1) * df);\r\n const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);\r\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\r\n for (let k = 0; k < numGauss; k++) {\r\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\r\n const segmentLength = point0.distance(point1);\r\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\r\n this._summedLength += segmentLength;\r\n else {\r\n const range = Range1d.createXX(fraction0, fraction1);\r\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\r\n if (!range.isNull)\r\n this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);\r\n }\r\n }\r\n\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\r\n // uh oh -- need to retain point for next interval\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Curve
|
|
3
|
+
*/
|
|
4
|
+
import { NewtonEvaluatorRtoR } from "../../numerics/Newton";
|
|
5
|
+
import { CurvePrimitive } from "../CurvePrimitive";
|
|
6
|
+
/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class NewtonRtoRStrokeHandler extends NewtonEvaluatorRtoR {
|
|
10
|
+
protected _parentCurvePrimitive: CurvePrimitive | undefined;
|
|
11
|
+
constructor();
|
|
12
|
+
/** retain the parentCurvePrimitive.
|
|
13
|
+
* * Calling this method tells the handler that the parent curve is to be used for detail searches.
|
|
14
|
+
* * Example: Transition spiral search is based on linestring first, then the exact spiral.
|
|
15
|
+
* * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
|
|
16
|
+
*/
|
|
17
|
+
startParentCurvePrimitive(curve: CurvePrimitive | undefined): void;
|
|
18
|
+
/** Forget the parentCurvePrimitive */
|
|
19
|
+
endParentCurvePrimitive(_curve: CurvePrimitive | undefined): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=NewtonRtoRStrokeHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewtonRtoRStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/NewtonRtoRStrokeHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,8BAAsB,uBAAwB,SAAQ,mBAAmB;IACvE,SAAS,CAAC,qBAAqB,EAAE,cAAc,GAAG,SAAS,CAAC;;IAO5D;;;;OAIG;IACI,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAIlE,sCAAsC;IAC/B,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS;CAGlE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Curve
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NewtonRtoRStrokeHandler = void 0;
|
|
11
|
+
const Newton_1 = require("../../numerics/Newton");
|
|
12
|
+
/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
class NewtonRtoRStrokeHandler extends Newton_1.NewtonEvaluatorRtoR {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this._parentCurvePrimitive = undefined;
|
|
19
|
+
}
|
|
20
|
+
/** retain the parentCurvePrimitive.
|
|
21
|
+
* * Calling this method tells the handler that the parent curve is to be used for detail searches.
|
|
22
|
+
* * Example: Transition spiral search is based on linestring first, then the exact spiral.
|
|
23
|
+
* * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
|
|
24
|
+
*/
|
|
25
|
+
startParentCurvePrimitive(curve) {
|
|
26
|
+
this._parentCurvePrimitive = curve;
|
|
27
|
+
}
|
|
28
|
+
/** Forget the parentCurvePrimitive */
|
|
29
|
+
endParentCurvePrimitive(_curve) {
|
|
30
|
+
this._parentCurvePrimitive = undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.NewtonRtoRStrokeHandler = NewtonRtoRStrokeHandler;
|
|
34
|
+
//# sourceMappingURL=NewtonRtoRStrokeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewtonRtoRStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/NewtonRtoRStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,kDAA4D;AAG5D;;GAEG;AACH,MAAsB,uBAAwB,SAAQ,4BAAmB;IAGvE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACI,yBAAyB,CAAC,KAAiC;QAChE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;IAED,sCAAsC;IAC/B,uBAAuB,CAAC,MAAkC;QAC/D,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACzC,CAAC;CACF;AArBD,0DAqBC","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\n\r\nimport { NewtonEvaluatorRtoR } from \"../../numerics/Newton\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\n/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler.\r\n * @internal\r\n */\r\nexport abstract class NewtonRtoRStrokeHandler extends NewtonEvaluatorRtoR {\r\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\r\n\r\n constructor() {\r\n super();\r\n this._parentCurvePrimitive = undefined;\r\n }\r\n\r\n /** retain the parentCurvePrimitive.\r\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\r\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\r\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.\r\n */\r\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._parentCurvePrimitive = curve;\r\n }\r\n\r\n /** Forget the parentCurvePrimitive */\r\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined) {\r\n this._parentCurvePrimitive = undefined;\r\n }\r\n}\r\n"]}
|