distance3d.distance.line_to_triangle

distance3d.distance.line_to_triangle(line_point, line_direction, triangle_points, epsilon=1e-06)[source]

Compute the shortest distance between point and triangle.

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

Parameters:
line_pointarray, shape (3,)

Point on line.

line_directionarray, shape (3,)

Direction of the line. This is assumed to be of unit length.

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 and triangle.

closest_point_linearray, shape (3,)

Closest point on line.

closest_point_trianglearray, shape (3,)

Closest point on triangle.