@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
|
@@ -19,8 +19,9 @@ import { Loop } from "../Loop";
|
|
|
19
19
|
import { Path } from "../Path";
|
|
20
20
|
import { RegionOps } from "../RegionOps";
|
|
21
21
|
import { StrokeOptions } from "../StrokeOptions";
|
|
22
|
+
// cspell:word CCWXY
|
|
22
23
|
/**
|
|
23
|
-
* Classification of
|
|
24
|
+
* Classification of how the joint is constructed.
|
|
24
25
|
* @internal
|
|
25
26
|
*/
|
|
26
27
|
var JointMode;
|
|
@@ -33,26 +34,44 @@ var JointMode;
|
|
|
33
34
|
JointMode[JointMode["Gap"] = 4] = "Gap";
|
|
34
35
|
})(JointMode || (JointMode = {}));
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* *
|
|
39
|
-
*
|
|
40
|
-
* *
|
|
41
|
-
*
|
|
42
|
-
* *
|
|
37
|
+
* Control parameters for joint construction.
|
|
38
|
+
* * Define a "joint" as the common point between adjacent segments of the input curve.
|
|
39
|
+
* * Define the "turn angle" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of
|
|
40
|
+
* the segments at the joint.
|
|
41
|
+
* * When creating offsets, if an offset needs to do an "outside" turn, the first applicable construction is applied:
|
|
42
|
+
* * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.
|
|
43
|
+
* * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to
|
|
44
|
+
* single intersection point (to create a sharp corner).
|
|
45
|
+
* * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:
|
|
46
|
+
* * lie outside the arc that would have been created by the first construction
|
|
47
|
+
* * have uniform turn angle less than `options.maxChamferDegrees`
|
|
48
|
+
* * touch the arc at their midpoint (except first and last edge).
|
|
43
49
|
* @public
|
|
44
50
|
*/
|
|
45
51
|
export class JointOptions {
|
|
46
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Construct JointOptions.
|
|
47
54
|
* * leftOffsetDistance is required
|
|
48
55
|
* * minArcDegrees and maxChamferDegrees are optional.
|
|
49
56
|
*/
|
|
50
|
-
constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false) {
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
57
|
+
constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false, allowSharpestCorners = false) {
|
|
58
|
+
/**
|
|
59
|
+
* Smallest arc to construct.
|
|
60
|
+
* * If this control angle is 180 degrees or more, arcs are never created.
|
|
53
61
|
*/
|
|
54
62
|
this.minArcDegrees = 180.0;
|
|
63
|
+
/** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */
|
|
55
64
|
this.maxChamferTurnDegrees = 90;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to remove the internal turn angle upper bound for sharp corner construction.
|
|
67
|
+
* * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose
|
|
68
|
+
* ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.
|
|
69
|
+
* * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles
|
|
70
|
+
* up to `maxChamferTurnDegrees`.
|
|
71
|
+
* * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset
|
|
72
|
+
* with sharp corners at each joint by setting `minArcDegrees` to 180 and `allowSharpestCorners` to true.
|
|
73
|
+
*/
|
|
74
|
+
this.allowSharpestCorners = false;
|
|
56
75
|
/** Offset distance, positive to left of base curve. */
|
|
57
76
|
this.leftOffsetDistance = 0;
|
|
58
77
|
/** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */
|
|
@@ -61,10 +80,11 @@ export class JointOptions {
|
|
|
61
80
|
this.minArcDegrees = minArcDegrees;
|
|
62
81
|
this.maxChamferTurnDegrees = maxChamferDegrees;
|
|
63
82
|
this.preserveEllipticalArcs = preserveEllipticalArcs;
|
|
83
|
+
this.allowSharpestCorners = allowSharpestCorners;
|
|
64
84
|
}
|
|
65
85
|
/** Return a deep clone. */
|
|
66
86
|
clone() {
|
|
67
|
-
return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs);
|
|
87
|
+
return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs, this.allowSharpestCorners);
|
|
68
88
|
}
|
|
69
89
|
/** Copy values of input options */
|
|
70
90
|
setFrom(other) {
|
|
@@ -72,6 +92,7 @@ export class JointOptions {
|
|
|
72
92
|
this.minArcDegrees = other.minArcDegrees;
|
|
73
93
|
this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;
|
|
74
94
|
this.preserveEllipticalArcs = other.preserveEllipticalArcs;
|
|
95
|
+
this.allowSharpestCorners = other.allowSharpestCorners;
|
|
75
96
|
}
|
|
76
97
|
/**
|
|
77
98
|
* Parse a number or JointOptions up to JointOptions:
|
|
@@ -82,17 +103,22 @@ export class JointOptions {
|
|
|
82
103
|
static create(leftOffsetDistanceOrOptions) {
|
|
83
104
|
if (leftOffsetDistanceOrOptions instanceof JointOptions)
|
|
84
105
|
return leftOffsetDistanceOrOptions;
|
|
85
|
-
// if (Number.isFinite(leftOffsetDistanceOrOptions))
|
|
86
106
|
return new JointOptions(leftOffsetDistanceOrOptions);
|
|
87
107
|
}
|
|
88
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
/** Return true if the options indicate this amount of turn should be handled with an arc. */
|
|
89
110
|
needArc(theta) {
|
|
90
111
|
return Math.abs(theta.degrees) >= this.minArcDegrees;
|
|
91
112
|
}
|
|
92
|
-
/**
|
|
113
|
+
/** Return the number of corners needed to chamfer the given turn angle. */
|
|
93
114
|
numChamferPoints(theta) {
|
|
94
115
|
const degrees = Math.abs(theta.degrees);
|
|
95
|
-
const
|
|
116
|
+
const minStepDegreesClamp = 10;
|
|
117
|
+
let maxStepDegreesClamp = 120;
|
|
118
|
+
if (this.allowSharpestCorners) {
|
|
119
|
+
maxStepDegreesClamp = this.maxChamferTurnDegrees;
|
|
120
|
+
}
|
|
121
|
+
const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);
|
|
96
122
|
if (degrees <= stepDegrees)
|
|
97
123
|
return 1;
|
|
98
124
|
return Math.ceil(degrees / stepDegrees);
|
|
@@ -108,17 +134,41 @@ export class OffsetOptions {
|
|
|
108
134
|
this.jointOptions = JointOptions.create(offsetDistanceOrOptions);
|
|
109
135
|
this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions.createForCurves();
|
|
110
136
|
}
|
|
111
|
-
get minArcDegrees() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
set
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
get
|
|
118
|
-
|
|
119
|
-
|
|
137
|
+
get minArcDegrees() {
|
|
138
|
+
return this.jointOptions.minArcDegrees;
|
|
139
|
+
}
|
|
140
|
+
set minArcDegrees(value) {
|
|
141
|
+
this.jointOptions.minArcDegrees = value;
|
|
142
|
+
}
|
|
143
|
+
get maxChamferTurnDegrees() {
|
|
144
|
+
return this.jointOptions.maxChamferTurnDegrees;
|
|
145
|
+
}
|
|
146
|
+
set maxChamferTurnDegrees(value) {
|
|
147
|
+
this.jointOptions.maxChamferTurnDegrees = value;
|
|
148
|
+
}
|
|
149
|
+
get allowSharpestCorners() {
|
|
150
|
+
return this.jointOptions.allowSharpestCorners;
|
|
151
|
+
}
|
|
152
|
+
set allowSharpestCorners(value) {
|
|
153
|
+
this.jointOptions.allowSharpestCorners = value;
|
|
154
|
+
}
|
|
155
|
+
get leftOffsetDistance() {
|
|
156
|
+
return this.jointOptions.leftOffsetDistance;
|
|
157
|
+
}
|
|
158
|
+
set leftOffsetDistance(value) {
|
|
159
|
+
this.jointOptions.leftOffsetDistance = value;
|
|
160
|
+
}
|
|
161
|
+
get preserveEllipticalArcs() {
|
|
162
|
+
return this.jointOptions.preserveEllipticalArcs;
|
|
163
|
+
}
|
|
164
|
+
set preserveEllipticalArcs(value) {
|
|
165
|
+
this.jointOptions.preserveEllipticalArcs = value;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Convert variant input into OffsetOptions.
|
|
120
169
|
* * If a JointOptions is provided, it is captured.
|
|
121
|
-
* * If an OffsetOptions is provided, a reference to it is returned.
|
|
170
|
+
* * If an OffsetOptions is provided, a reference to it is returned.
|
|
171
|
+
*/
|
|
122
172
|
static create(offsetDistanceOrOptions) {
|
|
123
173
|
if (offsetDistanceOrOptions instanceof OffsetOptions)
|
|
124
174
|
return offsetDistanceOrOptions;
|
|
@@ -147,7 +197,9 @@ class Joint {
|
|
|
147
197
|
this.swingPoint = swingPoint;
|
|
148
198
|
this.flexure = JointMode.Unknown;
|
|
149
199
|
}
|
|
150
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Try to construct an arc transition from ray0 to ray1 with given center.
|
|
202
|
+
*/
|
|
151
203
|
static constructArc(ray0, center, ray1) {
|
|
152
204
|
if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {
|
|
153
205
|
const angle = ray0.direction.angleToXY(ray1.direction);
|
|
@@ -192,6 +244,7 @@ class Joint {
|
|
|
192
244
|
destination.packedPoints.push(point);
|
|
193
245
|
}
|
|
194
246
|
}
|
|
247
|
+
/** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */
|
|
195
248
|
static collectStrokesFromChain(start, destination, maxTest = 100) {
|
|
196
249
|
let numOut = -2 * maxTest; // allow extra things to happen
|
|
197
250
|
Joint.visitJointsOnChain(start, (joint) => {
|
|
@@ -203,7 +256,7 @@ class Joint {
|
|
|
203
256
|
if (fA === 0.0 && fB === 1.0)
|
|
204
257
|
curve1 = joint.curve1.clone();
|
|
205
258
|
else if (fA < fB)
|
|
206
|
-
curve1 = joint.curve1.clonePartialCurve(fA, fB);
|
|
259
|
+
curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
|
|
207
260
|
if (curve1) {
|
|
208
261
|
if (!joint.jointCurve) {
|
|
209
262
|
this.addPoint(destination, curve1.startPoint());
|
|
@@ -243,6 +296,7 @@ class Joint {
|
|
|
243
296
|
}
|
|
244
297
|
}
|
|
245
298
|
}
|
|
299
|
+
/** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */
|
|
246
300
|
static collectCurvesFromChain(start, destination, maxTest = 100) {
|
|
247
301
|
if (start === undefined)
|
|
248
302
|
return;
|
|
@@ -257,13 +311,13 @@ class Joint {
|
|
|
257
311
|
if (fA === 0.0 && fB === 1.0)
|
|
258
312
|
curve1 = joint.curve1.clone();
|
|
259
313
|
else if (fA < fB)
|
|
260
|
-
curve1 = joint.curve1.clonePartialCurve(fA, fB);
|
|
314
|
+
curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve
|
|
261
315
|
this.collectPrimitive(destination, curve1);
|
|
262
316
|
}
|
|
263
317
|
return numOut++ < maxTest;
|
|
264
318
|
}, maxTest);
|
|
265
319
|
}
|
|
266
|
-
/** Execute `joint.annotateJointMode()` at all joints on the chain. */
|
|
320
|
+
/** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */
|
|
267
321
|
static annotateChain(start, options, maxTest = 100) {
|
|
268
322
|
if (start)
|
|
269
323
|
Joint.visitJointsOnChain(start, (joint) => { joint.annotateJointMode(options); return true; }, maxTest);
|
|
@@ -271,7 +325,7 @@ class Joint {
|
|
|
271
325
|
/**
|
|
272
326
|
* Visit joints on a chain.
|
|
273
327
|
* * terminate on `false` return from `callback`
|
|
274
|
-
* @param start first (and, for cyclic chain, final)
|
|
328
|
+
* @param start first (and, for cyclic chain, final) joint
|
|
275
329
|
* @param callback function to call with each Joint as a single parameter.
|
|
276
330
|
*/
|
|
277
331
|
static visitJointsOnChain(start, callback, maxTest = 100) {
|
|
@@ -279,7 +333,7 @@ class Joint {
|
|
|
279
333
|
if (joint) {
|
|
280
334
|
let numTest = 0;
|
|
281
335
|
while (joint !== undefined) {
|
|
282
|
-
if (numTest++ >= maxTest + 5)
|
|
336
|
+
if (numTest++ >= maxTest + 5) // allow extra things to happen
|
|
283
337
|
return true;
|
|
284
338
|
if (!callback(joint))
|
|
285
339
|
return false;
|
|
@@ -295,13 +349,13 @@ class Joint {
|
|
|
295
349
|
if (this.curve0 && this.curve1) {
|
|
296
350
|
const ray0 = this.curve0.fractionToPointAndDerivative(1.0);
|
|
297
351
|
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
298
|
-
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);
|
|
352
|
+
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
299
353
|
if (intersection.approachType === CurveCurveApproachType.Intersection) {
|
|
300
354
|
if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {
|
|
301
355
|
this.fraction0 = 1.0;
|
|
302
356
|
this.fraction1 = 0.0;
|
|
303
357
|
this.flexure = JointMode.Extend;
|
|
304
|
-
const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());
|
|
358
|
+
const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines
|
|
305
359
|
if (options.needArc(theta)) {
|
|
306
360
|
const arc = Joint.constructArc(ray0, this.curve0.baseCurveEnd, ray1);
|
|
307
361
|
if (arc) {
|
|
@@ -309,13 +363,12 @@ class Joint {
|
|
|
309
363
|
return;
|
|
310
364
|
}
|
|
311
365
|
}
|
|
312
|
-
const numChamferPoints = options.numChamferPoints(theta);
|
|
313
|
-
if (numChamferPoints <= 1) {
|
|
366
|
+
const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring
|
|
367
|
+
if (numChamferPoints <= 1) { // create sharp corner
|
|
314
368
|
this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);
|
|
315
369
|
return;
|
|
316
370
|
}
|
|
317
|
-
if (numChamferPoints > 1) {
|
|
318
|
-
// A nontrivial linestring ...
|
|
371
|
+
if (numChamferPoints > 1) { // create chamfer corner (a line string)
|
|
319
372
|
const radians0 = theta.radians;
|
|
320
373
|
const numHalfStep = 2.0 * numChamferPoints;
|
|
321
374
|
const halfStepRadians = radians0 / numHalfStep;
|
|
@@ -335,19 +388,20 @@ class Joint {
|
|
|
335
388
|
}
|
|
336
389
|
}
|
|
337
390
|
}
|
|
338
|
-
//
|
|
391
|
+
// if there is no intersection between the 2 ray lines, fill the gap by a line segment
|
|
339
392
|
this.flexure = JointMode.Gap;
|
|
340
393
|
this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
|
|
341
394
|
this.fraction0 = 1.0;
|
|
342
395
|
this.fraction1 = 0.0;
|
|
343
396
|
}
|
|
344
397
|
}
|
|
345
|
-
|
|
398
|
+
/** Select the index at which summed fraction difference is smallest */
|
|
346
399
|
selectIntersectionIndexByFraction(fractionA, fractionB, intersections) {
|
|
347
400
|
let index = -1;
|
|
348
401
|
let aMin = Number.MAX_VALUE;
|
|
349
402
|
for (let i = 0; i < intersections.length; i++) {
|
|
350
|
-
const a = Math.abs(intersections[i].detailA.fraction - fractionA)
|
|
403
|
+
const a = Math.abs(intersections[i].detailA.fraction - fractionA)
|
|
404
|
+
+ Math.abs(intersections[i].detailB.fraction - fractionB);
|
|
351
405
|
if (a < aMin) {
|
|
352
406
|
aMin = a;
|
|
353
407
|
index = i;
|
|
@@ -356,42 +410,42 @@ class Joint {
|
|
|
356
410
|
return index;
|
|
357
411
|
}
|
|
358
412
|
/**
|
|
359
|
-
* Examine the adjacent geometry
|
|
360
|
-
* * set JointMode:
|
|
413
|
+
* Examine the adjacent geometry to set some of joint attributes:
|
|
414
|
+
* * set JointMode: one of Cap, Extend, or Trim
|
|
361
415
|
* * set fraction0 and fraction1 of intersection of curve0 and curve1
|
|
416
|
+
* * set joint curve
|
|
362
417
|
* * this REFERENCES curve0, curve1, fraction0, fraction1
|
|
363
418
|
* * this does not reference nextJoint and previousJoint
|
|
364
419
|
*/
|
|
365
420
|
annotateJointMode(options) {
|
|
366
|
-
if (this.curve0 &&
|
|
421
|
+
if (!this.curve0 && this.curve1) { // joint at the start of the chain
|
|
367
422
|
this.flexure = JointMode.Cap;
|
|
368
|
-
this.
|
|
423
|
+
this.fraction1 = 0.0;
|
|
369
424
|
}
|
|
370
|
-
else if (this.
|
|
425
|
+
else if (this.curve0 && !this.curve1) { // joint at the end of the chain
|
|
371
426
|
this.flexure = JointMode.Cap;
|
|
372
|
-
this.
|
|
427
|
+
this.fraction0 = 1.0;
|
|
373
428
|
}
|
|
374
|
-
else if (this.curve0 && this.curve1) {
|
|
375
|
-
|
|
376
|
-
if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {
|
|
429
|
+
else if (this.curve0 && this.curve1) { // joints at the middle of the chain
|
|
430
|
+
if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments
|
|
377
431
|
this.fraction0 = 1.0;
|
|
378
432
|
this.fraction1 = 0.0;
|
|
379
433
|
this.flexure = JointMode.Trim;
|
|
380
434
|
}
|
|
381
|
-
else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) {
|
|
382
|
-
const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
|
|
383
|
-
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
384
|
-
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);
|
|
435
|
+
else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines
|
|
436
|
+
const ray0 = this.curve0.fractionToPointAndDerivative(0.0);
|
|
437
|
+
const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
|
|
438
|
+
const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines
|
|
385
439
|
if (intersection.approachType === CurveCurveApproachType.Intersection) {
|
|
386
440
|
this.fraction0 = intersection.detailA.fraction;
|
|
387
441
|
this.fraction1 = intersection.detailB.fraction;
|
|
388
|
-
if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {
|
|
442
|
+
if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend
|
|
389
443
|
this.annotateExtension(options);
|
|
390
444
|
}
|
|
391
|
-
else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {
|
|
445
|
+
else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim
|
|
392
446
|
this.flexure = JointMode.Trim;
|
|
393
447
|
}
|
|
394
|
-
else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {
|
|
448
|
+
else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment
|
|
395
449
|
this.flexure = JointMode.Gap;
|
|
396
450
|
this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
|
|
397
451
|
this.fraction0 = 1.0;
|
|
@@ -399,15 +453,15 @@ class Joint {
|
|
|
399
453
|
}
|
|
400
454
|
}
|
|
401
455
|
}
|
|
402
|
-
else { // generic pair of curves
|
|
456
|
+
else { // generic pair of curves
|
|
403
457
|
const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);
|
|
404
458
|
const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);
|
|
405
|
-
if (intersectionIndex >= 0) {
|
|
459
|
+
if (intersectionIndex >= 0) { // need to trim
|
|
406
460
|
this.flexure = JointMode.Trim;
|
|
407
461
|
this.fraction0 = intersections[intersectionIndex].detailA.fraction;
|
|
408
462
|
this.fraction1 = intersections[intersectionIndex].detailB.fraction;
|
|
409
463
|
}
|
|
410
|
-
else {
|
|
464
|
+
else { // need to extend
|
|
411
465
|
this.annotateExtension(options);
|
|
412
466
|
}
|
|
413
467
|
}
|
|
@@ -415,7 +469,8 @@ class Joint {
|
|
|
415
469
|
}
|
|
416
470
|
/**
|
|
417
471
|
* * Examine the primitive trim fractions between each pair of joints.
|
|
418
|
-
* * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at
|
|
472
|
+
* * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at
|
|
473
|
+
* surrounding primitives
|
|
419
474
|
* @param start
|
|
420
475
|
*/
|
|
421
476
|
static removeDegeneratePrimitives(start, options, maxTest) {
|
|
@@ -450,8 +505,7 @@ class Joint {
|
|
|
450
505
|
}
|
|
451
506
|
*/
|
|
452
507
|
const eliminateF = f0 >= f1 || f0 > 1.0;
|
|
453
|
-
const eliminateG = (g0 !== undefined && g0 > 1.0)
|
|
454
|
-
|| (g0 !== undefined && g1 !== undefined && g0 >= g1);
|
|
508
|
+
const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);
|
|
455
509
|
if (eliminateF && eliminateG) {
|
|
456
510
|
const jointC = jointB.nextJoint;
|
|
457
511
|
const newJoint = new Joint(jointA.curve0, jointC.curve1, undefined);
|
|
@@ -507,9 +561,8 @@ class Joint {
|
|
|
507
561
|
* @internal
|
|
508
562
|
*/
|
|
509
563
|
class PolygonWireOffsetContext {
|
|
510
|
-
/**
|
|
511
|
-
constructor() {
|
|
512
|
-
}
|
|
564
|
+
/** Construct a context. */
|
|
565
|
+
constructor() { }
|
|
513
566
|
// Construct a single offset from base points
|
|
514
567
|
static createOffsetSegment(basePointA, basePointB, distance) {
|
|
515
568
|
Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);
|
|
@@ -522,13 +575,25 @@ class PolygonWireOffsetContext {
|
|
|
522
575
|
return undefined;
|
|
523
576
|
}
|
|
524
577
|
/**
|
|
525
|
-
* Construct
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
578
|
+
* Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in
|
|
579
|
+
* a plane parallel to xy-plane).
|
|
580
|
+
* * This is a simple wire offset (in the form of a line string), not an area.
|
|
581
|
+
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
582
|
+
* * See [[JointOptions]] class doc for offset construction rules.
|
|
583
|
+
* @param points a single loop or path
|
|
584
|
+
* @param wrap true to offset the wraparound joint. Assumes first = last point.
|
|
585
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions
|
|
586
|
+
* object.
|
|
530
587
|
*/
|
|
531
588
|
constructPolygonWireXYOffset(points, wrap, leftOffsetDistanceOrOptions) {
|
|
589
|
+
/**
|
|
590
|
+
* if "wrap = true", then first and last point in the points array must be close; otherwise
|
|
591
|
+
* generated offset will be invalid.
|
|
592
|
+
*/
|
|
593
|
+
if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {
|
|
594
|
+
wrap = false;
|
|
595
|
+
}
|
|
596
|
+
/** create raw offsets as a linked list (joint0) */
|
|
532
597
|
const options = JointOptions.create(leftOffsetDistanceOrOptions);
|
|
533
598
|
const numPoints = points.length;
|
|
534
599
|
let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);
|
|
@@ -548,7 +613,9 @@ class PolygonWireOffsetContext {
|
|
|
548
613
|
newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);
|
|
549
614
|
Joint.link(previousJoint, newJoint);
|
|
550
615
|
}
|
|
616
|
+
/** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
|
|
551
617
|
Joint.annotateChain(joint0, options, numPoints);
|
|
618
|
+
/** make limited passes through the Joint chain until no self-intersections are removed */
|
|
552
619
|
for (let pass = 0; pass++ < 5;) {
|
|
553
620
|
const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);
|
|
554
621
|
joint0 = state.newStart;
|
|
@@ -562,6 +629,7 @@ class PolygonWireOffsetContext {
|
|
|
562
629
|
*/
|
|
563
630
|
}
|
|
564
631
|
// Joint.collectPrimitivesFromChain(joint0, result, numPoints);
|
|
632
|
+
/** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */
|
|
565
633
|
const chain = LineString3d.create();
|
|
566
634
|
Joint.collectStrokesFromChain(joint0, chain, numPoints);
|
|
567
635
|
const n = chain.packedPoints.length;
|
|
@@ -585,14 +653,13 @@ export { PolygonWireOffsetContext };
|
|
|
585
653
|
*/
|
|
586
654
|
export class CurveChainWireOffsetContext {
|
|
587
655
|
/** construct a context. */
|
|
588
|
-
constructor() {
|
|
589
|
-
}
|
|
656
|
+
constructor() { }
|
|
590
657
|
/**
|
|
591
658
|
* Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.
|
|
592
|
-
*
|
|
593
|
-
* @param cp primitive to annotate
|
|
659
|
+
* @param cp curve primitive to annotate
|
|
594
660
|
* @param startPoint optional start point
|
|
595
661
|
* @param endPoint optional end point
|
|
662
|
+
* @return the input CurvePrimitive with annotations
|
|
596
663
|
*/
|
|
597
664
|
static applyBasePoints(cp, startPoint, endPoint) {
|
|
598
665
|
if (cp !== undefined) {
|
|
@@ -604,7 +671,7 @@ export class CurveChainWireOffsetContext {
|
|
|
604
671
|
return cp;
|
|
605
672
|
}
|
|
606
673
|
/**
|
|
607
|
-
* Create the offset of a single primitive.
|
|
674
|
+
* Create the offset of a single primitive as viewed in the xy-plane (ignoring z).
|
|
608
675
|
* * each primitive may be labeled (as an `any` object) with start or end point of base curve:
|
|
609
676
|
* * `(primitive as any).baseCurveStart: Point3d`
|
|
610
677
|
* * `(primitive as any).baseCurveEnd: Point3d`
|
|
@@ -628,15 +695,10 @@ export class CurveChainWireOffsetContext {
|
|
|
628
695
|
}
|
|
629
696
|
/**
|
|
630
697
|
* Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
|
|
631
|
-
* * The construction will remove "some" local effects of features smaller than the offset distance, but will
|
|
698
|
+
* * The construction will remove "some" local effects of features smaller than the offset distance, but will
|
|
699
|
+
* not detect self intersection among widely separated edges.
|
|
632
700
|
* * If offsetDistance is given as a number, default OffsetOptions are applied.
|
|
633
|
-
* *
|
|
634
|
-
* * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
|
|
635
|
-
* * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
|
|
636
|
-
* * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
|
|
637
|
-
* * outside the arc
|
|
638
|
-
* * have uniform turn angle less than `options.maxChamferDegrees`
|
|
639
|
-
* * each line segment (except first and last) touches the arc at its midpoint.
|
|
701
|
+
* * See [[JointOptions]] class doc for offset construction rules.
|
|
640
702
|
* @param curves base curves.
|
|
641
703
|
* @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
|
|
642
704
|
*/
|
|
@@ -644,14 +706,15 @@ export class CurveChainWireOffsetContext {
|
|
|
644
706
|
const wrap = curves instanceof Loop;
|
|
645
707
|
const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);
|
|
646
708
|
const simpleOffsets = [];
|
|
647
|
-
|
|
709
|
+
/** traverse primitives (children of curves) and create simple offsets of each primitive as an array */
|
|
648
710
|
for (const c of curves.children) {
|
|
649
711
|
const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);
|
|
650
712
|
if (c1 === undefined) {
|
|
651
713
|
// bad .. maybe arc to inside?
|
|
652
714
|
}
|
|
653
|
-
else if (c1 instanceof CurvePrimitive)
|
|
715
|
+
else if (c1 instanceof CurvePrimitive) {
|
|
654
716
|
simpleOffsets.push(c1);
|
|
717
|
+
}
|
|
655
718
|
else if (Array.isArray(c1)) {
|
|
656
719
|
for (const c2 of c1) {
|
|
657
720
|
if (c2 instanceof CurvePrimitive)
|
|
@@ -659,6 +722,7 @@ export class CurveChainWireOffsetContext {
|
|
|
659
722
|
}
|
|
660
723
|
}
|
|
661
724
|
}
|
|
725
|
+
/** create joints between array elements to make offsets as a linked list (joint0) */
|
|
662
726
|
let fragment0;
|
|
663
727
|
let newJoint;
|
|
664
728
|
let previousJoint;
|
|
@@ -677,8 +741,10 @@ export class CurveChainWireOffsetContext {
|
|
|
677
741
|
}
|
|
678
742
|
if (joint0 && previousJoint && curves instanceof Loop)
|
|
679
743
|
Joint.link(previousJoint, joint0);
|
|
744
|
+
/** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */
|
|
680
745
|
const numOffset = simpleOffsets.length;
|
|
681
746
|
Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);
|
|
747
|
+
/** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */
|
|
682
748
|
const outputCurves = [];
|
|
683
749
|
Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);
|
|
684
750
|
return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);
|