Corner points of a quadrilateral from a set of grid points

578 views Asked by At

I am given a set of grid points (defined by their x and y coordinates) that make up an arbitrary quadrilateral. I want to be able to find which of these points are the corner points. I have been looking at minimum bounding problems, however in my case, 4 of the points already in this set of grid points are the corner points. An example of the points I would have are shown in blue below, however there are cases where it's not as simple as just picking the point most to the left, right, top or bottom, and this is where I get stuck. For example, if I decreased the y-coordinate of the point farthest on the right to be less than the y-coordinate of the point currently on the bottom, you would not be able to classify the current bottom point. I am not sure how to approach this and any help would be greatly appreciated.

EDIT: There is no restriction on the quadrilateral to be a parallelogram, concave, convex and can contain diagonals of angles other than 45º.

The matrix is ​​filled and in case there is any possibility of more than one solution, it should return any one of them.

enter image description here

1

There are 1 answers

0
Jonathan Dauwe On

If I well understand want you want to do, it is unfeasible. In the following example, you have the set of grid points [(0,0), (2,1), (2,2), (3,1), (4,1)] but you have at least 2 quadrilaterals that could be generated from this set: ABCD and ABCE.

enter image description here