// the perpendicular lies beyond the 1st endpoint. If pp > 1, then the\r
// perpendicular lies beyond the 2nd endpoint.\r
\r
- Vector lineSegment = v2 - v1;\r
+ Vector lineSegment = v1 - v2;\r
double magnitude = lineSegment.Magnitude();\r
- Vector pointSegment = p - v1;\r
+ Vector pointSegment = p - v2;\r
double t = lineSegment.Dot(pointSegment) / (magnitude * magnitude);\r
return t;\r
}\r
// (Not sure which is head or tail, or which hand the normal lies)\r
/*static*/ Vector Vector::Normal(Vector v1, Vector v2)\r
{\r
- Vector v = (v2 - v1).Unit();\r
+ Vector v = (v1 - v2).Unit();\r
return Vector(-v.y, v.x);\r
}\r
\r