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.
Uh, figured out why ComputePerpendicularDistance computes the wrong value: If the end coordinate of a segment is on the equator, there is a devide by zero, so the ratio is NaN and the source coordinate of the line segment is chosen as closest point. Now the unit-tests passes.