Comment #7 on issue 140 by
andrew.g...@gmail.com: Many time addr:street
The normalLength part of the two matches, so it's the difference between::
abs((P.x - A.x) * (B.y - A.y) - (P.y - A.y) * (B.x - A.x))
and the Vespucci code (using Wikipedia names):
abs((B.x - A.x) * (A.Y - P.y) - (A.x - P.x) * (B.y - A.y))
I'll transform the Vespucci code one step at a time:
1. Swap the two sides of the middle subtraction to get (B.y-A.y) and
(B.x-A.x) on the same side as Wikipedia:
abs(-(A.x - P.x) * (B.y - A.y) + (B.x - A.x) * (A.y - P.y))
2. Swap the two sides of the two (A-P) operations:
abs(-(-(P.x - A.x)) * (B.y - A.y) + (B.x - A.x) * -(P.y - A.y))
3. The two minus signs at the left cancel each other out, and the two parts
of the right multiplication can switch places:
abs((P.x - A.x) * (B.y - A.y) - (P.y - A.y) * (B.x - A.x))
4. Which is the same as the Wikipedia equation!