Add unit tests using boost test

Added UnitTests for a few classes, as well as fixing some minor bugs and cleaning up a little bit in the process.
I don't understand your comment here. The fix was that the minimum distance to a rectangle is precisely not the minimum distance to the edge points. (Imagine a point in the middle of an edge of the rectangle, move the point just outside the rectangle.)