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 CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by