X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvector.cpp;h=ac5a2058191e4f7e11d24218ba8085e93d7372d8;hb=4b37ccbdf263a4798e53a62e33d869a728ace283;hp=23bd783cf2fcce61dd3c6ab6627972ca7678813a;hpb=a42277d4d950d32459b16b3ec8ee8287c9c0afab;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); }