필터 지우기
필터 지우기

3D Binary Mask from Points

조회 수: 7 (최근 30일)
Jeremy
Jeremy 2016년 9월 28일
댓글: Walter Roberson 2016년 9월 29일
I'm trying to create a binary mask (1 inside the object and 0 outside the object) from some Collada files. This file https://www.mathworks.com/matlabcentral/fileexchange/45687-colladaparser helped me convert the actual .dae files into "tri - contains a 3xNumTri list of vertices that form triangles" and "vertex - contains a list vertices used (Nvertices x 3)."
Now I need to create a binary mask (that is maybe 100 x 250 x 100), or something of that magnitude) where the value of the logical matrix is 1 inside and 0 outside the 3d object created by these points and faces (with the ultimate goal of creating a signed distance function whose zero level set represents the 3d object). Does anyone have any ideas how to create the binary mask or even just the signed distance function itself?
Note that I wouldn't mind using a different 3d object file format (like .obj or .3ds), but I still need to end up with a signed distance function. And the packages I've tried for .obj and .3ds do not work.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 28일
  댓글 수: 2
Jeremy
Jeremy 2016년 9월 28일
편집: Jeremy 2016년 9월 28일
I saw a few of these, and I suppose I should ask a silly question now: is there a way to comprehensively test all points to a certain tolerance to see if they are in the polyhedron? (Like all possible combinations of (x,y,z) for x=a:0.01:b, y=c:0.01:d, z=e:0.01:f).
That is, I can't remember how to get that set of points I just described to be in the format [p1; p2; p3;...;pn] where p1 = (a,c,e) and pi = (xi,yi,zi)) and n = the total number of points
Walter Roberson
Walter Roberson 2016년 9월 29일
The general case is:
sets = {x, y, z}; %adjust this for situation
nset = length(sets);
[T1{1:nset] = ndgrid(sets{:});
output = zeros(numel(T1{1}), nset, class(T1{1}));
for K = 1 : nset
output(:,K) = reshape(T1{K}, [], 1);
end
clear T1
For the 3D case you can use
[T1, T2, T3] = ndgrid(x, y, z);
output = [T1(:), T2(:), T3(:)];
clear T1 T2 T3

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by