resqpy.olio.intersection.line_line_intersect

resqpy.olio.intersection.line_line_intersect(x1, y1, x2, y2, x3, y3, x4, y4, line_segment=False, half_segment=False)[source]

Returns the intersection x’,y’ of two lines x,y 1 to 2 and x,y 3 to 4.

Parameters:
  • x1 – coordinates of two points defining first line

  • y1 – coordinates of two points defining first line

  • x2 – coordinates of two points defining first line

  • y2 – coordinates of two points defining first line

  • x3 – coordinates of two points defining second line

  • y3 – coordinates of two points defining second line

  • x4 – coordinates of two points defining second line

  • y4 – coordinates of two points defining second line

  • line_segment (bool, default False) – if False, both lines are treated as unbounded; if True second line is treated as segment bounded by both end points and first line bounding depends on half_segment arg

  • half_segment (bool, default False) – if True and line_segment is True, first line is bounded only at end point x1, y1, whilst second line is fully bounded; if False and line_segment is True, first line is also treated as fully bounded; ignored if line_segment is False (ie. both lines unbounded)

Returns:

pair of floats being x, y of intersection point; or None, None if no qualifying intersection

Note

in the case of bounded line segments, both end points are ‘included’ in the segment