Method DistanceTo
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
DistanceTo(GeoPoint2)
Gets the distance from this spline to a point, using the default tolerance.
public double DistanceTo(GeoPoint2 point)
Parameters
pointGeoPoint2The point.
Returns
- double
The distance from the point to the nearest point of the curve, which is a line and not a region: a point inside a closed spline is as far from it as from the nearest of its points. Nought only where the point truly lies on it, otherwise the gap, measured exactly; exact to rounding, however the curve bends.
DistanceTo(GeoPoint2, Tolerance)
Gets the distance from this spline to a point, within a tolerance.
public double DistanceTo(GeoPoint2 point, Tolerance tolerance)
Parameters
pointGeoPoint2The point.
toleranceToleranceThe tolerance; not read, since the nearest point takes none.
Returns
- double
The distance from the point to the nearest point of the curve, measured exactly. The circle of radius 100 about the origin, as FromCircle(GeoCircle2) makes it, is 60 from (160, 0) and 100 from its own centre.
Remarks
The nearest point is found as GetKnotAtPoint(GeoPoint2) finds it: on each span the parameters where the curve stops coming nearer, all of them, from the roots of a polynomial in Bernstein form, and the ends; whichever span cannot be nearer than the best found, by the box of its control points, is not solved. The boxes are kept in a tree, built once, so the spans near the point are reached without looking at the rest: a query costs time in the logarithm of the number of spans and the number whose boxes are near the point, about 10 microseconds on a spiral of 100 000 spans where it was 0.5 ms before the tree, and a span solved costs about a microsecond. A spline of up to 24 spans looks at its boxes one by one, which is faster for so few.
DistanceTo(GeoLine2)
Calculates the shortest distance from this spline to a line segment, using the default tolerance.
public double DistanceTo(GeoLine2 line)
Parameters
lineGeoLine2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoLine2, Tolerance)
Calculates the shortest distance from this spline to a line segment, within a tolerance.
public double DistanceTo(GeoLine2 line, Tolerance tolerance)
Parameters
lineGeoLine2The line segment.
toleranceToleranceThe tolerance: a line segment no longer than its point tolerance is read as its start where it does not truly meet the spline.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
DistanceTo(GeoRay2)
Calculates the shortest distance from this spline to a ray, using the default tolerance.
public double DistanceTo(GeoRay2 ray)
Parameters
rayGeoRay2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoRay2, Tolerance)
Calculates the shortest distance from this spline to a ray, within a tolerance.
public double DistanceTo(GeoRay2 ray, Tolerance tolerance)
Parameters
rayGeoRay2The ray.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
DistanceTo(GeoXLine2)
Calculates the shortest distance from this spline to an infinite line, using the default tolerance.
public double DistanceTo(GeoXLine2 xline)
Parameters
xlineGeoXLine2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoXLine2, Tolerance)
Calculates the shortest distance from this spline to an infinite line, within a tolerance.
public double DistanceTo(GeoXLine2 xline, Tolerance tolerance)
Parameters
xlineGeoXLine2The infinite line.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
DistanceTo(GeoPolyline2)
Calculates the shortest distance from this spline to a polyline, using the default tolerance.
public double DistanceTo(GeoPolyline2 polyline)
Parameters
polylineGeoPolyline2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoPolyline2, Tolerance)
Calculates the shortest distance from this spline to a polyline, within a tolerance.
public double DistanceTo(GeoPolyline2 polyline, Tolerance tolerance)
Parameters
polylineGeoPolyline2The polyline.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoPolygon2)
Calculates the shortest distance from this spline to a polygon, using the default tolerance.
public double DistanceTo(GeoPolygon2 polygon)
Parameters
polygonGeoPolygon2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoPolygon2, Tolerance)
Calculates the shortest distance from this spline to a polygon, within a tolerance.
public double DistanceTo(GeoPolygon2 polygon, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A polygon is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoRectangle2)
Calculates the shortest distance from this spline to a rectangle, using the default tolerance.
public double DistanceTo(GeoRectangle2 rect)
Parameters
rectGeoRectangle2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoRectangle2, Tolerance)
Calculates the shortest distance from this spline to a rectangle, within a tolerance.
public double DistanceTo(GeoRectangle2 rect, Tolerance tolerance)
Parameters
rectGeoRectangle2The rectangle.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A rectangle is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
DistanceTo(GeoTriangle2)
Calculates the shortest distance from this spline to a triangle, using the default tolerance.
public double DistanceTo(GeoTriangle2 triangle)
Parameters
triangleGeoTriangle2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoTriangle2, Tolerance)
Calculates the shortest distance from this spline to a triangle, within a tolerance.
public double DistanceTo(GeoTriangle2 triangle, Tolerance tolerance)
Parameters
triangleGeoTriangle2The triangle.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A triangle is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
DistanceTo(GeoFace2)
Calculates the shortest distance from this spline to a face, using the default tolerance.
public double DistanceTo(GeoFace2 face)
Parameters
faceGeoFace2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoFace2, Tolerance)
Calculates the shortest distance from this spline to a face, within a tolerance.
public double DistanceTo(GeoFace2 face, Tolerance tolerance)
Parameters
faceGeoFace2The face.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A face is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoArc2)
Calculates the shortest distance from this spline to an arc, using the default tolerance.
public double DistanceTo(GeoArc2 arc)
Parameters
arcGeoArc2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoArc2, Tolerance)
Calculates the shortest distance from this spline to an arc, within a tolerance.
public double DistanceTo(GeoArc2 arc, Tolerance tolerance)
Parameters
arcGeoArc2The arc.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
DistanceTo(GeoCircle2)
Calculates the shortest distance from this spline to a circle, using the default tolerance.
public double DistanceTo(GeoCircle2 circle)
Parameters
circleGeoCircle2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoCircle2, Tolerance)
Calculates the shortest distance from this spline to a circle, within a tolerance.
public double DistanceTo(GeoCircle2 circle, Tolerance tolerance)
Parameters
circleGeoCircle2The circle.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A circle is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
DistanceTo(GeoEllipse2)
Calculates the shortest distance from this spline to an ellipse, using the default tolerance.
public double DistanceTo(GeoEllipse2 ellipse)
Parameters
ellipseGeoEllipse2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoEllipse2, Tolerance)
Calculates the shortest distance from this spline to an ellipse, within a tolerance.
public double DistanceTo(GeoEllipse2 ellipse, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
An ellipse is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
DistanceTo(GeoEdge2)
Calculates the shortest distance from this spline to an edge, using the default tolerance.
public double DistanceTo(GeoEdge2 edge)
Parameters
edgeGeoEdge2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoEdge2, Tolerance)
Calculates the shortest distance from this spline to an edge, within a tolerance.
public double DistanceTo(GeoEdge2 edge, Tolerance tolerance)
Parameters
edgeGeoEdge2The edge.
toleranceToleranceThe tolerance: a straight edge no longer than its point tolerance is read as its start where it does not truly meet the spline.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
DistanceTo(GeoPolylineArc2)
Calculates the shortest distance from this spline to a curved chain, using the default tolerance.
public double DistanceTo(GeoPolylineArc2 chain)
Parameters
chainGeoPolylineArc2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the curved chain is null.
DistanceTo(GeoPolylineArc2, Tolerance)
Calculates the shortest distance from this spline to a curved chain, within a tolerance.
public double DistanceTo(GeoPolylineArc2 chain, Tolerance tolerance)
Parameters
chainGeoPolylineArc2The curved chain.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the curved chain is null.
DistanceTo(GeoPolygonArc2)
Calculates the shortest distance from this spline to a curved loop, using the default tolerance.
public double DistanceTo(GeoPolygonArc2 loop)
Parameters
loopGeoPolygonArc2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the curved loop is null.
DistanceTo(GeoPolygonArc2, Tolerance)
Calculates the shortest distance from this spline to a curved loop, within a tolerance.
public double DistanceTo(GeoPolygonArc2 loop, Tolerance tolerance)
Parameters
loopGeoPolygonArc2The curved loop.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Remarks
A curved loop is a region here, as every curve reads it: a spline lying inside it is nought from it, though it crosses nothing.
Exceptions
- ArgumentNullException
Thrown when the curved loop is null.
DistanceTo(GeoSpline2)
Calculates the shortest distance from this spline to another, using the default tolerance.
public double DistanceTo(GeoSpline2 other)
Parameters
otherGeoSpline2
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the other spline is null.
DistanceTo(GeoSpline2, Tolerance)
Calculates the shortest distance from this spline to another, within a tolerance.
public double DistanceTo(GeoSpline2 other, Tolerance tolerance)
Parameters
otherGeoSpline2The other spline.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where they truly meet, a crossing or a touch found to rounding, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the other spline is null.