resqpy.olio.intersection.line_triangle_intersect

resqpy.olio.intersection.line_triangle_intersect(line_p, line_v, triangle, line_segment=False, l_tol=0.0, t_tol=0.0)[source]

Find the intersection of a line within a triangle in 3D space.

Parameters
  • line_p (3 element numpy vector) – a point on the line

  • line_v (3 element numpy vector) – vector being the direction of the line

  • triangle ((3, 3) numpy array) – three corners of the triangle (second index is xyz)

  • line_segment (boolean) – if True, returns None if intersection is outwith (line_p .. line_p + line_v)

  • l_tol (float, default 0.0) – a fraction of the line length to allow for an intersection to be found just outside the segment

  • t_tol (float, default 0.0) – a fraction of the triangle size to allow for an intersection to be found just outside the triangle

Returns

point (3 element numpy vector) of intersection of the line within the triangle, or None if line is parallel to plane of triangle or intersection with the plane is outside the triangle