diff --git a/include/math/Circle.hpp b/include/math/Circle.hpp index b84a1ef..01d3363 100644 --- a/include/math/Circle.hpp +++ b/include/math/Circle.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Circle.hpp,v 1.2 2005/03/03 09:25:19 cozman Exp $ +// $Id: Circle.hpp,v 1.3 2005/07/18 05:58:03 cozman Exp $ #ifndef PHOTON_MATH_CIRCLE_HPP #define PHOTON_MATH_CIRCLE_HPP @@ -122,20 +122,6 @@ public: // Center point. Point2 getCenter() const; - // Function: getCenterX - // Get center x coordinate. - // - // Returns: - // Center x coordinate. - scalar getCenterX() const; - - // Function: getCenterY - // Get center y coordinate. - // - // Returns: - // Center y coordinate. - scalar getCenterY() const; - // Function: getRadius // Get radius of Circle. // diff --git a/include/math/math.hpp b/include/math/math.hpp index 95fed8a..52f709e 100644 --- a/include/math/math.hpp +++ b/include/math/math.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: math.hpp,v 1.5 2005/07/06 04:27:23 cozman Exp $ +// $Id: math.hpp,v 1.6 2005/07/18 05:58:03 cozman Exp $ #ifndef PHOTON_MATH_MATH_HPP #define PHOTON_MATH_MATH_HPP @@ -19,8 +19,6 @@ namespace photon namespace math { -class Vector2; - // Title: Math Utilities // Group: Constants @@ -53,7 +51,7 @@ T clamp(T val, C low, C high); // epsilon - Epsilon value, defaults to 0.0001. // // Returns: -// true if |val1-val2| < epsilon +// true if |val1-val2| < epsilon, meaning values are approximately equal bool scalarCompare(scalar val1, scalar val2, scalar epsilon=0.000001); // Group: Degrees/Radians @@ -90,11 +88,17 @@ template T clamp(T val, C low, C high) { if(val < low) + { return low; + } else if(val > high) + { return high; - else + } + else + { return val; + } } } diff --git a/src/math/Circle.cpp b/src/math/Circle.cpp index c6c9070..fdaa640 100644 --- a/src/math/Circle.cpp +++ b/src/math/Circle.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Circle.cpp,v 1.3 2005/07/06 04:27:23 cozman Exp $ +// $Id: Circle.cpp,v 1.4 2005/07/18 05:58:03 cozman Exp $ #include "math/Circle.hpp" @@ -124,16 +124,6 @@ Point2 Circle::getCenter() const return center_; } -scalar Circle::getCenterX() const -{ - return center_.x; -} - -scalar Circle::getCenterY() const -{ - return center_.y; -} - scalar Circle::getRadius() const { return radius_; diff --git a/src/math/Rect.cpp b/src/math/Rect.cpp index 499ee46..e318fcd 100644 --- a/src/math/Rect.cpp +++ b/src/math/Rect.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Rect.cpp,v 1.3 2005/07/06 13:28:35 cozman Exp $ +// $Id: Rect.cpp,v 1.4 2005/07/18 05:58:03 cozman Exp $ #include "math/Rect.hpp" @@ -46,7 +46,6 @@ void Rect::moveTo(const Point2 &topleft) { bottomRight_ += (topleft-topLeft_); topLeft_ = topleft; - } void Rect::moveRel(scalar xMove, scalar yMove) diff --git a/src/math/math.cpp b/src/math/math.cpp index 2aaae18..92de635 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -5,19 +5,18 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: math.cpp,v 1.3 2005/07/06 04:27:23 cozman Exp $ +// $Id: math.cpp,v 1.4 2005/07/18 05:58:03 cozman Exp $ #include "math/math.hpp" -#include "math/Vector2.hpp" - namespace photon { namespace math { - + bool scalarCompare(scalar val1, scalar val2, scalar epsilon) { + // |diff| < epsilon means values are equal return std::fabs(val1-val2) < epsilon; }