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