math:: source review

This commit is contained in:
James Turk 2005-07-18 05:58:03 +00:00
parent ba332196d2
commit 39669bc6c6
5 changed files with 15 additions and 37 deletions

View File

@ -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.
//

View File

@ -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<typename T, typename C>
T clamp(T val, C low, C high)
{
if(val < low)
{
return low;
}
else if(val > high)
{
return high;
}
else
{
return val;
}
}
}

View File

@ -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_;

View File

@ -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)

View File

@ -5,12 +5,10 @@
// 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
@ -18,6 +16,7 @@ namespace math
bool scalarCompare(scalar val1, scalar val2, scalar epsilon)
{
// |diff| < epsilon means values are equal
return std::fabs(val1-val2) < epsilon;
}