Table of Contents

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

ellipse GeoEllipse2
point GeoPoint2

Returns

double

DistanceTo(GeoEllipse2, GeoPoint2, Tolerance)

Gets the distance from an ellipse to a point.

public static double DistanceTo(GeoEllipse2 ellipse, GeoPoint2 point, Tolerance tolerance)

Parameters

ellipse GeoEllipse2

The ellipse.

point GeoPoint2

The point.

tolerance Tolerance

The 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

ellipse GeoEllipse2
line GeoLine2

Returns

double

DistanceTo(GeoEllipse2, GeoLine2, Tolerance)

Gets the distance from an ellipse to a segment.

public static double DistanceTo(GeoEllipse2 ellipse, GeoLine2 line, Tolerance tolerance)

Parameters

ellipse GeoEllipse2

The ellipse.

line GeoLine2

The segment.

tolerance Tolerance

The 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

ellipse GeoEllipse2
polyline GeoPolyline2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

polyline GeoPolyline2

The polyline, a curve.

tolerance Tolerance

The 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

ellipse GeoEllipse2
polygon GeoPolygon2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

polygon GeoPolygon2

The polygon, a region.

tolerance Tolerance

The 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

ellipse GeoEllipse2
rect GeoRectangle2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

rect GeoRectangle2

The rectangle, a region.

tolerance Tolerance

The 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

ellipse GeoEllipse2
triangle GeoTriangle2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

triangle GeoTriangle2

The triangle, a region; one whose corners coincide exactly is read as its longest edge, a short side being the side it is.

tolerance Tolerance

The 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

ellipse GeoEllipse2
edge GeoEdge2

Returns

double

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

ellipse GeoEllipse2
edge GeoEdge2
tolerance Tolerance

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

ellipse GeoEllipse2
circle GeoCircle2

Returns

double

DistanceTo(GeoEllipse2, GeoCircle2, Tolerance)

Gets the distance from an ellipse to a circle.

public static double DistanceTo(GeoEllipse2 ellipse, GeoCircle2 circle, Tolerance tolerance)

Parameters

ellipse GeoEllipse2

The ellipse.

circle GeoCircle2

The circle, a region.

tolerance Tolerance

The 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

ellipse GeoEllipse2
arc GeoArc2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

arc GeoArc2

The arc, a curve.

tolerance Tolerance

The 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

ellipse GeoEllipse2
other GeoEllipse2

Returns

double

DistanceTo(GeoEllipse2, GeoEllipse2, Tolerance)

Gets the distance between two ellipses.

public static double DistanceTo(GeoEllipse2 ellipse, GeoEllipse2 other, Tolerance tolerance)

Parameters

ellipse GeoEllipse2

The first ellipse.

other GeoEllipse2

The second ellipse.

tolerance Tolerance

The 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

ellipse GeoEllipse2
chain GeoPolylineArc2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

chain GeoPolylineArc2

The chain, a curve.

tolerance Tolerance

The 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

ellipse GeoEllipse2
loop GeoPolygonArc2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

loop GeoPolygonArc2

The loop, a region.

tolerance Tolerance

The 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

ellipse GeoEllipse2
face GeoFace2

Returns

double

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

ellipse GeoEllipse2

The ellipse.

face GeoFace2

The face: its outline, less its holes.

tolerance Tolerance

The 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

ellipse GeoEllipse2
ray GeoRay2

Returns

double

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

ellipse GeoEllipse2
ray GeoRay2
tolerance Tolerance

Returns

double

Zero where the ray starts inside the ellipse or runs into it; otherwise the gap between them.