X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fvector.cpp;h=ac5a2058191e4f7e11d24218ba8085e93d7372d8;hb=67fbc130b4b6b4d253f69a9c32980d3d3306def5;hp=23bd783cf2fcce61dd3c6ab6627972ca7678813a;hpb=70297ac8ec7453e4196f4b58056bcfe4b04f2aca;p=architektonas diff --git a/src/vector.cpp b/src/vector.cpp index 23bd783..ac5a205 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -244,9 +244,9 @@ double Vector::Parameter(Vector v1, Vector v2, Vector p) // the perpendicular lies beyond the 1st endpoint. If pp > 1, then the // perpendicular lies beyond the 2nd endpoint. - Vector lineSegment = v2 - v1; + Vector lineSegment = v1 - v2; double magnitude = lineSegment.Magnitude(); - Vector pointSegment = p - v1; + Vector pointSegment = p - v2; double t = lineSegment.Dot(pointSegment) / (magnitude * magnitude); return t; } @@ -256,7 +256,7 @@ double Vector::Parameter(Vector v1, Vector v2, Vector p) // (Not sure which is head or tail, or which hand the normal lies) /*static*/ Vector Vector::Normal(Vector v1, Vector v2) { - Vector v = (v2 - v1).Unit(); + Vector v = (v1 - v2).Unit(); return Vector(-v.y, v.x); }