intersection_ray_mesh

compas.geometry.intersection_ray_mesh(ray, mesh)[source]

Compute the intersection(s) between a ray and a mesh.

Parameters:
raytuple of point and vector

A ray represented by a point and a direction vector.

meshtuple of vertices and faces

A mesh represented by a list of vertices and a list of faces.

Returns:
list of tuple

Per intersection of the ray with the mesh:

  1. the index of the intersected face

  2. the u coordinate of the intersection in the barycentric coordinates of the face

  3. the u coordinate of the intersection in the barycentric coordinates of the face

  4. the distance between the ray origin and the hit

Examples

>>>