changed distance_to formula to use http://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Line_defined_by_two_points