Method DistanceTo
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
DistanceTo(GeoPoint3)
Calculates the shortest distance from this box to a point. A point inside is at distance zero, and an empty box is infinitely far from everything.
public double DistanceTo(GeoPoint3 point)
Parameters
pointGeoPoint3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Remarks
This is what prunes a search through a tree of boxes: a box already farther away than the best answer so far cannot hold anything nearer, so the whole branch below it can be skipped without being looked at.
DistanceTo(GeoAabb3)
Calculates the shortest distance between this box and another one. Boxes that overlap are at distance zero, and an empty box is infinitely far from everything.
public double DistanceTo(GeoAabb3 other)
Parameters
otherGeoAabb3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Remarks
The gap between two axis-aligned boxes separates on each axis independently, so the distance is the length of the vector of per-axis gaps. This is what prunes a traversal of two trees at once: a pair of boxes already farther apart than the best answer so far cannot hold a nearer pair.
DistanceTo(GeoPolyline3)
Gets the distance from this box to a polyline, using the default tolerance.
public double DistanceTo(GeoPolyline3 polyline)
Parameters
polylineGeoPolyline3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoPolyline3, Tolerance)
Gets the distance from this box to a polyline, within a tolerance.
public double DistanceTo(GeoPolyline3 polyline, Tolerance tolerance)
Parameters
polylineGeoPolyline3toleranceTolerance
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoSolid3)
Gets the distance from this box to a solid, using the default tolerance.
public double DistanceTo(GeoSolid3 solid)
Parameters
solidGeoSolid3
Returns
- double
Nought where the two lie within the global point tolerance of each other, otherwise the gap.
DistanceTo(GeoSolid3, Tolerance)
Gets the distance from this box to a solid, within a tolerance.
public double DistanceTo(GeoSolid3 solid, Tolerance tolerance)
Parameters
Returns
- double
Nought where the two lie within the tolerance given of each other, otherwise the gap.
DistanceTo(GeoLine3)
Calculates the shortest distance between this axis-aligned box and a segment: the answer of DistanceTo(GeoLine3, GeoAabb3).
public double DistanceTo(GeoLine3 line)
Parameters
lineGeoLine3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A segment no longer than the global point tolerance is read as its start point, except where it truly meets the other shape.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 50 from
the segment from (150, 50, 50) to (150, 50, 150), and nought from one reaching into it.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoLine3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a segment, within a tolerance: the answer of DistanceTo(GeoLine3, GeoAabb3, Tolerance).
public double DistanceTo(GeoLine3 line, Tolerance tolerance)
Parameters
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A segment no longer than the tolerance given is read as its start point, except where it truly meets the other shape.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 50 from
the segment from (150, 50, 50) to (150, 50, 150), and nought from one reaching into it.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoRay3)
Calculates the shortest distance between this axis-aligned box and a ray: the answer of DistanceTo(GeoRay3, GeoAabb3).
public double DistanceTo(GeoRay3 ray)
Parameters
rayGeoRay3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 50 from
the ray from (150, 50, 50) along X, and nought from the same ray turned round.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoRay3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a ray, within a tolerance: the answer of DistanceTo(GeoRay3, GeoAabb3, Tolerance).
public double DistanceTo(GeoRay3 ray, Tolerance tolerance)
Parameters
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 50 from
the ray from (150, 50, 50) along X, and nought from the same ray turned round.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoPlane3)
Calculates the shortest distance between this axis-aligned box and a plane: the answer of DistanceTo(GeoPlane3, GeoAabb3).
public double DistanceTo(GeoPlane3 plane)
Parameters
planeGeoPlane3
Returns
- double
Nought where the plane crosses the shape or comes within the global point tolerance of it, otherwise the gap.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the plane z = 130, and nought from the plane z = 50.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoPlane3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a plane, within a tolerance: the answer of DistanceTo(GeoPlane3, GeoAabb3, Tolerance).
public double DistanceTo(GeoPlane3 plane, Tolerance tolerance)
Parameters
Returns
- double
Nought where the plane crosses the shape or comes within the tolerance given of it, otherwise the gap.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the plane z = 130, and nought from the plane z = 50.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoTriangle3)
Calculates the shortest distance between this axis-aligned box and a triangle: the answer of DistanceTo(GeoTriangle3, GeoAabb3).
public double DistanceTo(GeoTriangle3 triangle)
Parameters
triangleGeoTriangle3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the triangle with corners (0, 0, 130), (100, 0, 130) and (0, 100, 130), and nought from one wholly inside it.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoTriangle3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a triangle, within a tolerance: the answer of DistanceTo(GeoTriangle3, GeoAabb3, Tolerance).
public double DistanceTo(GeoTriangle3 triangle, Tolerance tolerance)
Parameters
triangleGeoTriangle3toleranceTolerance
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the triangle with corners (0, 0, 130), (100, 0, 130) and (0, 100, 130), and nought from one wholly inside it.
Exceptions
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoPolygon3)
Calculates the shortest distance between this axis-aligned box and a polygon: the answer of DistanceTo(GeoPolygon3, GeoAabb3).
public double DistanceTo(GeoPolygon3 polygon)
Parameters
polygonGeoPolygon3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the square 100 by 100 lying flat at a height of 130 over it, and nought from the square 200 by 200 lying across
it at half its height.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoPolygon3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a polygon, within a tolerance: the answer of DistanceTo(GeoPolygon3, GeoAabb3, Tolerance).
public double DistanceTo(GeoPolygon3 polygon, Tolerance tolerance)
Parameters
polygonGeoPolygon3toleranceTolerance
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The box from the origin to (100, 100, 100) is 30 from
the square 100 by 100 lying flat at a height of 130 over it, and nought from the square 200 by 200 lying across
it at half its height.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoFace3)
Calculates the shortest distance between this axis-aligned box and a face: the answer of DistanceTo(GeoFace3, GeoAabb3).
public double DistanceTo(GeoFace3 face)
Parameters
faceGeoFace3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The face is read by its material. The box from the
origin to (100, 100, 100) passes through the hole of the square 200 by 200 from (-50, -50, 50) to (150, 150, 50)
with a hole 150 by 150 in its middle and is 25 from its rim.
Exceptions
- ArgumentNullException
Thrown when the face is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoFace3, Tolerance)
Calculates the shortest distance between this axis-aligned box and a face, within a tolerance: the answer of DistanceTo(GeoFace3, GeoAabb3, Tolerance).
public double DistanceTo(GeoFace3 face, Tolerance tolerance)
Parameters
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly. A triangle, polygon or face within a billionth of a millimetre of the outside of a box reads nought, for the same reason.
Remarks
The answer about the box's body, ToObb().ToSolid(). The face is read by its material. The box from the
origin to (100, 100, 100) passes through the hole of the square 200 by 200 from (-50, -50, 50) to (150, 150, 50)
with a hole 150 by 150 in its middle and is 25 from its rim.
Exceptions
- ArgumentNullException
Thrown when the face is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoObb3)
Calculates the shortest distance between this axis-aligned box and an oriented box: the answer of DistanceTo(GeoObb3, GeoAabb3).
public double DistanceTo(GeoObb3 box)
Parameters
boxGeoObb3
Returns
- double
Nought where the two lie within the global point tolerance of each other, otherwise the gap.
Remarks
The answer of DistanceTo(GeoObb3, GeoObb3, Tolerance) with the axis-aligned box as
ToObb(): two oriented boxes are measured as their bodies once the separating axis test has found them
apart. The box from the origin to (100, 100, 100) and the box 100 by 100 by 100 about (250, 50, 50) are 100
apart.
Exceptions
- ArgumentNullException
Thrown when the oriented box is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoObb3, Tolerance)
Calculates the shortest distance between this axis-aligned box and an oriented box, within a tolerance: the answer of DistanceTo(GeoObb3, GeoAabb3, Tolerance).
public double DistanceTo(GeoObb3 box, Tolerance tolerance)
Parameters
Returns
- double
Nought where the two lie within the tolerance given of each other, otherwise the gap.
Remarks
The answer of DistanceTo(GeoObb3, GeoObb3, Tolerance) with the axis-aligned box as
ToObb(): two oriented boxes are measured as their bodies once the separating axis test has found them
apart. The box from the origin to (100, 100, 100) and the box 100 by 100 by 100 about (250, 50, 50) are 100
apart.
Exceptions
- ArgumentNullException
Thrown when the oriented box is null.
- InvalidOperationException
Thrown when the box is empty.
DistanceTo(GeoSphere3)
Calculates the shortest distance from this axis-aligned box to a ball.
public double DistanceTo(GeoSphere3 sphere)
Parameters
sphereGeoSphere3
Returns
- double
Nought where the axis-aligned box reaches the ball, otherwise the gap, measured exactly.
DistanceTo(GeoSpline3)
Calculates the shortest distance from this box 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 box 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.
DistanceTo(GeoXLine3)
Calculates the shortest distance from this box to an infinite line, using the default tolerance.
public double DistanceTo(GeoXLine3 xline)
Parameters
xlineGeoXLine3
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.
DistanceTo(GeoXLine3, Tolerance)
Calculates the shortest distance from this box to an infinite line, within a tolerance.
public double DistanceTo(GeoXLine3 xline, Tolerance tolerance)
Parameters
Returns
- double
Nought only where they truly meet, otherwise the gap, measured exactly.