Method DistanceTo
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
DistanceTo(GeoPoint3)
Calculates the shortest distance from this ball to a point.
public double DistanceTo(GeoPoint3 point)
Parameters
pointGeoPoint3
Returns
- double
Nought where a point reaches the ball, otherwise the gap, measured exactly.
Remarks
The point (200, 0, 0) is 150 from the ball of radius 50 about the origin, and (30, 0, 0), inside it, is nought.
DistanceTo(GeoLine3)
Calculates the shortest distance from this ball to a segment, using the default tolerance.
public double DistanceTo(GeoLine3 line)
Parameters
lineGeoLine3
Returns
- double
Nought where a segment reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoLine3, Tolerance)
Calculates the shortest distance from this ball to a segment, within a tolerance.
public double DistanceTo(GeoLine3 line, Tolerance tolerance)
Parameters
Returns
- double
Nought where a segment reaches the ball, otherwise the gap, measured exactly.
Remarks
The segment from (100, -100, 0) to (100, 100, 0) is 50 from the ball of radius 50 about the origin; the one from (0, -100, 0) to (0, 100, 0) passes through it and is nought. A segment no longer than the point tolerance is read as its start where it does not reach the ball: at a thousandth, the one from (0, 0, 50.0004) to (0, 0, 49.9995) passes into it and is nought from it, and the one from (0, 0, 50.0015) to (0, 0, 50.0006) is 0.0015 from it.
DistanceTo(GeoRay3)
Calculates the shortest distance from this ball to a ray.
public double DistanceTo(GeoRay3 ray)
Parameters
rayGeoRay3
Returns
- double
Nought where a ray reaches the ball, otherwise the gap, measured exactly.
Remarks
The ray from (100, 0, 0) along X runs away from the ball of radius 50 about the origin and is 50 from it; along -X it runs through it and is nought.
DistanceTo(GeoXLine3)
Calculates the shortest distance from this ball to an infinite line, using the default tolerance.
public double DistanceTo(GeoXLine3 xline)
Parameters
xlineGeoXLine3
Returns
- double
Nought where an infinite line reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoXLine3, Tolerance)
Calculates the shortest distance from this ball to an infinite line, within a tolerance.
public double DistanceTo(GeoXLine3 xline, Tolerance tolerance)
Parameters
Returns
- double
Nought where an infinite line reaches the ball, otherwise the gap, measured exactly.
Remarks
The line through (0, 80, 0) along X is 30 from the ball of radius 50 about the origin, and the line through (0, 30, 0) is nought from it, whichever way each runs.
DistanceTo(GeoArc3)
Calculates the shortest distance from this ball to an arc, using the default tolerance.
public double DistanceTo(GeoArc3 arc)
Parameters
arcGeoArc3
Returns
- double
Nought where an arc reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoArc3, Tolerance)
Calculates the shortest distance from this ball to an arc, within a tolerance.
public double DistanceTo(GeoArc3 arc, Tolerance tolerance)
Parameters
Returns
- double
Nought where an arc reaches the ball, otherwise the gap, measured exactly.
Remarks
The quarter of the circle of radius 100 about the origin in the floor, from (100, 0, 0) to (0, 100, 0), is 50 from the ball of radius 50 about the origin.
DistanceTo(GeoCircle3)
Calculates the shortest distance from this ball to a circle, using the default tolerance.
public double DistanceTo(GeoCircle3 circle)
Parameters
circleGeoCircle3
Returns
- double
Nought where a circle reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoCircle3, Tolerance)
Calculates the shortest distance from this ball to a circle, within a tolerance.
public double DistanceTo(GeoCircle3 circle, Tolerance tolerance)
Parameters
circleGeoCircle3toleranceTolerance
Returns
- double
Nought where a circle reaches the ball, otherwise the gap, measured exactly.
Remarks
A circle is read as the disc it is, as its own distance to a point reads it: the circle of radius 30 about (0, 0, 100) in a plane parallel to the floor is 50 from the ball of radius 50 about the origin, straight below it, and the circle of radius 30 about the origin in the floor is nought from it.
DistanceTo(GeoEllipse3)
Calculates the shortest distance from this ball to an ellipse, using the default tolerance.
public double DistanceTo(GeoEllipse3 ellipse)
Parameters
ellipseGeoEllipse3
Returns
- double
Nought where an ellipse reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoEllipse3, Tolerance)
Calculates the shortest distance from this ball to an ellipse, within a tolerance.
public double DistanceTo(GeoEllipse3 ellipse, Tolerance tolerance)
Parameters
ellipseGeoEllipse3toleranceTolerance
Returns
- double
Nought where an ellipse reaches the ball, otherwise the gap, measured exactly.
Remarks
An ellipse is read as the disc it is, as a circle is.
DistanceTo(GeoEdge3)
Calculates the shortest distance from this ball to an edge, using the default tolerance.
public double DistanceTo(GeoEdge3 edge)
Parameters
edgeGeoEdge3
Returns
- double
Nought where an edge reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoEdge3, Tolerance)
Calculates the shortest distance from this ball to an edge, within a tolerance.
public double DistanceTo(GeoEdge3 edge, Tolerance tolerance)
Parameters
Returns
- double
Nought where an edge reaches the ball, otherwise the gap, measured exactly.
Remarks
An edge is measured as the segment or the arc it is, and a straight one no longer than the point tolerance as a segment that short is.
DistanceTo(GeoPolyline3)
Calculates the shortest distance from this ball to a polyline, using the default tolerance.
public double DistanceTo(GeoPolyline3 polyline)
Parameters
polylineGeoPolyline3
Returns
- double
Nought where a polyline reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoPolyline3, Tolerance)
Calculates the shortest distance from this ball to a polyline, within a tolerance.
public double DistanceTo(GeoPolyline3 polyline, Tolerance tolerance)
Parameters
polylineGeoPolyline3toleranceTolerance
Returns
- double
Nought where a polyline reaches the ball, otherwise the gap, measured exactly.
Remarks
A polyline is a curve, measured to its path, so the chain from (-100, 60, 0) to (100, 60, 0) is 10 from the ball of radius 50 about the origin.
Exceptions
- ArgumentNullException
Thrown when the polyline is null.
DistanceTo(GeoPolygon3)
Calculates the shortest distance from this ball to a polygon, using the default tolerance.
public double DistanceTo(GeoPolygon3 polygon)
Parameters
polygonGeoPolygon3
Returns
- double
Nought where a polygon reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoPolygon3, Tolerance)
Calculates the shortest distance from this ball to a polygon, within a tolerance.
public double DistanceTo(GeoPolygon3 polygon, Tolerance tolerance)
Parameters
polygonGeoPolygon3toleranceTolerance
Returns
- double
Nought where a polygon reaches the ball, otherwise the gap, measured exactly.
Remarks
A polygon is read as a filled surface: the square from (-100, -100, 0) to (100, 100, 0) in the floor holds the centre of the ball of radius 50 about the origin and is nought from it, and the square 100 above it is 50 from it.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
DistanceTo(GeoPolylineArc3)
Calculates the shortest distance from this ball to a curved chain, using the default tolerance.
public double DistanceTo(GeoPolylineArc3 chain)
Parameters
chainGeoPolylineArc3
Returns
- double
Nought where a curved chain reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the curved chain is null.
DistanceTo(GeoPolylineArc3, Tolerance)
Calculates the shortest distance from this ball to a curved chain, within a tolerance.
public double DistanceTo(GeoPolylineArc3 chain, Tolerance tolerance)
Parameters
chainGeoPolylineArc3toleranceTolerance
Returns
- double
Nought where a curved chain reaches the ball, otherwise the gap, measured exactly.
Remarks
A curved chain is a curve, measured to its path.
Exceptions
- ArgumentNullException
Thrown when the curved chain is null.
DistanceTo(GeoPolygonArc3)
Calculates the shortest distance from this ball to a curved loop, using the default tolerance.
public double DistanceTo(GeoPolygonArc3 loop)
Parameters
loopGeoPolygonArc3
Returns
- double
Nought where a curved loop reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the curved loop is null.
DistanceTo(GeoPolygonArc3, Tolerance)
Calculates the shortest distance from this ball to a curved loop, within a tolerance.
public double DistanceTo(GeoPolygonArc3 loop, Tolerance tolerance)
Parameters
loopGeoPolygonArc3toleranceTolerance
Returns
- double
Nought where a curved loop reaches the ball, otherwise the gap, measured exactly.
Remarks
A curved loop is measured to its boundary, as its own distance to a point is.
Exceptions
- ArgumentNullException
Thrown when the curved loop is null.
DistanceTo(GeoTriangle3)
Calculates the shortest distance from this ball to a triangle.
public double DistanceTo(GeoTriangle3 triangle)
Parameters
triangleGeoTriangle3
Returns
- double
Nought where a triangle reaches the ball, otherwise the gap, measured exactly.
Remarks
A triangle is read as a filled surface: the triangle (0, 0, 100), (100, 0, 100), (0, 100, 100) is 100 from the centre of the ball of radius 50 about the origin, so 50 from the ball.
DistanceTo(GeoFace3)
Calculates the shortest distance from this ball to a face, using the default tolerance.
public double DistanceTo(GeoFace3 face)
Parameters
faceGeoFace3
Returns
- double
Nought where a face reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoFace3, Tolerance)
Calculates the shortest distance from this ball to a face, within a tolerance.
public double DistanceTo(GeoFace3 face, Tolerance tolerance)
Parameters
Returns
- double
Nought where a face reaches the ball, otherwise the gap, measured exactly.
Remarks
A hole is not material: the square 200 by 200 about the origin with a hole 40 by 40 about the middle is nought from the ball of radius 50 about the origin, whose centre is in the hole, since the rim of the hole lies 20 from the centre, inside the ball.
Exceptions
- ArgumentNullException
Thrown when the face is null.
DistanceTo(GeoPlane3)
Calculates the shortest distance from this ball to a plane.
public double DistanceTo(GeoPlane3 plane)
Parameters
planeGeoPlane3
Returns
- double
Nought where a plane reaches the ball, otherwise the gap, measured exactly.
Remarks
The floor through the centre cuts the ball of radius 50 about the origin and is nought from it; the plane 80 above is 30 from it.
DistanceTo(GeoAabb3)
Calculates the shortest distance from this ball to an axis-aligned box.
public double DistanceTo(GeoAabb3 box)
Parameters
boxGeoAabb3
Returns
- double
Nought where an axis-aligned box reaches the ball, otherwise the gap, measured exactly.
Remarks
The box from (100, -10, -10) to (200, 10, 10) is 50 from the ball of radius 50 about the origin. An empty box is infinitely far from everything.
DistanceTo(GeoObb3)
Calculates the shortest distance from this ball to an oriented box.
public double DistanceTo(GeoObb3 box)
Parameters
boxGeoObb3
Returns
- double
Nought where an oriented box reaches the ball, otherwise the gap, measured exactly.
Remarks
The box of 100 by 20 by 20 centred on (150, 0, 0) is 50 from the ball of radius 50 about the origin.
Exceptions
- ArgumentNullException
Thrown when the oriented box is null.
DistanceTo(GeoSolid3)
Calculates the shortest distance from this ball to a solid, using the default tolerance.
public double DistanceTo(GeoSolid3 solid)
Parameters
solidGeoSolid3
Returns
- double
Nought where a solid reaches the ball, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the solid is null.
DistanceTo(GeoSolid3, Tolerance)
Calculates the shortest distance from this ball to a solid, within a tolerance.
public double DistanceTo(GeoSolid3 solid, Tolerance tolerance)
Parameters
Returns
- double
Nought where a solid reaches the ball, otherwise the gap, measured exactly.
Remarks
A solid is read as its material: a body that holds the centre of the ball is nought from it, and the box from (100, -10, -10) to (200, 10, 10) is 50 from the ball of radius 50 about the origin.
Exceptions
- ArgumentNullException
Thrown when the solid is null.
DistanceTo(GeoSphere3)
Calculates the shortest distance from this ball to another ball.
public double DistanceTo(GeoSphere3 other)
Parameters
otherGeoSphere3
Returns
- double
Nought where the two touch or overlap, otherwise the gap, which is the distance between the centres less the two radii.
Remarks
The ball of radius 50 about (200, 0, 0) is 140 from the ball of radius 10 about the origin, 200 less 60, whichever way round it is asked, and nought from one of radius 160 about the origin, which overlaps it.
DistanceTo(GeoSpline3)
Calculates the shortest distance from this ball to a spline, using the default tolerance.
public double DistanceTo(GeoSpline3 spline)
Parameters
splineGeoSpline3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Exceptions
- ArgumentNullException
Thrown when the spline is null.
DistanceTo(GeoSpline3, Tolerance)
Calculates the shortest distance from this ball to a spline, within a tolerance.
public double DistanceTo(GeoSpline3 spline, Tolerance tolerance)
Parameters
splineGeoSpline3toleranceTolerance
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly; the tolerance is not read.
Exceptions
- ArgumentNullException
Thrown when the spline is null.