intersection_line_segment

compas.geometry.intersection_line_segment(line, segment, tol=1e-06)[source]

Compute the intersection of a line and a segment.

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

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

  • tol (float, optional) – A tolerance for membership verification. Default is 1e-6.

Returns

tuple – Two intersection points.

If the line and segment intersect and the second intersection point lies on the segment, the two points are identical. If the line and segment are skew and the second apparent intersection point lies on the segment, the two points are different.

In all other cases the return is (None, None).