0
$\begingroup$

I'm aware of a Matlab function which take a set of point as an input and select the points which compose the convex hull.

Exemples from Mathworks website :

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*')

Now, my question is : does there exists a Matlab function or what could be the method to follow in order to compute the intersection of two convex sets defined by the set of points of their convex hull ?

$\endgroup$
  • $\begingroup$ I don't understand. Do you want the intersection of two sets, or the convex hull of two sets? $\endgroup$ – David Ketcheson Apr 16 '15 at 12:57
  • 1
    $\begingroup$ The intersection of the two sets. $\endgroup$ – Tanj Apr 16 '15 at 13:18
1
$\begingroup$

Let the $x$-coordinates for the points in the convex hull of the first convex region be stored in the array x1, and let the $y$-coordinates of those same points be stored in the array y1. Let the arrays x2 and y2 store analogous information for the second convex region.

If you have MATLAB's Mapping Toolbox, you can use the polybool function to return the coordinates of a polygonal approximation of the intersection of your two regions via [x, y] = polybool('intersection', x1, y1, x2, y2). I'm not familiar with the algorithm behind the function, so I can't comment on that.

$\endgroup$
0
$\begingroup$

There is a polygon_intersection script on the Matlab file exchange which will compute the intersection of one or more polygons. In your case the convex hulls of your two sets are the polygons you wish to intersect.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.