Get xyz position of points along a line between 2 points along a 3D triangular mesh
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Roger Stafford
2014년 7월 5일
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.
채택된 답변
John D'Errico
2014년 7월 5일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computational Geometry에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!