distance3d.distance.line_segment_to_line_segment

distance3d.distance.line_segment_to_line_segment(segment_start1, segment_end1, segment_start2, segment_end2, epsilon=1e-06)[source]

Compute the shortest distance between two line segments.

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

Parameters:
segment_start1array, shape (3,)

Start point of segment 1.

segment_end1array, shape (3,)

End point of segment 1.

segment_start2array, shape (3,)

Start point of segment 2.

segment_end2array, shape (3,)

End point of segment 2.

epsilonfloat, optional (default: 1e-6)

Values smaller than epsilon are considered to be 0.

Returns:
distancefloat

The shortest distance between two line segments.

closest_point_segment1array, shape (3,)

Closest point on first line segment.

closest_point_segment2array, shape (3,)

Closest point on second line segment.