Choosing points from a set that produce the largest polygon

Click For Summary
SUMMARY

This discussion focuses on selecting points from a 2D plane to maximize the area of the polygon they define. The proposed method involves computing the average X,Y coordinates of all points and identifying those furthest from the center in eight directions. The strategy includes forming triangles with the selected points and eliminating any points within these triangles. Additionally, the conversation highlights the importance of using a convex hull algorithm for ensuring the selected points form a convex shape, as well as employing cross product techniques to manage concave polygons.

PREREQUISITES
  • Understanding of 2D geometry and polygon properties
  • Familiarity with convex hull algorithms
  • Knowledge of cross product calculations in vector mathematics
  • Experience with computational geometry techniques
NEXT STEPS
  • Research the QuickHull algorithm for efficient convex hull computation
  • Study the Graham scan algorithm for polygon area maximization
  • Learn about the properties of convex and concave polygons
  • Explore optimization techniques in computational geometry
USEFUL FOR

This discussion is beneficial for computer scientists, mathematicians, and software developers working on geometric algorithms, particularly those focused on polygon area optimization and computational geometry applications.

Jeff.Nevington
Messages
12
Reaction score
1
I am trying to find the most efficient way to select points on a 2d plane from a set that maximizes the area of the of the shape they define when joined together.

The points are all paired (sharing the same A->B vector), with these pairs also appearing mirrored about the origin. Here is an example:

https://i.imgur.com/MNARxPI.png

Sometimes a single point is used from the pair, and sometimes both.

For any given problem I can easily draw the solution by hand, but I am struggling to clearly define a sensible solution. I can loop through and for each point, check adjacent points, using the solution for which no other point in the subset is further from the origin than the joining line, but it seems messy. I feel like there should be a more elegant solution.

Does anyone have any ideas?
 
Physics news on Phys.org
It's not so much finding a way to do it - but finding a relatively efficient way.
I would start by computing the average X,Y of all points, and then identifying the ones that are furthest from that center in each of 8 directions. I pick 8 directions because it is easy to sort them that way based on X>0, Y>0, and |X|>|Y|.
Then I would form large triangles with that initial group of points and eliminate any other point that fell within the triangle. Determining whether a point is inside a triangle (or any polygon) can be done by determining which side of each line of the triangle the point is on, if it is on the inside side of each line, it is inside the triangle and can be eliminated.

Ultimately, this test can be applied to all triangles and all points - all groups of 4 of the remaining points.

From there, it is just a matter of finding optimizations.
 
Actually, any point that is furthest in any direction must be part of the border.
So start by finding the points with max and min X, max and min Y, max and min (X+Y)/2, and max and min (X-Y)/2.
Then eliminate all point that are within the resulting polygon.
Finally, do the "ultimate test" that I described above - except you do not have to test those original point, since they are definitely to be included.
 
It's unclear whether there are additional constraints to your data.
Specifically:
When you draw a vector from one point in a pair to the other, is that vector of the same size and direction as all other vectors in the set?
If you take the midpoint of each pair, are they always the vertices of a convex polygon? With the points following clockwise or counter clockwise along that polygon?

If the answer to all three is yes, then rotate your figure so that the pair direction is along the X direction. Then, as you follow the pairs clockwise:
* for each segment that is decending (-Y direction), use the high X member of the pair;
* for each segment that is ascending (+Y direction), use the low X member of the pair.
Two pairs will have end up using both points. Those will be the ones where the trailing segment heads in a different Y direction than the leading segment.
 
Hi Scott! Thanks for these ideas. I really like the last one, though unfortunately the centers do not necessarily form a convex polygon. However, on reconsidering the problem I am dealing with, I would not be interested in points that contributed to a non-convex shape, so I think all I might need is to choose an existing convex hull algorithm.
 
Jeff.Nevington said:
Hi Scott! Thanks for these ideas. I really like the last one, though unfortunately the centers do not necessarily form a convex polygon. However, on reconsidering the problem I am dealing with, I would not be interested in points that contributed to a non-convex shape, so I think all I might need is to choose an existing convex hull algorithm.
If you have a concave polygon, or one that may be concave, just follow it around taking the cross product of each adjacent pair of sides. Depending on the direction of travel (clockwise or CCW), you will be looking for only positive or negative cross products. If you find one that doesn't belong, the point between them should be dropped.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 82 ·
3
Replies
82
Views
8K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 19 ·
Replies
19
Views
4K