// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Mathematics module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_ANGLE_HPP #define NAZARA_ANGLE_HPP #include #include #include #include #include #include #include namespace Nz { struct SerializationContext; template class EulerAngles; template class Quaternion; template class Angle { public: Angle() = default; Angle(T angle); Angle(const Angle& angle); Angle(const Angle& angle); template explicit Angle(const Angle& Angle); ~Angle() = default; T GetCos() const; T GetSin() const; std::pair GetSinCos() const; T GetTan() const; Angle& MakeZero(); void Normalize(); Angle& Set(const Angle& ang); template Angle& Set(const Angle& ang); T ToDegrees() const; Angle ToDegreeAngle() const; EulerAngles ToEulerAngles() const; Quaternion ToQuaternion() const; T ToRadians() const; Angle ToRadianAngle() const; std::string ToString() const; Angle& operator=(const Angle&) = default; Angle operator+(const Angle& other) const; Angle operator-(const Angle& other) const; Angle operator*(T scalar) const; Angle operator/(T divider) const; Angle& operator+=(const Angle& other); Angle& operator-=(const Angle& other); Angle& operator*=(T scalar); Angle& operator/=(T divider); bool operator==(const Angle& other) const; bool operator!=(const Angle& other) const; static Angle FromDegrees(T ang); static Angle FromRadians(T ang); static 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_ANGLE_HPP