0

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

Sepideh
  • 11
  • 2

1 Answers1

0

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

kitchenette
  • 1,625
  • 11
  • 12
  • Thanks. However, I need the coordinates of those formed convex. from the shape, it is easy to find out but I have many 3-dimensions points. – Sepideh Aug 07 '12 at 19:43
  • Can I ask you what is inside variable k? maybe I misunderstood it. – Sepideh Aug 07 '12 at 19:46
  • (x,y) are all the points (the blue dots). k are the index of those points that form the convex hull. Put it into matlab and you'll find that x(k(1)), y(k(1)) is one point, x(k(2)), y(k(2)) is another point, and so on... – kitchenette Aug 09 '12 at 19:32