@itwin/core-geometry 4.1.0-dev.6 → 4.1.0-dev.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -0
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +4 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +1 -0
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +1 -0
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +36 -26
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +46 -39
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +67 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +75 -7
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +9 -7
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +4 -3
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +4 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +6 -4
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +4 -4
- 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 +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +7 -5
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +18 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +7 -7
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +19 -11
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +6 -6
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +15 -9
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +7 -7
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +69 -47
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +70 -47
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +6 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +6 -5
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +17 -8
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -0
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +5 -2
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +153 -87
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +9 -0
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +13 -0
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +27 -0
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +35 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +8 -0
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +13 -0
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +55 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +134 -94
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +297 -145
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +7 -0
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +12 -0
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +64 -6
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +104 -19
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +30 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -1
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +2 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +2 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +9 -0
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -0
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +2 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +1 -0
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +1 -0
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +36 -26
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +46 -39
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +67 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +74 -6
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +9 -7
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +4 -3
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +4 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +6 -4
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +4 -4
- 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.d.ts +7 -5
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +18 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +7 -7
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +19 -11
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +6 -6
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +15 -9
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +4 -6
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +7 -7
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +69 -47
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +70 -47
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +6 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +6 -5
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +17 -8
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -0
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +5 -2
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +153 -87
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +9 -0
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +13 -0
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +51 -55
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +13 -11
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +27 -0
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +35 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +8 -0
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +13 -0
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +56 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +134 -94
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +297 -145
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +7 -0
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +12 -0
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +64 -6
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +103 -19
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +30 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -1
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -1
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +2 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +2 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +9 -0
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +5 -5
|
@@ -22,8 +22,9 @@ const Loop_1 = require("../Loop");
|
|
|
22
22
|
const Path_1 = require("../Path");
|
|
23
23
|
const RegionOps_1 = require("../RegionOps");
|
|
24
24
|
const StrokeOptions_1 = require("../StrokeOptions");
|
|
25
|
+
// cspell:word CCWXY
|
|
25
26
|
/**
|
|
26
|
-
* Classification of
|
|
27
|
+
* Classification of how the joint is constructed.
|
|
27
28
|
* @internal
|
|
28
29
|
*/
|
|
29
30
|
var JointMode;
|
|
@@ -36,26 +37,44 @@ var JointMode;
|
|
|
36
37
|
JointMode[JointMode["Gap"] = 4] = "Gap";
|
|
37
38
|
})(JointMode || (JointMode = {}));
|
|
38
39
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* *
|
|
42
|
-
*
|
|
43
|
-
* *
|
|
44
|
-
*
|
|
45
|
-
* *
|
|
40
|
+
* Control parameters for joint construction.
|
|
41
|
+
* * Define a "joint" as the common point between adjacent segments of the input curve.
|
|
42
|
+
* * Define the "turn angle" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of
|
|
43
|
+
* the segments at the joint.
|
|
44
|
+
* * When creating offsets, if an offset needs to do an "outside" turn, the first applicable construction is applied:
|
|
45
|
+
* * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.
|
|
46
|
+
* * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to
|
|
47
|
+
* single intersection point (to create a sharp corner).
|
|
48
|
+
* * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:
|
|
49
|
+
* * lie outside the arc that would have been created by the first construction
|
|
50
|
+
* * have uniform turn angle less than `options.maxChamferDegrees`
|
|
51
|
+
* * touch the arc at their midpoint (except first and last edge).
|
|
46
52
|
* @public
|
|
47
53
|
*/
|
|
48
54
|
class JointOptions {
|
|
49
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Construct JointOptions.
|
|
50
57
|
* * leftOffsetDistance is required
|
|
51
58
|
* * minArcDegrees and maxChamferDegrees are optional.
|
|
52
59
|
*/
|
|
53
|
-
constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false) {
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
60
|
+
constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false, allowSharpestCorners = false) {
|
|
61
|
+
/**
|
|
62
|
+
* Smallest arc to construct.
|
|
63
|
+
* * If this control angle is 180 degrees or more, arcs are never created.
|
|
56
64
|
*/
|
|
57
65
|
this.minArcDegrees = 180.0;
|
|
66
|
+
/** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */
|
|
58
67
|
this.maxChamferTurnDegrees = 90;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to remove the internal turn angle upper bound for sharp corner construction.
|
|
70
|
+
* * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose
|
|
71
|
+
* ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.
|
|
72
|
+
* * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles
|
|
73
|
+
* up to `maxChamferTurnDegrees`.
|
|
74
|
+
* * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset
|
|
75
|
+
* with sharp corners at each joint by setting `minArcDegrees` to 180 and `allowSharpestCorners` to true.
|
|
76
|
+
*/
|
|
77
|
+
this.allowSharpestCorners = false;
|
|
59
78
|
/** Offset distance, positive to left of base curve. */
|
|
60
79
|
this.leftOffsetDistance = 0;
|
|
61
80
|
/** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */
|
|
@@ -64,10 +83,11 @@ class JointOptions {
|
|
|
64
83
|
this.minArcDegrees = minArcDegrees;
|
|
65
84
|
this.maxChamferTurnDegrees = maxChamferDegrees;
|
|
66
85
|
this.preserveEllipticalArcs = preserveEllipticalArcs;
|
|
86
|
+
this.allowSharpestCorners = allowSharpestCorners;
|
|
67
87
|
}
|
|
68
88
|
/** Return a deep clone. */
|
|
69
89
|
clone() {
|
|
70
|
-
return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs);
|
|
90
|
+
return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs, this.allowSharpestCorners);
|
|
71
91
|
}
|
|
72
92
|
/** Copy values of input options */
|
|
73
93
|
setFrom(other) {
|
|
@@ -75,6 +95,7 @@ class JointOptions {
|
|
|
75
95
|
this.minArcDegrees = other.minArcDegrees;
|
|
76
96
|
this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;
|
|
77
97
|
this.preserveEllipticalArcs = other.preserveEllipticalArcs;
|
|
98
|
+
this.allowSharpestCorners = other.allowSharpestCorners;
|
|
78
99
|
}
|
|
79
100
|
/**
|
|
80
101
|
* Parse a number or JointOptions up to JointOptions:
|
|
@@ -85,17 +106,22 @@ class JointOptions {
|
|
|
85
106
|
static create(leftOffsetDistanceOrOptions) {
|
|
86
107
|
if (leftOffsetDistanceOrOptions instanceof JointOptions)
|
|
87
108
|
return leftOffsetDistanceOrOptions;
|
|
88
|
-
// if (Number.isFinite(leftOffsetDistanceOrOptions))
|
|
89
109
|
return new JointOptions(leftOffsetDistanceOrOptions);
|
|
90
110
|
}
|
|
91
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
/** Return true if the options indicate this amount of turn should be handled with an arc. */
|
|
92
113
|
needArc(theta) {
|
|
93
114
|
return Math.abs(theta.degrees) >= this.minArcDegrees;
|
|
94
115
|
}
|
|
95
|
-
/**
|
|
116
|
+
/** Return the number of corners needed to chamfer the given turn angle. */
|
|
96
117
|
numChamferPoints(theta) {
|
|
97
118
|
const degrees = Math.abs(theta.degrees);
|
|
98
|
-
const
|
|
119
|
+
const minStepDegreesClamp = 10;
|
|
120
|
+
let maxStepDegreesClamp = 120;
|
|
121
|
+
if (this.allowSharpestCorners) {
|
|
122
|
+
maxStepDegreesClamp = this.maxChamferTurnDegrees;
|
|
123
|
+
}
|
|
124
|
+
const stepDegrees = Geometry_1.Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);
|
|
99
125
|
if (degrees <= stepDegrees)
|
|
100
126
|
return 1;
|
|
101
127
|
return Math.ceil(degrees / stepDegrees);
|
|
@@ -112,17 +138,41 @@ class OffsetOptions {
|
|
|
112
138
|
this.jointOptions = JointOptions.create(offsetDistanceOrOptions);
|
|
113
139
|
this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions_1.StrokeOptions.createForCurves();
|
|
114
140
|
}
|
|
115
|
-
get minArcDegrees() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
set
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
get
|
|
122
|
-
|
|
123
|
-
|
|
141
|
+
get minArcDegrees() {
|
|
142
|
+
return this.jointOptions.minArcDegrees;
|
|
143
|
+
}
|
|
144
|
+
set minArcDegrees(value) {
|
|
145
|
+
this.jointOptions.minArcDegrees = value;
|
|
146
|
+
}
|
|
147
|
+
get maxChamferTurnDegrees() {
|
|
148
|
+
return this.jointOptions.maxChamferTurnDegrees;
|
|
149
|
+
}
|
|
150
|
+
set maxChamferTurnDegrees(value) {
|
|
151
|
+
this.jointOptions.maxChamferTurnDegrees = value;
|
|
152
|
+
}
|
|
153
|
+
get allowSharpestCorners() {
|
|
154
|
+
return this.jointOptions.allowSharpestCorners;
|
|
155
|
+
}
|
|
156
|
+
set allowSharpestCorners(value) {
|
|
157
|
+
this.jointOptions.allowSharpestCorners = value;
|
|
158
|
+
}
|
|
159
|
+
get leftOffsetDistance() {
|
|
160
|
+
return this.jointOptions.leftOffsetDistance;
|
|
161
|
+
}
|
|
162
|
+
set leftOffsetDistance(value) {
|
|
163
|
+
this.jointOptions.leftOffsetDistance = value;
|
|
164
|
+
}
|
|
165
|
+
get preserveEllipticalArcs() {
|
|
166
|
+
return this.jointOptions.preserveEllipticalArcs;
|
|
167
|
+
}
|
|
168
|
+
set preserveEllipticalArcs(value) {
|
|
169
|
+
this.jointOptions.preserveEllipticalArcs = value;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Convert variant input into OffsetOptions.
|
|
124
173
|
* * If a JointOptions is provided, it is captured.
|
|
125
|
-
* * If an OffsetOptions is provided, a reference to it is returned.
|
|
174
|
+
* * If an OffsetOptions is provided, a reference to it is returned.
|
|
175
|
+
*/
|
|
126
176
|
static create(offsetDistanceOrOptions) {
|
|
127
177
|
if (offsetDistanceOrOptions instanceof OffsetOptions)
|
|
128
178
|
return offsetDistanceOrOptions;
|
|
@@ -152,7 +202,9 @@ class Joint {
|
|
|
152
202
|
this.swingPoint = swingPoint;
|
|
153
203
|
this.flexure = JointMode.Unknown;
|
|
154
204
|
}
|
|
155
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* Try to construct an arc transition from ray0 to ray1 with given center.
|
|
207
|
+
*/
|
|
156
208
|
static constructArc(ray0, center, ray1) {
|
|
157
209
|
if (center !== undefined && Geometry_1.Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {
|
|
158
210
|
const angle = ray0.direction.angleToXY(ray1.direction);
|
|
@@ -197,6 +249,7 @@ class Joint {
|
|
|
197
249
|
destination.packedPoints.push(point);
|
|
198
250
|
}
|
|
199
251
|
}
|
|
252
|
+
/** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */
|
|
200
253
|
static collectStrokesFromChain(start, destination, maxTest = 100) {
|
|
201
254
|
let numOut = -2 * maxTest; // allow extra things to happen
|
|
202
255
|
Joint.visitJointsOnChain(start, (joint) => {
|
|
@@ -208,7 +261,7 @@ class Joint {
|
|
|
208
261
|
if (fA === 0.0 && fB === 1.0)
|
|
209
262
|
curve1 = joint.curve1.clone();
|
|
210
263
|
else if (fA < fB)
|
|
211
|
-
curve1 = joint.curve1.clonePartialCurve(fA, fB);
|
|
264
|
+
curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
|
|
212
265
|
if (curve1) {
|
|
213
266
|
if (!joint.jointCurve) {
|
|
214
267
|
this.addPoint(destination, curve1.startPoint());
|
|
@@ -248,6 +301,7 @@ class Joint {
|
|
|
248
301
|
}
|
|
249
302
|
}
|
|
250
303
|
}
|
|
304
|
+
/** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */
|
|
251
305
|
static collectCurvesFromChain(start, destination, maxTest = 100) {
|
|
252
306
|
if (start === undefined)
|
|
253
307
|
return;
|
|
@@ -262,13 +316,13 @@ class Joint {
|
|
|
262
316
|
if (fA === 0.0 && fB === 1.0)
|
|
263
317
|
curve1 = joint.curve1.clone();
|
|
264
318
|
else if (fA < fB)
|
|
265
|
-
curve1 = joint.curve1.clonePartialCurve(fA, fB);
|
|
319
|
+
curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
|
|
266
320
|
this.collectPrimitive(destination, curve1);
|
|
267
321
|
}
|
|
268
322
|
return numOut++ < maxTest;
|
|
269
323
|
}, maxTest);
|
|
270
324
|
}
|
|
271
|
-
/** Execute `joint.annotateJointMode()` at all joints on the chain. */
|
|
325
|
+
/** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */
|
|
272
326
|
static annotateChain(start, options, maxTest = 100) {
|
|
273
327
|
if (start)
|
|
274
328
|
Joint.visitJointsOnChain(start, (joint) => { joint.annotateJointMode(options); return true; }, maxTest);
|
|
@@ -276,7 +330,7 @@ class Joint {
|
|
|
276
330
|
/**
|
|
277
331
|
* Visit joints on a chain.
|
|
278
332
|
* * terminate on `false` return from `callback`
|
|
279
|
-
* @param start first (and, for cyclic chain, final)
|
|
333
|
+
* @param start first (and, for cyclic chain, final) joint
|
|
280
334
|
* @param callback function to call with each Joint as a single parameter.
|
|
281
335
|
*/
|
|
282
336
|
static visitJointsOnChain(start, callback, maxTest = 100) {
|
|
@@ -284,7 +338,7 @@ class Joint {
|
|
|
284
338
|
if (joint) {
|
|
285
339
|
let numTest = 0;
|
|
286
340
|
while (joint !== undefined) {
|
|
287
|
-
if (numTest++ >= maxTest + 5)
|
|
341
|
+
if (numTest++ >= maxTest + 5) // allow extra things to happen
|
|
288
342
|
return true;
|
|
289
343
|
if (!callback(joint))
|
|
290
344
|
return false;
|
|
@@ -300,13 +354,13 @@ class Joint {
|
|
|
300
354
|
if (this.curve0 && this.curve1) {
|
|
301
355
|
const ray0 = this.curve0.fractionToPointAndDerivative(1.0);
|
|
302
356
|
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
303
|
-
const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
|
|
357
|
+
const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
304
358
|
if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
|
|
305
359
|
if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {
|
|
306
360
|
this.fraction0 = 1.0;
|
|
307
361
|
this.fraction1 = 0.0;
|
|
308
362
|
this.flexure = JointMode.Extend;
|
|
309
|
-
const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());
|
|
363
|
+
const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines
|
|
310
364
|
if (options.needArc(theta)) {
|
|
311
365
|
const arc = Joint.constructArc(ray0, this.curve0.baseCurveEnd, ray1);
|
|
312
366
|
if (arc) {
|
|
@@ -314,13 +368,12 @@ class Joint {
|
|
|
314
368
|
return;
|
|
315
369
|
}
|
|
316
370
|
}
|
|
317
|
-
const numChamferPoints = options.numChamferPoints(theta);
|
|
318
|
-
if (numChamferPoints <= 1) {
|
|
371
|
+
const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring
|
|
372
|
+
if (numChamferPoints <= 1) { // create sharp corner
|
|
319
373
|
this.jointCurve = LineString3d_1.LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);
|
|
320
374
|
return;
|
|
321
375
|
}
|
|
322
|
-
if (numChamferPoints > 1) {
|
|
323
|
-
// A nontrivial linestring ...
|
|
376
|
+
if (numChamferPoints > 1) { // create chamfer corner (a line string)
|
|
324
377
|
const radians0 = theta.radians;
|
|
325
378
|
const numHalfStep = 2.0 * numChamferPoints;
|
|
326
379
|
const halfStepRadians = radians0 / numHalfStep;
|
|
@@ -340,19 +393,20 @@ class Joint {
|
|
|
340
393
|
}
|
|
341
394
|
}
|
|
342
395
|
}
|
|
343
|
-
//
|
|
396
|
+
// if there is no intersection between the 2 ray lines, fill the gap by a line segment
|
|
344
397
|
this.flexure = JointMode.Gap;
|
|
345
398
|
this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
|
|
346
399
|
this.fraction0 = 1.0;
|
|
347
400
|
this.fraction1 = 0.0;
|
|
348
401
|
}
|
|
349
402
|
}
|
|
350
|
-
|
|
403
|
+
/** Select the index at which summed fraction difference is smallest */
|
|
351
404
|
selectIntersectionIndexByFraction(fractionA, fractionB, intersections) {
|
|
352
405
|
let index = -1;
|
|
353
406
|
let aMin = Number.MAX_VALUE;
|
|
354
407
|
for (let i = 0; i < intersections.length; i++) {
|
|
355
|
-
const a = Math.abs(intersections[i].detailA.fraction - fractionA)
|
|
408
|
+
const a = Math.abs(intersections[i].detailA.fraction - fractionA)
|
|
409
|
+
+ Math.abs(intersections[i].detailB.fraction - fractionB);
|
|
356
410
|
if (a < aMin) {
|
|
357
411
|
aMin = a;
|
|
358
412
|
index = i;
|
|
@@ -361,42 +415,42 @@ class Joint {
|
|
|
361
415
|
return index;
|
|
362
416
|
}
|
|
363
417
|
/**
|
|
364
|
-
* Examine the adjacent geometry
|
|
365
|
-
* * set JointMode:
|
|
418
|
+
* Examine the adjacent geometry to set some of joint attributes:
|
|
419
|
+
* * set JointMode: one of Cap, Extend, or Trim
|
|
366
420
|
* * set fraction0 and fraction1 of intersection of curve0 and curve1
|
|
421
|
+
* * set joint curve
|
|
367
422
|
* * this REFERENCES curve0, curve1, fraction0, fraction1
|
|
368
423
|
* * this does not reference nextJoint and previousJoint
|
|
369
424
|
*/
|
|
370
425
|
annotateJointMode(options) {
|
|
371
|
-
if (this.curve0 &&
|
|
426
|
+
if (!this.curve0 && this.curve1) { // joint at the start of the chain
|
|
372
427
|
this.flexure = JointMode.Cap;
|
|
373
|
-
this.
|
|
428
|
+
this.fraction1 = 0.0;
|
|
374
429
|
}
|
|
375
|
-
else if (this.
|
|
430
|
+
else if (this.curve0 && !this.curve1) { // joint at the end of the chain
|
|
376
431
|
this.flexure = JointMode.Cap;
|
|
377
|
-
this.
|
|
432
|
+
this.fraction0 = 1.0;
|
|
378
433
|
}
|
|
379
|
-
else if (this.curve0 && this.curve1) {
|
|
380
|
-
|
|
381
|
-
if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {
|
|
434
|
+
else if (this.curve0 && this.curve1) { // joints at the middle of the chain
|
|
435
|
+
if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments
|
|
382
436
|
this.fraction0 = 1.0;
|
|
383
437
|
this.fraction1 = 0.0;
|
|
384
438
|
this.flexure = JointMode.Trim;
|
|
385
439
|
}
|
|
386
|
-
else if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) {
|
|
387
|
-
const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
|
|
388
|
-
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
389
|
-
const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
|
|
440
|
+
else if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) { // pair of lines
|
|
441
|
+
const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
|
|
442
|
+
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
443
|
+
const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
390
444
|
if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
|
|
391
445
|
this.fraction0 = intersection.detailA.fraction;
|
|
392
446
|
this.fraction1 = intersection.detailB.fraction;
|
|
393
|
-
if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {
|
|
447
|
+
if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend
|
|
394
448
|
this.annotateExtension(options);
|
|
395
449
|
}
|
|
396
|
-
else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {
|
|
450
|
+
else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim
|
|
397
451
|
this.flexure = JointMode.Trim;
|
|
398
452
|
}
|
|
399
|
-
else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {
|
|
453
|
+
else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment
|
|
400
454
|
this.flexure = JointMode.Gap;
|
|
401
455
|
this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
|
|
402
456
|
this.fraction0 = 1.0;
|
|
@@ -404,15 +458,15 @@ class Joint {
|
|
|
404
458
|
}
|
|
405
459
|
}
|
|
406
460
|
}
|
|
407
|
-
else { // generic pair of curves
|
|
461
|
+
else { // generic pair of curves
|
|
408
462
|
const intersections = CurveCurve_1.CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);
|
|
409
463
|
const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);
|
|
410
|
-
if (intersectionIndex >= 0) {
|
|
464
|
+
if (intersectionIndex >= 0) { // need to trim
|
|
411
465
|
this.flexure = JointMode.Trim;
|
|
412
466
|
this.fraction0 = intersections[intersectionIndex].detailA.fraction;
|
|
413
467
|
this.fraction1 = intersections[intersectionIndex].detailB.fraction;
|
|
414
468
|
}
|
|
415
|
-
else {
|
|
469
|
+
else { // need to extend
|
|
416
470
|
this.annotateExtension(options);
|
|
417
471
|
}
|
|
418
472
|
}
|
|
@@ -420,7 +474,8 @@ class Joint {
|
|
|
420
474
|
}
|
|
421
475
|
/**
|
|
422
476
|
* * Examine the primitive trim fractions between each pair of joints.
|
|
423
|
-
* * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at
|
|
477
|
+
* * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at
|
|
478
|
+
* surrounding primitives
|
|
424
479
|
* @param start
|
|
425
480
|
*/
|
|
426
481
|
static removeDegeneratePrimitives(start, options, maxTest) {
|
|
@@ -455,8 +510,7 @@ class Joint {
|
|
|
455
510
|
}
|
|
456
511
|
*/
|
|
457
512
|
const eliminateF = f0 >= f1 || f0 > 1.0;
|
|
458
|
-
const eliminateG = (g0 !== undefined && g0 > 1.0)
|
|
459
|
-
|| (g0 !== undefined && g1 !== undefined && g0 >= g1);
|
|
513
|
+
const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);
|
|
460
514
|
if (eliminateF && eliminateG) {
|
|
461
515
|
const jointC = jointB.nextJoint;
|
|
462
516
|
const newJoint = new Joint(jointA.curve0, jointC.curve1, undefined);
|
|
@@ -512,9 +566,8 @@ class Joint {
|
|
|
512
566
|
* @internal
|
|
513
567
|
*/
|
|
514
568
|
class PolygonWireOffsetContext {
|
|
515
|
-
/**
|
|
516
|
-
constructor() {
|
|
517
|
-
}
|
|
569
|
+
/** Construct a context. */
|
|
570
|
+
constructor() { }
|
|
518
571
|
// Construct a single offset from base points
|
|
519
572
|
static createOffsetSegment(basePointA, basePointB, distance) {
|
|
520
573
|
Point3dVector3d_1.Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);
|
|
@@ -527,13 +580,25 @@ class PolygonWireOffsetContext {
|
|
|
527
580
|
return undefined;
|
|
528
581
|
}
|
|
529
582
|
/**
|
|
530
|
-
* Construct
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
583
|
+
* Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in
|
|
584
|
+
* a plane parallel to xy-plane).
|
|
585
|
+
* * This is a simple wire offset (in the form of a line string), not an area.
|
|
586
|
+
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
587
|
+
* * See [[JointOptions]] class doc for offset construction rules.
|
|
588
|
+
* @param points a single loop or path
|
|
589
|
+
* @param wrap true to offset the wraparound joint. Assumes first = last point.
|
|
590
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions
|
|
591
|
+
* object.
|
|
535
592
|
*/
|
|
536
593
|
constructPolygonWireXYOffset(points, wrap, leftOffsetDistanceOrOptions) {
|
|
594
|
+
/**
|
|
595
|
+
* if "wrap = true", then first and last point in the points array must be close; otherwise
|
|
596
|
+
* generated offset will be invalid.
|
|
597
|
+
*/
|
|
598
|
+
if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {
|
|
599
|
+
wrap = false;
|
|
600
|
+
}
|
|
601
|
+
/** create raw offsets as a linked list (joint0) */
|
|
537
602
|
const options = JointOptions.create(leftOffsetDistanceOrOptions);
|
|
538
603
|
const numPoints = points.length;
|
|
539
604
|
let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);
|
|
@@ -553,7 +618,9 @@ class PolygonWireOffsetContext {
|
|
|
553
618
|
newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);
|
|
554
619
|
Joint.link(previousJoint, newJoint);
|
|
555
620
|
}
|
|
621
|
+
/** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
|
|
556
622
|
Joint.annotateChain(joint0, options, numPoints);
|
|
623
|
+
/** make limited passes through the Joint chain until no self-intersections are removed */
|
|
557
624
|
for (let pass = 0; pass++ < 5;) {
|
|
558
625
|
const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);
|
|
559
626
|
joint0 = state.newStart;
|
|
@@ -567,6 +634,7 @@ class PolygonWireOffsetContext {
|
|
|
567
634
|
*/
|
|
568
635
|
}
|
|
569
636
|
// Joint.collectPrimitivesFromChain(joint0, result, numPoints);
|
|
637
|
+
/** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */
|
|
570
638
|
const chain = LineString3d_1.LineString3d.create();
|
|
571
639
|
Joint.collectStrokesFromChain(joint0, chain, numPoints);
|
|
572
640
|
const n = chain.packedPoints.length;
|
|
@@ -590,14 +658,13 @@ exports.PolygonWireOffsetContext = PolygonWireOffsetContext;
|
|
|
590
658
|
*/
|
|
591
659
|
class CurveChainWireOffsetContext {
|
|
592
660
|
/** construct a context. */
|
|
593
|
-
constructor() {
|
|
594
|
-
}
|
|
661
|
+
constructor() { }
|
|
595
662
|
/**
|
|
596
663
|
* Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.
|
|
597
|
-
*
|
|
598
|
-
* @param cp primitive to annotate
|
|
664
|
+
* @param cp curve primitive to annotate
|
|
599
665
|
* @param startPoint optional start point
|
|
600
666
|
* @param endPoint optional end point
|
|
667
|
+
* @return the input CurvePrimitive with annotations
|
|
601
668
|
*/
|
|
602
669
|
static applyBasePoints(cp, startPoint, endPoint) {
|
|
603
670
|
if (cp !== undefined) {
|
|
@@ -609,7 +676,7 @@ class CurveChainWireOffsetContext {
|
|
|
609
676
|
return cp;
|
|
610
677
|
}
|
|
611
678
|
/**
|
|
612
|
-
* Create the offset of a single primitive.
|
|
679
|
+
* Create the offset of a single primitive as viewed in the xy-plane (ignoring z).
|
|
613
680
|
* * each primitive may be labeled (as an `any` object) with start or end point of base curve:
|
|
614
681
|
* * `(primitive as any).baseCurveStart: Point3d`
|
|
615
682
|
* * `(primitive as any).baseCurveEnd: Point3d`
|
|
@@ -633,15 +700,10 @@ class CurveChainWireOffsetContext {
|
|
|
633
700
|
}
|
|
634
701
|
/**
|
|
635
702
|
* Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
|
|
636
|
-
* * The construction will remove "some" local effects of features smaller than the offset distance, but will
|
|
703
|
+
* * The construction will remove "some" local effects of features smaller than the offset distance, but will
|
|
704
|
+
* not detect self intersection among widely separated edges.
|
|
637
705
|
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
638
|
-
* *
|
|
639
|
-
* * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
|
|
640
|
-
* * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
|
|
641
|
-
* * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
|
|
642
|
-
* * outside the arc
|
|
643
|
-
* * have uniform turn angle less than `options.maxChamferDegrees`
|
|
644
|
-
* * each line segment (except first and last) touches the arc at its midpoint.
|
|
706
|
+
* * See [[JointOptions]] class doc for offset construction rules.
|
|
645
707
|
* @param curves base curves.
|
|
646
708
|
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
|
|
647
709
|
*/
|
|
@@ -649,14 +711,15 @@ class CurveChainWireOffsetContext {
|
|
|
649
711
|
const wrap = curves instanceof Loop_1.Loop;
|
|
650
712
|
const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);
|
|
651
713
|
const simpleOffsets = [];
|
|
652
|
-
|
|
714
|
+
/** traverse primitives (children of curves) and create simple offsets of each primitive as an array */
|
|
653
715
|
for (const c of curves.children) {
|
|
654
716
|
const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);
|
|
655
717
|
if (c1 === undefined) {
|
|
656
718
|
// bad .. maybe arc to inside?
|
|
657
719
|
}
|
|
658
|
-
else if (c1 instanceof CurvePrimitive_1.CurvePrimitive)
|
|
720
|
+
else if (c1 instanceof CurvePrimitive_1.CurvePrimitive) {
|
|
659
721
|
simpleOffsets.push(c1);
|
|
722
|
+
}
|
|
660
723
|
else if (Array.isArray(c1)) {
|
|
661
724
|
for (const c2 of c1) {
|
|
662
725
|
if (c2 instanceof CurvePrimitive_1.CurvePrimitive)
|
|
@@ -664,6 +727,7 @@ class CurveChainWireOffsetContext {
|
|
|
664
727
|
}
|
|
665
728
|
}
|
|
666
729
|
}
|
|
730
|
+
/** create joints between array elements to make offsets as a linked list (joint0) */
|
|
667
731
|
let fragment0;
|
|
668
732
|
let newJoint;
|
|
669
733
|
let previousJoint;
|
|
@@ -682,8 +746,10 @@ class CurveChainWireOffsetContext {
|
|
|
682
746
|
}
|
|
683
747
|
if (joint0 && previousJoint && curves instanceof Loop_1.Loop)
|
|
684
748
|
Joint.link(previousJoint, joint0);
|
|
749
|
+
/** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
|
|
685
750
|
const numOffset = simpleOffsets.length;
|
|
686
751
|
Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);
|
|
752
|
+
/** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */
|
|
687
753
|
const outputCurves = [];
|
|
688
754
|
Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);
|
|
689
755
|
return RegionOps_1.RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);
|