Added Point2d.withinDistance test and refactored to simplify test code