const double Utils::getAngleBetweenVectors(const Zeni::Vector3f &v0, const Zeni::Vector3f &v1) { const double a = v0.magnitude(); const double b = v1.magnitude(); const double c = (v1 - v0).magnitude(); double d = (a * a + b * b - c * c) / (2 * a * b); if (d > 1) { d = 1.0f; } else if (d < -1.0f) { d = -1.0f; } return double(acos(d)); }
const Zeni::Vector3f Utils::getVectorComponent(const Zeni::Vector3f &vector, const Zeni::Vector3f &direction) { return vector*direction/direction.magnitude() * direction.normalized(); }