88 o <<
"Radian(" << v.valueRadians() <<
")";
136 inline _OgreExport friend std::ostream&
operator <<
139 o <<
"Degree(" << v.valueDegrees() <<
")";
213 virtual Real getRandomUnit() = 0;
233 void buildTrigTables();
243 Math(
unsigned int trigTableSize = 4096);
249 static inline int IAbs (
int iValue) {
return ( iValue >= 0 ? iValue : -iValue ); }
250 static inline int ICeil (
float fValue) {
return int(ceil(fValue)); }
251 static inline int IFloor (
float fValue) {
return int(floor(fValue)); }
252 static int ISign (
int iValue);
330 return (!useTables) ?
Real(cos(fValue)) : SinTable(fValue + HALF_PI);
365 static inline float saturate(
float t) {
return (t < 0) ? 0 : ((t > 1) ? 1 : t); }
366 static inline double saturate(
double t) {
return (t < 0) ? 0 : ((t > 1) ? 1 : t); }
371 template<
typename V,
typename T>
static V
lerp(
const V& v0,
const V& v1,
const T& t) {
372 return v0 * (1 - t) + v1 * t; }
392 return (!useTables) ?
Real(sin(fValue)) : SinTable(fValue);
434 static Real UnitRandom ();
450 static Real SymmetricRandom ();
452 static void SetRandomValueProvider(RandomValueProvider* provider);
472 return (!useTables) ?
Real(tan(fValue)) : TanTable(fValue);
484 static void setAngleUnit(AngleUnit unit);
486 static AngleUnit getAngleUnit(
void);
489 static Real AngleUnitsToRadians(
Real units);
491 static Real RadiansToAngleUnits(
Real radians);
493 static Real AngleUnitsToDegrees(
Real units);
495 static Real DegreesToAngleUnits(
Real degrees);
548 static std::pair<bool, Real> intersects(
const Ray& ray,
const Plane& plane);
551 static std::pair<bool, Real> intersects(
const Ray& ray,
const Sphere& sphere,
552 bool discardInside =
true);
555 static std::pair<bool, Real> intersects(
const Ray& ray,
const AxisAlignedBox& box);
606 static std::pair<bool, Real> intersects(
const Ray& ray,
const Vector3& a,
608 bool positiveSide =
true,
bool negativeSide =
true);
630 static std::pair<bool, Real> intersects(
const Ray& ray,
const Vector3& a,
632 bool positiveSide =
true,
bool negativeSide =
true);
645 static std::pair<bool, Real> intersects(
647 bool normalIsOutside);
653 static std::pair<bool, Real> intersects(
655 bool normalIsOutside);
660 static bool intersects(
const Sphere& sphere,
const Plane& plane);
664 static bool RealEqual(
Real a,
Real b,
665 Real tolerance = std::numeric_limits<Real>::epsilon());
668 static Vector3 calculateTangentSpaceVector(
686 static Real gaussianDistribution(
Real x,
Real offset = 0.0f,
Real scale = 1.0f);
689 template <
typename T>
690 static T
Clamp(T val, T minval, T maxval)
692 assert (minval <= maxval &&
"Invalid clamp range");
693 return std::max(std::min(val, maxval), minval);
697 const Matrix4* reflectMatrix = 0);
virtual ~RandomValueProvider()
Degree & operator=(const Real &f)
static Real Sqr(Real fValue)
Squared function.
static const Real fRad2Deg
static const Real LOG2
Stored value of log(2) for frequent use.
bool operator==(const Radian &r) const
static Real mTrigTableFactor
Radian -> index factor value ( mTrigTableSize / 2 * PI )
static Radian Sqrt(const Radian &fValue)
Square root function.
Degree operator*(Real f) const
Class to provide access to common mathematical functions.
Real valueAngleUnits() const
static Real Cos(const Radian &fValue, bool useTables=false)
Cosine function.
static const Real HALF_PI
static Real Floor(Real fValue)
Floor function Returns the largest previous integer.
Implementation of a Quaternion, i.e.
A sphere primitive, mostly used for bounds checking.
4-dimensional homogeneous vector.
static bool isNaN(Real f)
Standard 2-dimensional vector.
float Real
Software floating point type.
static RandomValueProvider * mRandProvider
A random value provider. overriding the default random number generator.
static Real Log(Real fValue)
Radian operator/(Real f) const
static Degree Sign(const Degree &dValue)
Real valueRadians() const
static Degree Abs(const Degree &dValue)
Absolute value function.
Radian & operator+=(const Radian &r)
static AngleUnit msAngleUnit
Angle units used by the api.
static Radian Sign(const Radian &rValue)
AngleUnit
The angular units used by the API.
Degree operator/(Real f) const
static Real DegreesToRadians(Real degrees)
Defines a plane in 3D space.
static Real Exp(Real fValue)
static Real Abs(Real fValue)
Absolute value function.
bool operator>(const Radian &r) const
static int IFloor(float fValue)
Class encapsulating a standard 4x4 homogeneous matrix.
Standard 3-dimensional vector.
static int mTrigTableSize
Size of the trig tables as determined by constructor.
const Radian & operator+() const
bool operator==(const Degree &d) const
Real valueDegrees() const
static Real Log2(Real fValue)
Degree & operator/=(Real f)
Radian & operator=(const Real &f)
Wrapper class which identifies a value as the currently default angle type, as defined by Math::setAn...
static const Real POS_INFINITY
Radian & operator/=(Real f)
static Real RadiansToAngleUnits(Real radians)
Convert from radians to the current AngleUnit .
bool operator!=(const Radian &r) const
static Radian Abs(const Radian &rValue)
Absolute value function.
Degree & operator+=(const Degree &d)
static Real Sqrt(Real fValue)
Square root function.
bool operator>=(const Degree &d) const
bool operator<=(const Radian &r) const
Degree & operator-=(const Degree &d)
static Real RadiansToDegrees(Real radians)
Real valueRadians() const
Degree & operator*=(Real f)
static int ICeil(float fValue)
static Real Cos(Real fValue, bool useTables=false)
Cosine function.
bool operator<(const Degree &d) const
Radian & operator-=(const Radian &r)
Real valueAngleUnits() const
Radian & operator*=(Real f)
static Real Tan(const Radian &fValue, bool useTables=false)
Tangent function.
bool operator<(const Radian &r) const
static T Clamp(T val, T minval, T maxval)
Clamp a value within an inclusive range.
static const Real fDeg2Rad
static const Real NEG_INFINITY
bool operator<=(const Degree &d) const
static Real Ceil(Real fValue)
Ceiling function Returns the smallest following integer.
static Real Pow(Real fBase, Real fExponent)
static double saturate(double t)
const Degree & operator+() const
Radian operator*(Real f) const
Radian operator/(Real a, const Radian &b)
Real valueDegrees() const
Wrapper class which indicates a given angle value is in Degrees.
bool operator>=(const Radian &r) const
bool operator!=(const Degree &d) const
static Radian ATan(Real fValue)
Arc tangent function.
static Real Sin(const Radian &fValue, bool useTables=false)
Sine function.
static float saturate(float t)
Radian operator*(Real a, const Radian &b)
static Real Tan(Real fValue, bool useTables=false)
Tangent function.
static Real AngleUnitsToRadians(Real units)
Convert from the current AngleUnit to radians.
A 3D box aligned with the x/y/z axes.
static Real AngleUnitsToDegrees(Real units)
Convert from the current AngleUnit to degrees.
bool operator>(const Degree &d) const
This class is used to provide an external random value provider.
static V lerp(const V &v0, const V &v1, const T &t)
static int IAbs(int iValue)
static Radian ATan2(Real fY, Real fX)
Arc tangent between two values function.
static Real Sin(Real fValue, bool useTables=false)
Sine function.
static Degree Sqrt(const Degree &fValue)
Square root function.
Representation of a ray in space, i.e.
Wrapper class which indicates a given angle value is in Radians.
static Real LogN(Real base, Real fValue)
static Real DegreesToAngleUnits(Real degrees)
Convert from degrees to the current AngleUnit.