You can take a look at my old implementation of the Jarvis algorithm for convex hull. For description of Jarvis algorithm see e.g. http://en.wikipedia.org/wiki/Gift_wrapping_algorithm, it's probably the simplest and still quite good in many situations convex hull algorithm.