|
Re: Quadrilateral of Best Fit
One of the things you might attempt is to visit the vertices and connect lines that almost touch and are almost the same slope. This will eliminate collinear line segments.
Years ago I implemented some decimation routines for a pen plotter. The algorithm involved looking at a progression of points and determining if they were within an error cone that extended from the first point. The purpose was to only transmit the points needed to draw the shape and leave out the points that barely wiggled the pen or were just segments of a straight line.
To find a corner, a similar routine could identify points roughly shared between two segments where the angle is between say 60 and 120 degrees.
Finally, while this will help to eliminate collinear points, you will then want to determine if it is a quadrilateral. Sounds like a fun challenge.
Greg McKaskle
|