OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreMath.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __Math_H__
29 #define __Math_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreHeaderPrefix.h"
33 
34 #include "OgreCommon.h"
35 
36 namespace Ogre
37 {
49  class Radian
50  {
52 
53  public:
54  explicit Radian ( Real r=0 ) : mRad(r) {}
55  Radian ( const Degree& d );
56  Radian& operator = ( const Real& f ) { mRad = f; return *this; }
57  Radian& operator = ( const Radian& r ) { mRad = r.mRad; return *this; }
58  Radian& operator = ( const Degree& d );
59 
60  Real valueDegrees() const; // see bottom of this file
61  Real valueRadians() const { return mRad; }
62  Real valueAngleUnits() const;
63 
64  const Radian& operator + () const { return *this; }
65  Radian operator + ( const Radian& r ) const { return Radian ( mRad + r.mRad ); }
66  Radian operator + ( const Degree& d ) const;
67  Radian& operator += ( const Radian& r ) { mRad += r.mRad; return *this; }
68  Radian& operator += ( const Degree& d );
69  Radian operator - () const { return Radian(-mRad); }
70  Radian operator - ( const Radian& r ) const { return Radian ( mRad - r.mRad ); }
71  Radian operator - ( const Degree& d ) const;
72  Radian& operator -= ( const Radian& r ) { mRad -= r.mRad; return *this; }
73  Radian& operator -= ( const Degree& d );
74  Radian operator * ( Real f ) const { return Radian ( mRad * f ); }
75  Radian operator * ( const Radian& f ) const { return Radian ( mRad * f.mRad ); }
76  Radian& operator *= ( Real f ) { mRad *= f; return *this; }
77  Radian operator / ( Real f ) const { return Radian ( mRad / f ); }
78  Radian& operator /= ( Real f ) { mRad /= f; return *this; }
79 
80  bool operator < ( const Radian& r ) const { return mRad < r.mRad; }
81  bool operator <= ( const Radian& r ) const { return mRad <= r.mRad; }
82  bool operator == ( const Radian& r ) const { return mRad == r.mRad; }
83  bool operator != ( const Radian& r ) const { return mRad != r.mRad; }
84  bool operator >= ( const Radian& r ) const { return mRad >= r.mRad; }
85  bool operator > ( const Radian& r ) const { return mRad > r.mRad; }
86 
87  inline _OgreExport friend std::ostream& operator <<
88  ( std::ostream& o, const Radian& v )
89  {
90  o << "Radian(" << v.valueRadians() << ")";
91  return o;
92  }
93  };
94 
100  class Degree
101  {
102  Real mDeg; // if you get an error here - make sure to define/typedef 'Real' first
103 
104  public:
105  explicit Degree ( Real d=0 ) : mDeg(d) {}
106  Degree ( const Radian& r ) : mDeg(r.valueDegrees()) {}
107  Degree& operator = ( const Real& f ) { mDeg = f; return *this; }
108  Degree& operator = ( const Degree& d ) { mDeg = d.mDeg; return *this; }
109  Degree& operator = ( const Radian& r ) { mDeg = r.valueDegrees(); return *this; }
110 
111  Real valueDegrees() const { return mDeg; }
112  Real valueRadians() const; // see bottom of this file
113  Real valueAngleUnits() const;
114 
115  const Degree& operator + () const { return *this; }
116  Degree operator + ( const Degree& d ) const { return Degree ( mDeg + d.mDeg ); }
117  Degree operator + ( const Radian& r ) const { return Degree ( mDeg + r.valueDegrees() ); }
118  Degree& operator += ( const Degree& d ) { mDeg += d.mDeg; return *this; }
119  Degree& operator += ( const Radian& r ) { mDeg += r.valueDegrees(); return *this; }
120  Degree operator - () const { return Degree(-mDeg); }
121  Degree operator - ( const Degree& d ) const { return Degree ( mDeg - d.mDeg ); }
122  Degree operator - ( const Radian& r ) const { return Degree ( mDeg - r.valueDegrees() ); }
123  Degree& operator -= ( const Degree& d ) { mDeg -= d.mDeg; return *this; }
124  Degree& operator -= ( const Radian& r ) { mDeg -= r.valueDegrees(); return *this; }
125  Degree operator * ( Real f ) const { return Degree ( mDeg * f ); }
126  Degree operator * ( const Degree& f ) const { return Degree ( mDeg * f.mDeg ); }
127  Degree& operator *= ( Real f ) { mDeg *= f; return *this; }
128  Degree operator / ( Real f ) const { return Degree ( mDeg / f ); }
129  Degree& operator /= ( Real f ) { mDeg /= f; return *this; }
130 
131  bool operator < ( const Degree& d ) const { return mDeg < d.mDeg; }
132  bool operator <= ( const Degree& d ) const { return mDeg <= d.mDeg; }
133  bool operator == ( const Degree& d ) const { return mDeg == d.mDeg; }
134  bool operator != ( const Degree& d ) const { return mDeg != d.mDeg; }
135  bool operator >= ( const Degree& d ) const { return mDeg >= d.mDeg; }
136  bool operator > ( const Degree& d ) const { return mDeg > d.mDeg; }
137 
138  inline _OgreExport friend std::ostream& operator <<
139  ( std::ostream& o, const Degree& v )
140  {
141  o << "Degree(" << v.valueDegrees() << ")";
142  return o;
143  }
144  };
145 
152  class Angle
153  {
155  public:
156  explicit Angle ( Real angle ) : mAngle(angle) {}
157  operator Radian() const;
158  operator Degree() const;
159  };
160 
161  // these functions could not be defined within the class definition of class
162  // Radian because they required class Degree to be defined
163  inline Radian::Radian ( const Degree& d ) : mRad(d.valueRadians()) {
164  }
165  inline Radian& Radian::operator = ( const Degree& d ) {
166  mRad = d.valueRadians(); return *this;
167  }
168  inline Radian Radian::operator + ( const Degree& d ) const {
169  return Radian ( mRad + d.valueRadians() );
170  }
171  inline Radian& Radian::operator += ( const Degree& d ) {
172  mRad += d.valueRadians();
173  return *this;
174  }
175  inline Radian Radian::operator - ( const Degree& d ) const {
176  return Radian ( mRad - d.valueRadians() );
177  }
178  inline Radian& Radian::operator -= ( const Degree& d ) {
179  mRad -= d.valueRadians();
180  return *this;
181  }
182 
194  {
195  public:
202  {
204  AU_RADIAN
205  };
206 
207 
211  {
212  public:
213  virtual ~RandomValueProvider() {}
215  virtual Real getRandomUnit() = 0;
216  };
217 
218  protected:
221 
223  static int mTrigTableSize;
224 
227  static Real* mSinTable;
228  static Real* mTanTable;
229 
232 
235  void buildTrigTables();
236 
237  static Real SinTable (Real fValue);
238  static Real TanTable (Real fValue);
239  public:
245  Math(unsigned int trigTableSize = 4096);
246 
249  ~Math();
250 
251  static inline int IAbs (int iValue) { return ( iValue >= 0 ? iValue : -iValue ); }
252  static inline int ICeil (float fValue) { return int(ceil(fValue)); }
253  static inline int IFloor (float fValue) { return int(floor(fValue)); }
254  static int ISign (int iValue);
255 
260  static inline Real Abs (Real fValue) { return Real(fabs(fValue)); }
261 
266  static inline Degree Abs (const Degree& dValue) { return Degree(fabs(dValue.valueDegrees())); }
267 
272  static inline Radian Abs (const Radian& rValue) { return Radian(fabs(rValue.valueRadians())); }
273 
278  static Radian ACos (Real fValue);
279 
284  static Radian ASin (Real fValue);
285 
290  static inline Radian ATan (Real fValue) { return Radian(atan(fValue)); }
291 
298  static inline Radian ATan2 (Real fY, Real fX) { return Radian(atan2(fY,fX)); }
299 
306  static inline Real Ceil (Real fValue) { return Real(ceil(fValue)); }
307  static inline bool isNaN(Real f)
308  {
309  // std::isnan() is C99, not supported by all compilers
310  // However NaN always fails this next test, no other number does.
311  return f != f;
312  }
313 
321  static inline Real Cos (const Radian& fValue, bool useTables = false) {
322  return (!useTables) ? Real(cos(fValue.valueRadians())) : SinTable(fValue.valueRadians() + HALF_PI);
323  }
331  static inline Real Cos (Real fValue, bool useTables = false) {
332  return (!useTables) ? Real(cos(fValue)) : SinTable(fValue + HALF_PI);
333  }
334 
335  static inline Real Exp (Real fValue) { return Real(exp(fValue)); }
336 
343  static inline Real Floor (Real fValue) { return Real(floor(fValue)); }
344 
345  static inline Real Log (Real fValue) { return Real(log(fValue)); }
346 
348  static const Real LOG2;
349 
350  static inline Real Log2 (Real fValue) { return Real(log(fValue)/LOG2); }
351 
352  static inline Real LogN (Real base, Real fValue) { return Real(log(fValue)/log(base)); }
353 
354  static inline Real Pow (Real fBase, Real fExponent) { return Real(pow(fBase,fExponent)); }
355 
356  static Real Sign (Real fValue);
357  static inline Radian Sign ( const Radian& rValue )
358  {
359  return Radian(Sign(rValue.valueRadians()));
360  }
361  static inline Degree Sign ( const Degree& dValue )
362  {
363  return Degree(Sign(dValue.valueDegrees()));
364  }
365 
366  //Simulate the shader function saturate that clamps a parameter value between 0 and 1
367  static inline float saturate(float t)
368  {
369  float tmp = Ogre::max( t, 0.0f );
370  tmp = Ogre::min( tmp, 1.0f );
371  return tmp;
372  }
373  static inline double saturate(double t)
374  {
375  double tmp = Ogre::max( t, 0.0 );
376  tmp = Ogre::min( tmp, 1.0 );
377  return tmp;
378  }
379 
387  template<typename T, typename S> static FORCEINLINE T lerp( const T& a, const T& b, const S& w )
388  {
389  return a + w * (b - a);
390  }
391 
399  static inline Real Sin (const Radian& fValue, bool useTables = false) {
400  return (!useTables) ? Real(sin(fValue.valueRadians())) : SinTable(fValue.valueRadians());
401  }
409  static inline Real Sin (Real fValue, bool useTables = false) {
410  return (!useTables) ? Real(sin(fValue)) : SinTable(fValue);
411  }
412 
417  static inline Real Sqr (Real fValue) { return fValue*fValue; }
418 
423  static inline Real Sqrt (Real fValue) { return Real(sqrt(fValue)); }
424 
431  static inline Radian Sqrt (const Radian& fValue) { return Radian(sqrt(fValue.valueRadians())); }
432 
439  static inline Degree Sqrt (const Degree& fValue) { return Degree(sqrt(fValue.valueDegrees())); }
440 
446  static Real InvSqrt (Real fValue);
447 
452  static Real UnitRandom ();
453 
462  static Real RangeRandom (Real fLow, Real fHigh);
463 
468  static Real SymmetricRandom ();
469 
470  static void SetRandomValueProvider(RandomValueProvider* provider);
471 
479  static inline Real Tan (const Radian& fValue, bool useTables = false) {
480  return (!useTables) ? Real(tan(fValue.valueRadians())) : TanTable(fValue.valueRadians());
481  }
489  static inline Real Tan (Real fValue, bool useTables = false) {
490  return (!useTables) ? Real(tan(fValue)) : TanTable(fValue);
491  }
492 
493  static inline Real DegreesToRadians(Real degrees) { return degrees * fDeg2Rad; }
494  static inline Real RadiansToDegrees(Real radians) { return radians * fRad2Deg; }
495 
502  static void setAngleUnit(AngleUnit unit);
504  static AngleUnit getAngleUnit(void);
505 
507  static Real AngleUnitsToRadians(Real units);
509  static Real RadiansToAngleUnits(Real radians);
511  static Real AngleUnitsToDegrees(Real units);
513  static Real DegreesToAngleUnits(Real degrees);
514 
536  static bool pointInTri2D(const Vector2& p, const Vector2& a,
537  const Vector2& b, const Vector2& c);
538 
563  static bool pointInTri3D(const Vector3& p, const Vector3& a,
564  const Vector3& b, const Vector3& c, const Vector3& normal);
566  static std::pair<bool, Real> intersects(const Ray& ray, const Plane& plane);
567 
569  static std::pair<bool, Real> intersects(const Ray& ray, const Sphere& sphere,
570  bool discardInside = true);
571 
573  static std::pair<bool, Real> intersects(const Ray& ray, const AxisAlignedBox& box);
574 
597  static bool intersects(const Ray& ray, const AxisAlignedBox& box,
598  Real* d1, Real* d2);
599 
624  static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
625  const Vector3& b, const Vector3& c, const Vector3& normal,
626  bool positiveSide = true, bool negativeSide = true);
627 
648  static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
649  const Vector3& b, const Vector3& c,
650  bool positiveSide = true, bool negativeSide = true);
651 
653  //TODO: Enable (dark_sylinc)
654  //static bool intersects(const Sphere& sphere, const Aabb& aabb);
655 
657  static bool intersects(const Sphere& sphere, const AxisAlignedBox& box);
658 
660  static bool intersects(const Plane& plane, const AxisAlignedBox& box);
661 
667  static std::pair<bool, Real> intersects(
668  const Ray& ray, const vector<Plane>::type& planeList,
669  bool normalIsOutside);
675  static std::pair<bool, Real> intersects(
676  const Ray& ray, const list<Plane>::type& planeList,
677  bool normalIsOutside);
678 
682  static bool intersects(const Sphere& sphere, const Plane& plane);
683 
686  static bool RealEqual(Real a, Real b,
687  Real tolerance = std::numeric_limits<Real>::epsilon());
688 
690  static Vector3 calculateTangentSpaceVector(
691  const Vector3& position1, const Vector3& position2, const Vector3& position3,
692  Real u1, Real v1, Real u2, Real v2, Real u3, Real v3);
693 
695  static Matrix4 buildReflectionMatrix(const Plane& p);
697  static Vector4 calculateFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
699  static Vector3 calculateBasicFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
701  static Vector4 calculateFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
703  static Vector3 calculateBasicFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
704 
708  static Real gaussianDistribution(Real x, Real offset = 0.0f, Real scale = 1.0f);
709 
711  template <typename T>
712  inline static T Clamp(T val, T minval, T maxval)
713  {
714  assert (minval <= maxval && "Invalid clamp range");
715  return std::max(std::min(val, maxval), minval);
716  }
717 
718  static Matrix4 makeViewMatrix(const Vector3& position, const Quaternion& orientation,
719  const Matrix4* reflectMatrix = 0);
720 
722  static Real boundingRadiusFromAABB(const AxisAlignedBox& aabb);
723 
724 
725 
726  static const Real POS_INFINITY;
727  static const Real NEG_INFINITY;
728  static const Real PI;
729  static const Real TWO_PI;
730  static const Real HALF_PI;
731  static const Real fDeg2Rad;
732  static const Real fRad2Deg;
733 
734  };
735 
736  template <>
737  inline float Math::Clamp<float>(float val, float minval, float maxval)
738  {
739  assert (minval <= maxval && "Invalid clamp range");
740  return Ogre::max( Ogre::min(val, maxval), minval );
741  }
742  template <>
743  inline double Math::Clamp<double>(double val, double minval, double maxval)
744  {
745  assert (minval <= maxval && "Invalid clamp range");
746  return Ogre::max( Ogre::min(val, maxval), minval );
747  }
748 
749  // these functions must be defined down here, because they rely on the
750  // angle unit conversion functions in class Math:
751 
752  inline Real Radian::valueDegrees() const
753  {
754  return Math::RadiansToDegrees ( mRad );
755  }
756 
758  {
759  return Math::RadiansToAngleUnits ( mRad );
760  }
761 
762  inline Real Degree::valueRadians() const
763  {
764  return Math::DegreesToRadians ( mDeg );
765  }
766 
768  {
769  return Math::DegreesToAngleUnits ( mDeg );
770  }
771 
772  inline Angle::operator Radian() const
773  {
774  return Radian(Math::AngleUnitsToRadians(mAngle));
775  }
776 
777  inline Angle::operator Degree() const
778  {
779  return Degree(Math::AngleUnitsToDegrees(mAngle));
780  }
781 
782  inline Radian operator * ( Real a, const Radian& b )
783  {
784  return Radian ( a * b.valueRadians() );
785  }
786 
787  inline Radian operator / ( Real a, const Radian& b )
788  {
789  return Radian ( a / b.valueRadians() );
790  }
791 
792  inline Degree operator * ( Real a, const Degree& b )
793  {
794  return Degree ( a * b.valueDegrees() );
795  }
796 
797  inline Degree operator / ( Real a, const Degree& b )
798  {
799  return Degree ( a / b.valueDegrees() );
800  }
804 }
805 
806 #include "OgreHeaderSuffix.h"
807 
808 #endif
Representation of a ray in space, i.e.
Definition: OgreRay.h:45
Radian & operator+=(const Radian &r)
Definition: OgreMath.h:67
static Real LogN(Real base, Real fValue)
Definition: OgreMath.h:352
static float saturate(float t)
Definition: OgreMath.h:367
static Radian Sign(const Radian &rValue)
Definition: OgreMath.h:357
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
Degree & operator+=(const Degree &d)
Definition: OgreMath.h:118
float Real
Software floating point type.
static const Real LOG2
Stored value of log(2) for frequent use.
Definition: OgreMath.h:348
static const Real HALF_PI
Definition: OgreMath.h:730
#define _OgreExport
Definition: OgrePlatform.h:255
static T Clamp(T val, T minval, T maxval)
Clamp a value within an inclusive range.
Definition: OgreMath.h:712
static Degree Abs(const Degree &dValue)
Absolute value function.
Definition: OgreMath.h:266
AngleUnit
The angular units used by the API.
Definition: OgreMath.h:201
static Real Log(Real fValue)
Definition: OgreMath.h:345
static const Real fDeg2Rad
Definition: OgreMath.h:731
static RandomValueProvider * mRandProvider
A random value provider. overriding the default random number generator.
Definition: OgreMath.h:231
static Real Cos(Real fValue, bool useTables=false)
Cosine function.
Definition: OgreMath.h:331
Defines a plane in 3D space.
Definition: OgrePlane.h:61
const float & max(const float &a, const float &b)
Definition: OgreCommon.h:851
static FORCEINLINE T lerp(const T &a, const T &b, const S &w)
Linear interpolation.
Definition: OgreMath.h:387
Degree & operator=(const Real &f)
Definition: OgreMath.h:107
static Radian ATan(Real fValue)
Arc tangent function.
Definition: OgreMath.h:290
bool operator<=(const Radian &r) const
Definition: OgreMath.h:81
Real valueRadians() const
Definition: OgreMath.h:762
static Real RadiansToAngleUnits(Real radians)
Convert from radians to the current AngleUnit .
static Radian Sqrt(const Radian &fValue)
Square root function.
Definition: OgreMath.h:431
static Radian Abs(const Radian &rValue)
Absolute value function.
Definition: OgreMath.h:272
Real mRad
Definition: OgreMath.h:51
static Real Exp(Real fValue)
Definition: OgreMath.h:335
static Real Log2(Real fValue)
Definition: OgreMath.h:350
bool operator<(const Degree &d) const
Definition: OgreMath.h:131
Wrapper class which identifies a value as the currently default angle type, as defined by Math::setAn...
Definition: OgreMath.h:152
static const Real TWO_PI
Definition: OgreMath.h:729
A 3D box aligned with the x/y/z axes.
Radian & operator/=(Real f)
Definition: OgreMath.h:78
std::list< T, A > type
bool operator!=(const Degree &d) const
Definition: OgreMath.h:134
static Real Tan(Real fValue, bool useTables=false)
Tangent function.
Definition: OgreMath.h:489
Class to provide access to common mathematical functions.
Definition: OgreMath.h:193
Degree & operator/=(Real f)
Definition: OgreMath.h:129
bool operator>(const Radian &r) const
Definition: OgreMath.h:85
bool operator!=(const Radian &r) const
Definition: OgreMath.h:83
Radian & operator-=(const Radian &r)
Definition: OgreMath.h:72
static Real Cos(const Radian &fValue, bool useTables=false)
Cosine function.
Definition: OgreMath.h:321
Radian operator*(Real a, const Radian &b)
Definition: OgreMath.h:782
Radian operator/(Real a, const Radian &b)
Definition: OgreMath.h:787
Implementation of a Quaternion, i.e.
Angle(Real angle)
Definition: OgreMath.h:156
Radian operator/(Real f) const
Definition: OgreMath.h:77
static const Real POS_INFINITY
Definition: OgreMath.h:726
Degree & operator*=(Real f)
Definition: OgreMath.h:127
Real valueAngleUnits() const
Definition: OgreMath.h:767
static const Real PI
Definition: OgreMath.h:728
static Real Tan(const Radian &fValue, bool useTables=false)
Tangent function.
Definition: OgreMath.h:479
static Real Sin(Real fValue, bool useTables=false)
Sine function.
Definition: OgreMath.h:409
static Real AngleUnitsToDegrees(Real units)
Convert from the current AngleUnit to degrees.
static Real DegreesToRadians(Real degrees)
Definition: OgreMath.h:493
static Real * mTanTable
Definition: OgreMath.h:228
static Real Abs(Real fValue)
Absolute value function.
Definition: OgreMath.h:260
Degree & operator-=(const Degree &d)
Definition: OgreMath.h:123
static Real mTrigTableFactor
Radian -> index factor value ( mTrigTableSize / 2 * PI )
Definition: OgreMath.h:226
static Radian ATan2(Real fY, Real fX)
Arc tangent between two values function.
Definition: OgreMath.h:298
static Real Sin(const Radian &fValue, bool useTables=false)
Sine function.
Definition: OgreMath.h:399
bool operator>=(const Degree &d) const
Definition: OgreMath.h:135
Degree(const Radian &r)
Definition: OgreMath.h:106
static Real Sqrt(Real fValue)
Square root function.
Definition: OgreMath.h:423
static Real Ceil(Real fValue)
Ceiling function Returns the smallest following integer.
Definition: OgreMath.h:306
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
static Real AngleUnitsToRadians(Real units)
Convert from the current AngleUnit to radians.
Standard 2-dimensional vector.
Definition: OgreVector2.h:51
static Real Floor(Real fValue)
Floor function Returns the largest previous integer.
Definition: OgreMath.h:343
const float & min(const float &a, const float &b)
Definition: OgreCommon.h:846
Wrapper class which indicates a given angle value is in Degrees.
Definition: OgreMath.h:100
static int IAbs(int iValue)
Definition: OgreMath.h:251
static Degree Sqrt(const Degree &fValue)
Square root function.
Definition: OgreMath.h:439
Degree operator/(Real f) const
Definition: OgreMath.h:128
static Real Sqr(Real fValue)
Squared function.
Definition: OgreMath.h:417
Real valueRadians() const
Definition: OgreMath.h:61
static int mTrigTableSize
Size of the trig tables as determined by constructor.
Definition: OgreMath.h:223
Degree operator*(Real f) const
Definition: OgreMath.h:125
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
static Real Pow(Real fBase, Real fExponent)
Definition: OgreMath.h:354
static AngleUnit msAngleUnit
Angle units used by the api.
Definition: OgreMath.h:220
Degree(Real d=0)
Definition: OgreMath.h:105
static int IFloor(float fValue)
Definition: OgreMath.h:253
Radian & operator=(const Real &f)
Definition: OgreMath.h:56
bool operator<(const Radian &r) const
Definition: OgreMath.h:80
static const Real NEG_INFINITY
Definition: OgreMath.h:727
static double saturate(double t)
Definition: OgreMath.h:373
static Real * mSinTable
Definition: OgreMath.h:227
static Real DegreesToAngleUnits(Real degrees)
Convert from degrees to the current AngleUnit.
const Degree & operator+() const
Definition: OgreMath.h:115
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:49
const Radian & operator+() const
Definition: OgreMath.h:64
This class is used to provide an external random value provider.
Definition: OgreMath.h:210
static int ICeil(float fValue)
Definition: OgreMath.h:252
bool operator==(const Degree &d) const
Definition: OgreMath.h:133
bool operator>=(const Radian &r) const
Definition: OgreMath.h:84
#define FORCEINLINE
Definition: OgrePlatform.h:104
Real valueDegrees() const
Definition: OgreMath.h:752
static bool isNaN(Real f)
Definition: OgreMath.h:307
bool operator>(const Degree &d) const
Definition: OgreMath.h:136
Radian & operator*=(Real f)
Definition: OgreMath.h:76
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45
static Real RadiansToDegrees(Real radians)
Definition: OgreMath.h:494
bool operator==(const Radian &r) const
Definition: OgreMath.h:82
bool operator<=(const Degree &d) const
Definition: OgreMath.h:132
Real mAngle
Definition: OgreMath.h:154
Radian operator-() const
Definition: OgreMath.h:69
Radian operator*(Real f) const
Definition: OgreMath.h:74
Real valueAngleUnits() const
Definition: OgreMath.h:757
Degree operator-() const
Definition: OgreMath.h:120
Radian(Real r=0)
Definition: OgreMath.h:54
static const Real fRad2Deg
Definition: OgreMath.h:732
Real valueDegrees() const
Definition: OgreMath.h:111
static Degree Sign(const Degree &dValue)
Definition: OgreMath.h:361