Mesh/Polyline Intersection

I’m trying to get the intersection of a Polyline and a Mesh. Is there a function which is doing this? I looked for it in compas and also in compas_cgal but I didn’t find one. I just found the intersection_ray_mesh and the intersection_polyline_plane functions.
Is it alternatively possible to transfer the polyline into another type (for example a Mesh, …) which may be used to calculate the intersection?
Or is there a funtion to check whether a point (which is not necessarily a vertex of the mesh) lays on or closed to a mesh? If there would be such a is_point_on_mesh function, I could at least check which points are laying on the mesh.

Thanks a lot :slight_smile:


thanks for posting!

there is indeed no such function. but a few solutions should be available with a minimum of additional coding. for example, with intersection_ray_mesh you could compute the intersections between the different “rays” of you polyline segments, and if there is one, check if that intersection lies on the actual segment, with is_point_on_segment.

is_point_on_mesh also doesn’t exist, but there is a function trimesh_pull_points_numpy that you can use to pull the points of the polyline onto the mesh and then compute the distance between the corresponding pairs of the original points and the pulled points to determine which points are on the mesh, up to a tolerance…

hope this helps.
otherwise submit a feature request :slight_smile: