Add a new function angle::abs() which returns the absolute (positive) value of an...
[synfig.git] / ETL / trunk / ETL / _angle.h
index bd3231a..f1a9206 100644 (file)
@@ -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
@@ -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<value_type>(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