87 o <<
"Radian(" << v.valueRadians() <<
")";
135 inline _OgreExport friend std::ostream&
operator <<
138 o <<
"Degree(" << v.valueDegrees() <<
")";
218 void buildTrigTables();
228 Math(
unsigned int trigTableSize = 4096);
234 static inline int IAbs (
int iValue) {
return ( iValue >= 0 ? iValue : -iValue ); }
235 static inline int ICeil (
float fValue) {
return int(ceil(fValue)); }
236 static inline int IFloor (
float fValue) {
return int(floor(fValue)); }
237 static int ISign (
int iValue);
315 return (!useTables) ?
Real(cos(fValue)) : SinTable(fValue + HALF_PI);
367 return (!useTables) ?
Real(sin(fValue)) : SinTable(fValue);
409 static Real UnitRandom ();
425 static Real SymmetricRandom ();
445 return (!useTables) ?
Real(tan(fValue)) : TanTable(fValue);
457 static void setAngleUnit(AngleUnit unit);
459 static AngleUnit getAngleUnit(
void);
462 static Real AngleUnitsToRadians(
Real units);
464 static Real RadiansToAngleUnits(
Real radians);
466 static Real AngleUnitsToDegrees(
Real units);
468 static Real DegreesToAngleUnits(
Real degrees);
521 static std::pair<bool, Real> intersects(
const Ray& ray,
const Plane& plane);
524 static std::pair<bool, Real> intersects(
const Ray& ray,
const Sphere& sphere,
525 bool discardInside =
true);
528 static std::pair<bool, Real> intersects(
const Ray& ray,
const AxisAlignedBox& box);
579 static std::pair<bool, Real> intersects(
const Ray& ray,
const Vector3& a,
581 bool positiveSide =
true,
bool negativeSide =
true);
603 static std::pair<bool, Real> intersects(
const Ray& ray,
const Vector3& a,
605 bool positiveSide =
true,
bool negativeSide =
true);
618 static std::pair<bool, Real> intersects(
620 bool normalIsOutside);
626 static std::pair<bool, Real> intersects(
628 bool normalIsOutside);
633 static bool intersects(
const Sphere& sphere,
const Plane& plane);
637 static bool RealEqual(
Real a,
Real b,
638 Real tolerance = std::numeric_limits<Real>::epsilon());
641 static Vector3 calculateTangentSpaceVector(
659 static Real gaussianDistribution(
Real x,
Real offset = 0.0f,
Real scale = 1.0f);
662 template <
typename T>
663 static T
Clamp(T val, T minval, T maxval)
665 assert (minval <= maxval &&
"Invalid clamp range");
666 return std::max(std::min(val, maxval), minval);
670 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 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 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 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
static int IFloor(float fValue)
Radian & operator=(const Real &f)
bool operator<(const Radian &r) const
static const Real NEG_INFINITY
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
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)