123456789101112131415161718192021222324252627282930 |
- #ifndef QUATERNION_H
- #define QUATERNION_H
- #include "math/Vector.h"
- #include "utils/StringBuffer.h"
- class Quaternion {
- Vector3 xyz;
- float w;
- public:
- Quaternion();
- Quaternion(const Vector3& axis, float angle);
- Quaternion lerp(float f, const Quaternion& other) const;
- Quaternion& operator*=(const Quaternion& other);
- Quaternion operator*(const Quaternion& other) const;
- Vector3 operator*(const Vector3& v) const;
- template<int L>
- void toString(StringBuffer<L>& s) const {
- s.append("(");
- s.append(xyz[0]).append(" i + ");
- s.append(xyz[1]).append(" j + ");
- s.append(xyz[2]).append(" k + ");
- s.append(w).append(')');
- }
- };
- #endif
|