# distance_line_line

compas.geometry.distance_line_line(l1, l2, tol=0.0)[source]

Compute the shortest distance between two lines.

Parameters
• l1 (tuple) – Two points defining a line.

• l2 (tuple) – Two points defining a line.

Returns

float – The distance between the two lines.

Notes

The distance is the absolute value of the dot product of a unit vector that is perpendicular to the two lines, and the vector between two points on the lines (1, 2).

If each of the lines is defined by two points ($$l_1 = (\mathbf{x_1}, \mathbf{x_2})$$, $$l_2 = (\mathbf{x_3}, \mathbf{x_4})$$), then the unit vector that is perpendicular to both lines is…

References

1

Weisstein, E.W. Line-line Distance. Available at: http://mathworld.wolfram.com/Line-LineDistance.html.

2

Wikipedia. Skew lines Distance. Available at: https://en.wikipedia.org/wiki/Skew_lines#Distance.

Examples

>>>