Labelling the Outer Points of a Pentagram
I'm trying to program an outer point labelling system for pentagrams and I'm having trouble with the logic.
I have 5 pairs of outer x & y coordinates
I have 5 pairs of inner x & y coordinates
I have decided that point "A" is the outer x & y coordinate pair that has an x value closest to the x value of the center of the inner pentagon. That's easy. The center just being the average of the 5 inner pairs.
I would like the outer points to be labelled clockwise, B, C, D & E.
What logic can I use to determine which point is which?
Any help is appreciated.
Re: Labelling the Outer Points of a Pentagram
If you want to create a clock-wise ordering of points then you need to calculate the convex hull and reverse the order obtained by that algorithm (which creates an ordered list of points that is counter-clockwise in order).
For your problem, you have a 2D version which is a lot simpler than three or higher dimensions.