// Copyright (C) 2017 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 namespace Nz { struct SerializationContext; template class EulerAngles; template class Quaternion; template class Angle { public: Angle() = default; Angle(T value); template> explicit Angle(const Angle& value) { Set(value); } template> explicit Angle(const Angle& value) { Set(value); } template explicit Angle(const Angle& Angle); Angle(const Angle&) = default; ~Angle() = default; T GetCos() const; T GetSin() const; std::pair GetSinCos() const; T GetTan() const; Angle& MakeZero(); void Normalize(); template> Angle& Set(const Angle& Angle); template> Angle& Set(const Angle& Angle); Angle& Set(const Angle& Angle); template Angle& Set(const Angle& Angle); Angle ToDegrees() const; EulerAngles ToEulerAngles() const; Quaternion ToQuaternion() const; Angle ToRadians() const; 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 Zero(); T angle; }; 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