How to generate a path over a triangular mesh

5 views (last 30 days)
Hi guys,
I'm trying to generate paths/trajectories over a mold mesh. I would like to select two arbitrary points which belong to the same surface of the mesh, and then compute the path, as a straight line if i'm on a plane surface or curved line if i'm on a curved surface. Anyway, I need that each line pass through the selected points, and it lies on the surface(so the mesh).
Does anyone has suggestions?
Thanks in advance.

Answers (1)

Abhijeet
Abhijeet on 4 Apr 2023
To generate paths/trajectories over a mold mesh that pass through two arbitrary points on the same surface of the mesh, you can use the following steps:
  1. Identify the surface of the mesh that contains the two points. You can use a function like point2trimesh to determine which triangle the points belong to.
  2. Calculate the normal vector to the surface at one of the points. You can use the function surfnormal to obtain the normal vector.
  3. If the surface is a plane, you can use the equation of the plane to calculate a straight line that passes through the two points. If the surface is curved, you can use the normal vector and the curvature of the surface to calculate a curved path that passes through the two points and lies on the surface.
  4. Generate points along the calculated path and check that they lie on the surface of the mesh. You can use point2trimesh again to ensure that each point is on the surface.
  5. Repeat the above steps for other pairs of points to generate additional paths/trajectories.
Note : The accuracy of the calculated paths will depend on the accuracy of the surface mesh and the chosen method for calculating curved paths.
Hope it answers your query.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!