   Dot Product Problem
  Hi,I'm having some trouble getting my dot product function to work in opengl/c++.Here it is:float MyMaths::angleBetweenVectors(Point2D& u, Point2D& v){float uv = (u.x*v.x) + (u.y*v.y);float modu = sqrt((u.x*u.x) + (u.y*u.y));float modv = sqrt((v.x*v.x) + (v.y*v.y));float costheta = uv/(modu*modv);return acos(costheta);}In the main:float ang = MyMaths::angleBetweenVectors(pointA,pointB);ang = ang*(180.0/MyMaths::PI);cout << ang << endl;The function works perfectly whenever pointB lies on the x axis. Whenever it is placed above or below it however, the angle appears to be a few (maybe 10 or so?) degrees out, and I have no idea why?!Any help would be most appreciated!Thanks   
  Try to check that the vectors 'pointA' and 'pointB' have the correct data before passing them to angleBetweenVectors(). You could also post how the vectors pointA and pointB are being generated.   ;  Thanks for the reply :)Turns out my window width was slightly greater than its height, so any distortion wasn't noticeable with a horizontal line. As soon one end is higher or lower however, the distortion makes it look like a different angle!D'oh!   