Method DistanceTo
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
DistanceTo(GeoEllipse2, GeoPoint2)
Gets the distance from an ellipse to a point, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPoint2 point)
Parameters
ellipseGeoEllipse2pointGeoPoint2
Returns
DistanceTo(GeoEllipse2, GeoPoint2, Tolerance)
Gets the distance from an ellipse to a point.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPoint2 point, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
pointGeoPoint2The point.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged, as a circle measures it.
Returns
- double
Nought for a point inside or on the rim; otherwise its distance to the nearest point of the rim. The point (400, 0) is 100 from the ellipse 300 by 100 centred on the origin.
DistanceTo(GeoEllipse2, GeoLine2)
Gets the distance from an ellipse to a segment, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoLine2 line)
Parameters
ellipseGeoEllipse2lineGeoLine2
Returns
DistanceTo(GeoEllipse2, GeoLine2, Tolerance)
Gets the distance from an ellipse to a segment.
public static double DistanceTo(GeoEllipse2 ellipse, GeoLine2 line, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
lineGeoLine2The segment.
toleranceToleranceThe tolerance: a segment no longer than its point tolerance is read as its start where it does not truly meet the ellipse, as a circle reads it.
Returns
- double
Nought when the segment crosses the rim or lies inside; otherwise the shortest gap. The segment from (-100, 150) to (100, 150) is 50 from the ellipse 300 by 100 centred on the origin.
DistanceTo(GeoEllipse2, GeoPolyline2)
Gets the distance from an ellipse to a polyline, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolyline2 polyline)
Parameters
ellipseGeoEllipse2polylineGeoPolyline2
Returns
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoEllipse2, GeoPolyline2, Tolerance)
Gets the distance from an ellipse to a polyline, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolyline2 polyline, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
polylineGeoPolyline2The polyline, a curve.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where an edge truly meets the region, crossing the rim or lying inside, otherwise the gap from the nearest of its edges, measured exactly. A polyline 0.0005 outside the ellipse 300 by 100 is 0.0005 from it.
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoEllipse2, GeoPolygon2)
Gets the distance from an ellipse to a polygon, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolygon2 polygon)
Parameters
ellipseGeoEllipse2polygonGeoPolygon2
Returns
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoEllipse2, GeoPolygon2, Tolerance)
Gets the distance from an ellipse to a polygon, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolygon2 polygon, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
polygonGeoPolygon2The polygon, a region.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where the two truly meet, an edge reaching the region or the polygon holding the centre with no slack, a centre on an edge included; otherwise the distance from the nearest edge, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoEllipse2, GeoRectangle2)
Gets the distance from an ellipse to a rectangle, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoRectangle2 rect)
Parameters
ellipseGeoEllipse2rectGeoRectangle2
Returns
DistanceTo(GeoEllipse2, GeoRectangle2, Tolerance)
Gets the distance from an ellipse to a rectangle, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoRectangle2 rect, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
rectGeoRectangle2The rectangle, a region.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where the two truly meet, a side reaching the region or the rectangle holding the centre with no slack; otherwise the distance from the nearest side, measured exactly.
DistanceTo(GeoEllipse2, GeoTriangle2)
Gets the distance from an ellipse to a triangle, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoTriangle2 triangle)
Parameters
ellipseGeoEllipse2triangleGeoTriangle2
Returns
DistanceTo(GeoEllipse2, GeoTriangle2, Tolerance)
Gets the distance from an ellipse to a triangle, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoTriangle2 triangle, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
triangleGeoTriangle2The triangle, a region; one whose corners coincide exactly is read as its longest edge, a short side being the side it is.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged, and a side shorter than it is measured as the side it is.
Returns
- double
Nought only where the two truly meet; otherwise the distance from the nearest edge, measured exactly.
DistanceTo(GeoEllipse2, GeoEdge2)
Gets the distance from an ellipse to an edge, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoEdge2 edge)
Parameters
ellipseGeoEllipse2edgeGeoEdge2
Returns
DistanceTo(GeoEllipse2, GeoEdge2, Tolerance)
Gets the distance from an ellipse to an edge, within a tolerance: as a segment or as an arc, whichever the edge is.
public static double DistanceTo(GeoEllipse2 ellipse, GeoEdge2 edge, Tolerance tolerance)
Parameters
ellipseGeoEllipse2edgeGeoEdge2toleranceTolerance
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. An arc bowing less than its own rounding is read as its chord: the edge from (60.0005, -500) to (60.0005, 500) with a bulge of 1E-12 is 0.0005 from the ellipse 60 by 25 about the origin. The edge's own end points are weighed beside the arc's, so an edge ending on the rim is nought away.
DistanceTo(GeoEllipse2, GeoCircle2)
Gets the distance from an ellipse to a circle, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoCircle2 circle)
Parameters
ellipseGeoEllipse2circleGeoCircle2
Returns
DistanceTo(GeoEllipse2, GeoCircle2, Tolerance)
Gets the distance from an ellipse to a circle.
public static double DistanceTo(GeoEllipse2 ellipse, GeoCircle2 circle, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
circleGeoCircle2The circle, a region.
toleranceToleranceThe tolerance; not read, as two circles read none.
Returns
- double
Nought when the two overlap; otherwise how far the circle's centre is from the rim, less its radius. The circle of radius 50 about (0, 300) is 150 from the ellipse 300 by 100 centred on the origin.
DistanceTo(GeoEllipse2, GeoArc2)
Gets the distance from an ellipse to an arc, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoArc2 arc)
Parameters
ellipseGeoEllipse2arcGeoArc2
Returns
DistanceTo(GeoEllipse2, GeoArc2, Tolerance)
Gets the distance from an ellipse to an arc, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoArc2 arc, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
arcGeoArc2The arc, a curve.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where the arc truly meets the region, crossing the rim or lying inside; otherwise the shortest gap, measured exactly. The left half of the circle of radius 0.0008 about (60.0013, 0) is 0.0005 from the ellipse 60 by 25 about the origin at a tolerance of 0.001, where its ends alone were weighed and 0.0013 was read.
Remarks
The nearest pair is at an end of the arc, or on a normal of the rim that runs through the arc's centre, since there the gap runs square to both. Whether any of the arc lies inside is read exactly, from the turning points of the ellipse's equation along the arc.
DistanceTo(GeoEllipse2, GeoEllipse2)
Gets the distance between two ellipses, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoEllipse2 other)
Parameters
ellipseGeoEllipse2otherGeoEllipse2
Returns
DistanceTo(GeoEllipse2, GeoEllipse2, Tolerance)
Gets the distance between two ellipses.
public static double DistanceTo(GeoEllipse2 ellipse, GeoEllipse2 other, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The first ellipse.
otherGeoEllipse2The second ellipse.
toleranceToleranceThe tolerance; not read, as two circles read none.
Returns
- double
Nought when the two overlap, one inside the other included; otherwise the shortest gap between the rims. The ellipse 300 by 100 centred on the origin and the one 100 by 50 about (0, 250) along Y are 50 apart.
Remarks
Whether they overlap is read exactly, from the turning points of the equation of the one along the rim of the other. The gap is the least distance from a point of the first rim to the second, found by Brent's method from each least of 36 starting points round the first, each side of it on its own: 32 spread evenly half a step off the axes, so that none of them is an end of one, and the four ends of the axes, where a thin ellipse turns fastest. Checked against a dense independent search on 80 000 pairs apart, 20 000 from each of four seeds, as thin as a thousand to one: the worst relative error was 3E-13.
DistanceTo(GeoEllipse2, GeoPolylineArc2)
Gets the distance from an ellipse to a curved chain, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolylineArc2 chain)
Parameters
ellipseGeoEllipse2chainGeoPolylineArc2
Returns
Exceptions
- ArgumentNullException
Thrown when the chain is null.
DistanceTo(GeoEllipse2, GeoPolylineArc2, Tolerance)
Gets the distance from an ellipse to a curved chain, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolylineArc2 chain, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
chainGeoPolylineArc2The chain, a curve.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where an edge truly meets the region, otherwise the gap from the nearest of its edges, measured exactly on the arcs themselves. A chain 0.0005 outside the ellipse 300 by 100 is 0.0005 from it.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
DistanceTo(GeoEllipse2, GeoPolygonArc2)
Gets the distance from an ellipse to a curved loop, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolygonArc2 loop)
Parameters
ellipseGeoEllipse2loopGeoPolygonArc2
Returns
Exceptions
- ArgumentNullException
Thrown when the loop is null.
DistanceTo(GeoEllipse2, GeoPolygonArc2, Tolerance)
Gets the distance from an ellipse to a curved loop, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoPolygonArc2 loop, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
loopGeoPolygonArc2The loop, a region.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where the two truly meet, an edge reaching the region or the loop holding the centre with no slack; otherwise the distance from the nearest edge, measured exactly on the arcs themselves.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
DistanceTo(GeoEllipse2, GeoFace2)
Gets the distance from an ellipse to the material of a face, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoFace2 face)
Parameters
ellipseGeoEllipse2faceGeoFace2
Returns
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoEllipse2, GeoFace2, Tolerance)
Gets the distance from an ellipse to the material of a face, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoFace2 face, Tolerance tolerance)
Parameters
ellipseGeoEllipse2The ellipse.
faceGeoFace2The face: its outline, less its holes.
toleranceToleranceThe tolerance; not read, since a distance is measured rather than judged.
Returns
- double
Nought only where the ellipse truly meets the material, a rim crossing it or the ellipse lying on it; otherwise the gap from the nearest rim, measured exactly. The ellipse 15 by 5 about (50, 50), its major axis along X, lies in the hole of the square 100 by 100 with a corner at the origin and a hole 40 by 40 in its middle, and is 5 from its rim; one 0.0005 off a corner of the square is 0.0005 from it.
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoEllipse2, GeoRay2)
Gets the distance from an ellipse to a ray, using the default tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoRay2 ray)
Parameters
ellipseGeoEllipse2rayGeoRay2
Returns
DistanceTo(GeoEllipse2, GeoRay2, Tolerance)
Gets the distance from an ellipse to a ray, within a tolerance.
public static double DistanceTo(GeoEllipse2 ellipse, GeoRay2 ray, Tolerance tolerance)
Parameters
ellipseGeoEllipse2rayGeoRay2toleranceTolerance
Returns
- double
Zero where the ray starts inside the ellipse or runs into it; otherwise the gap between them.