Rasterize a triangle in 3-D space.

2 ビュー (過去 30 日間)
Kenneth
Kenneth 2019 年 10 月 11 日
コメント済み: Kenneth 2019 年 10 月 17 日
I would like to rasterize a triangle in 3-D space... This is, if I have X,Y,Z generated by a meshgrid, I would like to mark all voxel centered on XYZ through which a triangle (specified by 3-D vertices) passes through. Are there any Matlab native methods to do this? It seems pretty basic, but I can't figure out what functions would be a straightforward path.
  1 件のコメント
darova
darova 2019 年 10 月 11 日
Do you have any attempts? Your data where is?

サインインしてコメントする。

採用された回答

Matt J
Matt J 2019 年 10 月 11 日
編集済み: Matt J 2019 年 10 月 11 日
One way is to use vert2lcon,
as follows,
tolerance1=1;
tolerance2=1.5;
V=[x1,y1,z1;... %triangle vertices
x2,y2,z2;
x3,y3,z3;]
[A,b,Aeq,beq]=vert2lcon(V);
C=[X(:).';Y(:).';Z(:).'];
intriangle = all( A*C<=b+tolerance1 & abs(Aeq*C-beq)<=tolerance2 ,1);
result=reshape(intriangle, size(X));
  1 件のコメント
Kenneth
Kenneth 2019 年 10 月 17 日
Thanks, it makes sense - I'm gettting the chance to look into it. I think this should work for my purposes. I'm just a little concerned it will be sensitive to the tolerance settings either leading to holes or too thick areas.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMap Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by