resqpy.olio.intersection.line_triangle_intersect_numba

resqpy.olio.intersection.line_triangle_intersect_numba(line_p: ndarray, line_v: ndarray, triangle: ndarray, line_segment: bool = False, l_tol: float = 0.0, t_tol: float = 0.0) Union[None, ndarray][source]

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

Parameters
  • line_p (np.ndarray) – a point on the line.

  • line_v (np.ndarray) – vector being the direction of the line.

  • triangle (np.ndarray) – shape (3, 3); three corners of the triangle (second index is xyz).

  • line_segment (bool) – 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 (np.ndarray) 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.