How can I get a point cloud from a patch object?

8 ビュー (過去 30 日間)
Chris Virgin
Chris Virgin 2014 年 7 月 18 日
回答済み: Chris Virgin 2014 年 7 月 23 日
I've downloaded the IGESToolBox from here and brought in a flowpath from CAD. The IGESToolbox plots the supplied file as a patch;
patch('faces',TRI,'vertices',P','FaceColor',clr,'EdgeColor','none');
I would like to extract the point cloud from the patch so I can make a ndgrid or trimesh. However, I can't figure out how to get the data out of TRI and P. I've tried 3 different ways and I just end up with a funky wedge shape instead of the flowpath.
Thanks for looking

採用された回答

Kelly Kearney
Kelly Kearney 2014 年 7 月 18 日
I'm assuming from this example that TRI is nx3 and P is 3xm (i.e. your data is 3D)
trimesh uses the same face/vertex input as patch-with-face-vertex:
trimesh(TRI, P(1,:), P(2,:), P(3,:))
If you want the coordinates of all the triangular faces:
vx = P(:,1);
vy = P(:,2);
x = vx(TRI');
y = vy(TRI');

その他の回答 (1 件)

Chris Virgin
Chris Virgin 2014 年 7 月 23 日
I didn't know that about trimesh (or I missed it in the documentation).
That's exactly what I needed.
Thanks for your help!

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by