resqpy.olio.intersection.line_triangles_intersects

resqpy.olio.intersection.line_triangles_intersects(line_p, line_v, triangles, line_segment=False)[source]

Find the intersections of a line within each of a set of triangles 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

  • triangles ((n, 3, 3) numpy array) – three corners of each of the n triangles (final index is xyz)

  • line_segment (boolean, default False) – if True, the line is treated as a finite segment between p and p + v, and only intersections within the segment are included

Returns

points ((n, 3) numpy array) of intersection points of the line within the triangles, (nan, nan, nan) where line is parallel to plane of triangle or intersection with the plane is outside the triangle (or beyond the ends of the segment if applicable)