Easy question for you geniuses, what is wrong with my input for this matlab function?

7 views (last 30 days)
Ok so I have done a delaunay triangulation on a 3d point cloud.
tri=delaunay(x,y,z);
and graphed it with trisurf(tri,xval,yval,zval)
which is giving me this error:
>> [k V] = convexHull(tri)
Undefined function 'convexHull' for input arguments of type 'double'.
here is my question. What am I doing wrong, and what is the tri array actually mean? It looks like a huge array of numbers. Will the volume calculation in the convexHull function work without having the x,y,z values which are measured in millimeters?
Thank you!!!

Accepted Answer

Sven
Sven on 9 Jul 2012
Edited: Sven on 9 Jul 2012
I believe you've gotten (understandably) confused with:
delaunay()
and
DelaunayTri()
The first one does a delaunay triangulation and returns the vertices as numerical output.
The second one returns a triangulation object, from which you can do other fun stuff as specified in the DelaunayTri docs (such as convexHull).
If your only goal is to get the convex hull of your points, then you could go directly there with:
k = convhull(x,y,z);
figure, patch(struct('vertices',[x y z],'faces', k),'FaceColor','c')
However I think you're trying to get the volume of this convex hull too, so you can just do:
DT = DelaunayTri(x,y,z);
[k, vol] = DT.convexHull;
And if your original coordinates (x,y,z), are mm coordinates in space, then your vol will also be in mm^3. If your original coordinates are pixel indices of some 3D image you have, then you should either:
  1. Convert pixel indices into mm coordinates to send to DelaunayTri
  2. Calculate the volume of 1 3D "voxel". Beware, this will only make sense if your voxels are "isotropic".

More Answers (0)

Categories

Find more on Delaunay Triangulation 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!