I use different convex hull functions in Matlab to find points coordinates which are formed the convex hull. however, these functions return the matrix of triangles. How can I specify those points? Thanks. Sepideh

1

There are 1 answers

3
kitchenette On

I'm not sure I fully understand your question. Maybe if the following doesn't clarify things you can edit your post to include the name of the MATLAB function you are using and a snippet of code?

The convhull function in MATLAB does return the index of coordinates in the convex hull.

In the following example, (x(k), y(k)) are the coordinates. (taken straight from convhull doc)

xx = -1:.05:1; yy = abs(sqrt(xx));
[x,y] = pol2cart(xx,yy);
k = convhull(x,y);
plot(x(k),y(k),'r-',x,y,'b+')

convhull example

It's the same thing if you are using convexhull instead (convexhull doc).

x = rand(10,1);
y = rand(10,1);
dt = DelaunayTri(x,y);
k = convexHull(dt);
plot(x,y, '.', 'markersize',10); 
hold on;
plot(x(k), y(k), 'r'); 
hold off;

convexhull example