distance3d.distance.line_to_line_segment

distance3d.distance.line_to_line_segment(line_point, line_direction, segment_start, segment_end, epsilon=1e-06)[source]

Compute the shortest distance between line and line segment.

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.

segment_startarray, shape (3,)

Start point of segment.

segment_endarray, shape (3,)

End point of segment.

epsilonfloat, optional (default: 1e-6)

Values smaller than epsilon are considered to be 0.

Returns:
distfloat

The shortest distance between line and line segment.

closest_point1array, shape (3,)

Closest point on line.

closest_point2array, shape (3,)

Closest point on line segment.