intersection_line_segment

compas.geometry.intersection_line_segment(line, segment, tol=None)[source]

Compute the intersection of a line and a segment.

Parameters:
line[point, point] | compas.geometry.Line

Two points defining a line.

segment[point, point] | compas.geometry.Line

Two points defining a line segment.

tolfloat, optional

Tolerance value for computing the intersection points of the underlying lines, and for verifying that those points are contained by the segment. Default is TOL.absolute.

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.