Table of Contents

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

p1 GeoPoint3
p2 GeoPoint3

Returns

double

DistanceTo(GeoLine3, GeoPoint3)

Calculates the shortest distance from a line segment to a point.

public static double DistanceTo(GeoLine3 line, GeoPoint3 point)

Parameters

line GeoLine3
point GeoPoint3

Returns

double

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

line GeoLine3
point GeoPoint3
tolerance Tolerance

Returns

double

DistanceTo(GeoRay3, GeoPoint3)

Calculates the shortest distance from a ray to a point.

public static double DistanceTo(GeoRay3 ray, GeoPoint3 point)

Parameters

ray GeoRay3
point GeoPoint3

Returns

double

DistanceTo(GeoPlane3, GeoPoint3)

Calculates the perpendicular distance from a plane to a point.

public static double DistanceTo(GeoPlane3 plane, GeoPoint3 point)

Parameters

plane GeoPlane3
point GeoPoint3

Returns

double

DistanceTo(GeoTriangle3, GeoPoint3)

Calculates the shortest distance from a triangle to a point.

public static double DistanceTo(GeoTriangle3 triangle, GeoPoint3 point)

Parameters

triangle GeoTriangle3
point GeoPoint3

Returns

double

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

line1 GeoLine3
line2 GeoLine3

Returns

double

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

line1 GeoLine3
line2 GeoLine3
tolerance Tolerance

Returns

double

DistanceTo(GeoRay3, GeoLine3)

Calculates the shortest distance between a ray and a line segment.

public static double DistanceTo(GeoRay3 ray, GeoLine3 line)

Parameters

ray GeoRay3
line GeoLine3

Returns

double

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

ray GeoRay3
line GeoLine3
tolerance Tolerance

Returns

double

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

plane GeoPlane3
line GeoLine3

Returns

double

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

plane1 GeoPlane3
plane2 GeoPlane3

Returns

double

DistanceTo(GeoPlane3, GeoPlane3, Tolerance)

Calculates the distance between two planes, within a tolerance.

public static double DistanceTo(GeoPlane3 plane1, GeoPlane3 plane2, Tolerance tolerance)

Parameters

plane1 GeoPlane3
plane2 GeoPlane3
tolerance Tolerance

Returns

double

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

polyline GeoPolyline3
point GeoPoint3

Returns

double

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

polyline GeoPolyline3
point GeoPoint3
tolerance Tolerance

Returns

double

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

polygon GeoPolygon3
point GeoPoint3

Returns

double

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

polygon GeoPolygon3
point GeoPoint3
tolerance Tolerance

Returns

double

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

face GeoFace3
point GeoPoint3

Returns

double

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

face GeoFace3
point GeoPoint3
tolerance Tolerance

Returns

double

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

box GeoObb3
point GeoPoint3

Returns

double

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

solid GeoSolid3
point GeoPoint3

Returns

double

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

solid GeoSolid3
point GeoPoint3
tolerance Tolerance

Returns

double

DistanceTo(GeoCircle3, GeoPoint3)

Calculates the shortest distance from a circular disc to a point.

public static double DistanceTo(GeoCircle3 circle, GeoPoint3 point)

Parameters

circle GeoCircle3
point GeoPoint3

Returns

double

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

circle GeoCircle3
point GeoPoint3
tolerance Tolerance

Returns

double

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

box GeoAabb3
point GeoPoint3

Returns

double

DistanceTo(GeoAabb3, GeoAabb3)

Calculates the shortest distance between two axis-aligned boxes.

public static double DistanceTo(GeoAabb3 box1, GeoAabb3 box2)

Parameters

box1 GeoAabb3
box2 GeoAabb3

Returns

double

DistanceTo(GeoTriangle3, GeoTriangle3)

Calculates the shortest distance between two triangles.

public static double DistanceTo(GeoTriangle3 triangle1, GeoTriangle3 triangle2)

Parameters

triangle1 GeoTriangle3
triangle2 GeoTriangle3

Returns

double

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

triangle1 GeoTriangle3
triangle2 GeoTriangle3
tolerance Tolerance

Returns

double

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

line GeoLine3
triangle GeoTriangle3

Returns

double

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

line GeoLine3
triangle GeoTriangle3
tolerance Tolerance

Returns

double

DistanceTo(GeoLine3, GeoPolygon3)

Calculates the shortest distance between a line segment and a polygon.

public static double DistanceTo(GeoLine3 line, GeoPolygon3 polygon)

Parameters

line GeoLine3
polygon GeoPolygon3

Returns

double

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

line GeoLine3
polygon GeoPolygon3
tolerance Tolerance

Returns

double

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

line GeoLine3
solid GeoSolid3

Returns

double

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

line GeoLine3
solid GeoSolid3
tolerance Tolerance

Returns

double

DistanceTo(GeoSolid3, GeoTriangle3)

Calculates the shortest distance between a solid and a triangle.

public static double DistanceTo(GeoSolid3 solid, GeoTriangle3 triangle)

Parameters

solid GeoSolid3
triangle GeoTriangle3

Returns

double

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

solid GeoSolid3

The solid.

triangle GeoTriangle3

The triangle.

tolerance Tolerance

The 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

solid GeoSolid3
polygon GeoPolygon3

Returns

double

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

solid GeoSolid3
polygon GeoPolygon3
tolerance Tolerance

Returns

double

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

solid GeoSolid3
polyline GeoPolyline3

Returns

double

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

solid GeoSolid3
polyline GeoPolyline3
tolerance Tolerance

Returns

double

DistanceTo(GeoSolid3, GeoPlane3)

Calculates the shortest distance between a solid and a plane.

public static double DistanceTo(GeoSolid3 solid, GeoPlane3 plane)

Parameters

solid GeoSolid3
plane GeoPlane3

Returns

double

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

solid GeoSolid3
plane GeoPlane3
tolerance Tolerance

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

solid GeoSolid3
box GeoObb3

Returns

double

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

solid GeoSolid3
box GeoObb3
tolerance Tolerance

Returns

double

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

solid GeoSolid3
box GeoAabb3

Returns

double

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

solid GeoSolid3
box GeoAabb3
tolerance Tolerance

Returns

double

DistanceTo(GeoSolid3, GeoSolid3)

Calculates the shortest distance between two solids.

public static double DistanceTo(GeoSolid3 solid1, GeoSolid3 solid2)

Parameters

solid1 GeoSolid3
solid2 GeoSolid3

Returns

double

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

solid1 GeoSolid3
solid2 GeoSolid3
tolerance Tolerance

Returns

double

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

box1 GeoObb3
box2 GeoObb3

Returns

double

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

box1 GeoObb3
box2 GeoObb3
tolerance Tolerance

Returns

double

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

polyline GeoPolyline3
line GeoLine3

Returns

double

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

polyline GeoPolyline3
line GeoLine3
tolerance Tolerance

Returns

double

DistanceTo(GeoPolyline3, GeoPolyline3)

Calculates the shortest distance between two chains.

public static double DistanceTo(GeoPolyline3 polyline, GeoPolyline3 other)

Parameters

polyline GeoPolyline3
other GeoPolyline3

Returns

double

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

polyline GeoPolyline3
other GeoPolyline3
tolerance Tolerance

Returns

double

DistanceTo(GeoPolyline3, GeoTriangle3)

Calculates the shortest distance between a chain and a triangle.

public static double DistanceTo(GeoPolyline3 polyline, GeoTriangle3 triangle)

Parameters

polyline GeoPolyline3
triangle GeoTriangle3

Returns

double

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

polyline GeoPolyline3
triangle GeoTriangle3
tolerance Tolerance

Returns

double

DistanceTo(GeoPolyline3, GeoPolygon3)

Calculates the shortest distance between a chain and a polygon.

public static double DistanceTo(GeoPolyline3 polyline, GeoPolygon3 polygon)

Parameters

polyline GeoPolyline3
polygon GeoPolygon3

Returns

double

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

polyline GeoPolyline3
polygon GeoPolygon3
tolerance Tolerance

Returns

double

DistanceTo(GeoPolyline3, GeoPlane3)

Calculates the shortest distance between a chain and a plane.

public static double DistanceTo(GeoPolyline3 polyline, GeoPlane3 plane)

Parameters

polyline GeoPolyline3
plane GeoPlane3

Returns

double

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

polyline GeoPolyline3
plane GeoPlane3
tolerance Tolerance

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

polyline GeoPolyline3
box GeoObb3

Returns

double

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

polyline GeoPolyline3
box GeoObb3
tolerance Tolerance

Returns

double

DistanceTo(GeoPolyline3, GeoAabb3)

Calculates the shortest distance between a chain and an axis-aligned box.

public static double DistanceTo(GeoPolyline3 polyline, GeoAabb3 box)

Parameters

polyline GeoPolyline3
box GeoAabb3

Returns

double

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

polyline GeoPolyline3
box GeoAabb3
tolerance Tolerance

Returns

double

DistanceTo(GeoRay3, GeoTriangle3)

Calculates the shortest distance between a ray and a triangle.

public static double DistanceTo(GeoRay3 ray, GeoTriangle3 triangle)

Parameters

ray GeoRay3
triangle GeoTriangle3

Returns

double

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

ray GeoRay3

The ray.

triangle GeoTriangle3

The triangle.

tolerance Tolerance

The 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

ray GeoRay3
solid GeoSolid3

Returns

double

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

ray GeoRay3
solid GeoSolid3
tolerance Tolerance

Returns

double

Zero where the ray starts inside the body or runs into it, otherwise the gap.