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 ([point, point] | Line) – Two points defining a line.

  • segment ([point, point] | Line) – Two points defining a line segment.

  • tol (float, optional) – A tolerance for membership verification.

Returns

tuple[[float, float, float], [float, float, float]] | tuple[None, None] – 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 there are no intersection points.