distance3d.distance.line_segment_to_triangle

distance3d.distance.line_segment_to_triangle(segment_start, segment_end, triangle_points, epsilon=1e-06)[source]

Compute the shortest distance from line segment to triangle.

Implementation adapted from Real-Time Collision Detection by Christer Ericson published by Morgan Kaufmann Publishers, Copyright 2005 Elsevier Inc.

Parameters:
segment_startarray, shape (3,)

Start point of segment.

segment_endarray, shape (3,)

End point of segment.

triangle_pointsarray, shape (3, 3)

Each row contains a point of the triangle (A, B, C).

epsilonfloat, optional (default: 1e-6)

Values smaller than epsilon are considered to be 0.

Returns:
distancefloat

The shortest distance between line segment and triangle.

closest_point_line_segmentarray, shape (3,)

Closest point on line segment.

closest_point_trianglearray, shape (3,)

Closest point on triangle.