@itwin/core-geometry 4.1.0-dev.68 → 4.1.0-dev.69
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/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +2 -2
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +2 -2
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +3 -2
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +4 -5
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +1 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +2 -2
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +2 -2
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +2 -2
- package/lib/cjs/curve/CurveCollection.js +2 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +77 -0
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -0
- package/lib/cjs/curve/CurveOps.js +160 -0
- package/lib/cjs/curve/CurveOps.js.map +1 -0
- package/lib/cjs/curve/CurvePrimitive.d.ts +13 -13
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +2 -2
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +2 -2
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +2 -2
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +2 -2
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.d.ts +97 -0
- package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/cjs/curve/OffsetOptions.js +166 -0
- package/lib/cjs/curve/OffsetOptions.js.map +1 -0
- package/lib/cjs/curve/ProxyCurve.d.ts +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +10 -13
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +16 -17
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/cjs/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +59 -74
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +130 -223
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +6 -100
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +12 -167
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js +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/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +5 -5
- 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/Point2dVector2d.d.ts +8 -9
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -10
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/cjs/geometry3d/Point3dVector3d.js +5 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +5 -5
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -3
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts +69 -0
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/cjs/geometry3d/Ray2d.js +146 -0
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -0
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +3 -3
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js +16 -107
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +0 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js +5 -5
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -7
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +13 -12
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js +3 -3
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +3 -2
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +3 -3
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +1 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +1 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +2 -2
- package/lib/esm/curve/CurveCollection.js +2 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +77 -0
- package/lib/esm/curve/CurveOps.d.ts.map +1 -0
- package/lib/esm/curve/CurveOps.js +156 -0
- package/lib/esm/curve/CurveOps.js.map +1 -0
- package/lib/esm/curve/CurvePrimitive.d.ts +13 -13
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +2 -2
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +2 -2
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +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.d.ts +97 -0
- package/lib/esm/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/esm/curve/OffsetOptions.js +161 -0
- package/lib/esm/curve/OffsetOptions.js.map +1 -0
- package/lib/esm/curve/ProxyCurve.d.ts +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +10 -13
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +17 -18
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/esm/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +59 -74
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +129 -221
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +6 -100
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +9 -162
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js +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/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +5 -5
- 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/Point2dVector2d.d.ts +8 -9
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -10
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/esm/geometry3d/Point3dVector3d.js +5 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +5 -5
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +1 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -3
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts +69 -0
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/esm/geometry3d/Ray2d.js +142 -0
- package/lib/esm/geometry3d/Ray2d.js.map +1 -0
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.js +3 -3
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/esm/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js +14 -104
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +0 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js +5 -5
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -7
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +14 -13
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +2 -7
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js +3 -3
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +5 -16
- package/lib/cjs/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/cjs/curve/ChainCollectorContext.js.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,oBAAoB;AAEpB;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,6CAAU,CAAA;IACV,0CAAS,CAAA;IACT,yDAAgB,CA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B,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,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\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Control parameters for joint construction.\r\n * * Define a \"joint\" as the common point between adjacent segments of the input curve.\r\n * * Define the \"turn angle\" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of\r\n * the segments at the joint.\r\n * * When creating offsets, if an offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.\r\n * * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to\r\n * single intersection point (to create a sharp corner).\r\n * * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:\r\n * * lie outside the arc that would have been created by the first construction\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * touch the arc at their midpoint (except first and last edge).\r\n * @public\r\n */\r\nexport class JointOptions {\r\n /**\r\n * Smallest arc to construct.\r\n * * If this control angle is 180 degrees or more, arcs are never created.\r\n */\r\n public minArcDegrees = 180.0;\r\n /** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */\r\n public maxChamferTurnDegrees = 90;\r\n /**\r\n * Whether to remove the internal turn angle upper bound for sharp corner construction.\r\n * * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose\r\n * ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.\r\n * * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles\r\n * up to `maxChamferTurnDegrees`.\r\n * * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset with\r\n * sharp corners at each joint by setting `maxChamferTurnDegrees < minArcDegrees` and `allowSharpestCorners` to true.\r\n */\r\n public allowSharpestCorners = false;\r\n /** Offset distance, positive to left of base curve. */\r\n public leftOffsetDistance: number = 0;\r\n /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */\r\n public preserveEllipticalArcs = false;\r\n /**\r\n * Construct JointOptions.\r\n * * leftOffsetDistance is required\r\n * * minArcDegrees and maxChamferDegrees are optional.\r\n */\r\n constructor(\r\n leftOffsetDistance: number, minArcDegrees = 180, maxChamferDegrees = 90,\r\n preserveEllipticalArcs = false, allowSharpestCorners = false\r\n ) {\r\n this.leftOffsetDistance = leftOffsetDistance;\r\n this.minArcDegrees = minArcDegrees;\r\n this.maxChamferTurnDegrees = maxChamferDegrees;\r\n this.preserveEllipticalArcs = preserveEllipticalArcs;\r\n this.allowSharpestCorners = allowSharpestCorners;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): JointOptions {\r\n return new JointOptions(\r\n this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees,\r\n this.preserveEllipticalArcs, this.allowSharpestCorners\r\n );\r\n }\r\n /** Copy values of input options */\r\n public setFrom(other: JointOptions) {\r\n this.leftOffsetDistance = other.leftOffsetDistance;\r\n this.minArcDegrees = other.minArcDegrees;\r\n this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;\r\n this.preserveEllipticalArcs = other.preserveEllipticalArcs;\r\n this.allowSharpestCorners = other.allowSharpestCorners;\r\n }\r\n /**\r\n * Parse a number or JointOptions up to JointOptions:\r\n * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.\r\n * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.\r\n * @param leftOffsetDistanceOrOptions\r\n */\r\n public static create(leftOffsetDistanceOrOptions: number | JointOptions): JointOptions {\r\n if (leftOffsetDistanceOrOptions instanceof JointOptions)\r\n return leftOffsetDistanceOrOptions;\r\n return new JointOptions(leftOffsetDistanceOrOptions);\r\n }\r\n /** Return true if the options indicate this amount of turn should be handled with an arc. */\r\n public needArc(theta: Angle): boolean {\r\n return Math.abs(theta.degrees) >= this.minArcDegrees;\r\n }\r\n /** Return the number of corners needed to chamfer the given turn angle. */\r\n public numChamferPoints(theta: Angle): number {\r\n const degrees = Math.abs(theta.degrees);\r\n const minStepDegreesClamp = 10;\r\n let maxStepDegreesClamp = 120;\r\n if (this.allowSharpestCorners) {\r\n maxStepDegreesClamp = this.maxChamferTurnDegrees;\r\n }\r\n const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);\r\n if (degrees <= stepDegrees)\r\n return 1;\r\n return Math.ceil(degrees / stepDegrees);\r\n }\r\n}\r\n\r\n/**\r\n * Options for offsetting a curve.\r\n * @public\r\n */\r\nexport class OffsetOptions {\r\n /** Options for offsetting and joining CurvePrimitives */\r\n public jointOptions: JointOptions;\r\n /** Options for generating a B-spline curve offset */\r\n public strokeOptions: StrokeOptions;\r\n /** Options that are provided are captured. */\r\n constructor(offsetDistanceOrOptions: number | JointOptions, strokeOptions?: StrokeOptions) {\r\n this.jointOptions = JointOptions.create(offsetDistanceOrOptions);\r\n this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions.createForCurves();\r\n }\r\n public get minArcDegrees(): number {\r\n return this.jointOptions.minArcDegrees;\r\n }\r\n public set minArcDegrees(value: number) {\r\n this.jointOptions.minArcDegrees = value;\r\n }\r\n public get maxChamferTurnDegrees(): number {\r\n return this.jointOptions.maxChamferTurnDegrees;\r\n }\r\n public set maxChamferTurnDegrees(value: number) {\r\n this.jointOptions.maxChamferTurnDegrees = value;\r\n }\r\n public get allowSharpestCorners(): boolean {\r\n return this.jointOptions.allowSharpestCorners;\r\n }\r\n public set allowSharpestCorners(value: boolean) {\r\n this.jointOptions.allowSharpestCorners = value;\r\n }\r\n public get leftOffsetDistance(): number {\r\n return this.jointOptions.leftOffsetDistance;\r\n }\r\n public set leftOffsetDistance(value: number) {\r\n this.jointOptions.leftOffsetDistance = value;\r\n }\r\n public get preserveEllipticalArcs(): boolean {\r\n return this.jointOptions.preserveEllipticalArcs;\r\n }\r\n public set preserveEllipticalArcs(value: boolean) {\r\n this.jointOptions.preserveEllipticalArcs = value;\r\n }\r\n /**\r\n * Convert variant input into OffsetOptions.\r\n * * If a JointOptions is provided, it is captured.\r\n * * If an OffsetOptions is provided, a reference to it is returned.\r\n */\r\n public static create(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): OffsetOptions {\r\n if (offsetDistanceOrOptions instanceof OffsetOptions)\r\n return offsetDistanceOrOptions;\r\n return new OffsetOptions(offsetDistanceOrOptions);\r\n }\r\n /** Convert variant input into offset distance */\r\n public static getOffsetDistance(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): number {\r\n if (typeof offsetDistanceOrOptions === \"number\")\r\n return offsetDistanceOrOptions;\r\n return offsetDistanceOrOptions.leftOffsetDistance;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): OffsetOptions {\r\n return new OffsetOptions(this.jointOptions.clone(), this.strokeOptions.clone());\r\n }\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[]\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB)\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in\r\n * a plane parallel to xy-plane).\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions\r\n ): CurveChain | undefined {\r\n /**\r\n * if \"wrap = true\", then first and last point in the points array must be close; otherwise\r\n * generated offset will be invalid.\r\n */\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {\r\n wrap = false;\r\n }\r\n /** create raw offsets as a linked list (joint0) */\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n Joint.annotateChain(joint0, options, numPoints);\r\n /** make limited passes through the Joint chain until no self-intersections are removed */\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single primitive as viewed in the xy-plane (ignoring z).\r\n * * each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param g primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n g: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = g.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = g.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, g.startPoint(), g.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/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BACb,QAAQ,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,IAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,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\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\n\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest,\r\n );\r\n }\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number,\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number,\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in\r\n * a plane parallel to xy-plane).\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\r\n ): CurveChain | undefined {\r\n /**\r\n * if \"wrap = true\", then first and last point in the points array must be close; otherwise\r\n * generated offset will be invalid.\r\n */\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {\r\n wrap = false;\r\n }\r\n /** create raw offsets as a linked list (joint0) */\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n Joint.annotateChain(joint0, options, numPoints);\r\n /** make limited passes through the Joint chain until no self-intersections are removed */\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\r\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param curve primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
|
|
@@ -72,7 +72,7 @@ class IntegratedSpiral3d extends TransitionSpiral3d {
|
|
|
72
72
|
static initWorkSpace() {
|
|
73
73
|
IntegratedSpiral3d._gaussFraction = new Float64Array(5);
|
|
74
74
|
IntegratedSpiral3d._gaussWeight = new Float64Array(5);
|
|
75
|
-
IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;
|
|
75
|
+
IntegratedSpiral3d._gaussMapper = (xA, xB, xMapped, wMapped) => Quadrature.setupGauss5(xA, xB, xMapped, wMapped);
|
|
76
76
|
}
|
|
77
77
|
/** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.
|
|
78
78
|
* (recall that theta is a nonlinear function of the fraction.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAA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AAC,6BAA6B,CAAC,KAAK,CAAC,SAAS,CAAC;mBAC7D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;mBAChE,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAvWD,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,AAAb,CAAc;SA3C3C,kBAAkB;AAmZ/B,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,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 Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public override refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public override clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n if (activeFraction > 1.0) {\r\n result = this._globalStrokes.packedPoints.back(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 1.0;\r\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\r\n while (nextGlobalFraction < targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction += integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else if (activeFraction < 0.0) {\r\n result = this._globalStrokes.packedPoints.front(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 0.0;\r\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\r\n while (nextGlobalFraction > targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction -= integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else {\r\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\r\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // GeometryCoreTestIO.consoleLog(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\r\n\r\n }\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\n"]}
|
|
1
|
+
{"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,QAA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AC,SAAS,CAAC,6BAA6B,CAAC,KAAK,CAAC,SAAS,CAAC;mBAC7D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;mBAChE,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAvWD,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,AAAb,CAAc;SA3C3C,kBAAkB;AAmZ/B,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,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 Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = (xA, xB, xMapped, wMapped) => Quadrature.setupGauss5(xA, xB, xMapped, wMapped);\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public override refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public override clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n if (activeFraction > 1.0) {\r\n result = this._globalStrokes.packedPoints.back(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 1.0;\r\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\r\n while (nextGlobalFraction < targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction += integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else if (activeFraction < 0.0) {\r\n result = this._globalStrokes.packedPoints.front(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 0.0;\r\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\r\n while (nextGlobalFraction > targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction -= integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else {\r\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\r\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // GeometryCoreTestIO.consoleLog(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\r\n\r\n }\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\n"]}
|
|
@@ -3,8 +3,8 @@ import { Range1d, Range3d } from "../../geometry3d/Range";
|
|
|
3
3
|
import { Segment1d } from "../../geometry3d/Segment1d";
|
|
4
4
|
import { Transform } from "../../geometry3d/Transform";
|
|
5
5
|
import { CurvePrimitive } from "../CurvePrimitive";
|
|
6
|
-
import { OffsetOptions } from "../internalContexts/PolygonOffsetContext";
|
|
7
6
|
import { LineString3d } from "../LineString3d";
|
|
7
|
+
import { OffsetOptions } from "../OffsetOptions";
|
|
8
8
|
import { TransitionConditionalProperties } from "./TransitionConditionalProperties";
|
|
9
9
|
import type { Vector3d } from "../../geometry3d/Point3dVector3d";
|
|
10
10
|
import type { Ray3d } from "../../geometry3d/Ray3d";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAUA,O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
12
|
import { CurvePrimitive } from "../CurvePrimitive";
|
|
13
13
|
import { CurveOffsetXYHandler } from "../internalContexts/CurveOffsetXYHandler";
|
|
14
14
|
import { PlaneAltitudeRangeContext } from "../internalContexts/PlaneAltitudeRangeContext";
|
|
15
|
-
import { OffsetOptions } from "../
|
|
15
|
+
import { OffsetOptions } from "../OffsetOptions";
|
|
16
16
|
/**
|
|
17
17
|
* TransitionSpiral3d is a base class for multiple variants of spirals.
|
|
18
18
|
* * The menagerie of spiral types have 2 broad categories:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAW,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAwCzE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,cAAc;IAU7D,wEAAwE;IACxE,IAAW,sBAAsB,KAAgB,OAAO,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAKvF,0CAA0C;IAC1C,IAAW,YAAY,KAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAEnE,YAAsB,UAA8B,EAAE,YAAuB,EAAE,sBAA6C,EAAE,gBAA6D;QACzL,KAAK,EAAE,CAAC;QACR,IAAI,CAA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AAO,GAAG,aAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IACD,oDAAoD;IACpC,WAAW,CAAC,aAAsB,EAAE,SAAqB;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QACjE,aAAa,CAAC,WAAW,CAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACc,qBAAqB,CAAC,SAAiB,EAAE,SAAiB,EAAE,SAAqB;QAChG,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,OAAO,CAAC,UAAU,EAAG,CAAC;QAC/B,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAE,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,CAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;QAC/E,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,4BAA4B,CAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACzF,CAAC;IACD;;;;OAIG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Range1d, Range3d } from \"../../geometry3d/Range\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../internalContexts/PlaneAltitudeRangeContext\";\r\nimport { OffsetOptions } from \"../internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\n\r\nimport type { Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport type { Ray3d } from \"../../geometry3d/Ray3d\";\r\n\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): TransitionSpiral3d;\r\n\r\n /** Recompute strokes */\r\n public abstract refreshComputedProperties(): void;\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): TransitionSpiral3d {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** Clone with a transform applied */\r\n public override cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public override extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const myRange = this.rangeBetweenFractions (0.0, 1.0, transform);\r\n rangeToExtend.extendRange (myRange);\r\n }\r\n\r\n /** return the range of spiral between fractions of the activeStrokes.\r\n * * Use activeStrokes point count times interval factor for initial evaluation count, but do at least 5\r\n */\r\n public override rangeBetweenFractions(fractionA: number, fractionB: number, transform?: Transform): Range3d {\r\n const strokes = this.activeStrokes;\r\n if (undefined === strokes)\r\n return Range3d.createNull ();\r\n let count = Math.ceil (strokes.numPoints() * Math.abs (fractionB - fractionA));\r\n count = Geometry.clamp (5, count, 30);\r\n return this.rangeBetweenFractionsByCount (fractionA, fractionB, count, transform, 0.5);\r\n }\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAW,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAuCjD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,cAAc;IAU7D,wEAAwE;IACxE,IAAW,sBAAsB,KAAg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ACzF,CAAC;IACD;;;;OAIG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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 Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Range1d, Range3d } from \"../../geometry3d/Range\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { OffsetOptions } from \"../OffsetOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\n\r\nimport type { Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport type { Ray3d } from \"../../geometry3d/Ray3d\";\r\n\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): TransitionSpiral3d;\r\n\r\n /** Recompute strokes */\r\n public abstract refreshComputedProperties(): void;\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): TransitionSpiral3d {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** Clone with a transform applied */\r\n public override cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public override extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const myRange = this.rangeBetweenFractions (0.0, 1.0, transform);\r\n rangeToExtend.extendRange (myRange);\r\n }\r\n\r\n /** return the range of spiral between fractions of the activeStrokes.\r\n * * Use activeStrokes point count times interval factor for initial evaluation count, but do at least 5\r\n */\r\n public override rangeBetweenFractions(fractionA: number, fractionB: number, transform?: Transform): Range3d {\r\n const strokes = this.activeStrokes;\r\n if (undefined === strokes)\r\n return Range3d.createNull ();\r\n let count = Math.ceil (strokes.numPoints() * Math.abs (fractionB - fractionA));\r\n count = Geometry.clamp (5, count, 30);\r\n return this.rangeBetweenFractionsByCount (fractionA, fractionB, count, transform, 0.5);\r\n }\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
|