#pragma once #include #include namespace LinearAlgebra { // Essential Reading: // http://www.essentialmath.com/GDC2012/GDC2012_JMV_Rotations.pdf class EulerAngle { public: EulerAngle(); EulerAngle(float pitch, float yaw, float roll); EulerAngle(const Vector3& vec) : pitch(vec.x), yaw(vec.y), roll(vec.z) {} AxisAngle ToAxisAngle() const; explicit EulerAngle(const Quaternion& orientation); explicit EulerAngle(const AxisAngle& orientation); /// TODO: Implement separate upper and lower bounds /// Preserves internal value of euler angles, normalizes and clamps the output. /// This does not solve gimbal lock!!! float GetPitch(float pitch_limit) const; float GetYaw(float yaw_limit) const; float GetRoll(float roll_limit) const; bool operator==(const EulerAngle& a) const; void clamp(); // TODO: Euler Angles do not represent a vector, length doesn't apply, nor is this information meaningful for this data type. // If you need a meaningful representation of length in 3d space, use a vector!! [[nodiscard]] float length() const { return 0; } // TODO: Implement Vector3 unitVector() const; EulerAngle movementAngle() const; public: float pitch; float yaw; float roll; }; }