Filter löschen
Filter löschen

Get xyz position of points along a line between 2 points along a 3D triangular mesh

2 Ansichten (letzte 30 Tage)
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 Kommentar
Roger Stafford
Roger Stafford am 5 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

John D'Errico
John D'Errico am 5 Jul. 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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by