#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2015 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_GEOMETRY_ANGLE_H #define NUCLEX_GEOMETRY_ANGLE_H #include "Nuclex/Geometry/Config.h" #include "Nuclex/Geometry/Math.h" #include namespace Nuclex { namespace Geometry { // ------------------------------------------------------------------------------------------- // /// Definition for standard radiant angles (PI units per half-turn) template struct RadiantAngleDefinition { /// Units required to do one full turn public: static const TScalar OneTurn = Math::Perigon(); /// Units required to do half a turn public: static const TScalar HalfTurn = Math::PI(); }; // ------------------------------------------------------------------------------------------- // /// Definition for the classical 360 degree system template struct DegreeAngleDefinition { /// Units required to do one full turn public: static const TScalar OneTurn = 360; /// Units required to do half a turn public: static const TScalar HalfTurn = 180; }; // ------------------------------------------------------------------------------------------- // /// Definition for the clock angle degree system favored by pilots template struct ClockAngleDefinition { /// Units required to do one full turn public: static const TScalar OneTurn = 12; /// Units required to do half a turn public: static const TScalar HalfTurn = 6; }; // ------------------------------------------------------------------------------------------- // /// Stores an angle using a customizable unit /// Scalar type used to store the angle units /// /// Definition of the units used to represent angles /// template> struct Angle { /// Angle units in one full turn public: static const TScalar OneTurn = TAngleDefinition::OneTurn; /// Initializes an angle with the given direction public: Angle(TScalar value) : value(value) {} /// Converts an angle from another public: template Angle(Angle otherAngle) {} /// Accesses the amount of units storing the angle's direction public: operator TScalar() { return this->value; } /// Units storing the angle's direction private: TScalar value; //public: template //static operator AngleAn angle using radiant as the unit (2*PI is one full turn) template using Radiant = Angle>; /// An angle using classical degrees (360 degrees are one full turn) template using Degrees = Angle>; /// An angle specified in clocks (= hours) for rough directions template using Clocks = Angle>; // ------------------------------------------------------------------------------------------- // }} // namespace Nuclex::Geometry #endif // NUCLEX_GEOMETRY_ANGLE_H