12345678910111213141516171819202122232425262728293031 |
- #ifndef CORE_QUATERNION_H
- #define CORE_QUATERNION_H
- #include "math/Vector.h"
- #include "utils/ArrayString.h"
- namespace Core {
- class Quaternion final {
- 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;
- // returns true on error and calls the error callback
- template<int L>
- check_return bool toString(ArrayString<L>& s) const {
- return s.append("(") || s.append(xyz[0]) || s.append(" i + ") ||
- s.append(xyz[1]) || s.append(" j + ") || s.append(xyz[2]) ||
- s.append(" k + ") || s.append(w) || s.append(')');
- }
- };
- }
- #endif
|