I am stuck when designing a circular path algorithm that creates a path from points. This is the array I start with:
(1,1)
(1,6)
(2,2)
(2,5)
(4,1)
(4,2)
(6,5)
(6,6)
These are points in the coordinate system, and I want them to be ordered, so I only need horizontal or vertical lines between adjacent points. Therefore, the sorted array should look like this:
(1,1) (A,H)
(1,6) (A,B)
(6,6) (C,B)
(6,5) (C,D)
(2,5) (E,D)
(2,2) (E,F)
(4,2) (G,F)
(4,1) (G,H)
EDIT: These points are extracted from different edges. Each edge is defined by two points. There are no edges that overlap each other.
Edge: (1,1) -> (1,6)
Edge: (1,6) -> (6,6)
Edge: (6,6) -> (6,5)
Edge: (6,5) -> (2,5)
Edge: (2,5) -> (2,2)
Edge: (2,2) -> (4,2)
Edge: (4,2) -> (4,1)
Edge: (4,1) -> (1,1)
Thanks for the help!