Method DistanceTo
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
DistanceTo(GeoPoint3, GeoPoint3)
Calculates the distance between two points.
public static double DistanceTo(GeoPoint3 p1, GeoPoint3 p2)
Parameters
Returns
DistanceTo(GeoLine3, GeoPoint3)
Calculates the shortest distance from a line segment to a point.
public static double DistanceTo(GeoLine3 line, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoLine3, GeoPoint3, Tolerance)
Calculates the shortest distance from a line segment to a point, within a tolerance.
public static double DistanceTo(GeoLine3 line, GeoPoint3 point, Tolerance tolerance)
Parameters
Returns
DistanceTo(GeoRay3, GeoPoint3)
Calculates the shortest distance from a ray to a point.
public static double DistanceTo(GeoRay3 ray, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoPlane3, GeoPoint3)
Calculates the perpendicular distance from a plane to a point.
public static double DistanceTo(GeoPlane3 plane, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoTriangle3, GeoPoint3)
Calculates the shortest distance from a triangle to a point.
public static double DistanceTo(GeoTriangle3 triangle, GeoPoint3 point)
Parameters
triangleGeoTriangle3pointGeoPoint3
Returns
Remarks
The triangle counts as a filled surface, so a point sitting directly above its interior is measured to the surface rather than out to the nearest edge, and a point on the surface is at distance zero.
DistanceTo(GeoLine3, GeoLine3)
Calculates the shortest distance between two line segments.
public static double DistanceTo(GeoLine3 line1, GeoLine3 line2)
Parameters
Returns
DistanceTo(GeoLine3, GeoLine3, Tolerance)
Calculates the shortest distance between two line segments, within a tolerance.
public static double DistanceTo(GeoLine3 line1, GeoLine3 line2, Tolerance tolerance)
Parameters
Returns
DistanceTo(GeoRay3, GeoLine3)
Calculates the shortest distance between a ray and a line segment.
public static double DistanceTo(GeoRay3 ray, GeoLine3 line)
Parameters
Returns
DistanceTo(GeoRay3, GeoLine3, Tolerance)
Calculates the shortest distance between a ray and a line segment, within a tolerance.
public static double DistanceTo(GeoRay3 ray, GeoLine3 line, Tolerance tolerance)
Parameters
Returns
Remarks
The ray is sampled as a segment long enough to reach past the far end of the other segment, which is enough because the closest approach between a ray and a bounded segment can never lie beyond that point: past it, the ray is only moving away.
DistanceTo(GeoPlane3, GeoLine3)
Calculates the shortest distance from a plane to a line segment.
public static double DistanceTo(GeoPlane3 plane, GeoLine3 line)
Parameters
Returns
Remarks
A segment with endpoints on opposite sides of the plane crosses it, so the distance is zero. Otherwise the nearest point is whichever endpoint sits closer.
DistanceTo(GeoPlane3, GeoPlane3)
Calculates the distance between two planes.
public static double DistanceTo(GeoPlane3 plane1, GeoPlane3 plane2)
Parameters
Returns
DistanceTo(GeoPlane3, GeoPlane3, Tolerance)
Calculates the distance between two planes, within a tolerance.
public static double DistanceTo(GeoPlane3 plane1, GeoPlane3 plane2, Tolerance tolerance)
Parameters
Returns
Remarks
Two planes that are not parallel meet somewhere, so their distance is zero. Parallel planes keep a constant gap, measured along the shared normal.
DistanceTo(GeoPolyline3, GeoPoint3)
Calculates the shortest distance from a polyline to a point.
public static double DistanceTo(GeoPolyline3 polyline, GeoPoint3 point)
Parameters
polylineGeoPolyline3pointGeoPoint3
Returns
DistanceTo(GeoPolyline3, GeoPoint3, Tolerance)
Calculates the shortest distance from a polyline to a point, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoPoint3 point, Tolerance tolerance)
Parameters
polylineGeoPolyline3pointGeoPoint3toleranceTolerance
Returns
Remarks
A polyline is a curve and holds only the points on its path, so a chain tracing a square is
measured to that path and reports a positive distance for a point in the middle of it. Call
ToPolygon when the enclosed area is what should count.
DistanceTo(GeoPolygon3, GeoPoint3)
Calculates the shortest distance from a polygon to a point.
public static double DistanceTo(GeoPolygon3 polygon, GeoPoint3 point)
Parameters
polygonGeoPolygon3pointGeoPoint3
Returns
DistanceTo(GeoPolygon3, GeoPoint3, Tolerance)
Calculates the shortest distance from a polygon to a point, within a tolerance.
public static double DistanceTo(GeoPolygon3 polygon, GeoPoint3 point, Tolerance tolerance)
Parameters
polygonGeoPolygon3pointGeoPoint3toleranceTolerance
Returns
Remarks
The polygon counts as a filled surface, so a point above its interior is measured straight down and a point on the surface is at distance zero.
DistanceTo(GeoFace3, GeoPoint3)
Calculates the shortest distance from a face to a point.
public static double DistanceTo(GeoFace3 face, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoFace3, GeoPoint3, Tolerance)
Calculates the shortest distance from a face to a point, within a tolerance.
public static double DistanceTo(GeoFace3 face, GeoPoint3 point, Tolerance tolerance)
Parameters
Returns
Remarks
A hole is not material, so a point above a hole is measured out to the rim rather than down to the surface that is missing there.
DistanceTo(GeoObb3, GeoPoint3)
Calculates the shortest distance from an oriented box to a point. A point inside the box is at distance zero.
public static double DistanceTo(GeoObb3 box, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoSolid3, GeoPoint3)
Calculates the shortest distance from a solid to a point. A point inside the solid is at distance zero.
public static double DistanceTo(GeoSolid3 solid, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoSolid3, GeoPoint3, Tolerance)
Calculates the shortest distance from a solid to a point, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoPoint3 point, Tolerance tolerance)
Parameters
Returns
DistanceTo(GeoCircle3, GeoPoint3)
Calculates the shortest distance from a circular disc to a point.
public static double DistanceTo(GeoCircle3 circle, GeoPoint3 point)
Parameters
circleGeoCircle3pointGeoPoint3
Returns
DistanceTo(GeoCircle3, GeoPoint3, Tolerance)
Calculates the shortest distance from a circular disc to a point, within a tolerance.
public static double DistanceTo(GeoCircle3 circle, GeoPoint3 point, Tolerance tolerance)
Parameters
circleGeoCircle3pointGeoPoint3toleranceTolerance
Returns
Remarks
The disc counts as a filled surface, so a point directly above the centre is measured straight down rather than out to the circumference.
DistanceTo(GeoAabb3, GeoPoint3)
Calculates the perpendicular distance from an axis-aligned box to a point.
public static double DistanceTo(GeoAabb3 box, GeoPoint3 point)
Parameters
Returns
DistanceTo(GeoAabb3, GeoAabb3)
Calculates the shortest distance between two axis-aligned boxes.
public static double DistanceTo(GeoAabb3 box1, GeoAabb3 box2)
Parameters
Returns
DistanceTo(GeoTriangle3, GeoTriangle3)
Calculates the shortest distance between two triangles.
public static double DistanceTo(GeoTriangle3 triangle1, GeoTriangle3 triangle2)
Parameters
triangle1GeoTriangle3triangle2GeoTriangle3
Returns
DistanceTo(GeoTriangle3, GeoTriangle3, Tolerance)
Calculates the shortest distance between two triangles, within a tolerance.
public static double DistanceTo(GeoTriangle3 triangle1, GeoTriangle3 triangle2, Tolerance tolerance)
Parameters
triangle1GeoTriangle3triangle2GeoTriangle3toleranceTolerance
Returns
Remarks
Two triangles that touch or cross are at distance zero. Otherwise the closest pair of points lies either on a pair of edges or on a vertex of one and the face of the other — there is nowhere else it can be once the two no longer meet — so trying those cases covers it.
DistanceTo(GeoLine3, GeoTriangle3)
Calculates the shortest distance between a line segment and a triangle.
public static double DistanceTo(GeoLine3 line, GeoTriangle3 triangle)
Parameters
lineGeoLine3triangleGeoTriangle3
Returns
DistanceTo(GeoLine3, GeoTriangle3, Tolerance)
Calculates the shortest distance between a line segment and a triangle, within a tolerance.
public static double DistanceTo(GeoLine3 line, GeoTriangle3 triangle, Tolerance tolerance)
Parameters
lineGeoLine3triangleGeoTriangle3toleranceTolerance
Returns
DistanceTo(GeoLine3, GeoPolygon3)
Calculates the shortest distance between a line segment and a polygon.
public static double DistanceTo(GeoLine3 line, GeoPolygon3 polygon)
Parameters
lineGeoLine3polygonGeoPolygon3
Returns
DistanceTo(GeoLine3, GeoPolygon3, Tolerance)
Calculates the shortest distance between a line segment and a polygon, within a tolerance.
public static double DistanceTo(GeoLine3 line, GeoPolygon3 polygon, Tolerance tolerance)
Parameters
lineGeoLine3polygonGeoPolygon3toleranceTolerance
Returns
Remarks
The polygon counts as a filled surface, so a segment ending directly above its interior is measured straight down rather than out to the nearest edge.
DistanceTo(GeoLine3, GeoSolid3)
Calculates the shortest distance between a line segment and a solid.
public static double DistanceTo(GeoLine3 line, GeoSolid3 solid)
Parameters
Returns
DistanceTo(GeoLine3, GeoSolid3, Tolerance)
Calculates the shortest distance between a line segment and a solid. A segment reaching into the body is at distance zero.
public static double DistanceTo(GeoLine3 line, GeoSolid3 solid, Tolerance tolerance)
Parameters
Returns
DistanceTo(GeoSolid3, GeoTriangle3)
Calculates the shortest distance between a solid and a triangle.
public static double DistanceTo(GeoSolid3 solid, GeoTriangle3 triangle)
Parameters
solidGeoSolid3triangleGeoTriangle3
Returns
DistanceTo(GeoSolid3, GeoTriangle3, Tolerance)
Calculates the shortest distance between a solid and a triangle, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoTriangle3 triangle, Tolerance tolerance)
Parameters
solidGeoSolid3The solid.
triangleGeoTriangle3The triangle.
toleranceToleranceThe tolerance.
Returns
- double
Zero where the triangle reaches into the body, otherwise the gap between the two surfaces.
Remarks
A triangle lying wholly inside the body meets none of its faces, so it is caught by asking where its corners are before any face is measured. One that passes through is caught by the faces it cuts, which are at no distance from it.
DistanceTo(GeoSolid3, GeoPolygon3)
Calculates the shortest distance between a solid and a polygon.
public static double DistanceTo(GeoSolid3 solid, GeoPolygon3 polygon)
Parameters
solidGeoSolid3polygonGeoPolygon3
Returns
DistanceTo(GeoSolid3, GeoPolygon3, Tolerance)
Calculates the shortest distance between a solid and a polygon, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoPolygon3 polygon, Tolerance tolerance)
Parameters
solidGeoSolid3polygonGeoPolygon3toleranceTolerance
Returns
Remarks
The polygon is cut into triangles and each is measured against the body, so a polygon that is not convex is handled like any other.
DistanceTo(GeoSolid3, GeoPolyline3)
Calculates the shortest distance between a solid and a polyline.
public static double DistanceTo(GeoSolid3 solid, GeoPolyline3 polyline)
Parameters
solidGeoSolid3polylineGeoPolyline3
Returns
DistanceTo(GeoSolid3, GeoPolyline3, Tolerance)
Calculates the shortest distance between a solid and a polyline, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoPolyline3 polyline, Tolerance tolerance)
Parameters
solidGeoSolid3polylineGeoPolyline3toleranceTolerance
Returns
DistanceTo(GeoSolid3, GeoPlane3)
Calculates the shortest distance between a solid and a plane.
public static double DistanceTo(GeoSolid3 solid, GeoPlane3 plane)
Parameters
Returns
DistanceTo(GeoSolid3, GeoPlane3, Tolerance)
Calculates the shortest distance between a solid and a plane, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoPlane3 plane, Tolerance tolerance)
Parameters
Returns
- double
Zero where the body reaches the plane or crosses it, otherwise the gap.
Remarks
A plane is flat and endless, so nothing needs measuring but the corners of the body: the nearest point of a solid to a plane is always one of them, and the body crosses the plane exactly when two of them fall on opposite sides.
DistanceTo(GeoSolid3, GeoObb3)
Calculates the shortest distance between a solid and an oriented box.
public static double DistanceTo(GeoSolid3 solid, GeoObb3 box)
Parameters
Returns
DistanceTo(GeoSolid3, GeoObb3, Tolerance)
Calculates the shortest distance between a solid and an oriented box, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoObb3 box, Tolerance tolerance)
Parameters
Returns
Remarks
A box is a solid of six faces, so the two are measured against each other as two solids are.
DistanceTo(GeoSolid3, GeoAabb3)
Calculates the shortest distance between a solid and an axis-aligned box.
public static double DistanceTo(GeoSolid3 solid, GeoAabb3 box)
Parameters
Returns
DistanceTo(GeoSolid3, GeoAabb3, Tolerance)
Calculates the shortest distance between a solid and an axis-aligned box, within a tolerance.
public static double DistanceTo(GeoSolid3 solid, GeoAabb3 box, Tolerance tolerance)
Parameters
Returns
DistanceTo(GeoSolid3, GeoSolid3)
Calculates the shortest distance between two solids.
public static double DistanceTo(GeoSolid3 solid1, GeoSolid3 solid2)
Parameters
Returns
DistanceTo(GeoSolid3, GeoSolid3, Tolerance)
Calculates the shortest distance between two solids, within a tolerance.
public static double DistanceTo(GeoSolid3 solid1, GeoSolid3 solid2, Tolerance tolerance)
Parameters
Returns
Remarks
Bodies that touch or overlap are at distance zero, which includes one sitting wholly inside the other without their surfaces meeting. Otherwise both surfaces are indexed and walked as a pair of trees, so a pair of boxes farther apart than the closest triangles found so far discards everything beneath it.
DistanceTo(GeoObb3, GeoObb3)
Calculates the shortest distance between two oriented boxes.
public static double DistanceTo(GeoObb3 box1, GeoObb3 box2)
Parameters
Returns
DistanceTo(GeoObb3, GeoObb3, Tolerance)
Calculates the shortest distance between two oriented boxes, within a tolerance.
public static double DistanceTo(GeoObb3 box1, GeoObb3 box2, Tolerance tolerance)
Parameters
Returns
Remarks
Boxes that overlap or touch are at distance zero, which the separating axis test settles outright. Apart, they are measured as the bodies they are.
DistanceTo(GeoPolyline3, GeoLine3)
Calculates the shortest distance between a chain and a line segment.
public static double DistanceTo(GeoPolyline3 polyline, GeoLine3 line)
Parameters
polylineGeoPolyline3lineGeoLine3
Returns
DistanceTo(GeoPolyline3, GeoLine3, Tolerance)
Calculates the shortest distance between a chain and a line segment, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoLine3 line, Tolerance tolerance)
Parameters
polylineGeoPolyline3lineGeoLine3toleranceTolerance
Returns
DistanceTo(GeoPolyline3, GeoPolyline3)
Calculates the shortest distance between two chains.
public static double DistanceTo(GeoPolyline3 polyline, GeoPolyline3 other)
Parameters
polylineGeoPolyline3otherGeoPolyline3
Returns
DistanceTo(GeoPolyline3, GeoPolyline3, Tolerance)
Calculates the shortest distance between two chains, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoPolyline3 other, Tolerance tolerance)
Parameters
polylineGeoPolyline3otherGeoPolyline3toleranceTolerance
Returns
DistanceTo(GeoPolyline3, GeoTriangle3)
Calculates the shortest distance between a chain and a triangle.
public static double DistanceTo(GeoPolyline3 polyline, GeoTriangle3 triangle)
Parameters
polylineGeoPolyline3triangleGeoTriangle3
Returns
DistanceTo(GeoPolyline3, GeoTriangle3, Tolerance)
Calculates the shortest distance between a chain and a triangle, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoTriangle3 triangle, Tolerance tolerance)
Parameters
polylineGeoPolyline3triangleGeoTriangle3toleranceTolerance
Returns
DistanceTo(GeoPolyline3, GeoPolygon3)
Calculates the shortest distance between a chain and a polygon.
public static double DistanceTo(GeoPolyline3 polyline, GeoPolygon3 polygon)
Parameters
polylineGeoPolyline3polygonGeoPolygon3
Returns
DistanceTo(GeoPolyline3, GeoPolygon3, Tolerance)
Calculates the shortest distance between a chain and a polygon, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoPolygon3 polygon, Tolerance tolerance)
Parameters
polylineGeoPolyline3polygonGeoPolygon3toleranceTolerance
Returns
DistanceTo(GeoPolyline3, GeoPlane3)
Calculates the shortest distance between a chain and a plane.
public static double DistanceTo(GeoPolyline3 polyline, GeoPlane3 plane)
Parameters
polylineGeoPolyline3planeGeoPlane3
Returns
DistanceTo(GeoPolyline3, GeoPlane3, Tolerance)
Calculates the shortest distance between a chain and a plane, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoPlane3 plane, Tolerance tolerance)
Parameters
polylineGeoPolyline3planeGeoPlane3toleranceTolerance
Returns
- double
Zero where the chain reaches the plane or crosses it, otherwise the gap.
Remarks
A plane is flat and endless, so nothing needs measuring but the vertices: the nearest point of a straight chain to a plane is always one of them, and the chain crosses the plane exactly when two of them fall on opposite sides.
DistanceTo(GeoPolyline3, GeoObb3)
Calculates the shortest distance between a chain and an oriented box.
public static double DistanceTo(GeoPolyline3 polyline, GeoObb3 box)
Parameters
polylineGeoPolyline3boxGeoObb3
Returns
DistanceTo(GeoPolyline3, GeoObb3, Tolerance)
Calculates the shortest distance between a chain and an oriented box, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoObb3 box, Tolerance tolerance)
Parameters
polylineGeoPolyline3boxGeoObb3toleranceTolerance
Returns
DistanceTo(GeoPolyline3, GeoAabb3)
Calculates the shortest distance between a chain and an axis-aligned box.
public static double DistanceTo(GeoPolyline3 polyline, GeoAabb3 box)
Parameters
polylineGeoPolyline3boxGeoAabb3
Returns
DistanceTo(GeoPolyline3, GeoAabb3, Tolerance)
Calculates the shortest distance between a chain and an axis-aligned box, within a tolerance.
public static double DistanceTo(GeoPolyline3 polyline, GeoAabb3 box, Tolerance tolerance)
Parameters
polylineGeoPolyline3boxGeoAabb3toleranceTolerance
Returns
DistanceTo(GeoRay3, GeoTriangle3)
Calculates the shortest distance between a ray and a triangle.
public static double DistanceTo(GeoRay3 ray, GeoTriangle3 triangle)
Parameters
rayGeoRay3triangleGeoTriangle3
Returns
DistanceTo(GeoRay3, GeoTriangle3, Tolerance)
Calculates the shortest distance between a ray and a triangle, within a tolerance.
public static double DistanceTo(GeoRay3 ray, GeoTriangle3 triangle, Tolerance tolerance)
Parameters
rayGeoRay3The ray.
triangleGeoTriangle3The triangle.
toleranceToleranceThe tolerance.
Returns
- double
Zero where the ray pierces the face, otherwise the gap between them.
Remarks
A ray that pierces the face touches none of its edges, so the crossing is looked for first. After that the nearest pair lies either between the ray and an edge, or under the origin of the ray where it hangs over the face without ever reaching it.
DistanceTo(GeoRay3, GeoSolid3)
Calculates the shortest distance between a ray and a solid.
public static double DistanceTo(GeoRay3 ray, GeoSolid3 solid)
Parameters
Returns
DistanceTo(GeoRay3, GeoSolid3, Tolerance)
Calculates the shortest distance between a ray and a solid, within a tolerance.
public static double DistanceTo(GeoRay3 ray, GeoSolid3 solid, Tolerance tolerance)
Parameters
Returns
- double
Zero where the ray starts inside the body or runs into it, otherwise the gap.