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