@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
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module CartesianGeometry
|
|
7
7
|
*/
|
|
8
|
+
// cspell:word CWXY
|
|
8
9
|
import { Geometry } from "../Geometry";
|
|
9
10
|
import { Angle } from "./Angle";
|
|
10
11
|
import { XYAndZ } from "./XYZProps";
|
|
@@ -17,24 +18,42 @@ import { XYAndZ } from "./XYZProps";
|
|
|
17
18
|
* @public
|
|
18
19
|
*/
|
|
19
20
|
export class XYZ {
|
|
20
|
-
constructor(x = 0, y = 0, z = 0) {
|
|
21
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
22
|
+
this.x = x;
|
|
23
|
+
this.y = y;
|
|
24
|
+
this.z = z;
|
|
25
|
+
}
|
|
21
26
|
/**
|
|
22
27
|
* Set the x,y,z parts.
|
|
23
28
|
* @param x (optional) x part
|
|
24
29
|
* @param y (optional) y part
|
|
25
30
|
* @param z (optional) z part
|
|
26
31
|
*/
|
|
27
|
-
set(x = 0, y = 0, z = 0) {
|
|
32
|
+
set(x = 0, y = 0, z = 0) {
|
|
33
|
+
this.x = x;
|
|
34
|
+
this.y = y;
|
|
35
|
+
this.z = z;
|
|
36
|
+
}
|
|
28
37
|
/** Set the x,y,z parts to zero. */
|
|
29
|
-
setZero() {
|
|
38
|
+
setZero() {
|
|
39
|
+
this.x = 0;
|
|
40
|
+
this.y = 0;
|
|
41
|
+
this.z = 0;
|
|
42
|
+
}
|
|
30
43
|
/** Type guard for XAndY.
|
|
31
44
|
* @note this will return true for an XYAndZ. If you wish to distinguish between the two, call isXYAndZ first.
|
|
32
45
|
*/
|
|
33
|
-
static isXAndY(arg) {
|
|
46
|
+
static isXAndY(arg) {
|
|
47
|
+
return arg.x !== undefined && arg.y !== undefined;
|
|
48
|
+
}
|
|
34
49
|
/** Type guard to determine whether an object has a member called "z" */
|
|
35
|
-
static hasZ(arg) {
|
|
50
|
+
static hasZ(arg) {
|
|
51
|
+
return arg.z !== undefined;
|
|
52
|
+
}
|
|
36
53
|
/** Type guard for XYAndZ. */
|
|
37
|
-
static isXYAndZ(arg) {
|
|
54
|
+
static isXYAndZ(arg) {
|
|
55
|
+
return this.isXAndY(arg) && this.hasZ(arg);
|
|
56
|
+
}
|
|
38
57
|
/** Test if arg is any of:
|
|
39
58
|
* * XAndY
|
|
40
59
|
* * XYAndZ
|
|
@@ -117,6 +136,7 @@ export class XYZ {
|
|
|
117
136
|
/**
|
|
118
137
|
* Set the x,y,z parts from a Vector3d
|
|
119
138
|
* This is the same effect as `setFrom(other)` with no pretesting of variant input type
|
|
139
|
+
* * Set to zeros if `other` is undefined.
|
|
120
140
|
*/
|
|
121
141
|
setFromVector3d(other) {
|
|
122
142
|
if (other) {
|
|
@@ -147,13 +167,21 @@ export class XYZ {
|
|
|
147
167
|
&& Geometry.isSameCoordinate(this.y, other.y, tol);
|
|
148
168
|
}
|
|
149
169
|
/** Return a JSON object as array `[x,y,z]` */
|
|
150
|
-
toJSON() {
|
|
170
|
+
toJSON() {
|
|
171
|
+
return this.toArray();
|
|
172
|
+
}
|
|
151
173
|
/** Return as an array `[x,y,z]` */
|
|
152
|
-
toArray() {
|
|
174
|
+
toArray() {
|
|
175
|
+
return [this.x, this.y, this.z];
|
|
176
|
+
}
|
|
153
177
|
/** Return a JSON object as key value pairs `{x: value, y: value, z: value}` */
|
|
154
|
-
toJSONXYZ() {
|
|
178
|
+
toJSONXYZ() {
|
|
179
|
+
return { x: this.x, y: this.y, z: this.z };
|
|
180
|
+
}
|
|
155
181
|
/** Pack the x,y,z values in a Float64Array. */
|
|
156
|
-
toFloat64Array() {
|
|
182
|
+
toFloat64Array() {
|
|
183
|
+
return Float64Array.of(this.x, this.y, this.z);
|
|
184
|
+
}
|
|
157
185
|
/**
|
|
158
186
|
* Set the x,y,z properties from one of several json forms:
|
|
159
187
|
*
|
|
@@ -212,7 +240,7 @@ export class XYZ {
|
|
|
212
240
|
return this.y;
|
|
213
241
|
}
|
|
214
242
|
/**
|
|
215
|
-
*
|
|
243
|
+
* Set value at index 0 or 1 or 2.
|
|
216
244
|
*/
|
|
217
245
|
setAt(index, value) {
|
|
218
246
|
if (index < 0.5)
|
|
@@ -239,28 +267,54 @@ export class XYZ {
|
|
|
239
267
|
}
|
|
240
268
|
/** Return true if the x,y,z components are all nearly zero to tolerance Geometry.smallMetricDistance */
|
|
241
269
|
get isAlmostZero() {
|
|
242
|
-
return Geometry.isSmallMetricDistance(this.x) &&
|
|
270
|
+
return Geometry.isSmallMetricDistance(this.x) &&
|
|
271
|
+
Geometry.isSmallMetricDistance(this.y) &&
|
|
272
|
+
Geometry.isSmallMetricDistance(this.z);
|
|
243
273
|
}
|
|
244
274
|
/** Return true if the x,y,z components are all exactly zero */
|
|
245
|
-
get isZero() {
|
|
275
|
+
get isZero() {
|
|
276
|
+
return this.x === 0.0 && this.y === 0.0 && this.z === 0.0;
|
|
277
|
+
}
|
|
246
278
|
/** Return the largest absolute value of any component */
|
|
247
|
-
maxAbs() {
|
|
279
|
+
maxAbs() {
|
|
280
|
+
return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));
|
|
281
|
+
}
|
|
248
282
|
/** Return the sqrt of the sum of squared x,y,z parts */
|
|
249
|
-
magnitude() {
|
|
283
|
+
magnitude() {
|
|
284
|
+
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
285
|
+
}
|
|
250
286
|
/** Return the sum of squared x,y,z parts */
|
|
251
|
-
magnitudeSquared() {
|
|
287
|
+
magnitudeSquared() {
|
|
288
|
+
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
289
|
+
}
|
|
252
290
|
/** Return sqrt of the sum of squared x,y parts */
|
|
253
|
-
magnitudeXY() {
|
|
291
|
+
magnitudeXY() {
|
|
292
|
+
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
293
|
+
}
|
|
254
294
|
/** Return the sum of squared x,y parts */
|
|
255
|
-
magnitudeSquaredXY() {
|
|
295
|
+
magnitudeSquaredXY() {
|
|
296
|
+
return this.x * this.x + this.y * this.y;
|
|
297
|
+
}
|
|
256
298
|
/** exact equality test. */
|
|
257
|
-
isExactEqual(other) {
|
|
299
|
+
isExactEqual(other) {
|
|
300
|
+
return this.x === other.x && this.y === other.y && this.z === other.z;
|
|
301
|
+
}
|
|
258
302
|
/** equality test with Geometry.smallMetricDistance tolerance */
|
|
259
|
-
isAlmostEqualMetric(other) {
|
|
303
|
+
isAlmostEqualMetric(other) {
|
|
304
|
+
return this.maxDiff(other) <= Geometry.smallMetricDistance;
|
|
305
|
+
}
|
|
260
306
|
/** add x,y,z from other in place. */
|
|
261
|
-
addInPlace(other) {
|
|
307
|
+
addInPlace(other) {
|
|
308
|
+
this.x += other.x;
|
|
309
|
+
this.y += other.y;
|
|
310
|
+
this.z += other.z;
|
|
311
|
+
}
|
|
262
312
|
/** add x,y,z from other in place. */
|
|
263
|
-
subtractInPlace(other) {
|
|
313
|
+
subtractInPlace(other) {
|
|
314
|
+
this.x -= other.x;
|
|
315
|
+
this.y -= other.y;
|
|
316
|
+
this.z -= other.z;
|
|
317
|
+
}
|
|
264
318
|
/** add (in place) the scaled x,y,z of other */
|
|
265
319
|
addScaledInPlace(other, scale) {
|
|
266
320
|
this.x += scale * other.x;
|
|
@@ -268,11 +322,21 @@ export class XYZ {
|
|
|
268
322
|
this.z += scale * other.z;
|
|
269
323
|
}
|
|
270
324
|
/** Multiply the x, y, z parts by scale. */
|
|
271
|
-
scaleInPlace(scale) {
|
|
325
|
+
scaleInPlace(scale) {
|
|
326
|
+
this.x *= scale;
|
|
327
|
+
this.y *= scale;
|
|
328
|
+
this.z *= scale;
|
|
329
|
+
}
|
|
272
330
|
/** add to x, y, z parts */
|
|
273
|
-
addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) {
|
|
331
|
+
addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) {
|
|
332
|
+
this.x += dx;
|
|
333
|
+
this.y += dy;
|
|
334
|
+
this.z += dz;
|
|
335
|
+
}
|
|
274
336
|
/** Clone strongly typed as Point3d */
|
|
275
|
-
cloneAsPoint3d() {
|
|
337
|
+
cloneAsPoint3d() {
|
|
338
|
+
return Point3d.create(this.x, this.y, this.z);
|
|
339
|
+
}
|
|
276
340
|
/** Return a (full length) vector from this point to other */
|
|
277
341
|
vectorTo(other, result) {
|
|
278
342
|
return Vector3d.create(other.x - this.x, other.y - this.y, other.z - this.z, result);
|
|
@@ -285,9 +349,13 @@ export class XYZ {
|
|
|
285
349
|
* @param other target of created vector.
|
|
286
350
|
* @param result optional result vector.
|
|
287
351
|
*/
|
|
288
|
-
unitVectorTo(target, result) {
|
|
352
|
+
unitVectorTo(target, result) {
|
|
353
|
+
return this.vectorTo(target, result).normalize(result);
|
|
354
|
+
}
|
|
289
355
|
/** Freeze this XYZ */
|
|
290
|
-
freeze() {
|
|
356
|
+
freeze() {
|
|
357
|
+
return Object.freeze(this);
|
|
358
|
+
}
|
|
291
359
|
/** access x part of XYZProps (which may be .x or [0]) */
|
|
292
360
|
static x(xyz, defaultValue = 0) {
|
|
293
361
|
if (xyz === undefined)
|
|
@@ -324,7 +392,9 @@ export class XYZ {
|
|
|
324
392
|
*/
|
|
325
393
|
export class Point3d extends XYZ {
|
|
326
394
|
/** Constructor for Point3d */
|
|
327
|
-
constructor(x = 0, y = 0, z = 0) {
|
|
395
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
396
|
+
super(x, y, z);
|
|
397
|
+
}
|
|
328
398
|
/**
|
|
329
399
|
* Convert json to Point3d. Accepted forms are:
|
|
330
400
|
* * `[1,2,3]` --- array of numbers
|
|
@@ -332,9 +402,15 @@ export class Point3d extends XYZ {
|
|
|
332
402
|
* * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
|
|
333
403
|
* @param json json value.
|
|
334
404
|
*/
|
|
335
|
-
static fromJSON(json) {
|
|
405
|
+
static fromJSON(json) {
|
|
406
|
+
const val = new Point3d();
|
|
407
|
+
val.setFromJSON(json);
|
|
408
|
+
return val;
|
|
409
|
+
}
|
|
336
410
|
/** Return a new Point3d with the same coordinates */
|
|
337
|
-
clone(result) {
|
|
411
|
+
clone(result) {
|
|
412
|
+
return Point3d.create(this.x, this.y, this.z, result);
|
|
413
|
+
}
|
|
338
414
|
/** Create a new Point3d with given coordinates
|
|
339
415
|
* @param x x part
|
|
340
416
|
* @param y y part
|
|
@@ -380,7 +456,7 @@ export class Point3d extends XYZ {
|
|
|
380
456
|
/**
|
|
381
457
|
* Copy and unweight xyzw.
|
|
382
458
|
* @param xyzData flat array of x,y,z,w,x,y,z,w for multiple points
|
|
383
|
-
* @param pointIndex index of point to extract.
|
|
459
|
+
* @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
|
|
384
460
|
* @param result optional result point.
|
|
385
461
|
*/
|
|
386
462
|
static createFromPackedXYZW(xyzData, pointIndex, result) {
|
|
@@ -405,7 +481,9 @@ export class Point3d extends XYZ {
|
|
|
405
481
|
return result;
|
|
406
482
|
}
|
|
407
483
|
/** Create a new point with 000 xyz */
|
|
408
|
-
static createZero(result) {
|
|
484
|
+
static createZero(result) {
|
|
485
|
+
return Point3d.create(0, 0, 0, result);
|
|
486
|
+
}
|
|
409
487
|
/** Return the cross product of the vectors from this to pointA and pointB
|
|
410
488
|
*
|
|
411
489
|
* * the result is a vector
|
|
@@ -423,7 +501,7 @@ export class Point3d extends XYZ {
|
|
|
423
501
|
/** Return the triple product of the vectors from this to pointA, pointB, pointC
|
|
424
502
|
*
|
|
425
503
|
* * This is a scalar (number)
|
|
426
|
-
* *
|
|
504
|
+
* * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
|
|
427
505
|
*/
|
|
428
506
|
tripleProductToPoints(pointA, pointB, pointC) {
|
|
429
507
|
return Geometry.tripleProduct(pointA.x - this.x, pointA.y - this.y, pointA.z - this.z, pointB.x - this.x, pointB.y - this.y, pointB.z - this.z, pointC.x - this.x, pointC.y - this.y, pointC.z - this.z);
|
|
@@ -437,7 +515,10 @@ export class Point3d extends XYZ {
|
|
|
437
515
|
crossProductToPointsXY(pointA, pointB) {
|
|
438
516
|
return Geometry.crossProductXYXY(pointA.x - this.x, pointA.y - this.y, pointB.x - this.x, pointB.y - this.y);
|
|
439
517
|
}
|
|
440
|
-
/**
|
|
518
|
+
/**
|
|
519
|
+
* Return a point interpolated between `this` point and the `other` point.
|
|
520
|
+
* * fraction specifies where the interpolated point is located on the line passing `this` and `other`.
|
|
521
|
+
* */
|
|
441
522
|
interpolate(fraction, other, result) {
|
|
442
523
|
if (fraction <= 0.5)
|
|
443
524
|
return Point3d.create(this.x + fraction * (other.x - this.x), this.y + fraction * (other.y - this.y), this.z + fraction * (other.z - this.z), result);
|
|
@@ -520,9 +601,7 @@ export class Point3d extends XYZ {
|
|
|
520
601
|
(targetA.y - this.y) * (targetB.y - this.y) +
|
|
521
602
|
(targetA.z - this.z) * (targetB.z - this.z);
|
|
522
603
|
}
|
|
523
|
-
/** Return the fractional projection of this onto a line between points.
|
|
524
|
-
*
|
|
525
|
-
*/
|
|
604
|
+
/** Return the fractional projection of this onto a line between points. */
|
|
526
605
|
fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
|
|
527
606
|
const denominator = startPoint.distanceSquared(endPoint);
|
|
528
607
|
if (denominator < Geometry.smallMetricDistanceSquared)
|
|
@@ -534,7 +613,9 @@ export class Point3d extends XYZ {
|
|
|
534
613
|
* @public
|
|
535
614
|
*/
|
|
536
615
|
export class Vector3d extends XYZ {
|
|
537
|
-
constructor(x = 0, y = 0, z = 0) {
|
|
616
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
617
|
+
super(x, y, z);
|
|
618
|
+
}
|
|
538
619
|
/**
|
|
539
620
|
* Return an array of vectors constructed from groups of 3 entries in a Float64Array.
|
|
540
621
|
* Any incomplete group at the tail of the array is ignored.
|
|
@@ -549,7 +630,9 @@ export class Vector3d extends XYZ {
|
|
|
549
630
|
* Copy xyz from this instance to a new (or optionally reused) Vector3d
|
|
550
631
|
* @param result optional instance to reuse.
|
|
551
632
|
*/
|
|
552
|
-
clone(result) {
|
|
633
|
+
clone(result) {
|
|
634
|
+
return Vector3d.create(this.x, this.y, this.z, result);
|
|
635
|
+
}
|
|
553
636
|
/**
|
|
554
637
|
* return a Vector3d (new or reused from optional result)
|
|
555
638
|
* @param x x component
|
|
@@ -638,7 +721,11 @@ export class Vector3d extends XYZ {
|
|
|
638
721
|
* * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
|
|
639
722
|
* @param json json value.
|
|
640
723
|
*/
|
|
641
|
-
static fromJSON(json) {
|
|
724
|
+
static fromJSON(json) {
|
|
725
|
+
const val = new Vector3d();
|
|
726
|
+
val.setFromJSON(json);
|
|
727
|
+
return val;
|
|
728
|
+
}
|
|
642
729
|
/** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d */
|
|
643
730
|
static createFrom(data, result) {
|
|
644
731
|
if (data instanceof Float64Array) {
|
|
@@ -714,7 +801,7 @@ export class Vector3d extends XYZ {
|
|
|
714
801
|
return undefined;
|
|
715
802
|
}
|
|
716
803
|
/**
|
|
717
|
-
* Set (replace)
|
|
804
|
+
* Set (replace) xyz components so they are a vector from point0 to point1
|
|
718
805
|
* @param point0 start point of computed vector
|
|
719
806
|
* @param point1 end point of computed vector.
|
|
720
807
|
*/
|
|
@@ -724,13 +811,21 @@ export class Vector3d extends XYZ {
|
|
|
724
811
|
this.z = point1.z - point0.z;
|
|
725
812
|
}
|
|
726
813
|
/** Return a vector with 000 xyz parts. */
|
|
727
|
-
static createZero(result) {
|
|
814
|
+
static createZero(result) {
|
|
815
|
+
return Vector3d.create(0, 0, 0, result);
|
|
816
|
+
}
|
|
728
817
|
/** Return a unit X vector optionally multiplied by a scale */
|
|
729
|
-
static unitX(scale = 1) {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
/** Return a unit
|
|
733
|
-
static
|
|
818
|
+
static unitX(scale = 1) {
|
|
819
|
+
return new Vector3d(scale, 0, 0);
|
|
820
|
+
}
|
|
821
|
+
/** Return a unit Y vector optionally multiplied by a scale */
|
|
822
|
+
static unitY(scale = 1) {
|
|
823
|
+
return new Vector3d(0, scale, 0);
|
|
824
|
+
}
|
|
825
|
+
/** Return a unit Z vector optionally multiplied by a scale */
|
|
826
|
+
static unitZ(scale = 1) {
|
|
827
|
+
return new Vector3d(0, 0, scale);
|
|
828
|
+
}
|
|
734
829
|
/** Divide by denominator, but return undefined if denominator is zero. */
|
|
735
830
|
safeDivideOrNull(denominator, result) {
|
|
736
831
|
if (denominator !== 0.0) {
|
|
@@ -739,8 +834,8 @@ export class Vector3d extends XYZ {
|
|
|
739
834
|
return undefined;
|
|
740
835
|
}
|
|
741
836
|
/**
|
|
742
|
-
* Return a pair object containing (a) property `v` which is a unit vector in the direction
|
|
743
|
-
*
|
|
837
|
+
* Return a pair object containing (a) property `v` which is a unit vector in the direction of the input
|
|
838
|
+
* and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
|
|
744
839
|
* If the instance (input) is a near zero length the `v` property of the output is undefined.
|
|
745
840
|
* @param result optional result.
|
|
746
841
|
*/
|
|
@@ -753,7 +848,9 @@ export class Vector3d extends XYZ {
|
|
|
753
848
|
* Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
|
|
754
849
|
* @param result optional result.
|
|
755
850
|
*/
|
|
756
|
-
normalize(result) {
|
|
851
|
+
normalize(result) {
|
|
852
|
+
return this.normalizeWithLength(result).v;
|
|
853
|
+
}
|
|
757
854
|
/**
|
|
758
855
|
* If this vector has nonzero length, divide by the length to change to a unit vector.
|
|
759
856
|
* @returns true if normalization completed.
|
|
@@ -767,8 +864,31 @@ export class Vector3d extends XYZ {
|
|
|
767
864
|
this.z *= a;
|
|
768
865
|
return true;
|
|
769
866
|
}
|
|
770
|
-
/**
|
|
867
|
+
/** Create a normalized vector from the inputs.
|
|
868
|
+
* @param result optional result
|
|
869
|
+
* @returns undefined if and only if normalization fails
|
|
870
|
+
*/
|
|
871
|
+
static createNormalized(x = 0, y = 0, z = 0, result) {
|
|
872
|
+
if (undefined === result)
|
|
873
|
+
result = Vector3d.create(x, y, z);
|
|
874
|
+
else
|
|
875
|
+
result.set(x, y, z);
|
|
876
|
+
if (result.normalizeInPlace())
|
|
877
|
+
return result;
|
|
878
|
+
return undefined;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Return fractional projection of target vector onto this
|
|
882
|
+
* * It's returning the signed projection magnitude divided by the target magnitude. In other words,
|
|
883
|
+
* it's returning the length of the projection as a fraction of the target magnitude.
|
|
884
|
+
* @param target the target vector
|
|
885
|
+
* @param defaultFraction the returned value in case magnitude square of target vector is very small
|
|
886
|
+
* */
|
|
771
887
|
fractionOfProjectionToVector(target, defaultFraction = 0) {
|
|
888
|
+
/*
|
|
889
|
+
* projection length is (this.target)/||target||
|
|
890
|
+
* but here we return (this.target)/||target||^2
|
|
891
|
+
*/
|
|
772
892
|
const numerator = this.dotProduct(target);
|
|
773
893
|
const denominator = target.magnitudeSquared();
|
|
774
894
|
if (denominator < Geometry.smallMetricDistanceSquared)
|
|
@@ -788,7 +908,7 @@ export class Vector3d extends XYZ {
|
|
|
788
908
|
/** Return a vector same length as this but rotate 90 degrees CCW */
|
|
789
909
|
rotate90CCWXY(result) {
|
|
790
910
|
result = result ? result : new Vector3d();
|
|
791
|
-
// save x,y to allow aliasing
|
|
911
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
792
912
|
const xx = this.x;
|
|
793
913
|
const yy = this.y;
|
|
794
914
|
result.x = -yy;
|
|
@@ -796,6 +916,17 @@ export class Vector3d extends XYZ {
|
|
|
796
916
|
result.z = this.z;
|
|
797
917
|
return result;
|
|
798
918
|
}
|
|
919
|
+
/** Return a vector same length as this but rotated 90 degrees clockwise */
|
|
920
|
+
rotate90CWXY(result) {
|
|
921
|
+
result = result ? result : new Vector3d();
|
|
922
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
923
|
+
const xx = this.x;
|
|
924
|
+
const yy = this.y;
|
|
925
|
+
result.x = yy;
|
|
926
|
+
result.y = -xx;
|
|
927
|
+
result.z = this.z;
|
|
928
|
+
return result;
|
|
929
|
+
}
|
|
799
930
|
/**
|
|
800
931
|
* Return a vector which is in the xy plane, perpendicular ot the xy part of this vector, and of unit length.
|
|
801
932
|
* * If the xy part is 00, the return is the rotated (but not normalized) xy parts of this vector.
|
|
@@ -805,6 +936,7 @@ export class Vector3d extends XYZ {
|
|
|
805
936
|
result = result ? result : new Vector3d();
|
|
806
937
|
const xx = this.x;
|
|
807
938
|
const yy = this.y;
|
|
939
|
+
// save x,y to allow aliasing ("this" can be passed to the function as "result")
|
|
808
940
|
result.x = -yy;
|
|
809
941
|
result.y = xx;
|
|
810
942
|
result.z = 0.0;
|
|
@@ -834,17 +966,23 @@ export class Vector3d extends XYZ {
|
|
|
834
966
|
return result;
|
|
835
967
|
}
|
|
836
968
|
/**
|
|
837
|
-
* Return a (new or optionally preallocated) vector that is rotated 90 degrees in
|
|
969
|
+
* Return a (new or optionally preallocated) vector that is rotated 90 degrees in
|
|
970
|
+
* the plane of this vector and the target vector.
|
|
838
971
|
* @param target Second vector which defines the plane of rotation.
|
|
839
972
|
* @param result optional preallocated vector for result.
|
|
840
|
-
* @returns rotated vector, or undefined if the cross product of this and
|
|
973
|
+
* @returns rotated vector, or undefined if the cross product of this and
|
|
974
|
+
* the the target cannot be normalized (i.e. if the target and this are colinear)
|
|
841
975
|
*/
|
|
842
976
|
rotate90Towards(target, result) {
|
|
843
977
|
const normal = this.crossProduct(target).normalize();
|
|
844
978
|
return normal ? normal.crossProduct(this, result) : undefined;
|
|
845
979
|
}
|
|
846
980
|
/** Rotate this vector 90 degrees around an axis vector.
|
|
847
|
-
*
|
|
981
|
+
* * Note that simple cross is in the plane perpendicular to axis -- it loses the part
|
|
982
|
+
* of "this" that is along the axis. The unit and scale is supposed to fix that.
|
|
983
|
+
* This matches with Rodrigues' rotation formula because cos(theta) = 0 and sin(theta) = 1
|
|
984
|
+
* @returns the (new or optionally reused result) rotated vector, or undefined if the axis
|
|
985
|
+
* vector cannot be normalized.
|
|
848
986
|
*/
|
|
849
987
|
rotate90Around(axis, result) {
|
|
850
988
|
const unitNormal = axis.normalize();
|
|
@@ -852,12 +990,17 @@ export class Vector3d extends XYZ {
|
|
|
852
990
|
}
|
|
853
991
|
/**
|
|
854
992
|
* Return a vector computed at fractional position between this vector and vectorB
|
|
855
|
-
* @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
|
|
993
|
+
* @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
|
|
994
|
+
* True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
|
|
856
995
|
* @param vectorB second vector
|
|
857
996
|
* @param result optional preallocated result.
|
|
858
997
|
*/
|
|
859
998
|
interpolate(fraction, vectorB, result) {
|
|
860
999
|
result = result ? result : new Vector3d();
|
|
1000
|
+
/*
|
|
1001
|
+
* For best last-bit behavior, if fraction is below 0.5, use this as base point.
|
|
1002
|
+
* If above 0.5, use vectorB as base point.
|
|
1003
|
+
*/
|
|
861
1004
|
if (fraction <= 0.5) {
|
|
862
1005
|
result.x = this.x + fraction * (vectorB.x - this.x);
|
|
863
1006
|
result.y = this.y + fraction * (vectorB.y - this.y);
|
|
@@ -923,7 +1066,8 @@ export class Vector3d extends XYZ {
|
|
|
923
1066
|
static createAdd2Scaled(vectorA, scaleA, vectorB, scaleB, result) {
|
|
924
1067
|
return Vector3d.create(vectorA.x * scaleA + vectorB.x * scaleB, vectorA.y * scaleA + vectorB.y * scaleB, vectorA.z * scaleA + vectorB.z * scaleB, result);
|
|
925
1068
|
}
|
|
926
|
-
/** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB`
|
|
1069
|
+
/** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB`
|
|
1070
|
+
* with all components presented as numbers */
|
|
927
1071
|
static createAdd2ScaledXYZ(ax, ay, az, scaleA, bx, by, bz, scaleB, result) {
|
|
928
1072
|
return Vector3d.create(ax * scaleA + bx * scaleB, ay * scaleA + by * scaleB, az * scaleA + bz * scaleB, result);
|
|
929
1073
|
}
|
|
@@ -958,7 +1102,8 @@ export class Vector3d extends XYZ {
|
|
|
958
1102
|
return this.crossProduct(vectorB, result).normalize(result);
|
|
959
1103
|
}
|
|
960
1104
|
/**
|
|
961
|
-
* Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as
|
|
1105
|
+
* Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as
|
|
1106
|
+
* default if length is zero.
|
|
962
1107
|
* @param vectorB second vector of cross product
|
|
963
1108
|
* @param x x value for default result
|
|
964
1109
|
* @param y y value for default result
|
|
@@ -1002,7 +1147,8 @@ export class Vector3d extends XYZ {
|
|
|
1002
1147
|
return true;
|
|
1003
1148
|
}
|
|
1004
1149
|
/**
|
|
1005
|
-
* Compute cross product with `vectorB
|
|
1150
|
+
* Compute cross product with `vectorB`
|
|
1151
|
+
* * cross product vector will have the given length.
|
|
1006
1152
|
* @param vectorB second vector for cross product.
|
|
1007
1153
|
* @param productLength desired length of result vector.
|
|
1008
1154
|
* @param result optional preallocated vector
|
|
@@ -1091,17 +1237,18 @@ export class Vector3d extends XYZ {
|
|
|
1091
1237
|
return this.x * (pointB.x - pointA.x)
|
|
1092
1238
|
+ this.y * (pointB.y - pointA.y);
|
|
1093
1239
|
}
|
|
1094
|
-
/** Dot product with vector from pointA to pointB, with pointB given as (weighted)
|
|
1095
|
-
* * pointB is a homogeneous point
|
|
1240
|
+
/** Dot product with vector from pointA to pointB, with pointB given as (weighted) wx,wy,wz,w
|
|
1241
|
+
* * We need to unweight pointB (which is a homogeneous point) to be able to participate in the
|
|
1242
|
+
* vector dot product
|
|
1096
1243
|
* * if the weight is near zero metric, the return is zero.
|
|
1097
1244
|
*/
|
|
1098
|
-
dotProductStartEndXYZW(pointA,
|
|
1245
|
+
dotProductStartEndXYZW(pointA, wx, wy, wz, w) {
|
|
1099
1246
|
if (Geometry.isSmallMetricDistance(w))
|
|
1100
1247
|
return 0.0;
|
|
1101
1248
|
const dw = 1.0 / w;
|
|
1102
|
-
return this.x * (dw *
|
|
1103
|
-
+ this.y * (dw *
|
|
1104
|
-
+ this.z * (dw *
|
|
1249
|
+
return this.x * (dw * wx - pointA.x)
|
|
1250
|
+
+ this.y * (dw * wy - pointA.y)
|
|
1251
|
+
+ this.z * (dw * wz - pointA.z);
|
|
1105
1252
|
}
|
|
1106
1253
|
/** Return the dot product of the instance and vectorB, using only the x and y parts. */
|
|
1107
1254
|
dotProductXY(vectorB) {
|
|
@@ -1143,133 +1290,167 @@ export class Vector3d extends XYZ {
|
|
|
1143
1290
|
return Vector3d.createCrossProduct(this.x, this.y, this.z, x, y, z, result);
|
|
1144
1291
|
}
|
|
1145
1292
|
/**
|
|
1146
|
-
|
|
1293
|
+
* Return the (radians as a simple number, not strongly typed Angle) angle from this vector to vectorB.
|
|
1294
|
+
* * The returned angle is always positive and no larger than 180 degrees (PI radians)
|
|
1295
|
+
* * The returned angle is "in the plane containing the two vectors"
|
|
1296
|
+
* * Use `planarRadiansTo` and `signedRadiansTo` to take have angle measured in specific plane.
|
|
1297
|
+
* @param vectorB target vector.
|
|
1298
|
+
*/
|
|
1299
|
+
radiansTo(vectorB) {
|
|
1300
|
+
// ||axb|| = ||a|| ||b|| |sin(t)| and a.b = ||a|| ||b|| cos(t) ==>
|
|
1301
|
+
// ||axb|| / a.b = sin(t)/cos(t) = tan(t) ==> t = arctan(||axb|| / a.b).
|
|
1302
|
+
return Math.atan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Return the (strongly typed) angle from this vector to vectorB.
|
|
1147
1306
|
* * The returned angle is always positive and no larger than 180 degrees (PI radians)
|
|
1148
1307
|
* * The returned angle is "in the plane containing the two vectors"
|
|
1149
|
-
* * Use `planarAngleTo
|
|
1150
|
-
* @param vectorB target vector
|
|
1308
|
+
* * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in specific plane.
|
|
1309
|
+
* @param vectorB target vector.
|
|
1151
1310
|
*/
|
|
1152
1311
|
angleTo(vectorB) {
|
|
1153
|
-
return Angle.
|
|
1312
|
+
return Angle.createRadians(this.radiansTo(vectorB));
|
|
1154
1313
|
}
|
|
1155
1314
|
/**
|
|
1156
|
-
* Return the (
|
|
1315
|
+
* Return the (strongly typed) angle from this vector to the plane perpendicular to planeNormal.
|
|
1157
1316
|
* * The returned vector is signed
|
|
1158
|
-
* * The returned vector is (as degrees) always
|
|
1159
|
-
*
|
|
1317
|
+
* * The returned vector is (as degrees) always between -90 and 90 degrees.
|
|
1318
|
+
* * The function returns "PI/2 - angleTo(planeNormal)"
|
|
1319
|
+
* @param planeNormal a normal vector to the plane.
|
|
1160
1320
|
*/
|
|
1161
|
-
angleFromPerpendicular(
|
|
1162
|
-
return Angle.createAtan2(this.dotProduct(
|
|
1321
|
+
angleFromPerpendicular(planeNormal) {
|
|
1322
|
+
return Angle.createAtan2(this.dotProduct(planeNormal), this.crossProductMagnitude(planeNormal));
|
|
1163
1323
|
}
|
|
1164
1324
|
/**
|
|
1165
|
-
* Return the (Strongly typed) angle from this vector to vectorB,using only the xy parts.
|
|
1166
|
-
* * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180
|
|
1167
|
-
* *
|
|
1168
|
-
*
|
|
1325
|
+
* Return the (Strongly typed) angle from this vector to vectorB, using only the xy parts.
|
|
1326
|
+
* * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180
|
|
1327
|
+
* * degrees (positive PI radians), not closed on the negative side.
|
|
1328
|
+
* * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in other planes.
|
|
1329
|
+
* @param vectorB target vector.
|
|
1169
1330
|
*/
|
|
1170
1331
|
angleToXY(vectorB) {
|
|
1171
1332
|
return Angle.createAtan2(this.crossProductXY(vectorB), this.dotProductXY(vectorB));
|
|
1172
1333
|
}
|
|
1173
1334
|
/**
|
|
1174
|
-
|
|
1335
|
+
* Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured
|
|
1336
|
+
* in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
|
|
1337
|
+
* * The returned angle can range from negative PI to positive PI (not closed on negative side)
|
|
1338
|
+
* * The returned angle is "in the plane containing the two vectors"
|
|
1339
|
+
* * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
|
|
1340
|
+
* * vectorW does not have to be perpendicular to the plane.
|
|
1341
|
+
* * Use planarRadiansTo to measure the angle between vectors that are projected to another plane.
|
|
1342
|
+
* @param vectorB target vector.
|
|
1343
|
+
* @param vectorW distinguishes between the sides of the plane.
|
|
1344
|
+
*/
|
|
1345
|
+
signedRadiansTo(vectorB, vectorW) {
|
|
1346
|
+
const p = this.crossProduct(vectorB);
|
|
1347
|
+
const theta = Math.atan2(p.magnitude(), this.dotProduct(vectorB));
|
|
1348
|
+
if (vectorW.dotProduct(p) < 0.0)
|
|
1349
|
+
return -theta;
|
|
1350
|
+
else
|
|
1351
|
+
return theta;
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both,
|
|
1355
|
+
* with vectorW indicating which side to view to control sign of the angle.
|
|
1356
|
+
* * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees
|
|
1357
|
+
* * (positive PI radians), not closed on the negative side.
|
|
1358
|
+
* * The returned angle is "in the plane containing the two vectors"
|
|
1359
|
+
* * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
|
|
1360
|
+
* * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
|
|
1361
|
+
* * Use planarRadiansTo to measure the angle between vectors that are projected to another plane.
|
|
1362
|
+
* @param vectorB target vector.
|
|
1363
|
+
* @param vectorW distinguishes between the sides of the plane.
|
|
1364
|
+
*/
|
|
1365
|
+
signedAngleTo(vectorB, vectorW) {
|
|
1366
|
+
return Angle.createRadians(this.signedRadiansTo(vectorB, vectorW));
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Return the radians (as a simple number, not strongly typed Angle) from this vector to vectorB,
|
|
1370
|
+
* measured between their projections to the plane with the given normal.
|
|
1175
1371
|
* * The returned angle can be positive or negative, with magnitude no larger than PI radians
|
|
1176
|
-
*
|
|
1177
|
-
* @param
|
|
1372
|
+
* @param vectorB target vector
|
|
1373
|
+
* @param planeNormal the normal vector to the plane.
|
|
1178
1374
|
*/
|
|
1179
|
-
planarRadiansTo(
|
|
1375
|
+
planarRadiansTo(vectorB, planeNormal) {
|
|
1180
1376
|
const square = planeNormal.dotProduct(planeNormal);
|
|
1181
1377
|
if (square === 0.0)
|
|
1182
1378
|
return 0.0;
|
|
1183
1379
|
const factor = 1.0 / square;
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1380
|
+
/*
|
|
1381
|
+
* projection of vector 'v' on normal 'n' is given by vProj = [dot(v,n)/||n||^2]*n
|
|
1382
|
+
* and projection of 'v' on the plane is given by 'v - vProj'
|
|
1383
|
+
*/
|
|
1384
|
+
const thisProj = this.plusScaled(planeNormal, -this.dotProduct(planeNormal) * factor);
|
|
1385
|
+
const vectorBProj = vectorB.plusScaled(planeNormal, -vectorB.dotProduct(planeNormal) * factor);
|
|
1386
|
+
return thisProj.signedRadiansTo(vectorBProj, planeNormal);
|
|
1187
1387
|
}
|
|
1188
1388
|
/**
|
|
1189
|
-
* Return the (as strongly typed Angle)
|
|
1389
|
+
* Return the angle (as strongly typed Angle) from this vector to vectorB,
|
|
1390
|
+
* measured between their projections to the plane with the given normal.
|
|
1190
1391
|
* * The returned angle can range from negative PI to positive PI (not closed on negative side)
|
|
1191
|
-
*
|
|
1192
|
-
* @param
|
|
1392
|
+
* @param vectorB target vector.
|
|
1393
|
+
* @param planeNormal the normal vector to the plane.
|
|
1193
1394
|
*/
|
|
1194
|
-
planarAngleTo(
|
|
1195
|
-
return Angle.createRadians(this.planarRadiansTo(
|
|
1395
|
+
planarAngleTo(vectorB, planeNormal) {
|
|
1396
|
+
return Angle.createRadians(this.planarRadiansTo(vectorB, planeNormal));
|
|
1196
1397
|
}
|
|
1197
|
-
/**
|
|
1198
|
-
|
|
1199
|
-
* * The returned angle can range from negative PI to positive PI (not closed on negative side)
|
|
1200
|
-
* * The returned angle is "in the plane containing the two vectors"
|
|
1201
|
-
* * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
|
|
1202
|
-
* * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
|
|
1203
|
-
* @param vectorB target vector of rotation.
|
|
1204
|
-
*/
|
|
1205
|
-
signedRadiansTo(vector1, vectorW) {
|
|
1206
|
-
const p = this.crossProduct(vector1);
|
|
1207
|
-
const theta = Math.atan2(p.magnitude(), this.dotProduct(vector1));
|
|
1208
|
-
if (vectorW.dotProduct(p) < 0.0)
|
|
1209
|
-
return -theta;
|
|
1210
|
-
else
|
|
1211
|
-
return theta;
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
|
|
1215
|
-
* * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees (positive PI radians), not closed on the negative side.
|
|
1216
|
-
* * The returned angle is "in the plane containing the two vectors"
|
|
1217
|
-
* * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
|
|
1218
|
-
* * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
|
|
1219
|
-
* @param vectorB target vector of rotation.
|
|
1220
|
-
*/
|
|
1221
|
-
signedAngleTo(vector1, vectorW) { return Angle.createRadians(this.signedRadiansTo(vector1, vectorW)); }
|
|
1222
|
-
/** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
|
|
1223
|
-
smallerUnorientedAngleTo(vectorB) {
|
|
1224
|
-
return Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
|
|
1225
|
-
}
|
|
1226
|
-
/** Return the smallest angle (in radians) from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
|
|
1398
|
+
/** Return the smallest angle (in radians) from the (bidirectional) line containing `this`
|
|
1399
|
+
* to the (bidirectional) line containing `vectorB` */
|
|
1227
1400
|
smallerUnorientedRadiansTo(vectorB) {
|
|
1228
1401
|
const c = this.dotProduct(vectorB);
|
|
1229
1402
|
const s = this.crossProductMagnitude(vectorB);
|
|
1230
1403
|
return Math.atan2(Math.abs(s), Math.abs(c));
|
|
1231
1404
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
*/
|
|
1405
|
+
/** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this`
|
|
1406
|
+
* to the (bidirectional) line containing `vectorB` */
|
|
1407
|
+
smallerUnorientedAngleTo(vectorB) {
|
|
1408
|
+
return Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
|
|
1409
|
+
}
|
|
1238
1410
|
/**
|
|
1239
1411
|
* Test if this vector is parallel to other.
|
|
1412
|
+
* * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
|
|
1413
|
+
* so if you have a distance or angle tolerance t, you should pass in t * t.
|
|
1240
1414
|
* @param other second vector in comparison
|
|
1241
|
-
* @param oppositeIsParallel
|
|
1415
|
+
* @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel
|
|
1242
1416
|
* @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
|
|
1417
|
+
* @param options optional radian and distance tolerances.
|
|
1243
1418
|
*/
|
|
1244
|
-
isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false) {
|
|
1419
|
+
isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
|
|
1420
|
+
var _a, _b;
|
|
1421
|
+
const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
|
|
1422
|
+
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
|
|
1245
1423
|
const a2 = this.magnitudeSquared();
|
|
1246
1424
|
const b2 = other.magnitudeSquared();
|
|
1247
|
-
|
|
1248
|
-
if (a2 < Geometry.smallMetricDistanceSquared || b2 < Geometry.smallMetricDistanceSquared)
|
|
1425
|
+
if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
|
|
1249
1426
|
return returnValueIfAnInputIsZeroLength;
|
|
1250
1427
|
const dot = this.dotProduct(other);
|
|
1251
1428
|
if (dot < 0.0 && !oppositeIsParallel)
|
|
1252
|
-
return
|
|
1429
|
+
return false;
|
|
1253
1430
|
const cross2 = this.crossProductMagnitudeSquared(other);
|
|
1254
1431
|
/* a2,b2,cross2 are squared lengths of respective vectors */
|
|
1255
1432
|
/* cross2 = sin^2(theta) * a2 * b2 */
|
|
1256
1433
|
/* For small theta, sin^2(theta)~~theta^2 */
|
|
1257
|
-
return cross2 <=
|
|
1434
|
+
return cross2 <= radianSquaredTol * a2 * b2;
|
|
1258
1435
|
}
|
|
1259
1436
|
/**
|
|
1260
1437
|
* Test if this vector is perpendicular to other.
|
|
1438
|
+
* * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
|
|
1439
|
+
* so if you have a distance or angle tolerance t, you should pass in t * t.
|
|
1261
1440
|
* @param other second vector in comparison
|
|
1262
1441
|
* @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
|
|
1442
|
+
* @param options optional radian and distance tolerances.
|
|
1263
1443
|
*/
|
|
1264
|
-
isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false) {
|
|
1444
|
+
isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
|
|
1445
|
+
var _a, _b;
|
|
1446
|
+
const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
|
|
1447
|
+
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
|
|
1265
1448
|
const aa = this.magnitudeSquared();
|
|
1266
|
-
if (aa < Geometry.smallMetricDistanceSquared)
|
|
1267
|
-
return returnValueIfAnInputIsZeroLength;
|
|
1268
1449
|
const bb = other.magnitudeSquared();
|
|
1269
|
-
if (bb <
|
|
1450
|
+
if (aa < distanceSquaredTol || bb < distanceSquaredTol)
|
|
1270
1451
|
return returnValueIfAnInputIsZeroLength;
|
|
1271
1452
|
const ab = this.dotProduct(other);
|
|
1272
|
-
return ab * ab <=
|
|
1453
|
+
return ab * ab <= radianSquaredTol * aa * bb;
|
|
1273
1454
|
}
|
|
1274
1455
|
}
|
|
1275
1456
|
//# sourceMappingURL=Point3dVector3d.js.map
|