using 'line' command to create a triangular mesh

4 次查看(过去 30 天)
I have a two vectors with random values from [0 1] and an array of triangle connectivities how can I write a function that takes these three arrays as input arguments and draws the triangular mesh using the line command ?

回答(1 个)

Steven Lord
Steven Lord 2018-9-12
Use the trimesh function.
  2 个评论
Hamza Azzam
Hamza Azzam 2018-9-12
I need to use the 'line' command to draw a triangular mesh, without using the 'trimesh' function
Steven Lord
Steven Lord 2018-9-12
The line function just connects the dots. You need to give it the correct dots in the correct order. Since this sounds like it might be homework, the only other suggestion I'll give you is: indexing.
You could plot each triangle as an individual line as long as you don't have too many. But if you wanted to plot all the triangles as one line, if the vector you pass into line contains a NaN that will cause MATLAB to "pick up the pen" and not connect the two points the NaN is between with a line.
h = line([1 2 NaN 3 4 5], [1 4 NaN 1 4 9]);
MATLAB only created one line object, but visually there are two line segments since there's no line drawn between (2, 4) and (3, 1).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by