libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moMath.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moMath.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30  Portions taken from
31  Wild Magic Source Code
32  David Eberly
33  http://www.geometrictools.com
34  Copyright (c) 1998-2007
35 
36 *******************************************************************************/
37 
38 #ifndef __MO_MATH_H__
39 #define __MO_MATH_H__
40 
41 #include "moTypes.h"
42 #include "moAbstract.h"
43 
44 #ifndef NOMINMAX
45 #ifndef momax
46 #define momax(a,b) ((a)>(b)?(a):(b))
47 #endif
48 #ifndef momin
49 #define momin(a,b) ((a)<(b)?(a):(b))
50 #endif
51 #endif
52 
63  template <class Real>
65 {
66 public:
70  moMath() {}
74  ~moMath() {}
75 
81  inline static Real ACos (Real fValue)
82  {
83  if (-(Real)1.0 < fValue)
84  {
85  if (fValue < (Real)1.0)
86  {
87  return (Real)acos((double)fValue);
88  }
89  else
90  {
91  return (Real)0.0;
92  }
93  }
94  else
95  {
96  return moMath::PI;
97  }
98  }
99 
105  inline static Real ASin (Real fValue)
106  {
107  if (-(Real)1.0 < fValue)
108  {
109  if (fValue < (Real)1.0)
110  {
111  return (Real)asin((double)fValue);
112  }
113  else
114  {
115  return HALF_PI;
116  }
117  }
118  else
119  {
120  return -HALF_PI;
121  }
122  }
123 
129  inline static Real ATan (Real fValue)
130  {
131  return (Real)atan((double)fValue);
132  }
133 
140  inline static Real ATan2 (Real fY, Real fX)
141  {
142  return (Real)atan2((double)fY,(double)fX);
143  }
144 
150  inline static Real Ceil (Real fValue)
151  {
152  return (Real)ceil((double)fValue);
153  }
154 
160  inline static Real Cos (Real fValue)
161  {
162  return (Real)cos((double)fValue);
163  }
164 
170  inline static Real Exp (Real fValue)
171  {
172  return (Real)exp((double)fValue);
173  }
174 
180  inline static Real FAbs (Real fValue)
181  {
182  return (Real)fabs((double)fValue);
183  }
184 
190  inline static Real Floor (Real fValue)
191  {
192  return (Real)floor((double)fValue);
193  }
194 
200  inline static Real FMod (Real fX, Real fY)
201  {
202  return (Real)fmod((double)fX,(double)fY);
203  }
204 
210  inline static Real InvSqrt (Real fValue)
211  {
212  return (Real)(1.0/sqrt((double)fValue));
213  }
214 
220  inline static Real Log (Real fValue)
221  {
222  return (Real)log((double)fValue);
223  }
224 
230  inline static Real Log2 (Real fValue)
231  {
232  return moMath<Real>::INV_LN_2 * (Real)log((double)fValue);
233  }
234 
240  inline static Real Log10 (Real fValue)
241  {
242  return moMath<Real>::INV_LN_10 * (Real)log((double)fValue);
243  }
244 
250  inline static Real Pow (Real fBase, Real fExponent)
251  {
252  return (Real)pow((double)fBase,(double)fExponent);
253  }
254 
260  inline static Real Sin (Real fValue)
261  {
262  return (Real)sin((double)fValue);
263  }
264 
270  inline static Real Sqr (Real fValue) {
271  return fValue*fValue;
272  }
273 
279  inline static Real Sqrt (Real fValue) {
280  return (Real)sqrt((double)fValue);
281  }
282 
288  inline static Real Tan (Real fValue) {
289  return (Real)tan((double)fValue);
290  }
291 
297  inline bool IsPowerOfTwo (int iValue) {
298  return (iValue > 0) && ((iValue & (iValue - 1)) == 0);
299  }
300 
306  inline unsigned int Log2OfPowerOfTwo (unsigned int uiPowerOfTwo) {
307  unsigned int uiLog2 = (uiPowerOfTwo & 0xAAAAAAAA) != 0;
308  uiLog2 |= ((uiPowerOfTwo & 0xFFFF0000) != 0) << 4;
309  uiLog2 |= ((uiPowerOfTwo & 0xFF00FF00) != 0) << 3;
310  uiLog2 |= ((uiPowerOfTwo & 0xF0F0F0F0) != 0) << 2;
311  uiLog2 |= ((uiPowerOfTwo & 0xCCCCCCCC) != 0) << 1;
312  return uiLog2;
313  }
314 
322  inline static int ScaledFloatToInt(float fFloat, int iLog)
323  {
324  int iInt;
325  int iShift;
326  iShift = 150 - iLog - ((*(int*)(&fFloat) >> 23) & 0xFF);
327  if ( iShift < 24 )
328  {
329  iInt = ((*(int*)(&fFloat) & 0x007FFFFF) | 0x00800000) >> iShift;
330  if ( iInt == (1 << iLog) ) iInt--;
331  }
332  else iInt = 0;
333  return iInt;
334  }
335 
341  inline static char Sign (int iValue) {
342  if (iValue > 0)
343  {
344  return 1;
345  }
346 
347  if (iValue < 0)
348  {
349  return -1;
350  }
351 
352  return 0;
353  }
354 
360  inline static Real Sign (Real fValue) {
361  if (fValue > (Real)0.0)
362  {
363  return (Real)1.0;
364  }
365 
366  if (fValue < (Real)0.0)
367  {
368  return -(Real)1.0;
369  }
370 
371  return (Real)0.0;
372  }
373 
380  inline static Real UnitRandom (unsigned int uiSeed = 0) {
381  if (uiSeed > 0)
382  {
383  srand(uiSeed);
384  }
385 
386  double dRatio = ((double)rand())/((double)(RAND_MAX));
387  return (Real)dRatio;
388  }
389 
396  inline static Real SymmetricRandom (unsigned int uiSeed = 0) {
397  if (uiSeed > 0.0)
398  {
399  srand(uiSeed);
400  }
401 
402  double dRatio = ((double)rand())/((double)(RAND_MAX));
403  return (Real)(2.0*dRatio - 1.0);
404  }
405 
414  inline static Real IntervalRandom (Real fMin, Real fMax,
415  unsigned int uiSeed = 0) {
416  if (uiSeed > 0)
417  {
418  srand(uiSeed);
419  }
420 
421  double dRatio = ((double)rand())/((double)(RAND_MAX));
422  return fMin+(fMax-fMin)*((Real)dRatio);
423  }
424 
431  inline static Real UnitRandom (Real rSeed) {
432  return UnitRandom ((unsigned int)rSeed);
433  }
440  inline static Real SymmetricRandom (Real rSeed) {
441  return SymmetricRandom ((unsigned int)rSeed);
442  }
451  inline static Real IntervalRandom (Real fMin, Real fMax, Real rSeed) {
452  return IntervalRandom (fMin, fMax, (unsigned int)rSeed);
453  }
454 
460  inline static Real FastSin0 (Real fAngle) {
461  Real fASqr = fAngle*fAngle;
462  Real fResult = (Real)7.61e-03;
463  fResult *= fASqr;
464  fResult -= (Real)1.6605e-01;
465  fResult *= fASqr;
466  fResult += (Real)1.0;
467  fResult *= fAngle;
468  return fResult;
469  }
470 
476  inline static Real FastSin1 (Real fAngle) {
477  Real fASqr = fAngle*fAngle;
478  Real fResult = -(Real)2.39e-08;
479  fResult *= fASqr;
480  fResult += (Real)2.7526e-06;
481  fResult *= fASqr;
482  fResult -= (Real)1.98409e-04;
483  fResult *= fASqr;
484  fResult += (Real)8.3333315e-03;
485  fResult *= fASqr;
486  fResult -= (Real)1.666666664e-01;
487  fResult *= fASqr;
488  fResult += (Real)1.0;
489  fResult *= fAngle;
490  return fResult;
491  }
492 
498  inline static Real FastCos0 (Real fAngle) {
499  Real fASqr = fAngle*fAngle;
500  Real fResult = (Real)3.705e-02;
501  fResult *= fASqr;
502  fResult -= (Real)4.967e-01;
503  fResult *= fASqr;
504  fResult += (Real)1.0;
505  return fResult;
506  }
507 
513  inline static Real FastCos1 (Real fAngle) {
514  Real fASqr = fAngle*fAngle;
515  Real fResult = -(Real)2.605e-07;
516  fResult *= fASqr;
517  fResult += (Real)2.47609e-05;
518  fResult *= fASqr;
519  fResult -= (Real)1.3888397e-03;
520  fResult *= fASqr;
521  fResult += (Real)4.16666418e-02;
522  fResult *= fASqr;
523  fResult -= (Real)4.999999963e-01;
524  fResult *= fASqr;
525  fResult += (Real)1.0;
526  return fResult;
527  }
528 
534  inline static Real FastTan0 (Real fAngle) {
535  Real fASqr = fAngle*fAngle;
536  Real fResult = (Real)2.033e-01;
537  fResult *= fASqr;
538  fResult += (Real)3.1755e-01;
539  fResult *= fASqr;
540  fResult += (Real)1.0;
541  fResult *= fAngle;
542  return fResult;
543  }
544 
550  inline static Real FastTan1 (Real fAngle) {
551  Real fASqr = fAngle*fAngle;
552  Real fResult = (Real)9.5168091e-03;
553  fResult *= fASqr;
554  fResult += (Real)2.900525e-03;
555  fResult *= fASqr;
556  fResult += (Real)2.45650893e-02;
557  fResult *= fASqr;
558  fResult += (Real)5.33740603e-02;
559  fResult *= fASqr;
560  fResult += (Real)1.333923995e-01;
561  fResult *= fASqr;
562  fResult += (Real)3.333314036e-01;
563  fResult *= fASqr;
564  fResult += (Real)1.0;
565  fResult *= fAngle;
566  return fResult;
567  }
568 
574  inline static Real FastInvSin0 (Real fValue) {
575  Real fRoot = moMath<Real>::Sqrt(((Real)1.0)-fValue);
576  Real fResult = -(Real)0.0187293;
577  fResult *= fValue;
578  fResult += (Real)0.0742610;
579  fResult *= fValue;
580  fResult -= (Real)0.2121144;
581  fResult *= fValue;
582  fResult += (Real)1.5707288;
583  fResult = HALF_PI - fRoot*fResult;
584  return fResult;
585  }
586 
592  inline static Real FastInvSin1 (Real fValue) {
593  Real fRoot = moMath<Real>::Sqrt(FAbs(((Real)1.0)-fValue));
594  Real fResult = -(Real)0.0012624911;
595  fResult *= fValue;
596  fResult += (Real)0.0066700901;
597  fResult *= fValue;
598  fResult -= (Real)0.0170881256;
599  fResult *= fValue;
600  fResult += (Real)0.0308918810;
601  fResult *= fValue;
602  fResult -= (Real)0.0501743046;
603  fResult *= fValue;
604  fResult += (Real)0.0889789874;
605  fResult *= fValue;
606  fResult -= (Real)0.2145988016;
607  fResult *= fValue;
608  fResult += (Real)1.5707963050;
609  fResult = HALF_PI - fRoot*fResult;
610  return fResult;
611  }
612 
618  inline static Real FastInvCos0 (Real fValue) {
619  Real fRoot = moMath<Real>::Sqrt(((Real)1.0)-fValue);
620  Real fResult = -(Real)0.0187293;
621  fResult *= fValue;
622  fResult += (Real)0.0742610;
623  fResult *= fValue;
624  fResult -= (Real)0.2121144;
625  fResult *= fValue;
626  fResult += (Real)1.5707288;
627  fResult *= fRoot;
628  return fResult;
629  }
630 
636  inline static Real FastInvCos1 (Real fValue) {
637  Real fRoot = moMath<Real>::Sqrt(FAbs(((Real)1.0)-fValue));
638  Real fResult = -(Real)0.0012624911;
639  fResult *= fValue;
640  fResult += (Real)0.0066700901;
641  fResult *= fValue;
642  fResult -= (Real)0.0170881256;
643  fResult *= fValue;
644  fResult += (Real)0.0308918810;
645  fResult *= fValue;
646  fResult -= (Real)0.0501743046;
647  fResult *= fValue;
648  fResult += (Real)0.0889789874;
649  fResult *= fValue;
650  fResult -= (Real)0.2145988016;
651  fResult *= fValue;
652  fResult += (Real)1.5707963050;
653  fResult *= fRoot;
654  return fResult;
655  }
656 
662  inline static Real FastInvTan0 (Real fValue) {
663  Real fVSqr = fValue*fValue;
664  Real fResult = (Real)0.0208351;
665  fResult *= fVSqr;
666  fResult -= (Real)0.085133;
667  fResult *= fVSqr;
668  fResult += (Real)0.180141;
669  fResult *= fVSqr;
670  fResult -= (Real)0.3302995;
671  fResult *= fVSqr;
672  fResult += (Real)0.999866;
673  fResult *= fValue;
674  return fResult;
675  }
676 
682  inline static Real FastInvTan1 (Real fValue) {
683  Real fVSqr = fValue*fValue;
684  Real fResult = (Real)0.0028662257;
685  fResult *= fVSqr;
686  fResult -= (Real)0.0161657367;
687  fResult *= fVSqr;
688  fResult += (Real)0.0429096138;
689  fResult *= fVSqr;
690  fResult -= (Real)0.0752896400;
691  fResult *= fVSqr;
692  fResult += (Real)0.1065626393;
693  fResult *= fVSqr;
694  fResult -= (Real)0.1420889944;
695  fResult *= fVSqr;
696  fResult += (Real)0.1999355085;
697  fResult *= fVSqr;
698  fResult -= (Real)0.3333314528;
699  fResult *= fVSqr;
700  fResult += (Real)1.0;
701  fResult *= fValue;
702  return fResult;
703  }
704 
710  static Real FastInvSqrt (Real fValue);
711 
717  inline static Real FastNegExp0 (Real fValue) {
718  Real fResult = (Real)0.0038278;
719  fResult *= fValue;
720  fResult += (Real)0.0292732;
721  fResult *= fValue;
722  fResult += (Real)0.2507213;
723  fResult *= fValue;
724  fResult += (Real)1.0;
725  fResult *= fResult;
726  fResult *= fResult;
727  fResult = ((Real)1.0)/fResult;
728  return fResult;
729  }
730 
736  inline static Real FastNegExp1 (Real fValue) {
737  Real fResult = (Real)0.00026695;
738  fResult *= fValue;
739  fResult += (Real)0.00227723;
740  fResult *= fValue;
741  fResult += (Real)0.03158565;
742  fResult *= fValue;
743  fResult += (Real)0.24991035;
744  fResult *= fValue;
745  fResult += (Real)1.0;
746  fResult *= fResult;
747  fResult *= fResult;
748  fResult = ((Real)1.0)/fResult;
749  return fResult;
750  }
751 
757  inline static Real FastNegExp2 (Real fValue) {
758  Real fResult = (Real)0.000014876;
759  fResult *= fValue;
760  fResult += (Real)0.000127992;
761  fResult *= fValue;
762  fResult += (Real)0.002673255;
763  fResult *= fValue;
764  fResult += (Real)0.031198056;
765  fResult *= fValue;
766  fResult += (Real)0.250010936;
767  fResult *= fValue;
768  fResult += (Real)1.0;
769  fResult *= fResult;
770  fResult *= fResult;
771  fResult = ((Real)1.0)/fResult;
772  return fResult;
773  }
774 
780  inline static Real FastNegExp3 (Real fValue) {
781  Real fResult = (Real)0.0000006906;
782  fResult *= fValue;
783  fResult += (Real)0.0000054302;
784  fResult *= fValue;
785  fResult += (Real)0.0001715620;
786  fResult *= fValue;
787  fResult += (Real)0.0025913712;
788  fResult *= fValue;
789  fResult += (Real)0.0312575832;
790  fResult *= fValue;
791  fResult += (Real)0.2499986842;
792  fResult *= fValue;
793  fResult += (Real)1.0;
794  fResult *= fResult;
795  fResult *= fResult;
796  fResult = ((Real)1.0)/fResult;
797  return fResult;
798  }
799 
805  inline static Real DegToRad(Real iDeg)
806  {
807  return DEG_TO_RAD * iDeg;
808  }
809 
815  inline static Real RadToDeg(Real iRad)
816  {
817  return RAD_TO_DEG * iRad;
818  }
819 
823  static const Real EPSILON;
824  static const Real ZERO_TOLERANCE;
825  static const Real MAX_REAL;
826  static const Real PI;
827  static const Real TWO_PI;
828  static const Real HALF_PI;
829  static const Real INV_PI;
830  static const Real INV_TWO_PI;
831  static const Real DEG_TO_RAD;
832  static const Real RAD_TO_DEG;
833  static const Real LN_2;
834  static const Real LN_10;
835  static const Real INV_LN_2;
836  static const Real INV_LN_10;
837 };
838 
839 #ifndef MO_MACOSX
840 #ifndef MO_RASPBIAN
841 #ifndef MO_WIN32
845 #endif
846 #endif
847 #endif
848 
849 typedef moMath<long> moMathi;
850 typedef moMath<double> moMathd;
851 typedef moMath<float> moMathf;
852 
853 #ifdef MO_USING_VCXX
854  template<> const MOlong moMath<MOlong>::EPSILON = FLT_EPSILON;
855  template<> const MOlong moMath<MOlong>::ZERO_TOLERANCE = 1e-06f;
856  template<> const MOlong moMath<MOlong>::MAX_REAL = FLT_MAX;
857  template<> const MOlong moMath<MOlong>::PI = (MOlong)(4.0*atan(1.0));
858  template<> const MOlong moMath<MOlong>::TWO_PI = 2.0f*moMath<MOlong>::PI;
859  template<> const MOlong moMath<MOlong>::HALF_PI = 0.5f*moMath<MOlong>::PI;
860  template<> const MOlong moMath<MOlong>::INV_PI = 1.0f/moMath<MOlong>::PI;
861  template<> const MOlong moMath<MOlong>::INV_TWO_PI = 1.0f/moMath<MOlong>::TWO_PI;
862  template<> const MOlong moMath<MOlong>::DEG_TO_RAD = moMath<MOlong>::PI/180.0f;
863  template<> const MOlong moMath<MOlong>::RAD_TO_DEG = 180.0f/moMath<MOlong>::PI;
864  template<> const MOlong moMath<MOlong>::LN_2 = moMath<MOlong>::Log(2.0f);
865  template<> const MOlong moMath<MOlong>::LN_10 = moMath<MOlong>::Log(10.0f);
866  template<> const MOlong moMath<MOlong>::INV_LN_2 = 1.0f/moMath<MOlong>::LN_2;
867  template<> const MOlong moMath<MOlong>::INV_LN_10 = 1.0f/moMath<MOlong>::LN_10;
868 
869  template<> const MOfloat moMath<MOfloat>::EPSILON = FLT_EPSILON;
870  template<> const MOfloat moMath<MOfloat>::ZERO_TOLERANCE = 1e-06f;
871  template<> const MOfloat moMath<MOfloat>::MAX_REAL = FLT_MAX;
872  template<> const MOfloat moMath<MOfloat>::PI = (MOfloat)(4.0*atan(1.0));
873  template<> const MOfloat moMath<MOfloat>::TWO_PI = 2.0f*moMath<MOfloat>::PI;
874  template<> const MOfloat moMath<MOfloat>::HALF_PI = 0.5f*moMath<MOfloat>::PI;
875  template<> const MOfloat moMath<MOfloat>::INV_PI = 1.0f/moMath<MOfloat>::PI;
876  template<> const MOfloat moMath<MOfloat>::INV_TWO_PI = 1.0f/moMath<MOfloat>::TWO_PI;
877  template<> const MOfloat moMath<MOfloat>::DEG_TO_RAD = moMath<MOfloat>::PI/180.0f;
878  template<> const MOfloat moMath<MOfloat>::RAD_TO_DEG = 180.0f/moMath<MOfloat>::PI;
879  template<> const MOfloat moMath<MOfloat>::LN_2 = moMath<MOfloat>::Log(2.0f);
880  template<> const MOfloat moMath<MOfloat>::LN_10 = moMath<MOfloat>::Log(10.0f);
881  template<> const MOfloat moMath<MOfloat>::INV_LN_2 = 1.0f/moMath<MOfloat>::LN_2;
882  template<> const MOfloat moMath<MOfloat>::INV_LN_10 = 1.0f/moMath<MOfloat>::LN_10;
883 
884  template<> const MOdouble moMath<MOdouble>::EPSILON = DBL_EPSILON;
885  template<> const MOdouble moMath<MOdouble>::ZERO_TOLERANCE = 1e-08;
886  template<> const MOdouble moMath<MOdouble>::MAX_REAL = DBL_MAX;
887  template<> const MOdouble moMath<MOdouble>::PI = 4.0*atan(1.0);
888  template<> const MOdouble moMath<MOdouble>::TWO_PI = 2.0*moMath<MOdouble>::PI;
889  template<> const MOdouble moMath<MOdouble>::HALF_PI = 0.5*moMath<MOdouble>::PI;
890  template<> const MOdouble moMath<MOdouble>::INV_PI = 1.0/moMath<MOdouble>::PI;
891  template<> const MOdouble moMath<MOdouble>::INV_TWO_PI = 1.0/moMath<MOdouble>::TWO_PI;
892  template<> const MOdouble moMath<MOdouble>::DEG_TO_RAD = moMath<MOdouble>::PI/180.0;
893  template<> const MOdouble moMath<MOdouble>::RAD_TO_DEG = 180.0/moMath<MOdouble>::PI;
894  template<> const MOdouble moMath<MOdouble>::LN_2 = moMath<MOdouble>::Log(2.0);
895  template<> const MOdouble moMath<MOdouble>::LN_10 = moMath<MOdouble>::Log(10.0);
896  template<> const MOdouble moMath<MOdouble>::INV_LN_2 = 1.0/moMath<MOdouble>::LN_2;
897  template<> const MOdouble moMath<MOdouble>::INV_LN_10 = 1.0/moMath<MOdouble>::LN_10;
898 
899  template <>
900  long moMath<MOlong>::FastInvSqrt (MOlong fValue)
901  {
902 
903  return fValue;
904  }
905 
906  template <>
908  {
909  MOfloat fHalf = 0.5f*fValue;
910  int i = *(int*)&fValue;
911  i = 0x5f3759df - (i >> 1);
912  fValue = *(MOfloat*)&i;
913  fValue = fValue*(1.5f - fHalf*fValue*fValue);
914  return fValue;
915  }
916 
917  template <>
919  {
920  MOdouble dHalf = 0.5*dValue;
921  MOlonglong i = *(MOlonglong*)&dValue;
922  #if defined(WM4_USING_VC70) || defined(WM4_USING_VC6)
923  i = 0x5fe6ec85e7de30da - (i >> 1);
924  #else
925  i = 0x5fe6ec85e7de30daLL - (i >> 1);
926  #endif
927  dValue = *(MOdouble*)&i;
928  dValue = dValue*(1.5 - dHalf*dValue*dValue);
929  return dValue;
930  }
931 #endif
932 
933 #endif /*__MO_MATH_H__*/
934 
static Real FastInvTan1(Real fValue)
Definition: moMath.h:682
static const Real HALF_PI
Definition: moMath.h:828
static Real Log2(Real fValue)
Definition: moMath.h:230
moMath()
Definition: moMath.h:70
static Real FastCos1(Real fAngle)
Definition: moMath.h:513
static Real FastTan1(Real fAngle)
Definition: moMath.h:550
static Real FastTan0(Real fAngle)
Definition: moMath.h:534
static Real FastInvSin1(Real fValue)
Definition: moMath.h:592
static Real FastNegExp2(Real fValue)
Definition: moMath.h:757
static Real ACos(Real fValue)
Definition: moMath.h:81
static Real ATan2(Real fY, Real fX)
Definition: moMath.h:140
static Real IntervalRandom(Real fMin, Real fMax, Real rSeed)
Definition: moMath.h:451
static Real SymmetricRandom(Real rSeed)
Definition: moMath.h:440
static const Real RAD_TO_DEG
Definition: moMath.h:832
static const Real INV_TWO_PI
Definition: moMath.h:830
static Real FastInvCos1(Real fValue)
Definition: moMath.h:636
static Real Sin(Real fValue)
Definition: moMath.h:260
moMath< float > moMathf
Definition: moMath.h:851
static Real Tan(Real fValue)
Definition: moMath.h:288
moMath< long > moMathi
Definition: moMath.h:849
static const Real TWO_PI
Definition: moMath.h:827
static Real Log(Real fValue)
Definition: moMath.h:220
~moMath()
Definition: moMath.h:74
static Real Sqr(Real fValue)
Definition: moMath.h:270
static Real FastNegExp0(Real fValue)
Definition: moMath.h:717
static const Real ZERO_TOLERANCE
Definition: moMath.h:824
static Real SymmetricRandom(unsigned int uiSeed=0)
Definition: moMath.h:396
#define LIBMOLDEO_API
Definition: moTypes.h:180
#define MOfloat
Definition: moTypes.h:403
static Real Floor(Real fValue)
Definition: moMath.h:190
static const Real EPSILON
Definition: moMath.h:823
#define MOlong
Definition: moTypes.h:391
static Real ATan(Real fValue)
Definition: moMath.h:129
static const Real LN_2
Definition: moMath.h:833
static Real Log10(Real fValue)
Definition: moMath.h:240
static Real DegToRad(Real iDeg)
Definition: moMath.h:805
static const Real MAX_REAL
Definition: moMath.h:825
static Real InvSqrt(Real fValue)
Definition: moMath.h:210
static Real FastNegExp3(Real fValue)
Definition: moMath.h:780
static Real Sqrt(Real fValue)
Definition: moMath.h:279
static Real ASin(Real fValue)
Definition: moMath.h:105
static char Sign(int iValue)
Definition: moMath.h:341
static Real FastCos0(Real fAngle)
Definition: moMath.h:498
static const Real INV_LN_10
Definition: moMath.h:836
static Real FastSin0(Real fAngle)
Definition: moMath.h:460
static const Real LN_10
Definition: moMath.h:834
static Real FastInvTan0(Real fValue)
Definition: moMath.h:662
static Real UnitRandom(Real rSeed)
Definition: moMath.h:431
static Real RadToDeg(Real iRad)
Definition: moMath.h:815
const MOlong PI
Definition: moMath.cpp:44
static Real Cos(Real fValue)
Definition: moMath.h:160
static Real FastInvSqrt(Real fValue)
static Real FMod(Real fX, Real fY)
Definition: moMath.h:200
#define MOdouble
Definition: moTypes.h:404
bool IsPowerOfTwo(int iValue)
Definition: moMath.h:297
static Real FastInvSin0(Real fValue)
Definition: moMath.h:574
#define MOlonglong
Definition: moTypes.h:393
static Real FastInvCos0(Real fValue)
Definition: moMath.h:618
static int ScaledFloatToInt(float fFloat, int iLog)
Definition: moMath.h:322
Definition: moMath.h:64
static const Real INV_LN_2
Definition: moMath.h:835
static const Real PI
Definition: moMath.h:826
static Real Pow(Real fBase, Real fExponent)
Definition: moMath.h:250
static Real FastNegExp1(Real fValue)
Definition: moMath.h:736
moMath< double > moMathd
Definition: moMath.h:850
static Real IntervalRandom(Real fMin, Real fMax, unsigned int uiSeed=0)
Definition: moMath.h:414
static const Real DEG_TO_RAD
Definition: moMath.h:831
static Real FAbs(Real fValue)
Definition: moMath.h:180
static Real Sign(Real fValue)
Definition: moMath.h:360
static Real UnitRandom(unsigned int uiSeed=0)
Definition: moMath.h:380
static Real FastSin1(Real fAngle)
Definition: moMath.h:476
static Real Exp(Real fValue)
Definition: moMath.h:170
static const Real INV_PI
Definition: moMath.h:829
static Real Ceil(Real fValue)
Definition: moMath.h:150
unsigned int Log2OfPowerOfTwo(unsigned int uiPowerOfTwo)
Definition: moMath.h:306