X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=ETL%2Ftrunk%2FETL%2F_angle.h;h=eb7710b2137be280ea485d9acc8a0a8bc44950fd;hb=84a3dfe5cc1fafe126a639db7d233ac3a93883f1;hp=f1a92061228d13b15a32f570d68a915966583b33;hpb=5e17dc413c19054462e58826ac22a6a2ce96c95f;p=synfig.git diff --git a/ETL/trunk/ETL/_angle.h b/ETL/trunk/ETL/_angle.h index f1a9206..eb7710b 100644 --- a/ETL/trunk/ETL/_angle.h +++ b/ETL/trunk/ETL/_angle.h @@ -5,6 +5,7 @@ ** $Id$ ** ** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -40,6 +41,8 @@ # define HALF_PI (PI/2) #endif +#define ANGLE_EPSILON (1.0e-6) + /* === T Y P E D E F S ===================================================== */ /* === C L A S S E S & S T R U C T S ======================================= */ @@ -127,6 +130,7 @@ public: return ret.mod(); } +#ifdef ETL_WRAP_ANGLES /*! Returns true if the shortest angle from the left-hand to the right-hand side is counter-clockwise */ @@ -164,14 +168,55 @@ public: on the unit circle. */ bool operator==(const angle &rhs)const - { return std::abs(dist(rhs).v)epsilon; } + { 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; } +#endif // ETL_WRAP_ANGLES //! Absolute Angle Function /*! This function will return the @@ -236,15 +281,13 @@ public: return ret; } - bool operator!()const { return std::abs(mod().v) < epsilon; } + bool operator!()const { return std::abs(mod().v) < ANGLE_EPSILON; } private: static value_type rot_floor(value_type x) { return static_cast(std::floor(x/(PI*2))*PI*2); } - static const value_type epsilon = 1.0e-6; - public: /* ** Conversion Classes