// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Math module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_MATH_ANGLE_HPP #define NAZARA_MATH_ANGLE_HPP #include #include #include #include #include #include #include namespace Nz { struct SerializationContext; template class EulerAngles; template class Quaternion; template class Angle { public: constexpr Angle() = default; constexpr Angle(T angle); template constexpr explicit Angle(const Angle& Angle); constexpr Angle(const Angle& angle); constexpr Angle(const Angle& angle); ~Angle() = default; T GetCos() const; T GetSin() const; std::pair GetSinCos() const; T GetTan() const; constexpr Angle& MakeZero(); constexpr Angle& Normalize(); constexpr Angle& Set(const Angle& ang); template constexpr Angle& Set(const Angle& ang); constexpr T ToDegrees() const; constexpr Angle ToDegreeAngle() const; EulerAngles ToEulerAngles() const; Quaternion ToQuaternion() const; constexpr T ToRadians() const; constexpr Angle ToRadianAngle() const; std::string ToString() const; constexpr Angle& operator=(const Angle&) = default; constexpr Angle operator+(const Angle& other) const; constexpr Angle operator-(const Angle& other) const; constexpr Angle operator*(T scalar) const; constexpr Angle operator/(T divider) const; constexpr Angle& operator+=(const Angle& other); constexpr Angle& operator-=(const Angle& other); constexpr Angle& operator*=(T scalar); constexpr Angle& operator/=(T divider); constexpr bool operator==(const Angle& other) const; constexpr bool operator!=(const Angle& other) const; static constexpr Angle FromDegrees(T ang); static constexpr Angle FromRadians(T ang); static constexpr Angle Zero(); T value; }; template using DegreeAngle = Angle; using DegreeAngled = DegreeAngle; using DegreeAnglef = DegreeAngle; template using RadianAngle = Angle; using RadianAngled = RadianAngle; using RadianAnglef = RadianAngle; template bool Serialize(SerializationContext& context, const Angle& angle, TypeTag>); template bool Unserialize(SerializationContext& context, Angle* angle, TypeTag>); } template Nz::Angle operator*(T scale, const Nz::Angle& angle); template Nz::Angle operator/(T divider, const Nz::Angle& angle); template std::ostream& operator<<(std::ostream& out, const Nz::Angle& angle); #include #endif // NAZARA_MATH_ANGLE_HPP