12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef CORE_QUATERNION_HPP
- #define CORE_QUATERNION_HPP
- #include "math/Vector.hpp"
- #include "utils/ArrayString.hpp"
- 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;
- template<typename String>
- check_return Error toString(String& s) const {
- CORE_RETURN_ERROR(s.append("("));
- CORE_RETURN_ERROR(s.append(xyz[0]));
- CORE_RETURN_ERROR(s.append(" i + "));
- CORE_RETURN_ERROR(s.append(xyz[1]));
- CORE_RETURN_ERROR(s.append(" j + "));
- CORE_RETURN_ERROR(s.append(xyz[2]));
- CORE_RETURN_ERROR(s.append(" k + "));
- CORE_RETURN_ERROR(s.append(w));
- CORE_RETURN_ERROR(s.append(')'));
- return Error::NONE;
- }
- };
- }
- #endif
|