Get xyz position of points along a line between 2 points along a 3D triangular mesh
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matthew
le 4 Juil 2014
Réponse apportée : John D'Errico
le 5 Juil 2014
I have a 3D triangular mesh. It is defined by vertex positions and triangles.
I would like to be able to select 2 vertices on that surface and connect them with a line along the surface.
What i require as an output is a series of positions (xyz) between the two selected points. Is there a easy way to extract that information from the triangular mesh?
Thank you.
1 commentaire
Roger Stafford
le 5 Juil 2014
If this is a 3D triangular mesh, there is nothing unique about a "line" along the triangular surface connecting two given vertices. How do you define your "line"? It is to be the geodesic (shortest path)? If so, you are asking a difficult question.
Réponse acceptée
John D'Errico
le 5 Juil 2014
You need to be more specific. Think about your goal, and carefully define what you mean.
For example, the path you describe might arise in several ways. The shortest path contained in the surface is not a trivial thing to compute. However, if you define the path as that which is obtained from a vertical cutting plane through the two points, then it is easy enough to generate.
1. Determine which triangles have at least one vertex on each side of the cutting plane.
2. For each triangle so cut, determine which edges are crossed, and using linear interpolation, find the point of intersection. There must be EACTLY two points of intersection as long as the triangle is not "degenerate". Here degenerate would be defined by triangles that are fully contained in the cutting plane, or triangles where an edge is contained in the cutting plane. Such degeneracies can be treated of course by careful code.
3. Since each triangle that was cut has defined a line segment, connect those segments to form a path across the surface.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!