Curve.ComputeClosestPoints
Method
Description:
Find the closest points between two curves. Closest points mean closest pairs of points, each pair consisting of a point on this, say P1, and a point on other curve, say P2. P1 and P2 are closest locally.
Find the closest points between two curves. Closest points mean closest pairs of points, each pair consisting of a point on this, say P1, and a point on other curve, say P2. P1 and P2 are closest locally.
Remarks:
The output list of closest points contains one entry for each pair of closest points. The following is the meaning of every ClosestPointsPairBetweenTwoCurves's members:
The output list of closest points contains one entry for each pair of closest points. The following is the meaning of every ClosestPointsPairBetweenTwoCurves's members:
- XYZPointOnFirstCurve is the closest point on the first curve;
- XYZPointOnSecondCurve is the closest point on the second curve;
- ParameterOnFirstCurve is the raw (not normalized) parameter on the first curve
- ParameterOnSecondCurve is the raw (not normalized) parameter on the second curve
- Distance is the distance from the closest point on the first curve to the closest point on the second curve.
Syntax
public void ComputeClosestPoints(
Curve otherCurve,
bool withinThisCurveBounds,
bool withinOtherCurveBounds,
bool returnAllCriticalPnts,
out IList<ClosestPointsPairBetweenTwoCurves> resultList
)
Parameters
Parameter | Type | Description |
---|---|---|
otherCurve | Curve | The specified curve used to compute closest points to this curve. |
withinThisCurveBounds | Boolean | If this parameter is true only the solutions that are between this curve bounds will be returned. This curve must be bound if this parameter is true. |
withinOtherCurveBounds | Boolean | If this parameter is true only the solutions that are between other curve bounds will be returned. The other curve must be bound if this parameter is true. |
returnAllCriticalPnts | Boolean | The input parameter returnAllCriticalPnts is used to tell if all the critical points of the distance function are to be returned. |
resultList | IList | Output parameter that will contain the results collection. |
Return Value
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when otherCurve argument is null. Thrown when resultArray is null. |
ArgumentsInconsistentException | Thrown when withinThisCurveBounds is true and this curve is unbounded. Thrown when withinOtherCurveBounds is true and other curve is unbounded. |
InvalidOperationException | Thrown when the method failed. For example the problem has infinitely many solutions such as two parallel lines or two concentric circles, or in other singular cases that the method currently cannot handle, such as evaluating the closest points between a spline and a line, and the spline contains a flat segment (all points on the segment have zero curvature), and the closest points lie within that flat segment. |