3D body plot ( visualization )
Show older comments
Hi, I have little or no experience with volumetric data in MATLAB, I found next appropriated descriptions: http://www.mathworks.com/help/techdoc/ref/isonormals.html
I need to complete next task:
I have 3 vectors ( rows ):
x_ = vector(1:smpl:max_row,1);
y_ = vector(1:smpl:max_row,2);
z_ = vector(1:smpl:max_row,3);
that are samples from large 3 columns array vector with height max_row. x_ , y_ , z_ are points of 3D figure - surface points of the figure ( volume ). They represent 3D body that should be drawn in matlab.
I created linear grid:
%linear grid
a = -1.1:step:(-1.1+step*(length(x_)-1));
b = -1.1:step:(-1.1+step*(length(y_)-1));
c = -1.1:step:(-1.1+step*(length(z_)-1));
[x,y,z] = meshgrid(-1.1:step:(-1.1+step*(length(x_)-1)));
and also I create array v length(x_)*length(x_)*length(x_) that contains '1' in cells that are of 3D body representation function points and '0' another.
I tryied to make interpolation:
vi = interp3(x,y,z,v,x,y,z,'nearest');
but then vi = v that I've already created.
Now I need to plot the v array on 3D and form 3D body like in
for example.
I make that next way:
%plotting:
figure
p = patch(isosurface(x,y,z,v,1e- 5,'verbose'),'FaceColor','green','EdgeColor','none');
grid on;
isonormals(v,p);
daspect([1 1 1])
view(3);
axis tight;
camproj perspective;
camlight
lighting gouraud
colormap(hsv)
I expect to get body enclosed by the points where v = 1 , but I get then only small rectangles in place of function '1' that are not connected ( see attached picture ) Does anybody know what is the problem , how to draw 3D body from the x,y,z,v vectors ?
Thanks in advance.
image:
5 Comments
Sean de Wolski
on 26 Jan 2012
First: well written question.
Second:
If you separate the call to ISOSURFACE from the call to PATCH, what is the output from isosurface (size/shape)?
[f v] = isosurface(...
?
Mr. Pavl M.
on 26 Jan 2012
Mr. Pavl M.
on 26 Jan 2012
Sean de Wolski
on 26 Jan 2012
It must be how your data is stored in x,y,z. Does it change if you change the isovalue to 0? Should the output be convex? The output from ISOSURFACE looks like it could/should be correct (i.e. not wrong). Can you post your sample data in a matfile to somewhere?
Mr. Pavl M.
on 26 Jan 2012
Accepted Answer
More Answers (0)
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!