I have a gray scale image of 64x64. I found the dots of the contour by a simple algorithm: 

* find brightest spot (Example: 100)
* divide by 2 (100/2 = 50)
* define a band around the result (50-5=45 to 50+5=55)
* mark all dots that have value in the band (between 45 to 55)

The question now is, how do I decide of the order of connecting the dots?

(All references will be accepted, links, thoughts, etc')