b2Angle.cpp 321 B

1234567891011121314151617181920
  1. //
  2. // Created by jovian on 31/07/17.
  3. //
  4. #include "b2Angle.h"
  5. float b2Angle(b2Vec2 u, b2Vec2 v) {
  6. u.Normalize();
  7. v.Normalize();
  8. float rep(std::acos(b2Dot(u, v)));
  9. if ( b2Cross(u, v) > 0.0f )
  10. rep *= -1.0f;
  11. return rep;
  12. }
  13. float b2Angle(b2Vec2 u) {
  14. return b2Angle(u, b2Vec2(1.0f, 0.0f));
  15. }