// Copyright (C) 2024 Jérôme "SirLynix" 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 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); template constexpr Angle(const Angle& angle); constexpr Angle(const Angle&) = default; constexpr Angle(Angle&&) noexcept = default; ~Angle() = default; constexpr bool ApproxEqual(const Angle& angle) const; constexpr bool ApproxEqual(const Angle& angle, T maxDifference) const; T GetCos() const; T GetSin() const; std::pair GetSinCos() const; T GetTan() const; constexpr Angle& Normalize(); template T To() const; template Angle ToAngle() const; 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 T ToTurns() const; constexpr Angle ToTurnAngle() const; constexpr Angle& operator=(const Angle&) = default; constexpr Angle& operator=(Angle&&) noexcept = default; constexpr Angle operator+() const; constexpr Angle operator-() const; constexpr Angle operator+(Angle other) const; constexpr Angle operator-(Angle other) const; constexpr Angle operator*(T scalar) const; constexpr Angle operator/(T divider) const; constexpr Angle& operator+=(Angle other); constexpr Angle& operator-=(Angle other); constexpr Angle& operator*=(T scalar); constexpr Angle& operator/=(T divider); constexpr bool operator==(Angle other) const; constexpr bool operator!=(Angle other) const; constexpr bool operator<(Angle other) const; constexpr bool operator<=(Angle other) const; constexpr bool operator>(Angle other) const; constexpr bool operator>=(Angle other) const; static constexpr bool ApproxEqual(const Angle& lhs, const Angle& rhs); static constexpr bool ApproxEqual(const Angle& lhs, const Angle& rhs, T maxDifference); static constexpr Angle Clamp(Angle angle, Angle min, Angle max); template static constexpr Angle From(T value); static constexpr Angle FromDegrees(T degrees); static constexpr Angle FromRadians(T radians); static constexpr Angle FromTurns(T turn); 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 using TurnAngle = Angle; using TurnAngled = TurnAngle; using TurnAnglef = TurnAngle; template Angle operator*(T scale, Angle angle); template Angle operator/(T divider, Angle angle); template std::ostream& operator<<(std::ostream& out, Angle angle); template bool Serialize(SerializationContext& context, Angle angle, TypeTag>); template bool Unserialize(SerializationContext& context, Angle* angle, TypeTag>); } #include #endif // NAZARA_MATH_ANGLE_HPP