distance3d.distance.point_to_triangle

distance3d.distance.point_to_triangle(point, triangle_points)[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:
pointarray, shape (3,)

3D point.

triangle_pointsarray, shape (3, 3)

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

Returns:
distancefloat

The shortest distance between point and triangle.

closest_pointarray, shape (3,)

Closest point on triangle.