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);
Representation of a ray in space, i.e.
Radian & operator+=(const Radian &r)
static Real LogN(Real base, Real fValue)
static float saturate(float t)
static Radian Sign(const Radian &rValue)
Class encapsulating a standard 4x4 homogeneous matrix.
Degree & operator+=(const Degree &d)
float Real
Software floating point type.
static const Real LOG2
Stored value of log(2) for frequent use.
static const Real HALF_PI
static T Clamp(T val, T minval, T maxval)
Clamp a value within an inclusive range.
static Degree Abs(const Degree &dValue)
Absolute value function.
AngleUnit
The angular units used by the API.
static Real Log(Real fValue)
static const Real fDeg2Rad
static RandomValueProvider * mRandProvider
A random value provider. overriding the default random number generator.
virtual ~RandomValueProvider()
static Real Cos(Real fValue, bool useTables=false)
Cosine function.
Defines a plane in 3D space.
Degree & operator=(const Real &f)
static Radian ATan(Real fValue)
Arc tangent function.
bool operator<=(const Radian &r) const
Real valueRadians() const
static Real RadiansToAngleUnits(Real radians)
Convert from radians to the current AngleUnit .
static Radian Sqrt(const Radian &fValue)
Square root function.
static Radian Abs(const Radian &rValue)
Absolute value function.
static Real Exp(Real fValue)
static Real Log2(Real fValue)
bool operator<(const Degree &d) const
Wrapper class which identifies a value as the currently default angle type, as defined by Math::setAn...
A 3D box aligned with the x/y/z axes.
Radian & operator/=(Real f)
bool operator!=(const Degree &d) const
static Real Tan(Real fValue, bool useTables=false)
Tangent function.
Class to provide access to common mathematical functions.
Degree & operator/=(Real f)
bool operator>(const Radian &r) const
bool operator!=(const Radian &r) const
Radian & operator-=(const Radian &r)
static Real Cos(const Radian &fValue, bool useTables=false)
Cosine function.
Radian operator*(Real a, const Radian &b)
Radian operator/(Real a, const Radian &b)
Implementation of a Quaternion, i.e.
Radian operator/(Real f) const
static const Real POS_INFINITY
Degree & operator*=(Real f)
Real valueAngleUnits() const
static V lerp(const V &v0, const V &v1, const T &t)
static Real Tan(const Radian &fValue, bool useTables=false)
Tangent function.
static Real Sin(Real fValue, bool useTables=false)
Sine function.
static Real AngleUnitsToDegrees(Real units)
Convert from the current AngleUnit to degrees.
static Real DegreesToRadians(Real degrees)
static Real Abs(Real fValue)
Absolute value function.
Degree & operator-=(const Degree &d)
static Real mTrigTableFactor
Radian -> index factor value ( mTrigTableSize / 2 * PI )
static Radian ATan2(Real fY, Real fX)
Arc tangent between two values function.
static Real Sin(const Radian &fValue, bool useTables=false)
Sine function.
bool operator>=(const Degree &d) const
static Real Sqrt(Real fValue)
Square root function.
static Real Ceil(Real fValue)
Ceiling function Returns the smallest following integer.
A sphere primitive, mostly used for bounds checking.
static Real AngleUnitsToRadians(Real units)
Convert from the current AngleUnit to radians.
Standard 2-dimensional vector.
static Real Floor(Real fValue)
Floor function Returns the largest previous integer.
Wrapper class which indicates a given angle value is in Degrees.
static int IAbs(int iValue)
static Degree Sqrt(const Degree &fValue)
Square root function.
Degree operator/(Real f) const
static Real Sqr(Real fValue)
Squared function.
Real valueRadians() const
static int mTrigTableSize
Size of the trig tables as determined by constructor.
Degree operator*(Real f) const
Standard 3-dimensional vector.
static Real Pow(Real fBase, Real fExponent)
static AngleUnit msAngleUnit
Angle units used by the api.
static int IFloor(float fValue)
Radian & operator=(const Real &f)
bool operator<(const Radian &r) const
static const Real NEG_INFINITY
static double saturate(double t)
static Real DegreesToAngleUnits(Real degrees)
Convert from degrees to the current AngleUnit.
const Degree & operator+() const
Wrapper class which indicates a given angle value is in Radians.
const Radian & operator+() const
This class is used to provide an external random value provider.
static int ICeil(float fValue)
bool operator==(const Degree &d) const
bool operator>=(const Radian &r) const
Real valueDegrees() const
static bool isNaN(Real f)
bool operator>(const Degree &d) const
Radian & operator*=(Real f)
4-dimensional homogeneous vector.
static Real RadiansToDegrees(Real radians)
bool operator==(const Radian &r) const
bool operator<=(const Degree &d) const
Radian operator*(Real f) const
Real valueAngleUnits() const
static const Real fRad2Deg
Real valueDegrees() const
static Degree Sign(const Degree &dValue)