简体   繁体   中英

Find all polygons in points using MATLAB

I have a set of points in the plane and I want to find all convex polygons without including a point inside them.

For example I want to find all triangles, all four sized polygons, all four five sized polygons and so on until is possible to find them without including a point inside them.

In the image, row a corresponds to convex polygons of size 3. While column 1 and 2 show correct examples of what I want, column 3 shows a triangle including two points inside of it, which I dont want.

Rows b and c show examples of polygons of size 4 and 5.

b3 shows an example of a non convex polygon

在此处输入图片说明

I wonder if there is a function in MATLAB or any other language or if someone knows about an algorithm that can do it.

The algorithm could receive, beside the points, the size of the polygons to search, it would return all possibly correct polygons or empty if does not contain any polygon of that size.

I appreciate the help.

Step 1: Perform a Delaunay-Triangulation of the points.

Step 2:

  • For polygons of size 3: resulting triangles are the result.
  • For polygons of size 4: pick any pair of triangles that share two corners
  • For polygons of size 5: pick any polygon of size 4 and pair it with a triangle that shares exactly two corners

You can try the naive solution if it is feasible :-

  1. select k points for k sided polygon
  2. apply convex hull alogrithm on it
  3. if convex hull size equal k then the set of points form desired k sided polygon.

Time Complexity:- O(2^N*N*logN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM