12345678910111213141516171819202122 |
- //
- // Created by jovian on 31/07/17.
- //
- #include "b2Angle.h"
- float b2Angle(const b2Vec2 &u, const b2Vec2 &v) {
- float rep(std::acos(b2Dot(u, v)));
- if ( b2Cross(u, v) > 0.0f )
- rep *= -1.0f;
- return rep;
- }
- float b2Angle(const b2Vec2 &u) {
- return b2Angle(u, b2Vec2(1.0f, 0.0f));
- }
- b2Vec2 b2Dir(const float angle) {
- return b2Vec2((float) cos(angle), (float) sin(angle));
- }
|