X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_angle.h;h=f1a92061228d13b15a32f570d68a915966583b33;hb=5e17dc413c19054462e58826ac22a6a2ce96c95f;hp=67989cae60c6ae9e0f57e5009ab0c405e6cbe559;hpb=8ceee9e55e8fb6a4d32d81f7ff9f46f4d86a1209;p=synfig.git diff --git a/ETL/trunk/ETL/_angle.h b/ETL/trunk/ETL/_angle.h index 67989ca..f1a9206 100644 --- a/ETL/trunk/ETL/_angle.h +++ b/ETL/trunk/ETL/_angle.h @@ -173,6 +173,17 @@ public: operator!=(const angle &rhs)const { return std::abs(dist(rhs).v)>epsilon; } + //! Absolute Angle Function + /*! This function will return the + absolute value of the angle. */ + angle + abs()const + { + angle ret; + ret.v=std::abs(v); + return ret; + } + //! Angle Difference Function /*! This function will return the shortest physical distance between @@ -225,7 +236,7 @@ public: return ret; } - bool operator!()const { return v==0; } + bool operator!()const { return std::abs(mod().v) < epsilon; } private: @@ -286,12 +297,12 @@ public: rad(const angle &a):angle(a) { } rad mod()const { return angle::mod(); } rad dist(const angle &rhs)const { return angle::dist(rhs); } + value_type get()const { return v; } #ifndef ETL_NO_DEPRECATED - operator value_type()const ETL_DEPRECATED_FUNCTION; + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif - value_type get()const { return v; } }; // END of class angle::radians -inline angle::rad::operator angle::value_type()const { return get(); } +// inline angle::rad::operator angle::value_type()const { return get(); } // ======================================================================== /*! \class angle::deg _angle.h ETL/angle @@ -308,10 +319,10 @@ public: deg dist(const angle &rhs)const { return angle::dist(rhs); } value_type get()const { return v*360/(PI*2); } #ifndef ETL_NO_DEPRECATED - operator value_type()const ETL_DEPRECATED_FUNCTION; + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif }; // END of class angle::degrees -inline angle::deg::operator angle::value_type()const { return get(); } +// inline angle::deg::operator angle::value_type()const { return get(); } // ======================================================================== /*! \class angle::rot _angle.h ETL/angle @@ -328,10 +339,10 @@ public: rot dist(const angle &rhs)const { return angle::dist(rhs); } value_type get()const { return v/(PI*2); } #ifndef ETL_NO_DEPRECATED - operator value_type()const ETL_DEPRECATED_FUNCTION; + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif }; // END of class angle::rotations -inline angle::rot::operator angle::value_type()const { return get(); } +// inline angle::rot::operator angle::value_type()const { return get(); } // ======================================================================== /*! \class angle::sin _angle.h ETL/angle @@ -348,10 +359,10 @@ public: sin dist(const angle &rhs)const { return angle::dist(rhs); } value_type get()const { return static_cast(std::sin(v)); } #ifndef ETL_NO_DEPRECATED - operator value_type()const ETL_DEPRECATED_FUNCTION; + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif }; // END of class angle::sin -inline angle::sin::operator angle::value_type()const { return get(); } +// inline angle::sin::operator angle::value_type()const { return get(); } // ======================================================================== /*! \class angle::cos _angle.h ETL/angle @@ -366,12 +377,12 @@ public: cos(const angle &a):angle(a) { } cos mod()const { return angle::mod(); } cos dist(const angle &rhs)const { return angle::dist(rhs); } - operator value_type()const ETL_DEPRECATED_FUNCTION; -#ifndef ETL_NO_DEPRECATED value_type get()const { return (value_type)std::cos(v); } +#ifndef ETL_NO_DEPRECATED + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif }; // END of class angle::cos -inline angle::cos::operator angle::value_type()const { return get(); } +// inline angle::cos::operator angle::value_type()const { return get(); } // ======================================================================== /*! \class angle::tan _angle.h ETL/angle @@ -387,12 +398,12 @@ public: tan(const angle &a):angle(a) { } tan mod()const { return angle::mod(); } tan dist(const angle &rhs)const { return angle::dist(rhs); } + value_type get()const { return (value_type)std::tan(v); } #ifndef ETL_NO_DEPRECATED - operator value_type()const ETL_DEPRECATED_FUNCTION; + // operator value_type()const ETL_DEPRECATED_FUNCTION; #endif - value_type get()const { return (value_type)std::tan(v); } }; // END of class angle::tan -inline angle::tan::operator angle::value_type()const { return get(); } +// inline angle::tan::operator angle::value_type()const { return get(); } _ETL_END_NAMESPACE