Hi guys,
How to link four points to a convex polygon? I mean how to identify the order of these four points.
Thanks.
Zhong
Hi guys,
How to link four points to a convex polygon? I mean how to identify the order of these four points.
Thanks.
Zhong
Take the center point (i.e. average of x and y coords), then calculate x/y values for y<centery
, then for y>=centery
. would be fastest I guess.
(that is, if I understood the question in the first place...)
Sort them vertically, connect 2 top most to each other and two lowest to each other.
Sort horizontally and then connect 2 leftmost to each other and two rightmost to each other.
EDIT: anyways, SO's cool related section on the right suggests an answered duplicate: http://stackoverflow.com/questions/242404/sort-four-points-in-clockwise-order