@itwin/core-geometry 4.10.0-dev.9 → 5.0.0-dev.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 +21 -1
- package/lib/cjs/Geometry.js +2 -2
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js +0 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +5 -3
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +5 -4
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -1
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +136 -128
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +177 -152
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +7 -5
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +9 -7
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +21 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +45 -10
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.d.ts +18 -15
- package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js +18 -17
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +11 -13
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +19 -46
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +9 -5
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +9 -5
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.d.ts.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js +0 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +2 -3
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js +4 -4
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +14 -0
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +27 -0
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
- package/lib/cjs/curve/PointString3d.js +0 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +0 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -6
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +10 -10
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +4 -4
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +46 -42
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +5 -4
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +10 -6
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +15 -12
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +4 -4
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +0 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +28 -17
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +36 -17
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -3
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +0 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -4
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +2 -2
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
- package/lib/cjs/geometry4d/Map4d.js +5 -5
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +4 -7
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +2 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +0 -1
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +3 -0
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +2 -5
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +46 -201
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +132 -445
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js +2 -2
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.d.ts +164 -0
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -0
- package/lib/cjs/numerics/SmallSystem.js +321 -0
- package/lib/cjs/numerics/SmallSystem.js.map +1 -0
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +0 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +2 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +0 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +1 -2
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +0 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +7 -7
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.d.ts.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js +0 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +2 -2
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js +2 -2
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +1 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +2 -2
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/Geometry.js +2 -2
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js +0 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +5 -3
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +5 -4
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -1
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +136 -128
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +177 -152
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +7 -5
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +9 -7
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +21 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +45 -10
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.d.ts +18 -15
- package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js +18 -17
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +11 -13
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +17 -44
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +9 -5
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +9 -5
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.d.ts.map +1 -1
- package/lib/esm/curve/CurveProcessor.js +0 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +1 -2
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/OffsetOptions.d.ts.map +1 -1
- package/lib/esm/curve/OffsetOptions.js +4 -4
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +14 -0
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +27 -0
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.d.ts.map +1 -1
- package/lib/esm/curve/PointString3d.js +0 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +0 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +4 -5
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +5 -5
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -3
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +46 -42
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +5 -4
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +10 -6
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +15 -12
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +0 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +28 -17
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +36 -17
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js +0 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +0 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -4
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.d.ts +5 -5
- package/lib/esm/geometry4d/Map4d.js +5 -5
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +4 -7
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +2 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +0 -1
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +3 -0
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +1 -4
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +46 -201
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +132 -444
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.d.ts +164 -0
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -0
- package/lib/esm/numerics/SmallSystem.js +317 -0
- package/lib/esm/numerics/SmallSystem.js.map +1 -0
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +0 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +2 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +0 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +1 -2
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +0 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -4
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.d.ts.map +1 -1
- package/lib/esm/serialization/DeepCompare.js +0 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +1 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +8 -8
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ImplicitLineXY = exports.SineCosinePolynomial = exports.BilinearPolynomial = exports.
|
|
7
|
+
exports.ImplicitLineXY = exports.SineCosinePolynomial = exports.BilinearPolynomial = exports.TrigPolynomial = exports.PowerPolynomial = exports.AnalyticRoots = exports.SphereImplicit = exports.TorusImplicit = exports.Degree4PowerPolynomial = exports.Degree3PowerPolynomial = exports.Degree2PowerPolynomial = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Numerics
|
|
10
10
|
*/
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
12
|
const Geometry_1 = require("../Geometry");
|
|
12
13
|
const Angle_1 = require("../geometry3d/Angle");
|
|
13
14
|
const AngleSweep_1 = require("../geometry3d/AngleSweep");
|
|
@@ -16,9 +17,7 @@ const LongitudeLatitudeAltitude_1 = require("../geometry3d/LongitudeLatitudeAlti
|
|
|
16
17
|
const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
|
|
17
18
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
18
19
|
const Range_1 = require("../geometry3d/Range");
|
|
19
|
-
// cspell:
|
|
20
|
-
// cspell:word CCminusSS
|
|
21
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
20
|
+
// cspell:words Cardano internaldocs
|
|
22
21
|
/**
|
|
23
22
|
* degree 2 (quadratic) polynomial in for y = c0 + c1*x + c2*x^2
|
|
24
23
|
* @internal
|
|
@@ -684,8 +683,8 @@ class AnalyticRoots {
|
|
|
684
683
|
return;
|
|
685
684
|
}
|
|
686
685
|
else if (D > 0) {
|
|
687
|
-
const
|
|
688
|
-
this.append2Solutions(
|
|
686
|
+
const sqrtD = Math.sqrt(D);
|
|
687
|
+
this.append2Solutions(sqrtD - p, -sqrtD - p, values);
|
|
689
688
|
return;
|
|
690
689
|
}
|
|
691
690
|
return;
|
|
@@ -751,7 +750,7 @@ class AnalyticRoots {
|
|
|
751
750
|
*/
|
|
752
751
|
/*
|
|
753
752
|
private static _appendCubicRootsUnsorted(c: Float64Array | number[], results: GrowableFloat64Array) {
|
|
754
|
-
let
|
|
753
|
+
let AA: number;
|
|
755
754
|
let p: number;
|
|
756
755
|
let q: number;
|
|
757
756
|
|
|
@@ -772,9 +771,9 @@ class AnalyticRoots {
|
|
|
772
771
|
// f' = 3y^2 + p
|
|
773
772
|
// local min/max at Y = +-sqrt (-p)
|
|
774
773
|
// f(+Y) = -p sqrt(-p) + 3p sqrt (-p) + 2q = 2 p sqrt (-p) + 2q
|
|
775
|
-
|
|
776
|
-
p = (3.0 * B -
|
|
777
|
-
q = 1.0 / 2 * (2.0 / 27 * A *
|
|
774
|
+
AA = A * A;
|
|
775
|
+
p = (3.0 * B - AA) / 9.0;
|
|
776
|
+
q = 1.0 / 2 * (2.0 / 27 * A * AA - 1.0 / 3 * A * B + C);
|
|
778
777
|
|
|
779
778
|
// Use Cardano formula
|
|
780
779
|
const cb_p: number = p * p * p;
|
|
@@ -812,9 +811,9 @@ class AnalyticRoots {
|
|
|
812
811
|
|
|
813
812
|
return;
|
|
814
813
|
} else { // One real solution
|
|
815
|
-
const
|
|
816
|
-
const u = this.cbrt(
|
|
817
|
-
const v = -(this.cbrt(
|
|
814
|
+
const sqrtD = Math.sqrt(D);
|
|
815
|
+
const u = this.cbrt(sqrtD - q);
|
|
816
|
+
const v = -(this.cbrt(sqrtD + q));
|
|
818
817
|
results.push(origin + u + v);
|
|
819
818
|
this.improveRoots(c, 3, results, false);
|
|
820
819
|
return;
|
|
@@ -828,7 +827,7 @@ class AnalyticRoots {
|
|
|
828
827
|
// EDL April 5, 2020 replace classic GraphicsGems solver by RWDNickalls.
|
|
829
828
|
// Don't know if improveRoots is needed.
|
|
830
829
|
// Breaks in AnalyticRoots.test.ts checkQuartic suggest it indeed converts many e-16 errors to zero.
|
|
831
|
-
//
|
|
830
|
+
// e-13 cases are unaffected
|
|
832
831
|
this.improveRoots(c, 3, results, false);
|
|
833
832
|
}
|
|
834
833
|
else {
|
|
@@ -837,49 +836,46 @@ class AnalyticRoots {
|
|
|
837
836
|
// this.appendCubicRootsUnsorted(c, results);
|
|
838
837
|
results.sort();
|
|
839
838
|
}
|
|
840
|
-
/** Compute roots of quartic
|
|
839
|
+
/** Compute roots of quartic `c[0] + c[1] * x + c[2] * x^2 + c[3] * x^3 + c[4] * x^4` */
|
|
841
840
|
static appendQuarticRoots(c, results) {
|
|
842
|
-
|
|
841
|
+
// for details, see core\geometry\internaldocs\quarticRoots.md
|
|
842
|
+
const coffs = new Float64Array(4);
|
|
843
843
|
let u;
|
|
844
844
|
let v;
|
|
845
|
-
// normal form: x^4 + Ax^3 + Bx^2 + Cx + D = 0
|
|
846
845
|
const coffScale = new Float64Array(1);
|
|
847
846
|
if (!this.safeDivide(coffScale, 1.0, c[4], 0.0, 0)) {
|
|
848
847
|
this.appendCubicRoots(c, results);
|
|
849
848
|
return;
|
|
850
849
|
}
|
|
850
|
+
// normal form: x^4 + Ax^3 + Bx^2 + Cx + D = 0
|
|
851
851
|
const A = c[3] * coffScale[0];
|
|
852
852
|
const B = c[2] * coffScale[0];
|
|
853
853
|
const C = c[1] * coffScale[0];
|
|
854
854
|
const D = c[0] * coffScale[0];
|
|
855
855
|
const origin = -0.25 * A;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
const
|
|
859
|
-
const
|
|
860
|
-
const
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
if (this.isZero(r)) {
|
|
864
|
-
// no absolute term: y(y^3 + py + q) = 0
|
|
856
|
+
// substitute x = y - A/4 to eliminate cubic term: y^4 + py^2 + qy + r = 0
|
|
857
|
+
const AA = A * A;
|
|
858
|
+
const p = -0.375 * AA + B;
|
|
859
|
+
const q = 0.125 * AA * A - 0.5 * A * B + C;
|
|
860
|
+
const r = -0.01171875 * AA * AA + 0.0625 * AA * B - 0.25 * A * C + D;
|
|
861
|
+
const cubicSolutions = new GrowableFloat64Array_1.GrowableFloat64Array();
|
|
862
|
+
if (this.isZero(r)) { // no absolute term: y(y^3 + py + q) = 0
|
|
865
863
|
coffs[0] = q;
|
|
866
864
|
coffs[1] = p;
|
|
867
865
|
coffs[2] = 0;
|
|
868
866
|
coffs[3] = 1;
|
|
869
867
|
this.appendCubicRoots(coffs, results);
|
|
870
|
-
results.push(0);
|
|
871
|
-
this.addConstant(origin, results);
|
|
868
|
+
results.push(0);
|
|
869
|
+
this.addConstant(origin, results); // apply origin
|
|
872
870
|
return;
|
|
873
871
|
}
|
|
874
|
-
else {
|
|
875
|
-
|
|
876
|
-
coffs[0] = 1.0 / 2 * r * p - 1.0 / 8 * q * q;
|
|
872
|
+
else { // solve the resolvent cubic
|
|
873
|
+
coffs[0] = 0.5 * r * p - 0.125 * q * q;
|
|
877
874
|
coffs[1] = -r;
|
|
878
|
-
coffs[2] = -
|
|
875
|
+
coffs[2] = -0.5 * p;
|
|
879
876
|
coffs[3] = 1;
|
|
880
|
-
this.appendCubicRoots(coffs,
|
|
881
|
-
const z = this.mostDistantFromMean(
|
|
882
|
-
// ... to build two quadric equations
|
|
877
|
+
this.appendCubicRoots(coffs, cubicSolutions);
|
|
878
|
+
const z = this.mostDistantFromMean(cubicSolutions);
|
|
883
879
|
u = z * z - r;
|
|
884
880
|
v = 2 * z - p;
|
|
885
881
|
if (this.isSmallRatio(u, r)) {
|
|
@@ -898,11 +894,9 @@ class AnalyticRoots {
|
|
|
898
894
|
v = Math.sqrt(v);
|
|
899
895
|
}
|
|
900
896
|
else {
|
|
901
|
-
for (let i = 0; i < tempStack.length; i++) {
|
|
902
|
-
results.push(tempStack.atUncheckedIndex(i));
|
|
903
|
-
}
|
|
904
897
|
return;
|
|
905
898
|
}
|
|
899
|
+
// the two quadratic equations
|
|
906
900
|
coffs[0] = z - u;
|
|
907
901
|
coffs[1] = ((q < 0) ? (-v) : (v));
|
|
908
902
|
coffs[2] = 1;
|
|
@@ -912,8 +906,7 @@ class AnalyticRoots {
|
|
|
912
906
|
coffs[2] = 1;
|
|
913
907
|
this.appendQuadraticRoots(coffs, results);
|
|
914
908
|
}
|
|
915
|
-
//
|
|
916
|
-
this.addConstant(origin, results);
|
|
909
|
+
this.addConstant(origin, results); // apply origin
|
|
917
910
|
results.sort();
|
|
918
911
|
this.improveRoots(c, 4, results, true);
|
|
919
912
|
return;
|
|
@@ -1018,19 +1011,17 @@ class PowerPolynomial {
|
|
|
1018
1011
|
return this.degreeKnownEvaluate(coff, degree, x);
|
|
1019
1012
|
}
|
|
1020
1013
|
/**
|
|
1021
|
-
*
|
|
1022
|
-
* *
|
|
1023
|
-
* * Returns degree of result as determined by comparing trailing coefficients to zero
|
|
1014
|
+
* Accumulate `coffQ*scaleQ` into `coffP`.
|
|
1015
|
+
* * The length of `coffP` must be at least length of `coffQ`.
|
|
1016
|
+
* * Returns degree of result as determined by comparing trailing coefficients to zero.
|
|
1024
1017
|
*/
|
|
1025
1018
|
static accumulate(coffP, coffQ, scaleQ) {
|
|
1026
1019
|
let degreeP = coffP.length - 1;
|
|
1027
1020
|
const degreeQ = coffQ.length - 1;
|
|
1028
|
-
for (let i = 0; i <= degreeQ; i++)
|
|
1021
|
+
for (let i = 0; i <= degreeQ; i++)
|
|
1029
1022
|
coffP[i] += scaleQ * coffQ[i];
|
|
1030
|
-
|
|
1031
|
-
while (degreeP >= 0 && coffP[degreeP] === 0.0) {
|
|
1023
|
+
while (degreeP >= 0 && coffP[degreeP] === 0.0)
|
|
1032
1024
|
degreeP--;
|
|
1033
|
-
}
|
|
1034
1025
|
return degreeP;
|
|
1035
1026
|
}
|
|
1036
1027
|
/** Zero all coefficients */
|
|
@@ -1047,17 +1038,17 @@ exports.PowerPolynomial = PowerPolynomial;
|
|
|
1047
1038
|
*/
|
|
1048
1039
|
class TrigPolynomial {
|
|
1049
1040
|
/**
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
* @param
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
* @param radians
|
|
1041
|
+
* Find the roots of a univariate polynomial created from substituting the rational parameterization of the unit
|
|
1042
|
+
* circle into a trigonometric polynomial. Roots are returned as radian angles.
|
|
1043
|
+
* * Currently implemented for polynomials of degree <= 4.
|
|
1044
|
+
* * For example, the ellipse-ellipse intersection problem reduces to finding the roots of a quartic polynomial:
|
|
1045
|
+
* `p(t) = coff[0] + coff[1] t + coff[2] t^2 + coff[3] t^3 + coff[4] t^4`.
|
|
1046
|
+
* * Particular care is given to report a root at t = +/-infinity, which corresponds to the returned angle -pi/2.
|
|
1047
|
+
* @param coff coefficients in the power basis
|
|
1048
|
+
* @param nominalDegree degree of the polynomial under the most complex root case.
|
|
1049
|
+
* @param referenceCoefficient a number which represents the size of coefficients at various stages of computation.
|
|
1050
|
+
* A small fraction of this number will be used as a zero tolerance.
|
|
1051
|
+
* @param radians roots are placed here.
|
|
1061
1052
|
* @return false if equation is all zeros. This usually means any angle is a solution.
|
|
1062
1053
|
*/
|
|
1063
1054
|
static solveAngles(coff, nominalDegree, referenceCoefficient, radians) {
|
|
@@ -1067,31 +1058,23 @@ class TrigPolynomial {
|
|
|
1067
1058
|
const relTol = this._smallAngle;
|
|
1068
1059
|
for (let i = 0; i <= nominalDegree; i++) {
|
|
1069
1060
|
a = Math.abs(coff[i]);
|
|
1070
|
-
if (a > maxCoff)
|
|
1061
|
+
if (a > maxCoff)
|
|
1071
1062
|
maxCoff = a;
|
|
1072
|
-
}
|
|
1073
1063
|
}
|
|
1074
1064
|
const coffTol = relTol * maxCoff;
|
|
1075
1065
|
let degree = nominalDegree;
|
|
1076
|
-
while (degree > 0 && (Math.abs(coff[degree]) <= coffTol))
|
|
1066
|
+
while (degree > 0 && (Math.abs(coff[degree]) <= coffTol))
|
|
1077
1067
|
degree--;
|
|
1078
|
-
}
|
|
1079
|
-
// let status = false;
|
|
1080
1068
|
const roots = new GrowableFloat64Array_1.GrowableFloat64Array();
|
|
1081
1069
|
if (degree === -1) {
|
|
1082
|
-
//
|
|
1083
|
-
// status = false;
|
|
1070
|
+
// do nothing
|
|
1084
1071
|
}
|
|
1085
1072
|
else {
|
|
1086
|
-
// status = true;
|
|
1087
1073
|
if (degree === 0) {
|
|
1088
|
-
// p(t) is a nonzero constant
|
|
1089
|
-
// No roots, but not degenerate.
|
|
1090
|
-
// status = true;
|
|
1074
|
+
// p(t) is a nonzero constant; no roots but not degenerate.
|
|
1091
1075
|
}
|
|
1092
1076
|
else if (degree === 1) {
|
|
1093
|
-
// p(t) = coff[
|
|
1094
|
-
roots.push(-coff[0] / coff[1]);
|
|
1077
|
+
roots.push(-coff[0] / coff[1]); // p(t) = coff[0] + coff[1] * t
|
|
1095
1078
|
}
|
|
1096
1079
|
else if (degree === 2) {
|
|
1097
1080
|
AnalyticRoots.appendQuadraticRoots(coff, roots);
|
|
@@ -1103,70 +1086,68 @@ class TrigPolynomial {
|
|
|
1103
1086
|
AnalyticRoots.appendQuarticRoots(coff, roots);
|
|
1104
1087
|
}
|
|
1105
1088
|
else {
|
|
1106
|
-
// TODO:
|
|
1107
|
-
|
|
1089
|
+
// TODO: WORK WITH BEZIER SOLVER
|
|
1090
|
+
(0, core_bentley_1.assert)(false, "Unimplemented degree in trig solver");
|
|
1108
1091
|
}
|
|
1109
1092
|
if (roots.length > 0) {
|
|
1110
|
-
//
|
|
1111
|
-
//
|
|
1112
|
-
// Division by W has no effect on Atan2 calculations, so we just compute S(t),C(t)
|
|
1093
|
+
// each solution t represents an angle with Math.Cos(theta) = C(t)/W(t) and sin(theta) = S(t)/W(t)
|
|
1094
|
+
// division by W has no effect on atan2 calculations, so we just compute S(t),C(t)
|
|
1113
1095
|
for (let i = 0; i < roots.length; i++) {
|
|
1114
1096
|
const ss = PowerPolynomial.evaluate(this.S, roots.atUncheckedIndex(i));
|
|
1115
1097
|
const cc = PowerPolynomial.evaluate(this.C, roots.atUncheckedIndex(i));
|
|
1116
1098
|
radians.push(Math.atan2(ss, cc));
|
|
1117
1099
|
}
|
|
1118
|
-
// Each leading zero at the front of the coefficients corresponds to a root at -PI/2.
|
|
1119
|
-
// Only make one entry....
|
|
1120
|
-
// for (int i = degree; i < nominalDegree; i++)
|
|
1121
|
-
if (degree < nominalDegree) {
|
|
1122
|
-
radians.push(-0.5 * Math.PI);
|
|
1123
|
-
}
|
|
1124
1100
|
}
|
|
1101
|
+
// If the tail of the coff array is zero, we solved a polynomial of lesser degree above, and
|
|
1102
|
+
// we report the skipped "root at infinity" as the corresponding angle -pi/2 (without multiplicity).
|
|
1103
|
+
// See core\geometry\internaldocs\unitCircleEllipseIntersection.md for details.
|
|
1104
|
+
if (degree < nominalDegree)
|
|
1105
|
+
radians.push(-0.5 * Math.PI);
|
|
1125
1106
|
}
|
|
1126
1107
|
return radians.length > 0;
|
|
1127
1108
|
}
|
|
1128
1109
|
/**
|
|
1129
|
-
* Compute intersections of unit circle `x^2 + y^2 = 1` with general quadric
|
|
1130
|
-
* `axx
|
|
1131
|
-
*
|
|
1132
|
-
* @param
|
|
1133
|
-
* @param
|
|
1134
|
-
* @param
|
|
1135
|
-
* @param
|
|
1136
|
-
* @param
|
|
1137
|
-
* @param
|
|
1138
|
-
* @param radians solution angles
|
|
1110
|
+
* Compute intersections of the unit circle `x^2 + y^2 = 1` with the general quadric (conic)
|
|
1111
|
+
* `axx x^2 + axy xy + ayy y^2 + ax x + ay y + a = 0`.
|
|
1112
|
+
* @param axx coefficient of x^2
|
|
1113
|
+
* @param axy coefficient of xy
|
|
1114
|
+
* @param ayy coefficient of y^2
|
|
1115
|
+
* @param ax coefficient of x
|
|
1116
|
+
* @param ay coefficient of y
|
|
1117
|
+
* @param a constant coefficient
|
|
1118
|
+
* @param radians up to 4 solution angles t in the quadric parameterization: x = cos(t), y = sin(t)
|
|
1139
1119
|
*/
|
|
1140
|
-
static solveUnitCircleImplicitQuadricIntersection(axx, axy, ayy, ax, ay,
|
|
1141
|
-
const
|
|
1142
|
-
PowerPolynomial.zero(
|
|
1120
|
+
static solveUnitCircleImplicitQuadricIntersection(axx, axy, ayy, ax, ay, a, radians) {
|
|
1121
|
+
const coffs = new Float64Array(5);
|
|
1122
|
+
PowerPolynomial.zero(coffs);
|
|
1143
1123
|
let degree;
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
PowerPolynomial.accumulate(
|
|
1147
|
-
PowerPolynomial.accumulate(
|
|
1148
|
-
PowerPolynomial.accumulate(
|
|
1149
|
-
PowerPolynomial.accumulate(
|
|
1150
|
-
PowerPolynomial.accumulate(
|
|
1124
|
+
// see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients
|
|
1125
|
+
if (Geometry_1.Geometry.hypotenuseXYZ(axx, axy, ayy) > TrigPolynomial._coefficientRelTol * Geometry_1.Geometry.hypotenuseXYZ(ax, ay, a)) {
|
|
1126
|
+
PowerPolynomial.accumulate(coffs, this.CW, ax);
|
|
1127
|
+
PowerPolynomial.accumulate(coffs, this.SW, ay);
|
|
1128
|
+
PowerPolynomial.accumulate(coffs, this.WW, a);
|
|
1129
|
+
PowerPolynomial.accumulate(coffs, this.SS, ayy);
|
|
1130
|
+
PowerPolynomial.accumulate(coffs, this.CC, axx);
|
|
1131
|
+
PowerPolynomial.accumulate(coffs, this.SC, axy);
|
|
1151
1132
|
degree = 4;
|
|
1152
1133
|
}
|
|
1153
1134
|
else {
|
|
1154
|
-
PowerPolynomial.accumulate(
|
|
1155
|
-
PowerPolynomial.accumulate(
|
|
1156
|
-
PowerPolynomial.accumulate(
|
|
1135
|
+
PowerPolynomial.accumulate(coffs, this.C, ax);
|
|
1136
|
+
PowerPolynomial.accumulate(coffs, this.S, ay);
|
|
1137
|
+
PowerPolynomial.accumulate(coffs, this.W, a);
|
|
1157
1138
|
degree = 2;
|
|
1158
1139
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
const b = this.solveAngles(Coffs, degree, maxCoff, radians);
|
|
1140
|
+
const maxCoff = Math.max(Math.abs(axx), Math.abs(ayy), Math.abs(axy), Math.abs(ax), Math.abs(ay), Math.abs(a));
|
|
1141
|
+
const b = this.solveAngles(coffs, degree, maxCoff, radians);
|
|
1162
1142
|
/*
|
|
1163
1143
|
for (const theta of angles) {
|
|
1164
1144
|
const c = theta.cos();
|
|
1165
1145
|
const s = theta.sin();
|
|
1166
1146
|
GeometryCoreTestIO.consoleLog({
|
|
1167
1147
|
angle: theta, co: c, si: s,
|
|
1168
|
-
f: axx * c * c + axy * c * s + ayy * s * s + ax * c + ay * s +
|
|
1169
|
-
|
|
1148
|
+
f: axx * c * c + axy * c * s + ayy * s * s + ax * c + ay * s + a,
|
|
1149
|
+
});
|
|
1150
|
+
} */
|
|
1170
1151
|
return b;
|
|
1171
1152
|
}
|
|
1172
1153
|
/**
|
|
@@ -1184,13 +1165,14 @@ class TrigPolynomial {
|
|
|
1184
1165
|
*/
|
|
1185
1166
|
static solveUnitCircleEllipseIntersection(cx, cy, ux, uy, vx, vy, ellipseRadians, circleRadians) {
|
|
1186
1167
|
circleRadians.length = 0;
|
|
1168
|
+
// see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients:
|
|
1187
1169
|
const acc = ux * ux + uy * uy;
|
|
1188
1170
|
const acs = 2.0 * (ux * vx + uy * vy);
|
|
1189
1171
|
const ass = vx * vx + vy * vy;
|
|
1190
1172
|
const ac = 2.0 * (ux * cx + uy * cy);
|
|
1191
|
-
const
|
|
1173
|
+
const as = 2.0 * (vx * cx + vy * cy);
|
|
1192
1174
|
const a = cx * cx + cy * cy - 1.0;
|
|
1193
|
-
const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac,
|
|
1175
|
+
const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, as, a, ellipseRadians);
|
|
1194
1176
|
for (const radians of ellipseRadians) {
|
|
1195
1177
|
const cc = Math.cos(radians);
|
|
1196
1178
|
const ss = Math.sin(radians);
|
|
@@ -1201,7 +1183,7 @@ class TrigPolynomial {
|
|
|
1201
1183
|
return status;
|
|
1202
1184
|
}
|
|
1203
1185
|
/**
|
|
1204
|
-
* Compute intersections of unit circle `x^2 + y^2 = w^2` with the ellipse
|
|
1186
|
+
* Compute intersections of unit circle `x^2 + y^2 = w^2` (in homogeneous coordinates) with the ellipse
|
|
1205
1187
|
* `F(t) = (cx + ux cos(t) + vx sin(t), cy + uy cos(t) + vy sin(t)) / (cw + uw cos(t) + vw sin(t))`.
|
|
1206
1188
|
* @param cx center x
|
|
1207
1189
|
* @param cy center y
|
|
@@ -1217,13 +1199,14 @@ class TrigPolynomial {
|
|
|
1217
1199
|
*/
|
|
1218
1200
|
static solveUnitCircleHomogeneousEllipseIntersection(cx, cy, cw, ux, uy, uw, vx, vy, vw, ellipseRadians, circleRadians) {
|
|
1219
1201
|
circleRadians.length = 0;
|
|
1202
|
+
// see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients:
|
|
1220
1203
|
const acc = ux * ux + uy * uy - uw * uw;
|
|
1221
1204
|
const acs = 2.0 * (ux * vx + uy * vy - uw * vw);
|
|
1222
1205
|
const ass = vx * vx + vy * vy - vw * vw;
|
|
1223
1206
|
const ac = 2.0 * (ux * cx + uy * cy - uw * cw);
|
|
1224
|
-
const
|
|
1207
|
+
const as = 2.0 * (vx * cx + vy * cy - vw * cw);
|
|
1225
1208
|
const a = cx * cx + cy * cy - cw * cw;
|
|
1226
|
-
const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac,
|
|
1209
|
+
const status = this.solveUnitCircleImplicitQuadricIntersection(acc, acs, ass, ac, as, a, ellipseRadians);
|
|
1227
1210
|
for (const radians of ellipseRadians) {
|
|
1228
1211
|
const cc = Math.cos(radians);
|
|
1229
1212
|
const ss = Math.sin(radians);
|
|
@@ -1237,326 +1220,62 @@ class TrigPolynomial {
|
|
|
1237
1220
|
exports.TrigPolynomial = TrigPolynomial;
|
|
1238
1221
|
// tolerance for small angle decision.
|
|
1239
1222
|
TrigPolynomial._smallAngle = 1.0e-11;
|
|
1240
|
-
|
|
1223
|
+
// see core\geometry\internaldocs\unitCircleEllipseIntersection.md for derivation of these coefficients.
|
|
1224
|
+
/** Standard Basis coefficients for the numerator of the y-coordinate y(t) = S(t)/W(t) in the rational semicircle parameterization. */
|
|
1241
1225
|
TrigPolynomial.S = Float64Array.from([0.0, 2.0, -2.0]);
|
|
1242
|
-
/** Standard Basis coefficients for rational
|
|
1226
|
+
/** Standard Basis coefficients for the numerator of the x-coordinate x(t) = C(t)/W(t) in the rational semicircle parameterization. */
|
|
1243
1227
|
TrigPolynomial.C = Float64Array.from([1.0, -2.0]);
|
|
1244
|
-
/** Standard Basis coefficients for rational
|
|
1228
|
+
/** Standard Basis coefficients for the denominator of x(t) and y(t) in the rational semicircle parameterization. */
|
|
1245
1229
|
TrigPolynomial.W = Float64Array.from([1.0, -2.0, 2.0]);
|
|
1246
|
-
/** Standard Basis coefficients for
|
|
1230
|
+
/** Standard Basis coefficients for C(t) * W(t). */
|
|
1247
1231
|
TrigPolynomial.CW = Float64Array.from([1.0, -4.0, 6.0, -4.0]);
|
|
1248
|
-
/** Standard Basis coefficients for
|
|
1232
|
+
/** Standard Basis coefficients for S(t) * W(t). */
|
|
1249
1233
|
TrigPolynomial.SW = Float64Array.from([0.0, 2.0, -6.0, 8.0, -4.0]);
|
|
1250
|
-
/** Standard Basis coefficients for
|
|
1234
|
+
/** Standard Basis coefficients for S(t) * C(t). */
|
|
1251
1235
|
TrigPolynomial.SC = Float64Array.from([0.0, 2.0, -6.0, 4.0]);
|
|
1252
|
-
/** Standard Basis coefficients for
|
|
1236
|
+
/** Standard Basis coefficients for S(t) * S(t). */
|
|
1253
1237
|
TrigPolynomial.SS = Float64Array.from([0.0, 0.0, 4.0, -8.0, 4.0]);
|
|
1254
|
-
/** Standard Basis coefficients for
|
|
1238
|
+
/** Standard Basis coefficients for C(t) * C(t). */
|
|
1255
1239
|
TrigPolynomial.CC = Float64Array.from([1.0, -4.0, 4.0]);
|
|
1256
|
-
/** Standard Basis coefficients for
|
|
1240
|
+
/** Standard Basis coefficients for W(t) * W(t). */
|
|
1257
1241
|
TrigPolynomial.WW = Float64Array.from([1.0, -4.0, 8.0, -8.0, 4.0]);
|
|
1258
|
-
/** Standard Basis coefficients for (
|
|
1259
|
-
TrigPolynomial.
|
|
1242
|
+
/** Standard Basis coefficients for C(t) * C(t) - S(t) * S(t). */
|
|
1243
|
+
TrigPolynomial.CCMinusSS = Float64Array.from([1.0, -4.0, 0.0, 8.0, -4.0]); // eslint-disable-line @typescript-eslint/naming-convention
|
|
1260
1244
|
TrigPolynomial._coefficientRelTol = 1.0e-12;
|
|
1261
1245
|
/**
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1246
|
+
* * bilinear expression
|
|
1247
|
+
* * `f(u,v) = a + b * u * c * v + d * u * v`
|
|
1248
|
+
* @internal
|
|
1264
1249
|
*/
|
|
1265
|
-
class
|
|
1266
|
-
/**
|
|
1267
|
-
* Return true if lines (a0,a1) to (b0, b1) have a simple intersection.
|
|
1268
|
-
* Return the fractional (not xy) coordinates in result.x, result.y
|
|
1269
|
-
* @param a0 start point of line a
|
|
1270
|
-
* @param a1 end point of line a
|
|
1271
|
-
* @param b0 start point of line b
|
|
1272
|
-
* @param b1 end point of line b
|
|
1273
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1274
|
-
*/
|
|
1275
|
-
static lineSegment2dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
|
|
1276
|
-
const ux = a1.x - a0.x;
|
|
1277
|
-
const uy = a1.y - a0.y;
|
|
1278
|
-
const vx = b1.x - b0.x;
|
|
1279
|
-
const vy = b1.y - b0.y;
|
|
1280
|
-
const cx = b0.x - a0.x;
|
|
1281
|
-
const cy = b0.y - a0.y;
|
|
1282
|
-
const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
|
|
1283
|
-
const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
|
|
1284
|
-
const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
|
|
1285
|
-
const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
|
|
1286
|
-
const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
|
|
1287
|
-
if (s !== undefined && t !== undefined) {
|
|
1288
|
-
result.set(s, -t);
|
|
1289
|
-
return true;
|
|
1290
|
-
}
|
|
1291
|
-
result.set(0, 0);
|
|
1292
|
-
return false;
|
|
1293
|
-
}
|
|
1294
|
-
/**
|
|
1295
|
-
* * (ax0,ay0) to (ax0+ux,ay0+uy) are line A.
|
|
1296
|
-
* * (bx0,by0) to (bx0+vx,by0+vy) are lineB.
|
|
1297
|
-
* * Return true if the lines have a simple intersection.
|
|
1298
|
-
* * Return the fractional (not xy) coordinates in result.x, result.y
|
|
1299
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1300
|
-
*/
|
|
1301
|
-
static lineSegmentXYUVTransverseIntersectionUnbounded(ax0, ay0, ux, uy, bx0, by0, vx, vy, result) {
|
|
1302
|
-
const cx = bx0 - ax0;
|
|
1303
|
-
const cy = by0 - ay0;
|
|
1304
|
-
const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
|
|
1305
|
-
const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
|
|
1306
|
-
const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
|
|
1307
|
-
const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
|
|
1308
|
-
const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
|
|
1309
|
-
if (s !== undefined && t !== undefined) {
|
|
1310
|
-
result.set(s, -t);
|
|
1311
|
-
return true;
|
|
1312
|
-
}
|
|
1313
|
-
result.set(0, 0);
|
|
1314
|
-
return false;
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
* Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts
|
|
1318
|
-
* Return the fractional (not xy) coordinates in result.x, result.y
|
|
1319
|
-
* @param a0 start point of line a
|
|
1320
|
-
* @param a1 end point of line a
|
|
1321
|
-
* @param b0 start point of line b
|
|
1322
|
-
* @param b1 end point of line b
|
|
1323
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1324
|
-
*/
|
|
1325
|
-
static lineSegment3dXYTransverseIntersectionUnbounded(a0, a1, b0, b1, result) {
|
|
1326
|
-
const ux = a1.x - a0.x;
|
|
1327
|
-
const uy = a1.y - a0.y;
|
|
1328
|
-
const vx = b1.x - b0.x;
|
|
1329
|
-
const vy = b1.y - b0.y;
|
|
1330
|
-
const cx = b0.x - a0.x;
|
|
1331
|
-
const cy = b0.y - a0.y;
|
|
1332
|
-
const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
|
|
1333
|
-
const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
|
|
1334
|
-
const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
|
|
1335
|
-
const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
|
|
1336
|
-
const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
|
|
1337
|
-
if (s !== undefined && t !== undefined) {
|
|
1338
|
-
result.set(s, -t);
|
|
1339
|
-
return true;
|
|
1340
|
-
}
|
|
1341
|
-
result.set(0, 0);
|
|
1342
|
-
return false;
|
|
1343
|
-
}
|
|
1344
|
-
/**
|
|
1345
|
-
* Return true if lines (a0,a1) to (b0, b1) have a simple intersection using only xy parts of WEIGHTED 4D Points
|
|
1346
|
-
* Return the fractional (not xy) coordinates in result.x, result.y
|
|
1347
|
-
* @param hA0 homogeneous start point of line a
|
|
1348
|
-
* @param hA1 homogeneous end point of line a
|
|
1349
|
-
* @param hB0 homogeneous start point of line b
|
|
1350
|
-
* @param hB1 homogeneous end point of line b
|
|
1351
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1352
|
-
*/
|
|
1353
|
-
static lineSegment3dHXYTransverseIntersectionUnbounded(hA0, hA1, hB0, hB1, result) {
|
|
1354
|
-
// Considering only x,y,w parts....
|
|
1355
|
-
// Point Q along B is (in full homogeneous) `(1-lambda) B0 + lambda 1`
|
|
1356
|
-
// PointQ is colinear with A0,A1 when the determinant det (A0,A1,Q) is zero. (Each column takes xyw parts)
|
|
1357
|
-
const alpha0 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB0.x, hA0.y, hA1.y, hB0.y, hA0.w, hA1.w, hB0.w);
|
|
1358
|
-
const alpha1 = Geometry_1.Geometry.tripleProduct(hA0.x, hA1.x, hB1.x, hA0.y, hA1.y, hB1.y, hA0.w, hA1.w, hB1.w);
|
|
1359
|
-
const fractionB = Geometry_1.Geometry.conditionalDivideFraction(-alpha0, alpha1 - alpha0);
|
|
1360
|
-
if (fractionB !== undefined) {
|
|
1361
|
-
const beta0 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA0.x, hB0.y, hB1.y, hA0.y, hB0.w, hB1.w, hA0.w);
|
|
1362
|
-
const beta1 = Geometry_1.Geometry.tripleProduct(hB0.x, hB1.x, hA1.x, hB0.y, hB1.y, hA1.y, hB0.w, hB1.w, hA1.w);
|
|
1363
|
-
const fractionA = Geometry_1.Geometry.conditionalDivideFraction(-beta0, beta1 - beta0);
|
|
1364
|
-
if (fractionA !== undefined)
|
|
1365
|
-
return Point2dVector2d_1.Vector2d.create(fractionA, fractionB, result);
|
|
1366
|
-
}
|
|
1367
|
-
return undefined;
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Return the line fraction at which the (homogeneous) line is closest to a space point as viewed in xy only.
|
|
1371
|
-
* @param hA0 homogeneous start point of line a
|
|
1372
|
-
* @param hA1 homogeneous end point of line a
|
|
1373
|
-
* @param spacePoint homogeneous point in space
|
|
1374
|
-
*/
|
|
1375
|
-
static lineSegment3dHXYClosestPointUnbounded(hA0, hA1, spacePoint) {
|
|
1376
|
-
// Considering only x,y,w parts....
|
|
1377
|
-
// weighted difference of (A1 w0 - A0 w1) is (cartesian) tangent vector along the line as viewed.
|
|
1378
|
-
// The perpendicular (pure vector) W = (-y,x) flip is the direction of projection
|
|
1379
|
-
// Point Q along A is (in full homogeneous) `(1-lambda) A0 + lambda 1 A1`
|
|
1380
|
-
// PointQ is colinear with spacePoint and and W when the xyw homogeneous determinant | Q W spacePoint | is zero.
|
|
1381
|
-
const tx = hA1.x * hA0.w - hA0.x * hA1.w;
|
|
1382
|
-
const ty = hA1.y * hA0.w - hA0.y * hA1.w;
|
|
1383
|
-
const det0 = Geometry_1.Geometry.tripleProduct(hA0.x, -ty, spacePoint.x, hA0.y, tx, spacePoint.y, hA0.w, 0, spacePoint.w);
|
|
1384
|
-
const det1 = Geometry_1.Geometry.tripleProduct(hA1.x, -ty, spacePoint.x, hA1.y, tx, spacePoint.y, hA1.w, 0, spacePoint.w);
|
|
1385
|
-
return Geometry_1.Geometry.conditionalDivideFraction(-det0, det1 - det0);
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Return the line fraction at which the line is closest to a space point as viewed in xy only.
|
|
1389
|
-
* @param pointA0 start point
|
|
1390
|
-
* @param pointA1 end point
|
|
1391
|
-
* @param spacePoint point in space
|
|
1392
|
-
*/
|
|
1393
|
-
static lineSegment3dXYClosestPointUnbounded(pointA0, pointA1, spacePoint) {
|
|
1394
|
-
// Considering only x,y parts....
|
|
1395
|
-
const ux = pointA1.x - pointA0.x;
|
|
1396
|
-
const uy = pointA1.y - pointA0.y;
|
|
1397
|
-
const uu = ux * ux + uy * uy;
|
|
1398
|
-
const vx = spacePoint.x - pointA0.x;
|
|
1399
|
-
const vy = spacePoint.y - pointA0.y;
|
|
1400
|
-
const uv = ux * vx + uy * vy;
|
|
1401
|
-
return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* Return the line fraction at which the line is closest to a space point
|
|
1405
|
-
* @param pointA0 start point
|
|
1406
|
-
* @param pointA1 end point
|
|
1407
|
-
* @param spacePoint point in space
|
|
1408
|
-
*/
|
|
1409
|
-
static lineSegment3dClosestPointUnbounded(pointA0, pointA1, spacePoint) {
|
|
1410
|
-
const ux = pointA1.x - pointA0.x;
|
|
1411
|
-
const uy = pointA1.y - pointA0.y;
|
|
1412
|
-
const uz = pointA1.z - pointA0.z;
|
|
1413
|
-
const uu = ux * ux + uy * uy + uz * uz;
|
|
1414
|
-
const vx = spacePoint.x - pointA0.x;
|
|
1415
|
-
const vy = spacePoint.y - pointA0.y;
|
|
1416
|
-
const vz = spacePoint.z - pointA0.z;
|
|
1417
|
-
const uv = ux * vx + uy * vy + uz * vz;
|
|
1418
|
-
return Geometry_1.Geometry.conditionalDivideFraction(uv, uu);
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Return true if lines (a0,a1) to (b0, b1) have closest approach (go by each other) in 3d
|
|
1422
|
-
* Return the fractional (not xy) coordinates in result.x, result.y
|
|
1423
|
-
* @param a0 start point of line a
|
|
1424
|
-
* @param a1 end point of line a
|
|
1425
|
-
* @param b0 start point of line b
|
|
1426
|
-
* @param b1 end point of line b
|
|
1427
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1428
|
-
*/
|
|
1429
|
-
static lineSegment3dClosestApproachUnbounded(a0, a1, b0, b1, result) {
|
|
1430
|
-
return this.ray3dXYZUVWClosestApproachUnbounded(a0.x, a0.y, a0.z, a1.x - a0.x, a1.y - a0.y, a1.z - a0.z, b0.x, b0.y, b0.z, b1.x - b0.x, b1.y - b0.y, b1.z - b0.z, result);
|
|
1431
|
-
}
|
|
1432
|
-
/**
|
|
1433
|
-
* Return true if the given rays have closest approach (go by each other) in 3d
|
|
1434
|
-
* Return the fractional (not xy) coordinates as x and y parts of a Point2d.
|
|
1435
|
-
* @param ax x-coordinate of the origin of the first ray
|
|
1436
|
-
* @param ay y-coordinate of the origin of the first ray
|
|
1437
|
-
* @param az z-coordinate of the origin of the first ray
|
|
1438
|
-
* @param au x-coordinate of the direction vector of the first ray
|
|
1439
|
-
* @param av y-coordinate of the direction vector of the first ray
|
|
1440
|
-
* @param aw z-coordinate of the direction vector of the first ray
|
|
1441
|
-
* @param bx x-coordinate of the origin of the second ray
|
|
1442
|
-
* @param by y-coordinate of the origin of the second ray
|
|
1443
|
-
* @param bz z-coordinate of the origin of the second ray
|
|
1444
|
-
* @param bu x-coordinate of the direction vector of the second ray
|
|
1445
|
-
* @param bv y-coordinate of the direction vector of the second ray
|
|
1446
|
-
* @param bw z-coordinate of the direction vector of the second ray
|
|
1447
|
-
* @param result point to receive fractional coordinates of intersection. result.x is fraction on line a. result.y is fraction on line b.
|
|
1448
|
-
*/
|
|
1449
|
-
static ray3dXYZUVWClosestApproachUnbounded(ax, ay, az, au, av, aw, bx, by, bz, bu, bv, bw, result) {
|
|
1450
|
-
const cx = bx - ax;
|
|
1451
|
-
const cy = by - ay;
|
|
1452
|
-
const cz = bz - az;
|
|
1453
|
-
const uu = Geometry_1.Geometry.hypotenuseSquaredXYZ(au, av, aw);
|
|
1454
|
-
const vv = Geometry_1.Geometry.hypotenuseSquaredXYZ(bu, bv, bw);
|
|
1455
|
-
const uv = Geometry_1.Geometry.dotProductXYZXYZ(au, av, aw, bu, bv, bw);
|
|
1456
|
-
const cu = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, au, av, aw);
|
|
1457
|
-
const cv = Geometry_1.Geometry.dotProductXYZXYZ(cx, cy, cz, bu, bv, bw);
|
|
1458
|
-
return SmallSystem.linearSystem2d(uu, -uv, uv, -vv, cu, cv, result);
|
|
1459
|
-
}
|
|
1460
|
-
/**
|
|
1461
|
-
* Solve the pair of linear equations
|
|
1462
|
-
* * `ux * x + vx * y = cx`
|
|
1463
|
-
* * `uy * x + vy * y = cy`
|
|
1464
|
-
* @param ux xx coefficient
|
|
1465
|
-
* @param vx xy coefficient
|
|
1466
|
-
* @param uy yx coefficient
|
|
1467
|
-
* @param vy yy coefficient
|
|
1468
|
-
* @param cx x right hand side
|
|
1469
|
-
* @param cy y right hand side
|
|
1470
|
-
* @param result (x,y) solution (MUST be preallocated by caller)
|
|
1471
|
-
*/
|
|
1472
|
-
static linearSystem2d(ux, vx, // first row of matrix
|
|
1473
|
-
uy, vy, // second row of matrix
|
|
1474
|
-
cx, cy, // right side
|
|
1475
|
-
result) {
|
|
1476
|
-
const uv = Geometry_1.Geometry.crossProductXYXY(ux, uy, vx, vy);
|
|
1477
|
-
const cv = Geometry_1.Geometry.crossProductXYXY(cx, cy, vx, vy);
|
|
1478
|
-
const cu = Geometry_1.Geometry.crossProductXYXY(ux, uy, cx, cy);
|
|
1479
|
-
const s = Geometry_1.Geometry.conditionalDivideFraction(cv, uv);
|
|
1480
|
-
const t = Geometry_1.Geometry.conditionalDivideFraction(cu, uv);
|
|
1481
|
-
if (s !== undefined && t !== undefined) {
|
|
1482
|
-
result.set(s, t);
|
|
1483
|
-
return true;
|
|
1484
|
-
}
|
|
1485
|
-
result.set(0, 0);
|
|
1486
|
-
return false;
|
|
1487
|
-
}
|
|
1250
|
+
class BilinearPolynomial {
|
|
1488
1251
|
/**
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
* @param
|
|
1494
|
-
* @param axy row 0, column 1 coefficient
|
|
1495
|
-
* @param axz row 0, column 1 coefficient
|
|
1496
|
-
* @param ayx row 1, column 0 coefficient
|
|
1497
|
-
* @param ayy row 1, column 1 coefficient
|
|
1498
|
-
* @param ayz row 1, column 2 coefficient
|
|
1499
|
-
* @param azx row 2, column 0 coefficient
|
|
1500
|
-
* @param azy row 2, column 1 coefficient
|
|
1501
|
-
* @param azz row 2, column 2 coefficient
|
|
1502
|
-
* @param cx right hand side row 0 coefficient
|
|
1503
|
-
* @param cy right hand side row 1 coefficient
|
|
1504
|
-
* @param cz right hand side row 2 coefficient
|
|
1505
|
-
* @param result optional result.
|
|
1506
|
-
* @returns solution vector (u,v,w) or `undefined` if system is singular.
|
|
1252
|
+
*
|
|
1253
|
+
* @param a constant coefficient
|
|
1254
|
+
* @param b `u` coefficient
|
|
1255
|
+
* @param c `v` coefficient
|
|
1256
|
+
* @param d `u*v` coefficient
|
|
1507
1257
|
*/
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
// determinants of various combinations of columns ...
|
|
1514
|
-
const detXYZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, axz, ayz, azz);
|
|
1515
|
-
const detCYZ = Geometry_1.Geometry.tripleProduct(cx, cy, cz, axy, ayy, azy, axz, ayz, azz);
|
|
1516
|
-
const detXCZ = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, cx, cy, cz, axz, ayz, azz);
|
|
1517
|
-
const detXYC = Geometry_1.Geometry.tripleProduct(axx, ayx, azx, axy, ayy, azy, cx, cy, cz);
|
|
1518
|
-
const s = Geometry_1.Geometry.conditionalDivideFraction(detCYZ, detXYZ);
|
|
1519
|
-
const t = Geometry_1.Geometry.conditionalDivideFraction(detXCZ, detXYZ);
|
|
1520
|
-
const u = Geometry_1.Geometry.conditionalDivideFraction(detXYC, detXYZ);
|
|
1521
|
-
if (s !== undefined && t !== undefined && u !== undefined) {
|
|
1522
|
-
return Point3dVector3d_1.Vector3d.create(s, t, u, result);
|
|
1523
|
-
}
|
|
1524
|
-
return undefined;
|
|
1258
|
+
constructor(a, b, c, d) {
|
|
1259
|
+
this.a = a;
|
|
1260
|
+
this.b = b;
|
|
1261
|
+
this.c = c;
|
|
1262
|
+
this.d = d;
|
|
1525
1263
|
}
|
|
1526
1264
|
/**
|
|
1527
|
-
*
|
|
1528
|
-
* @param xyzA point on the first plane
|
|
1529
|
-
* @param normalA normal of the first plane
|
|
1530
|
-
* @param xyzB point on the second plane
|
|
1531
|
-
* @param normalB normal of the second plane
|
|
1532
|
-
* @param xyzC point on the third plane
|
|
1533
|
-
* @param normalC normal of the third plane
|
|
1534
|
-
* @param result optional result
|
|
1535
|
-
* @returns intersection point of the three planes (as a Vector3d), or undefined if at least two planes are parallel.
|
|
1265
|
+
* Evaluate the bilinear expression at u,v
|
|
1536
1266
|
*/
|
|
1537
|
-
|
|
1538
|
-
return this.
|
|
1267
|
+
evaluate(u, v) {
|
|
1268
|
+
return this.a + this.b * u + v * (this.c + this.d * u);
|
|
1539
1269
|
}
|
|
1540
|
-
/**
|
|
1541
|
-
* * in rowB, replace `rowB[j] += a * rowB[pivot] * rowA[j] / rowA[pivot]` for `j>pivot`
|
|
1542
|
-
* @param rowA row that does not change
|
|
1543
|
-
* @param pivotIndex index of pivot (divisor) in rowA.
|
|
1544
|
-
* @param rowB row where elimination occurs.
|
|
1270
|
+
/** Create a bilinear polynomial z=f(u,v) given z values at 00, 10, 01, 11.
|
|
1545
1271
|
*/
|
|
1546
|
-
static
|
|
1547
|
-
|
|
1548
|
-
let q = Geometry_1.Geometry.conditionalDivideFraction(rowB[pivotIndex], rowA[pivotIndex]);
|
|
1549
|
-
if (q === undefined)
|
|
1550
|
-
return false;
|
|
1551
|
-
q *= a;
|
|
1552
|
-
for (let j = pivotIndex + 1; j < n; j++)
|
|
1553
|
-
rowB[j] += q * rowA[j];
|
|
1554
|
-
return true;
|
|
1272
|
+
static createUnitSquareValues(f00, f10, f01, f11) {
|
|
1273
|
+
return new BilinearPolynomial(f00, f10, f10, f11 - f10 - f01);
|
|
1555
1274
|
}
|
|
1556
1275
|
/**
|
|
1557
1276
|
* Solve a pair of bilinear equations
|
|
1558
1277
|
* * First equation: `a0 + b0 * u + c0 * v + d0 * u * v = 0`
|
|
1559
|
-
* * Second equation: `
|
|
1278
|
+
* * Second equation: `a1 + b1 * u + c1 * v + d1 * u * v = 0`
|
|
1560
1279
|
*/
|
|
1561
1280
|
static solveBilinearPair(a0, b0, c0, d0, a1, b1, c1, d1) {
|
|
1562
1281
|
// constant linear, and quadratic coefficients for c0 + c1 * u + c2 * u*u = 0
|
|
@@ -1577,38 +1296,6 @@ class SmallSystem {
|
|
|
1577
1296
|
}
|
|
1578
1297
|
return uv;
|
|
1579
1298
|
}
|
|
1580
|
-
}
|
|
1581
|
-
exports.SmallSystem = SmallSystem;
|
|
1582
|
-
/**
|
|
1583
|
-
* * bilinear expression
|
|
1584
|
-
* * `f(u,v) = a + b * u * c * v + d * u * v`
|
|
1585
|
-
* @internal
|
|
1586
|
-
*/
|
|
1587
|
-
class BilinearPolynomial {
|
|
1588
|
-
/**
|
|
1589
|
-
*
|
|
1590
|
-
* @param a constant coefficient
|
|
1591
|
-
* @param b `u` coefficient
|
|
1592
|
-
* @param c `v` coefficient
|
|
1593
|
-
* @param d `u*v` coefficient
|
|
1594
|
-
*/
|
|
1595
|
-
constructor(a, b, c, d) {
|
|
1596
|
-
this.a = a;
|
|
1597
|
-
this.b = b;
|
|
1598
|
-
this.c = c;
|
|
1599
|
-
this.d = d;
|
|
1600
|
-
}
|
|
1601
|
-
/**
|
|
1602
|
-
* Evaluate the bilinear expression at u,v
|
|
1603
|
-
*/
|
|
1604
|
-
evaluate(u, v) {
|
|
1605
|
-
return this.a + this.b * u + v * (this.c + this.d * u);
|
|
1606
|
-
}
|
|
1607
|
-
/** Create a bilinear polynomial z=f(u,v) given z values at 00, 10, 01, 11.
|
|
1608
|
-
*/
|
|
1609
|
-
static createUnitSquareValues(f00, f10, f01, f11) {
|
|
1610
|
-
return new BilinearPolynomial(f00, f10, f10, f11 - f10 - f01);
|
|
1611
|
-
}
|
|
1612
1299
|
/**
|
|
1613
1300
|
* Solve the simultaneous equations
|
|
1614
1301
|
* * `p(u,v) = pValue`
|
|
@@ -1619,7 +1306,7 @@ class BilinearPolynomial {
|
|
|
1619
1306
|
* @param qValue
|
|
1620
1307
|
*/
|
|
1621
1308
|
static solvePair(p, pValue, q, qValue) {
|
|
1622
|
-
return
|
|
1309
|
+
return BilinearPolynomial.solveBilinearPair(p.a - pValue, p.b, p.c, p.d, q.a - qValue, q.b, q.c, q.d);
|
|
1623
1310
|
}
|
|
1624
1311
|
}
|
|
1625
1312
|
exports.BilinearPolynomial = BilinearPolynomial;
|