Refactored the EdgeBasedNode class.

The ComputePerpendicularDistance method of the EdgeBaseNode class exhibits some numerical problems that can occur during the computation of the perpendicular foot point. This patch remedies those problems. Also, the method's implementation has been refactored and now uses several smaller, single-purpose methods. I have also added comments.