@itwin/core-geometry 5.7.2 → 5.8.0-dev.10
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 +1 -1
- package/lib/cjs/Geometry.d.ts +24 -14
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +34 -14
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +2 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +19 -3
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +50 -23
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js +317 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +18 -5
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +34 -14
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +12 -11
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +36 -36
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.d.ts +5 -5
- package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js +4 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +14 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +19 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +2 -2
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +2 -2
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +4 -15
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +1 -35
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +18 -13
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js +78 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +843 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js +300 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js +141 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js +170 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +187 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +197 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js +208 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js +193 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +2 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +2 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -0
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +5 -0
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +7 -0
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +2 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +8 -6
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/Geometry.d.ts +24 -14
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +34 -14
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts +2 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +19 -3
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +50 -23
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/esm/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/ConstrainedCurve2d.js +313 -0
- package/lib/esm/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -5
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +34 -14
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +12 -11
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +36 -36
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.d.ts +5 -5
- package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js +4 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +14 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +19 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +2 -2
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +2 -2
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +4 -15
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +1 -35
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +19 -14
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js +74 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +839 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js +295 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js +135 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +148 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js +166 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +183 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +193 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js +204 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js +189 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/esm/geometry3d/Ellipsoid.d.ts +2 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +2 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -0
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +5 -0
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +7 -0
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +2 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +8 -6
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/curve/Arc3d.js
CHANGED
|
@@ -767,48 +767,61 @@ export class Arc3d extends CurvePrimitive {
|
|
|
767
767
|
/**
|
|
768
768
|
* Return details of the closest point on the arc, optionally extending to full ellipse.
|
|
769
769
|
* @param spacePoint search for point closest to this point.
|
|
770
|
-
* @param extend if true, consider projections to the complete ellipse. If false, consider only endpoints
|
|
771
|
-
* projections within the arc sweep.
|
|
770
|
+
* @param extend if true, consider projections to the complete ellipse. If false (default), consider only endpoints
|
|
771
|
+
* and projections within the arc sweep. Note that for an open arc, extending one end is the same as extending both ends.
|
|
772
772
|
* @param result optional preallocated result.
|
|
773
773
|
*/
|
|
774
|
-
closestPoint(spacePoint, extend, result) {
|
|
774
|
+
closestPoint(spacePoint, extend = false, result) {
|
|
775
775
|
result = CurveLocationDetail.create(this, result);
|
|
776
|
-
const allRadians = this.allPerpendicularAngles(spacePoint, true,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
extend0
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
allRadians.push(this._sweep.startRadians);
|
|
786
|
-
allRadians.push(this._sweep.endRadians);
|
|
776
|
+
const allRadians = this.allPerpendicularAngles(spacePoint, true, false);
|
|
777
|
+
// test endpoints if and only if arc is open and unextended
|
|
778
|
+
if (!this._sweep.isFullCircle) {
|
|
779
|
+
const extend0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0);
|
|
780
|
+
const extend1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1);
|
|
781
|
+
if (extend0 === CurveExtendMode.None && extend1 === CurveExtendMode.None) {
|
|
782
|
+
allRadians.push(this._sweep.startRadians);
|
|
783
|
+
allRadians.push(this._sweep.endRadians);
|
|
784
|
+
}
|
|
787
785
|
}
|
|
788
|
-
// hm... logically there must at least two angles there ... but if it happens return the start point ...
|
|
789
786
|
const workRay = Ray3d.createZero();
|
|
790
|
-
if (allRadians.length === 0) {
|
|
791
|
-
result.setFR(0.0, this.radiansToPointAndDerivative(this._sweep.startRadians, workRay));
|
|
792
|
-
result.a = spacePoint.distance(result.point);
|
|
787
|
+
if (allRadians.length === 0) { // shouldn't happen; there should always be at least 2 angles
|
|
788
|
+
result.setFR(0.0, this.radiansToPointAndDerivative(this._sweep.startRadians, workRay), spacePoint.distance(result.point));
|
|
793
789
|
}
|
|
794
790
|
else {
|
|
795
791
|
let dMin = Number.MAX_VALUE;
|
|
796
792
|
let d = 0;
|
|
797
793
|
for (const radians of allRadians) {
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
this.fractionToPointAndDerivative(fraction, workRay);
|
|
794
|
+
const validatedFraction = CurveExtendOptions.resolveRadiansToValidSweepFraction(extend, radians, this.sweep);
|
|
795
|
+
if (validatedFraction.isValid) {
|
|
796
|
+
this.fractionToPointAndDerivative(validatedFraction.fraction, workRay);
|
|
801
797
|
d = spacePoint.distance(workRay.origin);
|
|
802
798
|
if (d < dMin) {
|
|
803
799
|
dMin = d;
|
|
804
|
-
result.setFR(fraction, workRay);
|
|
805
|
-
result.a = d;
|
|
800
|
+
result.setFR(validatedFraction.fraction, workRay, d);
|
|
806
801
|
}
|
|
807
802
|
}
|
|
808
803
|
}
|
|
809
804
|
}
|
|
810
805
|
return result;
|
|
811
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* Search for a point on the Arc3d that is closest to the spacePoint as viewed in the xy-plane (ignoring z).
|
|
809
|
+
* * If the space point is exactly on the curve, this is the reverse of fractionToPoint.
|
|
810
|
+
* * Since CurvePrimitive should always have start and end available as candidate points, this method should always
|
|
811
|
+
* succeed.
|
|
812
|
+
* @param spacePoint point in space.
|
|
813
|
+
* @param extend if true, consider projections to the complete ellipse. If false (default), consider only endpoints
|
|
814
|
+
* and projections within the arc sweep. Note that for an open arc, extending one end is the same as extending both ends.
|
|
815
|
+
* @param result (optional) pre-allocated detail to populate and return.
|
|
816
|
+
* @returns details of the closest point.
|
|
817
|
+
*/
|
|
818
|
+
closestPointXY(spacePoint, extend = false, result) {
|
|
819
|
+
// prevent `ClosestPointStroker.claimResult` from clamping an exterior fraction when arc is half-extended
|
|
820
|
+
const extend0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0);
|
|
821
|
+
const extend1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1);
|
|
822
|
+
extend = extend0 !== CurveExtendMode.None || extend1 !== CurveExtendMode.None;
|
|
823
|
+
return super.closestPointXY(spacePoint, extend, result); // TODO: implement exact solution instead of deferring to superclass
|
|
824
|
+
}
|
|
812
825
|
/** Override of [[CurvePrimitive.emitTangents]] for Arc3d. */
|
|
813
826
|
emitTangents(spacePoint, announceTangent, options) {
|
|
814
827
|
const centerToPoint = Vector3d.createStartEnd(this.centerRef, spacePoint);
|
|
@@ -876,6 +889,20 @@ export class Arc3d extends CurvePrimitive {
|
|
|
876
889
|
const axy = this._matrix.columnXDotColumnY();
|
|
877
890
|
return Angle.isPerpendicularDotSet(axx, ayy, axy) && Geometry.isSameCoordinateSquared(axx, ayy);
|
|
878
891
|
}
|
|
892
|
+
/** Return true if the vector0 and vector90 xy parts are of equal length and perpendicular. */
|
|
893
|
+
get isCircularXY() {
|
|
894
|
+
const columnX = this._matrix.columnX();
|
|
895
|
+
const columnY = this._matrix.columnY();
|
|
896
|
+
const axx = columnX.magnitudeSquaredXY();
|
|
897
|
+
const ayy = columnY.magnitudeSquaredXY();
|
|
898
|
+
const axy = columnX.dotProductXY(columnY);
|
|
899
|
+
return Angle.isPerpendicularDotSet(axx, ayy, axy) && Geometry.isSameCoordinateSquared(axx, ayy);
|
|
900
|
+
}
|
|
901
|
+
/** Return true if the arc has zero radius (is a point). */
|
|
902
|
+
get isDegenerateCircle() {
|
|
903
|
+
return Geometry.isSmallMetricDistanceSquared(this._matrix.columnXMagnitudeSquared()) &&
|
|
904
|
+
Geometry.isSmallMetricDistanceSquared(this._matrix.columnYMagnitudeSquared());
|
|
905
|
+
}
|
|
879
906
|
/** Return radius if the vector0 and vector90 are of equal length and perpendicular. Ignores z. */
|
|
880
907
|
circularRadiusXY() {
|
|
881
908
|
const ux = this._matrix.at(0, 0);
|