MathDefs.pkg 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $#include "MathDefs.h"
  2. static const float M_PI;
  3. static const float M_HALF_PI;
  4. static const int M_MIN_INT;
  5. static const int M_MAX_INT;
  6. static const unsigned M_MIN_UNSIGNED;
  7. static const unsigned M_MAX_UNSIGNED;
  8. static const float M_EPSILON;
  9. static const float M_LARGE_EPSILON;
  10. static const float M_MIN_NEARCLIP;
  11. static const float M_MAX_FOV;
  12. static const float M_LARGE_VALUE;
  13. static const float M_INFINITY;
  14. static const float M_DEGTORAD;
  15. static const float M_DEGTORAD_2;
  16. static const float M_RADTODEG;
  17. enum Intersection
  18. {
  19. OUTSIDE,
  20. INTERSECTS,
  21. INSIDE
  22. };
  23. bool Equals(float lhs, float rhs);
  24. bool IsNaN(float value);
  25. float Lerp(float lhs, float rhs, float t);
  26. float Min(float lhs, float rhs);
  27. float Max(float lhs, float rhs);
  28. float Abs(float value);
  29. float Sign(float value);
  30. float Clamp(float value, float min, float max);
  31. float SmoothStep(float lhs, float rhs, float t);
  32. float Sin(float angle);
  33. float Cos(float angle);
  34. float Tan(float angle);
  35. float Asin(float x);
  36. float Acos(float x);
  37. float Atan(float x);
  38. float Atan2(float y, float x);
  39. int Min @ MinInt(int lhs, int rhs);
  40. int Max @ MaxInt(int lhs, int rhs);
  41. int Abs @ AbsInt(int value);
  42. int Clamp @ ClampInt(int value, int min, int max);
  43. bool IsPowerOfTwo(unsigned value);
  44. unsigned NextPowerOfTwo(unsigned value);
  45. unsigned CountSetBits(unsigned value);
  46. unsigned SDBMHash(unsigned hash, unsigned char c);
  47. float Random();
  48. float Random(float range);
  49. float Random(float min, float max);
  50. int Random @ RandomInt(int range);
  51. int Random @ RandomInt(int min, int max);
  52. float RandomNormal(float meanValue, float variance);