convhull
Computes the 2D convex hull.
Syntax
h = convhull(x,y)
h = convhull(x,y,options)
[h,a] = convhull(...)
Inputs
- x
 - The x coordinates.
 - y
 - The y coordinates.
 - options
 - The Qhull options. A string with options separated by spaces, or a cell of strings. Omit or use [] for the default. For no options, use an empty string.
 
Outputs
- h
 - The indices of the convex hull vertices.
 - a
 - The area of the convex hull.
 
Example
ang = [1:1:60] * (2*pi/60);
x = 8 .* (1 + 0.1*cos(8*ang)) .* cos(ang);
y = 6 .* (1 + 0.1*cos(8*ang)) .* sin(ang);
h = convhull(x, y);
plot(x,y);
hold on;
plot(x(h),y(h));
legend('shape', 'hull');
      
Figure 1. convhull figure 1
Comments
convhulln uses the Qhull package. For details, see:
http://www.qhull.org/html/qh-quick.htm http://www.qhull.org/html/qh-optq.htmUsing options overwrites the default, so the default must be repeated if it is to be included.