Release of synfigstudio 0.61.09 version. *****
[synfig.git] / ETL / tags / stable / ETL / _angle.h
index 78e91ba..c15f90d 100644 (file)
@@ -118,6 +118,7 @@ public:
                return ret;
        }
 
+#ifdef ETL_NOT_USED
        //! 180 degree rotation operator
        /*! Returns the angle directly opposite of
                the given angle, and will yield a result
@@ -129,7 +130,9 @@ public:
                ret.v = v+PI;
                return ret.mod();
        }
+#endif // ETL_NOT_USED
 
+#ifdef ETL_WRAP_ANGLES
        /*! Returns true if the shortest
                angle from the left-hand to the
                right-hand side is counter-clockwise */
@@ -175,6 +178,47 @@ public:
        bool
        operator!=(const angle &rhs)const
        { return std::abs(dist(rhs).v)>ANGLE_EPSILON; }
+#else // ETL_WRAP_ANGLES
+       /*! Returns true if the left-hand
+               side is less than the
+               right-hand side */
+       bool
+       operator<(const angle &rhs)const
+       { return v < rhs.v; }
+
+       /*! Returns true if the left-hand
+               side is greater than the
+               right-hand side */
+       bool
+       operator>(const angle &rhs)const
+       { return v > rhs.v; }
+
+       /*! Returns true if the left-hand
+               side is less or equal to the
+               right-hand side */
+       bool
+       operator<=(const angle &rhs)const
+       { return v <= rhs.v; }
+
+       /*! Returns true if the left-hand
+               side is greater than or equal
+               to the right-hand side */
+       bool
+       operator>=(const angle &rhs)const
+       { return v >= rhs.v; }
+
+       /*! Returns true if the angles
+               are the same, or close */
+       bool
+       operator==(const angle &rhs)const
+       { return std::abs(v - rhs.v)<ANGLE_EPSILON; }
+
+       /*! Returns false if the angles
+               are different */
+       bool
+       operator!=(const angle &rhs)const
+               { return std::abs(v - rhs.v)>ANGLE_EPSILON; }
+#endif // ETL_WRAP_ANGLES
 
        //! Absolute Angle Function
        /*! This function will return the
@@ -187,6 +231,7 @@ public:
                return ret;
        }
 
+#ifdef ETL_WRAP_ANGLES
        //! Angle Difference Function
        /*! This function will return the
                shortest physical distance between
@@ -211,6 +256,26 @@ public:
                ret.v-=rot_floor(ret.v);
                return ret;
        }
+#else // ETL_WRAP_ANGLES
+       //! Angle Difference Function
+       /*! This function will return the
+               difference between
+               two angles, just like
+               \sa angle operator-(const angle &) */
+       angle
+       dist(const angle &rhs)const
+       { return angle(*this)-=rhs; }
+
+       //! Rotation Modulus
+       /*! This function will return the
+               value of the angle */
+       angle
+       mod()const
+       {
+               angle ret(*this);
+               return ret;
+       }
+#endif // ETL_WRAP_ANGLES
 
        //! Zero Rotation (0 degrees)
        static angle
@@ -243,8 +308,10 @@ public:
 
 private:
 
+#ifdef ETL_WRAP_ANGLES
        static value_type rot_floor(value_type x)
        { return static_cast<value_type>(std::floor(x/(PI*2))*PI*2); }
+#endif // ETL_WRAP_ANGLES
 
 public:
        /*