Table of Contents

Method GetShortestLineTo

Namespace
GeometryHelper.Core
Assembly
GeometryHelper.dll

GetShortestLineTo(GeoLine3, GeoLine3)

Finds the shortest segment connecting a point on one line segment to a point on another, using the default tolerance.

public static GeoLine3 GetShortestLineTo(GeoLine3 line1, GeoLine3 line2)

Parameters

line1 GeoLine3
line2 GeoLine3

Returns

GeoLine3

GetShortestLineTo(GeoLine3, GeoLine3, Tolerance)

Finds the shortest segment connecting a point on one line segment to a point on another, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoLine3 line1, GeoLine3 line2, Tolerance tolerance)

Parameters

line1 GeoLine3

The first segment; the result starts on it.

line2 GeoLine3

The second segment; the result ends on it.

tolerance Tolerance

The tolerance used to detect degenerate segments.

Returns

GeoLine3

The shortest segment from a point on the first to a point on the second.

Remarks

Two segments in space usually do not meet, so the answer is a segment rather than a point, and its length is the distance between them. When they do cross, the result is a zero-length segment sitting at the crossing point.

GetShortestLineTo(GeoLine3, GeoLine3, LineExtension)

Finds the shortest segment connecting two line segments, reading either or both as the infinite line carrying it, using the default tolerance.

public static GeoLine3 GetShortestLineTo(GeoLine3 line1, GeoLine3 line2, LineExtension extension)

Parameters

line1 GeoLine3
line2 GeoLine3
extension LineExtension

Returns

GeoLine3

GetShortestLineTo(GeoLine3, GeoLine3, LineExtension, Tolerance)

Finds the shortest segment connecting two line segments, reading either or both as the infinite line carrying it, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoLine3 line1, GeoLine3 line2, LineExtension extension, Tolerance tolerance)

Parameters

line1 GeoLine3

The first segment; the result starts on it, or on the line carrying it when extended.

line2 GeoLine3

The second segment; the result ends on it, or on the line carrying it when extended.

extension LineExtension

Which of the two may be reached past its endpoints.

tolerance Tolerance

The tolerance used to detect degenerate segments.

Returns

GeoLine3

The shortest segment between the two, as far as each is allowed to reach.

Remarks

With Both this is Tekla's Intersection.LineToLine: two axes that pass each other in space are joined by their common perpendicular, whose length is the gap between them. Where every pair of facing points is equally close, as for parallel lines, one end of the result sits on a start point: that of the first segment, unless only the first is extended, and then that of the second.

Exceptions

ArgumentOutOfRangeException

Thrown when the extension is not a defined value.

GetShortestLineTo(GeoLine3, GeoTriangle3)

Gets the shortest segment joining a segment to a triangle.

public static GeoLine3 GetShortestLineTo(GeoLine3 line, GeoTriangle3 triangle)

Parameters

line GeoLine3
triangle GeoTriangle3

Returns

GeoLine3

GetShortestLineTo(GeoLine3, GeoTriangle3, Tolerance)

Gets the shortest segment joining a segment to a triangle, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoLine3 line, GeoTriangle3 triangle, Tolerance tolerance)

Parameters

line GeoLine3

The segment the answer leaves.

triangle GeoTriangle3

The triangle the answer lands on.

tolerance Tolerance

The tolerance.

Returns

GeoLine3

A segment leaving line and landing on triangle, of no length at all where the two meet.

Remarks

A segment that passes clean through the face meets none of its edges, so the crossing is looked for first; after that the nearest pair is either between the segment and an edge, or under one of the segment ends.

GetShortestLineTo(GeoTriangle3, GeoTriangle3)

Gets the shortest segment joining two triangles.

public static GeoLine3 GetShortestLineTo(GeoTriangle3 first, GeoTriangle3 second)

Parameters

first GeoTriangle3
second GeoTriangle3

Returns

GeoLine3

GetShortestLineTo(GeoTriangle3, GeoTriangle3, Tolerance)

Gets the shortest segment joining two triangles, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoTriangle3 first, GeoTriangle3 second, Tolerance tolerance)

Parameters

first GeoTriangle3

The triangle the answer leaves.

second GeoTriangle3

The triangle the answer lands on.

tolerance Tolerance

The tolerance.

Returns

GeoLine3

A segment leaving first and landing on second, of no length at all where the two meet.

Remarks

Two faces that cross share a segment whose ends lie on an edge of one and inside the other, so the crossings of each edge with the other face are looked for first. Failing that the nearest pair is between two edges, or under a corner of one lying over the face of the other, which is the same set of candidates DistanceTo(GeoTriangle3, GeoTriangle3, Tolerance) weighs.

GetShortestLineTo(GeoSolid3, GeoPoint3)

Gets the shortest segment joining a solid to a point.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoPoint3 point)

Parameters

solid GeoSolid3
point GeoPoint3

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoPoint3, Tolerance)

Gets the shortest segment joining a solid to a point, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoPoint3 point, Tolerance tolerance)

Parameters

solid GeoSolid3
point GeoPoint3
tolerance Tolerance

Returns

GeoLine3

A segment leaving the surface of the solid and ending at point, which has a length even for a point inside the body.

GetShortestLineTo(GeoSolid3, GeoLine3)

Gets the shortest segment joining a solid to a segment.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoLine3 line)

Parameters

solid GeoSolid3
line GeoLine3

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoLine3, Tolerance)

Gets the shortest segment joining a solid to a segment, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoLine3 line, Tolerance tolerance)

Parameters

solid GeoSolid3
line GeoLine3
tolerance Tolerance

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoTriangle3)

Gets the shortest segment joining a solid to a triangle.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoTriangle3 triangle)

Parameters

solid GeoSolid3
triangle GeoTriangle3

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoTriangle3, Tolerance)

Gets the shortest segment joining a solid to a triangle, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoTriangle3 triangle, Tolerance tolerance)

Parameters

solid GeoSolid3
triangle GeoTriangle3
tolerance Tolerance

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoSolid3)

Gets the shortest segment joining two solids.

public static GeoLine3 GetShortestLineTo(GeoSolid3 first, GeoSolid3 second)

Parameters

first GeoSolid3
second GeoSolid3

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoSolid3, Tolerance)

Gets the shortest segment joining two solids, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoSolid3 first, GeoSolid3 second, Tolerance tolerance)

Parameters

first GeoSolid3

The solid the answer leaves.

second GeoSolid3

The solid the answer lands on.

tolerance Tolerance

The tolerance.

Returns

GeoLine3

A segment leaving the surface of first and landing on the surface of second.

Remarks

Every face is weighed against every face, but a pair whose boxes already stand farther apart than the best segment found so far is passed over without being measured, which is what makes the walk bearable on bodies of any size.

GetShortestLineTo(GeoRay3, GeoLine3)

Gets the shortest segment joining a ray to a line segment.

public static GeoLine3 GetShortestLineTo(GeoRay3 ray, GeoLine3 line)

Parameters

ray GeoRay3
line GeoLine3

Returns

GeoLine3

GetShortestLineTo(GeoRay3, GeoLine3, Tolerance)

Gets the shortest segment joining a ray to a line segment, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoRay3 ray, GeoLine3 line, Tolerance tolerance)

Parameters

ray GeoRay3

The ray the answer leaves.

line GeoLine3

The segment the answer lands on.

tolerance Tolerance

The tolerance.

Returns

GeoLine3

A segment leaving ray and landing on line.

Remarks

The nearest pair is either where the two run past each other, or at the origin of the ray, or under an end of the segment. The first of those is found by reading the ray as the whole line through it and then clamping what comes back onto the ray and onto the segment, so the pair is one both shapes really hold whether or not the perpendicular falls where they live.

GetShortestLineTo(GeoRay3, GeoTriangle3)

Gets the shortest segment joining a ray to a triangle.

public static GeoLine3 GetShortestLineTo(GeoRay3 ray, GeoTriangle3 triangle)

Parameters

ray GeoRay3
triangle GeoTriangle3

Returns

GeoLine3

GetShortestLineTo(GeoRay3, GeoTriangle3, Tolerance)

Gets the shortest segment joining a ray to a triangle, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoRay3 ray, GeoTriangle3 triangle, Tolerance tolerance)

Parameters

ray GeoRay3
triangle GeoTriangle3
tolerance Tolerance

Returns

GeoLine3

A segment leaving ray and landing on triangle, of no length at all where the ray pierces the face.

GetShortestLineTo(GeoSolid3, GeoRay3)

Gets the shortest segment joining a solid to a ray.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoRay3 ray)

Parameters

solid GeoSolid3
ray GeoRay3

Returns

GeoLine3

GetShortestLineTo(GeoSolid3, GeoRay3, Tolerance)

Gets the shortest segment joining a solid to a ray, within a tolerance.

public static GeoLine3 GetShortestLineTo(GeoSolid3 solid, GeoRay3 ray, Tolerance tolerance)

Parameters

solid GeoSolid3
ray GeoRay3
tolerance Tolerance

Returns

GeoLine3

A segment leaving the surface of the solid and landing on ray.

Remarks

A ray starting inside a closed body has to come out through a face, so the answer there is of no length rather than a measurement out to the skin.