@itwin/core-geometry 3.5.0-dev.7 → 3.6.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -1
- package/lib/cjs/Geometry.d.ts +26 -10
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +32 -17
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +11 -5
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +47 -18
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +12 -4
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +4 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +3 -0
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +10 -4
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +17 -5
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +15 -7
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +46 -29
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +13 -4
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +23 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +4 -3
- package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js +8 -6
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +20 -18
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +58 -339
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +9 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +18 -2
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +39 -23
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +4 -0
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +5 -0
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +17 -3
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +9 -6
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +55 -47
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +66 -42
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +201 -99
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +102 -60
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +191 -106
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +67 -15
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +1 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +86 -25
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +230 -81
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +14 -4
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +15 -5
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +121 -67
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +318 -137
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +1 -2
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +1 -2
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +5 -5
- package/lib/cjs/geometry3d/Ray3d.js +5 -5
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +0 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +4 -4
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +3 -3
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +7 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +8 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +36 -8
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +112 -31
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -1
- package/lib/cjs/solid/Sphere.js +3 -3
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +17 -13
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +67 -38
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +1 -1
- package/lib/cjs/topology/Graph.js +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +9 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +26 -10
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +32 -17
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +11 -5
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +47 -18
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +12 -4
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +4 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +3 -0
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +10 -4
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +17 -5
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +15 -7
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +46 -29
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +13 -4
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +23 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +4 -3
- package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js +8 -6
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +20 -18
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +52 -333
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +8 -2
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +9 -0
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +18 -2
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +39 -23
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +9 -7
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +4 -0
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +5 -0
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +17 -3
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +9 -6
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +56 -48
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +66 -42
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +201 -99
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +102 -60
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +191 -106
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +67 -15
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +1 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +86 -25
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +230 -81
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +14 -4
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +15 -5
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +121 -67
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +318 -137
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +1 -2
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +1 -2
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +5 -5
- package/lib/esm/geometry3d/Ray3d.js +5 -5
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +0 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +4 -4
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +3 -3
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +7 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +8 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +36 -8
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +113 -32
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +4 -3
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -1
- package/lib/esm/solid/Sphere.js +3 -3
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +17 -13
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +67 -38
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +1 -1
- package/lib/esm/topology/Graph.js +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +9 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +5 -5
|
@@ -17,11 +17,20 @@ import { Angle } from "./Angle";
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export class XY {
|
|
20
|
-
constructor(x = 0, y = 0) {
|
|
20
|
+
constructor(x = 0, y = 0) {
|
|
21
|
+
this.x = x;
|
|
22
|
+
this.y = y;
|
|
23
|
+
}
|
|
21
24
|
/** Set both x and y. */
|
|
22
|
-
set(x = 0, y = 0) {
|
|
25
|
+
set(x = 0, y = 0) {
|
|
26
|
+
this.x = x;
|
|
27
|
+
this.y = y;
|
|
28
|
+
}
|
|
23
29
|
/** Set both x and y to zero */
|
|
24
|
-
setZero() {
|
|
30
|
+
setZero() {
|
|
31
|
+
this.x = 0;
|
|
32
|
+
this.y = 0;
|
|
33
|
+
}
|
|
25
34
|
/** Set both x and y from other. */
|
|
26
35
|
setFrom(other) {
|
|
27
36
|
if (other) {
|
|
@@ -34,16 +43,30 @@ export class XY {
|
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
/** Freeze this instance so it is read-only */
|
|
37
|
-
freeze() {
|
|
46
|
+
freeze() {
|
|
47
|
+
return Object.freeze(this);
|
|
48
|
+
}
|
|
38
49
|
/** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */
|
|
39
|
-
isAlmostEqual(other, tol) {
|
|
50
|
+
isAlmostEqual(other, tol) {
|
|
51
|
+
return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);
|
|
52
|
+
}
|
|
40
53
|
/** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */
|
|
41
|
-
isAlmostEqualXY(x, y, tol) {
|
|
54
|
+
isAlmostEqualXY(x, y, tol) {
|
|
55
|
+
return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);
|
|
56
|
+
}
|
|
42
57
|
/** return a json array `[x,y]` */
|
|
43
|
-
toJSON() {
|
|
58
|
+
toJSON() {
|
|
59
|
+
return [this.x, this.y];
|
|
60
|
+
}
|
|
44
61
|
/** return a json object `{x: 1, y:2}` */
|
|
45
|
-
toJSONXY() {
|
|
46
|
-
|
|
62
|
+
toJSONXY() {
|
|
63
|
+
return { x: this.x, y: this.y };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
|
|
67
|
+
* * If no JSON input is provided, 0 would be used as default values for x and y.
|
|
68
|
+
* @param json the JSON input
|
|
69
|
+
* */
|
|
47
70
|
setFromJSON(json) {
|
|
48
71
|
if (Array.isArray(json)) {
|
|
49
72
|
this.set(json[0] || 0, json[1] || 0);
|
|
@@ -59,39 +82,76 @@ export class XY {
|
|
|
59
82
|
distance(other) {
|
|
60
83
|
const xDist = other.x - this.x;
|
|
61
84
|
const yDist = other.y - this.y;
|
|
62
|
-
return
|
|
85
|
+
return Math.sqrt(xDist * xDist + yDist * yDist);
|
|
63
86
|
}
|
|
64
87
|
/** Return squared distance from this point to other */
|
|
65
88
|
distanceSquared(other) {
|
|
66
89
|
const xDist = other.x - this.x;
|
|
67
90
|
const yDist = other.y - this.y;
|
|
68
|
-
return
|
|
91
|
+
return xDist * xDist + yDist * yDist;
|
|
69
92
|
}
|
|
70
93
|
/** Return the largest absolute distance between corresponding components */
|
|
71
94
|
maxDiff(other) {
|
|
72
95
|
return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));
|
|
73
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Return the x,y component corresponding to 0,1.
|
|
99
|
+
*/
|
|
100
|
+
at(index) {
|
|
101
|
+
if (index < 0.5)
|
|
102
|
+
return this.x;
|
|
103
|
+
return this.y;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Set value at index 0 or 1.
|
|
107
|
+
*/
|
|
108
|
+
setAt(index, value) {
|
|
109
|
+
if (index < 0.5)
|
|
110
|
+
this.x = value;
|
|
111
|
+
else
|
|
112
|
+
this.y = value;
|
|
113
|
+
}
|
|
114
|
+
/** Return the index (0,1) of the x,y component with largest absolute value */
|
|
115
|
+
indexOfMaxAbs() {
|
|
116
|
+
let index = 0;
|
|
117
|
+
const a = Math.abs(this.x);
|
|
118
|
+
const b = Math.abs(this.y);
|
|
119
|
+
if (b > a) {
|
|
120
|
+
index = 1;
|
|
121
|
+
}
|
|
122
|
+
return index;
|
|
123
|
+
}
|
|
74
124
|
/** returns true if the x,y components are both small by metric metric tolerance */
|
|
75
125
|
get isAlmostZero() {
|
|
76
126
|
return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);
|
|
77
127
|
}
|
|
78
128
|
/** Return the largest absolute value of any component */
|
|
79
|
-
maxAbs() {
|
|
129
|
+
maxAbs() {
|
|
130
|
+
return Math.max(Math.abs(this.x), Math.abs(this.y));
|
|
131
|
+
}
|
|
80
132
|
/** Return the magnitude of the vector */
|
|
81
|
-
magnitude() {
|
|
133
|
+
magnitude() {
|
|
134
|
+
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
135
|
+
}
|
|
82
136
|
/** Return the squared magnitude of the vector. */
|
|
83
|
-
magnitudeSquared() {
|
|
137
|
+
magnitudeSquared() {
|
|
138
|
+
return this.x * this.x + this.y * this.y;
|
|
139
|
+
}
|
|
84
140
|
/** returns true if the x,y components are exactly equal. */
|
|
85
|
-
isExactEqual(other) {
|
|
141
|
+
isExactEqual(other) {
|
|
142
|
+
return this.x === other.x && this.y === other.y;
|
|
143
|
+
}
|
|
86
144
|
/** returns true if x,y match `other` within metric tolerance */
|
|
87
|
-
isAlmostEqualMetric(other
|
|
145
|
+
isAlmostEqualMetric(other, distanceTol = Geometry.smallMetricDistance) {
|
|
146
|
+
return this.maxDiff(other) <= distanceTol;
|
|
147
|
+
}
|
|
88
148
|
/** Return a (full length) vector from this point to other */
|
|
89
149
|
vectorTo(other, result) {
|
|
90
150
|
return Vector2d.create(other.x - this.x, other.y - this.y, result);
|
|
91
151
|
}
|
|
92
152
|
/** Return a unit vector from this point to other */
|
|
93
|
-
unitVectorTo(
|
|
94
|
-
return this.vectorTo(
|
|
153
|
+
unitVectorTo(other, result) {
|
|
154
|
+
return this.vectorTo(other, result).normalize(result);
|
|
95
155
|
}
|
|
96
156
|
/** cross product of vectors from origin to targets */
|
|
97
157
|
static crossProductToPoints(origin, targetA, targetB) {
|
|
@@ -103,9 +163,13 @@ export class XY {
|
|
|
103
163
|
*/
|
|
104
164
|
export class Point2d extends XY {
|
|
105
165
|
/** Constructor for Point2d */
|
|
106
|
-
constructor(x = 0, y = 0) {
|
|
166
|
+
constructor(x = 0, y = 0) {
|
|
167
|
+
super(x, y);
|
|
168
|
+
}
|
|
107
169
|
/** return a new Point2d with x,y coordinates from this. */
|
|
108
|
-
clone(result) {
|
|
170
|
+
clone(result) {
|
|
171
|
+
return Point2d.create(this.x, this.y, result);
|
|
172
|
+
}
|
|
109
173
|
/**
|
|
110
174
|
* Return a point (newly created unless result provided) with given x,y coordinates
|
|
111
175
|
* @param x x coordinate
|
|
@@ -120,8 +184,16 @@ export class Point2d extends XY {
|
|
|
120
184
|
}
|
|
121
185
|
return new Point2d(x, y);
|
|
122
186
|
}
|
|
123
|
-
/**
|
|
124
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
|
|
189
|
+
* * If no JSON input is provided, 0 would be used as default values for x and y.
|
|
190
|
+
* @param json the JSON input
|
|
191
|
+
* */
|
|
192
|
+
static fromJSON(json) {
|
|
193
|
+
const val = new Point2d();
|
|
194
|
+
val.setFromJSON(json);
|
|
195
|
+
return val;
|
|
196
|
+
}
|
|
125
197
|
/** Create (or optionally reuse) a Point2d from another object with fields x and y */
|
|
126
198
|
static createFrom(xy, result) {
|
|
127
199
|
if (xy)
|
|
@@ -129,19 +201,22 @@ export class Point2d extends XY {
|
|
|
129
201
|
return Point2d.create(0, 0, result);
|
|
130
202
|
}
|
|
131
203
|
/** Create a Point2d with both coordinates zero. */
|
|
132
|
-
static createZero(result) {
|
|
133
|
-
|
|
134
|
-
|
|
204
|
+
static createZero(result) {
|
|
205
|
+
return Point2d.create(0, 0, result);
|
|
206
|
+
}
|
|
207
|
+
/** Starting at this point, move along vector by tangentFraction of the vector length, and then
|
|
208
|
+
* to the left by leftFraction of the perpendicular vector length.
|
|
135
209
|
* @param tangentFraction distance to move along the vector, as a fraction of vector
|
|
136
210
|
* @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector
|
|
211
|
+
* @param vector the other vector
|
|
137
212
|
*/
|
|
138
213
|
addForwardLeft(tangentFraction, leftFraction, vector) {
|
|
139
214
|
const dx = vector.x;
|
|
140
215
|
const dy = vector.y;
|
|
141
216
|
return Point2d.create(this.x + tangentFraction * dx - leftFraction * dy, this.y + tangentFraction * dy + leftFraction * dx);
|
|
142
217
|
}
|
|
143
|
-
/** Interpolate at tangentFraction between this instance and point
|
|
144
|
-
* of the vector between the points.
|
|
218
|
+
/** Interpolate at tangentFraction between this instance and point, and then Move by leftFraction
|
|
219
|
+
* along the xy perpendicular of the vector between the points.
|
|
145
220
|
*/
|
|
146
221
|
forwardLeftInterpolate(tangentFraction, leftFraction, point) {
|
|
147
222
|
const dx = point.x - this.x;
|
|
@@ -189,10 +264,13 @@ export class Point2d extends XY {
|
|
|
189
264
|
* @param targetB target of second vector
|
|
190
265
|
*/
|
|
191
266
|
dotVectorsToTargets(targetA, targetB) {
|
|
192
|
-
return (targetA.x - this.x) * (targetB.x - this.x) +
|
|
193
|
-
(targetA.y - this.y) * (targetB.y - this.y);
|
|
267
|
+
return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);
|
|
194
268
|
}
|
|
195
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB
|
|
271
|
+
* @param target1 target of first vector
|
|
272
|
+
* @param target2 target of second vector
|
|
273
|
+
*/
|
|
196
274
|
crossProductToPoints(target1, target2) {
|
|
197
275
|
const x1 = target1.x - this.x;
|
|
198
276
|
const y1 = target1.y - this.y;
|
|
@@ -200,25 +278,31 @@ export class Point2d extends XY {
|
|
|
200
278
|
const y2 = target2.y - this.y;
|
|
201
279
|
return x1 * y2 - y1 * x2;
|
|
202
280
|
}
|
|
203
|
-
/** Return the fractional coordinate of the projection of this instance x,y onto the
|
|
281
|
+
/** Return the fractional coordinate of the projection of this instance x,y onto the
|
|
282
|
+
* line from startPoint to endPoint.
|
|
204
283
|
* @param startPoint start point of line
|
|
205
284
|
* @param endPoint end point of line
|
|
206
285
|
* @param defaultFraction fraction to return if startPoint and endPoint are equal.
|
|
207
286
|
*/
|
|
208
|
-
fractionOfProjectionToLine(startPoint, endPoint, defaultFraction) {
|
|
287
|
+
fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
|
|
209
288
|
const denominator = startPoint.distanceSquared(endPoint);
|
|
210
289
|
if (denominator < Geometry.smallMetricDistanceSquared)
|
|
211
|
-
return defaultFraction
|
|
212
|
-
|
|
290
|
+
return defaultFraction;
|
|
291
|
+
const numerator = startPoint.dotVectorsToTargets(endPoint, this);
|
|
292
|
+
return numerator / denominator;
|
|
213
293
|
}
|
|
214
294
|
}
|
|
215
295
|
/** 2D vector with `x`,`y` as properties
|
|
216
296
|
* @public
|
|
217
297
|
*/
|
|
218
298
|
export class Vector2d extends XY {
|
|
219
|
-
constructor(x = 0, y = 0) {
|
|
299
|
+
constructor(x = 0, y = 0) {
|
|
300
|
+
super(x, y);
|
|
301
|
+
}
|
|
220
302
|
/** Return a new Vector2d with the same x,y */
|
|
221
|
-
clone(result) {
|
|
303
|
+
clone(result) {
|
|
304
|
+
return Vector2d.create(this.x, this.y, result);
|
|
305
|
+
}
|
|
222
306
|
/** Return a new Vector2d with given x and y */
|
|
223
307
|
static create(x = 0, y = 0, result) {
|
|
224
308
|
if (result) {
|
|
@@ -228,12 +312,24 @@ export class Vector2d extends XY {
|
|
|
228
312
|
}
|
|
229
313
|
return new Vector2d(x, y);
|
|
230
314
|
}
|
|
231
|
-
/**
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
315
|
+
/**
|
|
316
|
+
* Return a (new) Vector2d with components scale,0
|
|
317
|
+
* If scale is not given default value 1 is used.
|
|
318
|
+
*/
|
|
319
|
+
static unitX(scale = 1) {
|
|
320
|
+
return new Vector2d(scale, 0);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Return a (new) Vector2d with components 0,scale
|
|
324
|
+
* If scale is not given default value 1 is used.
|
|
325
|
+
*/
|
|
326
|
+
static unitY(scale = 1) {
|
|
327
|
+
return new Vector2d(0, scale);
|
|
328
|
+
}
|
|
235
329
|
/** Return a Vector2d with components 0,0 */
|
|
236
|
-
static createZero(result) {
|
|
330
|
+
static createZero(result) {
|
|
331
|
+
return Vector2d.create(0, 0, result);
|
|
332
|
+
}
|
|
237
333
|
/** copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */
|
|
238
334
|
static createFrom(data, result) {
|
|
239
335
|
if (data instanceof Float64Array) {
|
|
@@ -245,8 +341,16 @@ export class Vector2d extends XY {
|
|
|
245
341
|
}
|
|
246
342
|
return Vector2d.create(data.x, data.y, result);
|
|
247
343
|
}
|
|
248
|
-
/**
|
|
249
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
|
|
346
|
+
* * If no JSON input is provided, 0 would be used as default values for x and y.
|
|
347
|
+
* @param json the JSON input
|
|
348
|
+
* */
|
|
349
|
+
static fromJSON(json) {
|
|
350
|
+
const val = new Vector2d();
|
|
351
|
+
val.setFromJSON(json);
|
|
352
|
+
return val;
|
|
353
|
+
}
|
|
250
354
|
/** Return a new Vector2d from polar coordinates for radius and Angle from x axis */
|
|
251
355
|
static createPolar(r, theta) {
|
|
252
356
|
return Vector2d.create(r * theta.cos(), r * theta.sin());
|
|
@@ -257,6 +361,7 @@ export class Vector2d extends XY {
|
|
|
257
361
|
}
|
|
258
362
|
/**
|
|
259
363
|
* Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines
|
|
364
|
+
* * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)
|
|
260
365
|
* @param unitPerpA unit perpendicular to incoming direction
|
|
261
366
|
* @param unitPerpB unit perpendicular to outgoing direction
|
|
262
367
|
* @param offset offset distance
|
|
@@ -265,12 +370,13 @@ export class Vector2d extends XY {
|
|
|
265
370
|
let bisector = unitPerpA.plus(unitPerpB);
|
|
266
371
|
bisector = bisector.normalize();
|
|
267
372
|
if (bisector) {
|
|
268
|
-
const c =
|
|
373
|
+
const c = bisector.dotProduct(unitPerpA);
|
|
374
|
+
bisector.scale(offset, bisector);
|
|
269
375
|
return bisector.safeDivideOrNull(c);
|
|
270
376
|
}
|
|
271
377
|
return undefined;
|
|
272
378
|
}
|
|
273
|
-
/** Return a (new or optionally reused) vector which is `this` divided by denominator
|
|
379
|
+
/** Return a (new or optionally reused) vector which is `this` divided by `denominator`
|
|
274
380
|
* * return undefined if denominator is zero.
|
|
275
381
|
*/
|
|
276
382
|
safeDivideOrNull(denominator, result) {
|
|
@@ -285,12 +391,22 @@ export class Vector2d extends XY {
|
|
|
285
391
|
result = result ? result : new Vector2d();
|
|
286
392
|
return this.safeDivideOrNull(mag, result);
|
|
287
393
|
}
|
|
288
|
-
/**
|
|
394
|
+
/**
|
|
395
|
+
* Return fractional projection of target vector onto this
|
|
396
|
+
* * It's returning the signed projection magnitude divided by the target magnitude. In other words,
|
|
397
|
+
* it's returning the length of the projection as a fraction of the target magnitude.
|
|
398
|
+
* @param target the target vector
|
|
399
|
+
* @param defaultFraction the returned value in case magnitude square of target vector is very small
|
|
400
|
+
* */
|
|
289
401
|
fractionOfProjectionToVector(target, defaultFraction) {
|
|
290
|
-
|
|
402
|
+
/*
|
|
403
|
+
* projection length is (this.target)/||target||
|
|
404
|
+
* but here we return (this.target)/||target||^2
|
|
405
|
+
*/
|
|
291
406
|
const denominator = target.magnitudeSquared();
|
|
292
407
|
if (denominator < Geometry.smallMetricDistanceSquared)
|
|
293
408
|
return defaultFraction ? defaultFraction : 0;
|
|
409
|
+
const numerator = this.dotProduct(target);
|
|
294
410
|
return numerator / denominator;
|
|
295
411
|
}
|
|
296
412
|
/** Return a new vector with components negated from this instance. */
|
|
@@ -303,7 +419,7 @@ export class Vector2d extends XY {
|
|
|
303
419
|
/** Return a vector same length as this but rotated 90 degrees counter clockwise */
|
|
304
420
|
rotate90CCWXY(result) {
|
|
305
421
|
result = result ? result : new Vector2d();
|
|
306
|
-
// save x,y to allow aliasing
|
|
422
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
307
423
|
const xx = this.x;
|
|
308
424
|
const yy = this.y;
|
|
309
425
|
result.x = -yy;
|
|
@@ -313,7 +429,7 @@ export class Vector2d extends XY {
|
|
|
313
429
|
/** Return a vector same length as this but rotated 90 degrees clockwise */
|
|
314
430
|
rotate90CWXY(result) {
|
|
315
431
|
result = result ? result : new Vector2d();
|
|
316
|
-
// save x,y to allow aliasing
|
|
432
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
317
433
|
const xx = this.x;
|
|
318
434
|
const yy = this.y;
|
|
319
435
|
result.x = yy;
|
|
@@ -325,6 +441,7 @@ export class Vector2d extends XY {
|
|
|
325
441
|
result = result ? result : new Vector2d();
|
|
326
442
|
const xx = this.x;
|
|
327
443
|
const yy = this.y;
|
|
444
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
328
445
|
result.x = -yy;
|
|
329
446
|
result.y = xx;
|
|
330
447
|
const d2 = xx * xx + yy * yy;
|
|
@@ -339,6 +456,7 @@ export class Vector2d extends XY {
|
|
|
339
456
|
rotateXY(angle, result) {
|
|
340
457
|
const s = angle.sin();
|
|
341
458
|
const c = angle.cos();
|
|
459
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
342
460
|
const xx = this.x;
|
|
343
461
|
const yy = this.y;
|
|
344
462
|
result = result ? result : new Vector2d();
|
|
@@ -346,18 +464,26 @@ export class Vector2d extends XY {
|
|
|
346
464
|
result.y = xx * s + yy * c;
|
|
347
465
|
return result;
|
|
348
466
|
}
|
|
349
|
-
/**
|
|
350
|
-
|
|
467
|
+
/** Return a vector computed at fractional position between this vector and vectorB
|
|
468
|
+
* @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
|
|
469
|
+
* True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
|
|
470
|
+
* @param vectorB second vector
|
|
471
|
+
* @param result optional preallocated result.
|
|
472
|
+
*/
|
|
473
|
+
interpolate(fraction, vectorB, result) {
|
|
351
474
|
result = result ? result : new Vector2d();
|
|
352
|
-
/*
|
|
475
|
+
/*
|
|
476
|
+
* For best last-bit behavior, if fraction is below 0.5, use this as base point.
|
|
477
|
+
* If above 0.5, use vectorB as base point.
|
|
478
|
+
*/
|
|
353
479
|
if (fraction <= 0.5) {
|
|
354
|
-
result.x = this.x + fraction * (
|
|
355
|
-
result.y = this.y + fraction * (
|
|
480
|
+
result.x = this.x + fraction * (vectorB.x - this.x);
|
|
481
|
+
result.y = this.y + fraction * (vectorB.y - this.y);
|
|
356
482
|
}
|
|
357
483
|
else {
|
|
358
484
|
const t = fraction - 1.0;
|
|
359
|
-
result.x =
|
|
360
|
-
result.y =
|
|
485
|
+
result.x = vectorB.x + t * (vectorB.x - this.x);
|
|
486
|
+
result.y = vectorB.y + t * (vectorB.y - this.y);
|
|
361
487
|
}
|
|
362
488
|
return result;
|
|
363
489
|
}
|
|
@@ -411,36 +537,47 @@ export class Vector2d extends XY {
|
|
|
411
537
|
return this.scale(length / mag, result);
|
|
412
538
|
}
|
|
413
539
|
/** return the dot product of this with vectorB */
|
|
414
|
-
dotProduct(vectorB) {
|
|
540
|
+
dotProduct(vectorB) {
|
|
541
|
+
return this.x * vectorB.x + this.y * vectorB.y;
|
|
542
|
+
}
|
|
415
543
|
/** dot product with vector from pointA to pointB */
|
|
416
544
|
dotProductStartEnd(pointA, pointB) {
|
|
417
|
-
return this.x * (pointB.x - pointA.x)
|
|
418
|
-
+ this.y * (pointB.y - pointA.y);
|
|
545
|
+
return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);
|
|
419
546
|
}
|
|
420
547
|
/** vector cross product {this CROSS vectorB} */
|
|
421
|
-
crossProduct(vectorB) {
|
|
422
|
-
|
|
548
|
+
crossProduct(vectorB) {
|
|
549
|
+
return this.x * vectorB.y - this.y * vectorB.x;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.
|
|
553
|
+
* This is positive if the shortest turn is counterclockwise, negative if clockwise.
|
|
554
|
+
*/
|
|
555
|
+
radiansTo(vectorB) {
|
|
556
|
+
return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* return the (strongly typed) signed angle from this to vectorB.
|
|
560
|
+
* This is positive if the shortest turn is counterclockwise, negative if clockwise.
|
|
561
|
+
*/
|
|
423
562
|
angleTo(vectorB) {
|
|
424
|
-
return Angle.
|
|
425
|
-
}
|
|
426
|
-
/* smallerUnorientedAngleTo(vectorB: Vector2d): Angle { }
|
|
427
|
-
signedAngleTo(vectorB: Vector2d, upVector: Vector2d): Angle { }
|
|
428
|
-
planarAngleTo(vectorB: Vector2d, planeNormal: Vector2d): Angle { }
|
|
429
|
-
// sectors
|
|
430
|
-
isInSmallerSector(vectorA: Vector2d, vectorB: Vector2d): boolean { }
|
|
431
|
-
isInCCWSector(vectorA: Vector2d, vectorB: Vector2d, upVector: Vector2d): boolean { }
|
|
432
|
-
*/
|
|
563
|
+
return Angle.createRadians(this.radiansTo(vectorB));
|
|
564
|
+
}
|
|
433
565
|
/**
|
|
434
|
-
* Test if
|
|
566
|
+
* Test if this vector is parallel to other.
|
|
567
|
+
* * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
|
|
568
|
+
* so if you have a distance or angle tolerance t, you should pass in t * t.
|
|
435
569
|
* @param other second vector for comparison.
|
|
436
|
-
* @param oppositeIsParallel
|
|
570
|
+
* @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.
|
|
571
|
+
* @param options optional radian and distance tolerances.
|
|
437
572
|
*/
|
|
438
|
-
isParallelTo(other, oppositeIsParallel = false) {
|
|
573
|
+
isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
|
|
574
|
+
var _a, _b;
|
|
575
|
+
const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
|
|
576
|
+
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
|
|
439
577
|
const a2 = this.magnitudeSquared();
|
|
440
578
|
const b2 = other.magnitudeSquared();
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
return false;
|
|
579
|
+
if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
|
|
580
|
+
return returnValueIfAnInputIsZeroLength;
|
|
444
581
|
const dot = this.dotProduct(other);
|
|
445
582
|
if (dot < 0.0 && !oppositeIsParallel)
|
|
446
583
|
return false;
|
|
@@ -448,14 +585,26 @@ export class Vector2d extends XY {
|
|
|
448
585
|
/* a2,b2,cross2 are squared lengths of respective vectors */
|
|
449
586
|
/* cross2 = sin^2(theta) * a2 * b2 */
|
|
450
587
|
/* For small theta, sin^2(theta)~~theta^2 */
|
|
451
|
-
return cross * cross <=
|
|
588
|
+
return cross * cross <= radianSquaredTol * a2 * b2;
|
|
452
589
|
}
|
|
453
590
|
/**
|
|
454
|
-
*
|
|
455
|
-
*
|
|
591
|
+
* Test if this vector is perpendicular to other.
|
|
592
|
+
* * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
|
|
593
|
+
* so if you have a distance or angle tolerance t, you should pass in t * t.
|
|
594
|
+
* @param other second vector in comparison.
|
|
595
|
+
* @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
|
|
596
|
+
* @param options optional radian and distance tolerances.
|
|
456
597
|
*/
|
|
457
|
-
isPerpendicularTo(other) {
|
|
458
|
-
|
|
598
|
+
isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
|
|
599
|
+
var _a, _b;
|
|
600
|
+
const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
|
|
601
|
+
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
|
|
602
|
+
const aa = this.magnitudeSquared();
|
|
603
|
+
const bb = other.magnitudeSquared();
|
|
604
|
+
if (aa < distanceSquaredTol || bb < distanceSquaredTol)
|
|
605
|
+
return returnValueIfAnInputIsZeroLength;
|
|
606
|
+
const ab = this.dotProduct(other);
|
|
607
|
+
return ab * ab <= radianSquaredTol * aa * bb;
|
|
459
608
|
}
|
|
460
609
|
}
|
|
461
610
|
//# sourceMappingURL=Point2dVector2d.js.map
|