TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g3dmath.h
Go to the documentation of this file.
1 
16 #ifndef G3D_g3dmath_h
17 #define G3D_g3dmath_h
18 
19 #ifdef _MSC_VER
20 // Disable conditional expression is constant, which occurs incorrectly on inlined functions
21 # pragma warning (push)
22 # pragma warning (disable : 4127)
23 // disable: "C++ exception handler used"
24 # pragma warning (disable : 4530)
25 #endif
26 
27 #include "G3D/platform.h"
28 #include <ctype.h>
29 #include <float.h>
30 #include <limits>
31 #include <stdlib.h>
32 #include <stdint.h>
33 
34 #if defined(_MSC_VER) && (_MSC_VER < 1000)
35  // Visual Studio is missing inttypes.h
36 # ifndef PRId64
37 # define PRId64 "I64d"
38 # endif
39 #else
40 #include <inttypes.h>
41 #endif
42 
43 /*These defines enable functionality introduced with the 1999 ISO C
44 **standard. They must be defined before the inclusion of math.h to
45 **engage them. If optimisation is enabled, these functions will be
46 **inlined. With optimisation switched off, you have to link in the
47 **maths library using -lm.
48 */
49 
50 #define _ISOC9X_SOURCE1
51 #define _ISOC99_SOURCE1
52 #define __USE_ISOC9X1
53 #define __USE_ISOC991
54 
55 #include <math.h>
56 
57 #include "G3D/debug.h"
58 
59 #undef min
60 #undef max
61 
68 #define G3D_DECLARE_SYMBOL(s) \
69  static const std::string SYMBOL_##s = #s
70 
71 
72 namespace G3D {
73 
74 #ifdef _MSC_VER
75 inline double __fastcall drand48() {
76  return ::rand() / double(RAND_MAX);
77 }
78 
79 # ifdef _M_IX86
80  // 32-bit
95  __inline long int lrint (double flt) {
96  int intgr;
97 
98  _asm {
99  fld flt
100  fistp intgr
101  };
102 
103  return intgr;
104  }
105 
106  __inline long int lrintf(float flt) {
107  int intgr;
108 
109  _asm {
110  fld flt
111  fistp intgr
112  };
113 
114  return intgr;
115  }
116 # else
117  // 64-bit
118 
119  __inline long int lrintf(float flt) {
120  return (long int)(flt + 0.5f);
121  }
122 
123  __inline long int lrint (double flt) {
124  return (long int)(flt + 0.5);
125  }
126 
127 # endif
128 #endif
129 
130 
131 #define fuzzyEpsilon64 (0.0000005)
132 #define fuzzyEpsilon32 (0.00001f)
133 
137 double inf();
138 
141 double nan();
142 
143 float finf();
144 
145 float fnan();
146 
147 inline double pi() {
148  return 3.1415926535898;
149 }
150 
151 inline float pif() {
152  return 3.1415926535898f;
153 }
154 
155 inline double halfPi() {
156  return 1.57079633;
157 }
158 
159 inline double twoPi() {
160  return 6.28318531;
161 }
162 
163 typedef int8_t int8;
164 typedef uint8_t uint8;
165 typedef int16_t int16;
166 typedef uint16_t uint16;
167 typedef int32_t int32;
168 typedef uint32_t uint32;
169 typedef int64_t int64;
170 typedef uint64_t uint64;
171 
172 typedef float float32;
173 typedef double float64;
174 
175 int iAbs(int iValue);
176 int iCeil(double fValue);
177 
181 int iClamp(int val, int low, int hi);
182 int16 iClamp(int16 val, int16 low, int16 hi);
183 double clamp(double val, double low, double hi);
184 float clamp(float val, float low, float hi);
185 
189 inline double lerp(double a, double b, double f) {
190  return a + (b - a) * f;
191 }
192 
193 inline float lerp(float a, float b, float f) {
194  return a + (b - a) * f;
195 }
196 
203 int iWrap(int val, int hi);
204 
205 int iFloor(double fValue);
206 
207 int iSign(int iValue);
208 int iSign(double fValue);
209 
210 inline int iSign(float f) {
211  return iSign((double)f);
212 }
213 
214 inline double round(double f) {
215  return floor(f + 0.5f);
216 }
217 
218 inline float round(float f) {
219  return floor(f + 0.5f);
220 }
221 
226 inline int iRound(double fValue) {
227  return lrint(fValue);
228 }
229 
234 inline int iRound(float f) {
235  return lrintf(f);
236 }
237 
243 int iRandom(int low, int hi);
244 
245 double abs (double fValue);
246 double aCos (double fValue);
247 double aSin (double fValue);
248 double aTan (double fValue);
249 double aTan2 (double fY, double fX);
250 double sign (double fValue);
251 double square (double fValue);
252 
256 bool isFinite(double x);
257 
263 bool isNaN(double x);
264 bool isNaN(float x);
265 inline bool isNaN(int x) {
266  (void)x;
267  return false;
268 }
269 
270 inline bool isNaN(uint64 x) {
271  (void)x;
272  return false;
273 }
274 
278 int iMod3(int x);
279 
285 float uniformRandom(float low = 0.0f, float hi = 1.0f);
286 
293 float gaussRandom(float mean = 0.0f, float stdev = 1.0f);
294 
295 
297 template <class T>
298 inline T pow5(T x) {
299  const T y = x * x;
300  return y * y * x;
301 }
302 
303 
304 template <class T>
305 inline T min(const T& x, const T& y) {
306  return std::min<T>(x, y);
307 }
308 
309 template <class T>
310 inline T min(const T& x, const T& y, const T& z) {
311  return std::min<T>(std::min<T>(x, y), z);
312 }
313 
314 template <class T>
315 inline T min(const T& x, const T& y, const T& z, const T& w) {
316  return std::min<T>(std::min<T>(x, y), std::min<T>(z, w));
317 }
318 
319 template <class T>
320 inline T max(const T& x, const T& y) {
321  return std::max<T>(x, y);
322 }
323 
324 template <class T>
325 inline T max(const T& x, const T& y, const T& z) {
326  return std::max<T>(std::max<T>(x, y), z);
327 }
328 
329 template <class T>
330 inline T max(const T& x, const T& y, const T& z, const T& w) {
331  return std::max<T>(std::max<T>(x, y), std::max<T>(z, w));
332 }
333 
334 int iMin(int x, int y);
335 int iMax(int x, int y);
336 
337 double square(double x);
338 double sumSquares(double x, double y);
339 double sumSquares(double x, double y, double z);
340 double distance(double x, double y);
341 double distance(double x, double y, double z);
342 
349 int highestBit(uint32 x);
350 
356 bool fuzzyEq(double a, double b);
357 
358 
362 bool fuzzyNe(double a, double b);
363 
366 bool fuzzyGt(double a, double b);
367 
369 bool fuzzyGe(double a, double b);
370 
372 bool fuzzyLt(double a, double b);
373 
375 bool fuzzyLe(double a, double b);
376 
380 inline float rsq(float x) {
381  return 1.0f / sqrtf(x);
382 }
383 
389 int ceilPow2(unsigned int in);
390 
392 inline int pow2(unsigned int x) {
393  return 1 << x;
394 }
395 
396 inline double log2(double x) {
397  return ::log(x) * 1.442695;
398 }
399 
400 inline float log2(float x) {
401  return ::logf(x) * 1.442695f;
402 }
403 
404 inline double log2(int x) {
405  return log2((double)x);
406 }
407 
408 
412 bool isPow2(int num);
413 bool isPow2(uint64 num);
414 
415 bool isOdd(int num);
416 bool isEven(int num);
417 
418 double toRadians(double deg);
419 double toDegrees(double rad);
420 
424 inline bool any(float x) {
425  return x != 0;
426 }
427 
431 inline bool all(float x) {
432  return x != 0;
433 }
434 
438 inline float normalize(float v) {
439  return v / v;
440 }
441 
445 inline float dot(float a, float b) {
446  return a * b;
447 }
448 
449 
453 inline float mul(float a, float b) {
454  return a * b;
455 }
456 
460 inline double exp2(double x) {
461  return pow(2.0, x);
462 }
463 
464 inline float exp2(float x) {
465  return powf(2.0f, x);
466 }
467 
469 inline double rsqrt(double x) {
470  return 1.0 / sqrt(x);
471 }
472 
474 inline float rsqrt(float x) {
475  // TODO: default this to using the SSE2 instruction
476  return 1.0f / sqrtf(x);
477 }
478 
482 inline double sinc(double x) {
483  double r = sin(x) / x;
484 
485  if (isNaN(r)) {
486  return 1.0;
487  } else {
488  return r;
489  }
490 }
491 
495 inline float wrap(float t, float lo, float hi) {
496  if ((t >= lo) && (t < hi)) {
497  return t;
498  }
499 
500  debugAssert(hi > lo);
501 
502  float interval = hi - lo;
503 
504  return t - interval * iFloor((t - lo) / interval);
505 }
506 
507 
508 inline double wrap(double t, double lo, double hi) {
509  if ((t >= lo) && (t < hi)) {
510  return t;
511  }
512 
513  debugAssert(hi > lo);
514 
515  double interval = hi - lo;
516 
517  return t - interval * iFloor((t - lo) / interval);
518 }
519 
520 inline double wrap(double t, double hi) {
521  return wrap(t, 0.0, hi);
522 }
523 
524 
525 inline bool isFinite(double x) {
526  return ! isNaN(x) && (x < G3D::inf()) && (x > -G3D::inf());
527 }
528 
529 inline bool isFinite(float x) {
530  return ! isNaN(x) && (x < G3D::finf()) && (x > -G3D::finf());
531 }
532 
533 //----------------------------------------------------------------------------
534 inline int iAbs (int iValue) {
535  return ( iValue >= 0 ? iValue : -iValue );
536 }
537 
538 //----------------------------------------------------------------------------
539 inline int iCeil (double fValue) {
540  return int(::ceil(fValue));
541 }
542 
543 //----------------------------------------------------------------------------
544 
545 inline int iClamp(int val, int low, int hi) {
546  debugAssert(low <= hi);
547  if (val <= low) {
548  return low;
549  } else if (val >= hi) {
550  return hi;
551  } else {
552  return val;
553  }
554 }
555 
556 //----------------------------------------------------------------------------
557 
558 inline int16 iClamp(int16 val, int16 low, int16 hi) {
559  debugAssert(low <= hi);
560  if (val <= low) {
561  return low;
562  } else if (val >= hi) {
563  return hi;
564  } else {
565  return val;
566  }
567 }
568 
569 //----------------------------------------------------------------------------
570 
571 inline double clamp(double val, double low, double hi) {
572  debugAssert(low <= hi);
573  if (val <= low) {
574  return low;
575  } else if (val >= hi) {
576  return hi;
577  } else {
578  return val;
579  }
580 }
581 
582 inline float clamp(float val, float low, float hi) {
583  debugAssert(low <= hi);
584  if (val <= low) {
585  return low;
586  } else if (val >= hi) {
587  return hi;
588  } else {
589  return val;
590  }
591 }
592 //----------------------------------------------------------------------------
593 
594 inline int iWrap(int val, int hi) {
595  if (val < 0) {
596  return ((val % hi) + hi) % hi;
597  } else {
598  return val % hi;
599  }
600 }
601 
602 //----------------------------------------------------------------------------
603 inline int iFloor (double fValue) {
604  return int(::floor(fValue));
605 }
606 
607 //----------------------------------------------------------------------------
608 inline int iSign (int iValue) {
609  return ( iValue > 0 ? + 1 : ( iValue < 0 ? -1 : 0 ) );
610 }
611 
612 inline int iSign (double fValue) {
613  return ( fValue > 0.0 ? + 1 : ( fValue < 0.0 ? -1 : 0 ) );
614 }
615 
616 //----------------------------------------------------------------------------
617 inline double abs (double fValue) {
618  return double(::fabs(fValue));
619 }
620 
621 //----------------------------------------------------------------------------
622 inline double aCos (double fValue) {
623  if ( -1.0 < fValue ) {
624  if ( fValue < 1.0 )
625  return double(::acos(fValue));
626  else
627  return 0.0;
628  } else {
629  return pi();
630  }
631 }
632 
633 inline float acos (float fValue) {
634  if ( -1.0f < fValue ) {
635  if ( fValue < 1.0f ) {
636  return ::acos(fValue);
637  } else {
638  return 0.0f;
639  }
640  } else {
641  return pif();
642  }
643 }
644 
645 //----------------------------------------------------------------------------
646 inline double aSin (double fValue) {
647  if ( -1.0 < fValue ) {
648  if ( fValue < 1.0 ) {
649  return double(::asin(fValue));
650  } else {
651  return -halfPi();
652  }
653  } else {
654  return halfPi();
655  }
656 }
657 
658 //----------------------------------------------------------------------------
659 inline double aTan (double fValue) {
660  return double(::atan(fValue));
661 }
662 
663 //----------------------------------------------------------------------------
664 inline double aTan2 (double fY, double fX) {
665  return double(::atan2(fY, fX));
666 }
667 
668 //----------------------------------------------------------------------------
669 inline double sign (double fValue) {
670  if (fValue > 0.0) {
671  return 1.0;
672  }
673 
674  if (fValue < 0.0) {
675  return -1.0;
676  }
677 
678  return 0.0;
679 }
680 
681 inline float sign (float fValue) {
682  if (fValue > 0.0f) {
683  return 1.0f;
684  }
685 
686  if (fValue < 0.0f) {
687  return -1.0f;
688  }
689 
690  return 0.0f;
691 }
692 
693 
694 inline float uniformRandom(float low, float hi) {
695  return (hi - low) * float(::rand()) / float(RAND_MAX) + low;
696 }
697 
698 inline double square(double x) {
699  return x * x;
700 }
701 
702 inline float square(float x) {
703  return x * x;
704 }
705 
706 inline int square(int x) {
707  return x * x;
708 }
709 
710 //----------------------------------------------------------------------------
711 inline double sumSquares(double x, double y) {
712  return x*x + y*y;
713 }
714 
715 //----------------------------------------------------------------------------
716 inline float sumSquares(float x, float y) {
717  return x*x + y*y;
718 }
719 
720 //----------------------------------------------------------------------------
721 inline double sumSquares(double x, double y, double z) {
722  return x*x + y*y + z*z;
723 }
724 
725 //----------------------------------------------------------------------------
726 inline float sumSquares(float x, float y, float z) {
727  return x*x + y*y + z*z;
728 }
729 
730 //----------------------------------------------------------------------------
731 inline double distance(double x, double y) {
732  return sqrt(sumSquares(x, y));
733 }
734 
735 //----------------------------------------------------------------------------
736 inline float distance(float x, float y) {
737  return sqrt(sumSquares(x, y));
738 }
739 
740 //----------------------------------------------------------------------------
741 inline double distance(double x, double y, double z) {
742  return sqrt(sumSquares(x, y, z));
743 }
744 
745 //----------------------------------------------------------------------------
746 inline float distance(float x, float y, float z) {
747  return sqrt(sumSquares(x, y, z));
748 }
749 
750 //----------------------------------------------------------------------------
751 
753 inline int iMin(int x, int y) {
754  return (x >= y) ? y : x;
755 }
756 
757 //----------------------------------------------------------------------------
759 inline int iMax(int x, int y) {
760  return (x >= y) ? x : y;
761 }
762 
763 //----------------------------------------------------------------------------
764 inline int ceilPow2(unsigned int in) {
765  in -= 1;
766 
767  in |= in >> 16;
768  in |= in >> 8;
769  in |= in >> 4;
770  in |= in >> 2;
771  in |= in >> 1;
772 
773  return in + 1;
774 }
775 
776 inline bool isPow2(int num) {
777  return ((num & -num) == num);
778 }
779 
780 inline bool isPow2(uint64 x) {
781  // See http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/, method #9
782  return ((x != 0) && !(x & (x - 1)));
783 }
784 
785 inline bool isPow2(uint32 x) {
786  // See http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/, method #9
787  return ((x != 0) && !(x & (x - 1)));
788 }
789 
790 inline bool isOdd(int num) {
791  return (num & 1) == 1;
792 }
793 
794 inline bool isEven(int num) {
795  return (num & 1) == 0;
796 }
797 
798 inline double toRadians(double deg) {
799  return deg * pi() / 180.0;
800 }
801 
802 inline double toDegrees(double rad) {
803  return rad * 180.0 / pi();
804 }
805 
806 inline float toRadians(float deg) {
807  return deg * (float)pi() / 180.0f;
808 }
809 
810 inline float toDegrees(float rad) {
811  return rad * 180.0f / (float)pi();
812 }
813 
814 inline float toRadians(int deg) {
815  return deg * (float)pi() / 180.0f;
816 }
817 
818 inline float toDegrees(int rad) {
819  return rad * 180.0f / (float)pi();
820 }
824 inline double eps(double a, double b) {
825  // For a and b to be nearly equal, they must have nearly
826  // the same magnitude. This means that we can ignore b
827  // since it either has the same magnitude or the comparison
828  // will fail anyway.
829  (void)b;
830  const double aa = abs(a) + 1.0;
831  if (aa == inf()) {
832  return fuzzyEpsilon64;
833  } else {
834  return fuzzyEpsilon64 * aa;
835  }
836 }
837 
838 inline float eps(float a, float b) {
839  // For a and b to be nearly equal, they must have nearly
840  // the same magnitude. This means that we can ignore b
841  // since it either has the same magnitude or the comparison
842  // will fail anyway.
843  (void)b;
844  const float aa = (float)abs(a) + 1.0f;
845  if (aa == inf()) {
846  return fuzzyEpsilon32;
847  } else {
848  return fuzzyEpsilon32 * aa;
849  }
850 }
851 
852 
853 inline bool fuzzyEq(float a, float b) {
854  return (a == b) || (abs(a - b) <= eps(a, b));
855 }
856 
857 inline bool fuzzyEq(double a, double b) {
858  return (a == b) || (abs(a - b) <= eps(a, b));
859 }
860 
861 inline bool fuzzyNe(double a, double b) {
862  return ! fuzzyEq(a, b);
863 }
864 
865 inline bool fuzzyGt(double a, double b) {
866  return a > b + eps(a, b);
867 }
868 
869 inline bool fuzzyGe(double a, double b) {
870  return a > b - eps(a, b);
871 }
872 
873 inline bool fuzzyLt(double a, double b) {
874  return a < b - eps(a, b);
875 }
876 
877 inline bool fuzzyLe(double a, double b) {
878  return a < b + eps(a, b);
879 }
880 
881 inline int iMod3(int x) {
882  return x % 3;
883 }
884 
888 inline uint32 flipEndian32(const uint32 x) {
889  return (x << 24) | ((x & 0xFF00) << 8) |
890  ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24);
891 }
892 
896 inline uint16 flipEndian16(const uint16 x) {
897  return (x << 8) | ((x & 0xFF00) >> 8);
898 }
899 
901 inline float smoothstep(float edge0, float edge1, float x) {
902  // Scale, bias and saturate x to 0..1 range
903  x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
904 
905  // Evaluate polynomial
906  return x * x * (3 - 2 * x);
907 }
908 
909 
911 inline float smootherstep(float edge0, float edge1, float x) {
912 
913  // Scale, and saturate x to 0..1 range
914  x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
915 
916  // Evaluate polynomial
917  return x * x * x * (x * (x * 6 - 15) + 10);
918 }
919 
920 
922 inline float signedPow(float b, float e) {
923  return sign(b) * powf(fabsf(b), e);
924 }
925 
926 
928 inline double signedPow(double b, double e) {
929  return sign(b) * pow(abs(b), e);
930 }
931 
932 
933 } // namespace
934 
935 namespace std {
936 inline int pow(int a, int b) {
937  return (int)pow(double(a), double(b));
938 }
939 
940 }
941 #ifdef _MSC_VER
942 # pragma warning (pop)
943 #endif
944 
945 #endif
946 
float finf()
Definition: g3dmath.cpp:71
#define __fastcall
Fast call is a register-based optimized calling convention supported only by Visual C++...
Definition: platform.h:55
float fnan()
Definition: g3dmath.cpp:82
float signedPow(float b, float e)
Definition: g3dmath.h:922
int16_t int16
Definition: g3dmath.h:165
uint32 flipEndian32(const uint32 x)
Definition: g3dmath.h:888
double round(double f)
Definition: g3dmath.h:214
signed short int16_t
Definition: stdint.h:76
int iSign(int iValue)
Definition: g3dmath.h:608
double sumSquares(double x, double y)
Definition: g3dmath.h:711
double abs(double fValue)
Definition: g3dmath.h:617
static Vector3int16 floor(const Vector3 &v)
double aTan2(double fY, double fX)
Definition: g3dmath.h:664
int iAbs(int iValue)
Definition: g3dmath.h:534
double float64
Definition: g3dmath.h:173
int8_t int8
Definition: g3dmath.h:163
int iRound(double fValue)
Definition: g3dmath.h:226
TC_SHARED_API::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,::google::protobuf::internal::EnumTypeTraits< ::bgs::protocol::LogOption,::bgs::protocol::LogOption_IsValid >, 14, false > log
#define fuzzyEpsilon64
Definition: g3dmath.h:131
Definition: AABox.h:25
STL namespace.
bool any(float x)
Definition: g3dmath.h:424
bool isNaN(double x)
Definition: g3dmath.cpp:56
int iFloor(double fValue)
Definition: g3dmath.h:603
float mul(float a, float b)
Definition: g3dmath.h:453
int highestBit(uint32 x)
Definition: g3dmath.cpp:88
uint64_t uint64
Definition: g3dmath.h:170
bool fuzzyNe(double a, double b)
Definition: g3dmath.h:861
float rsq(float x)
Definition: g3dmath.h:380
double clamp(double val, double low, double hi)
Definition: g3dmath.h:571
float smoothstep(float edge0, float edge1, float x)
Definition: g3dmath.h:901
bool isPow2(int num)
Definition: g3dmath.h:776
uint16 flipEndian16(const uint16 x)
Definition: g3dmath.h:896
double pi()
Definition: g3dmath.h:147
signed __int64 int64_t
Definition: stdint.h:89
double aTan(double fValue)
Definition: g3dmath.h:659
double sinc(double x)
Definition: g3dmath.h:482
uint16_t uint16
Definition: g3dmath.h:166
double distance(double x, double y)
Definition: g3dmath.h:731
bool all(float x)
Definition: g3dmath.h:431
T max(const T &x, const T &y)
Definition: g3dmath.h:320
double log2(double x)
Definition: g3dmath.h:396
float wrap(float t, float lo, float hi)
Definition: g3dmath.h:495
unsigned int uint32_t
Definition: stdint.h:80
int iMod3(int x)
Definition: g3dmath.h:881
float normalize(float v)
Definition: g3dmath.h:438
float uniformRandom(float low=0.0f, float hi=1.0f)
Definition: g3dmath.h:694
T min(const T &x, const T &y)
Definition: g3dmath.h:305
double inf()
Definition: g3dmath.cpp:40
float gaussRandom(float mean=0.0f, float stdev=1.0f)
Definition: g3dmath.cpp:18
double toRadians(double deg)
Definition: g3dmath.h:798
unsigned __int64 uint64_t
Definition: stdint.h:90
#define debugAssert(exp)
Definition: debugAssert.h:160
G3D::int16 z
Definition: Vector3int16.h:46
float float32
Definition: g3dmath.h:172
G3D::int16 y
Definition: Vector2int16.h:38
bool isOdd(int num)
Definition: g3dmath.h:790
double square(double fValue)
Definition: g3dmath.h:698
bool isEven(int num)
Definition: g3dmath.h:794
double aCos(double fValue)
Definition: g3dmath.h:622
int pow2(unsigned int x)
Definition: g3dmath.h:392
#define fuzzyEpsilon32
Definition: g3dmath.h:132
double twoPi()
Definition: g3dmath.h:159
float acos(float fValue)
Definition: g3dmath.h:633
T pow5(T x)
Definition: g3dmath.h:298
int64_t int64
Definition: g3dmath.h:169
G3D::Quat pow(const G3D::Quat &q, double x)
Definition: Quat.h:761
uint8_t uint8
Definition: g3dmath.h:164
int iWrap(int val, int hi)
Definition: g3dmath.h:594
unsigned char uint8_t
Definition: stdint.h:78
float dot(float a, float b)
Definition: g3dmath.h:445
signed char int8_t
Definition: stdint.h:75
int32_t int32
Definition: g3dmath.h:167
double exp2(double x)
Definition: g3dmath.h:460
double toDegrees(double rad)
Definition: g3dmath.h:802
float pif()
Definition: g3dmath.h:151
signed int int32_t
Definition: stdint.h:77
double lerp(double a, double b, double f)
Definition: g3dmath.h:189
float smootherstep(float edge0, float edge1, float x)
Definition: g3dmath.h:911
bool fuzzyGt(double a, double b)
Definition: g3dmath.h:865
uint32_t uint32
Definition: g3dmath.h:168
bool fuzzyGe(double a, double b)
Definition: g3dmath.h:869
double aSin(double fValue)
Definition: g3dmath.h:646
G3D::int16 x
Definition: Vector2int16.h:37
static Vector3int16 ceil(const Vector3 &v)
Definition: Vector3int16.cpp:55
double eps(double a, double b)
Definition: g3dmath.h:824
double halfPi()
Definition: g3dmath.h:155
int iMax(int x, int y)
Definition: g3dmath.h:759
int iClamp(int val, int low, int hi)
Definition: g3dmath.h:545
int iRandom(int low, int hi)
Definition: g3dmath.cpp:110
double sign(double fValue)
Definition: g3dmath.h:669
int ceilPow2(unsigned int in)
Definition: g3dmath.h:764
unsigned short uint16_t
Definition: stdint.h:79
bool fuzzyEq(double a, double b)
Definition: g3dmath.h:857
double nan()
Definition: g3dmath.cpp:77
bool fuzzyLe(double a, double b)
Definition: g3dmath.h:877
bool isFinite(double x)
Definition: g3dmath.h:525
int iCeil(double fValue)
Definition: g3dmath.h:539
double rsqrt(double x)
Definition: g3dmath.h:469
int iMin(int x, int y)
Definition: g3dmath.h:753
bool fuzzyLt(double a, double b)
Definition: g3dmath.h:873