mathutil.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. //
  19. // Filename: mathutil.h
  20. // Project: wwutil
  21. // Author: Tom Spencer-Smith
  22. // Date: June 1998
  23. // Description: static
  24. //
  25. //-----------------------------------------------------------------------------
  26. #if defined(_MSV_VER)
  27. #pragma once
  28. #endif
  29. #ifndef MATHUTIL_H
  30. #define MATHUTIL_H
  31. class cMathUtil
  32. {
  33. public:
  34. static void Angle_To_Vector(double angle, double & dx, double & dy);
  35. static void Vector_To_Angle(double dx, double dy, double & angle);
  36. static double Simple_Distance(double x1, double y1, double x2, double y2);
  37. static int Round(double arg);
  38. static void Rotate_Vector(double & vx, double & vy, double angle);
  39. //
  40. // Random numbers generated according to simple
  41. // Probability Density Functions
  42. //
  43. static double Get_Uniform_Pdf_Double(double lower, double upper);
  44. static double Get_Normalized_Uniform_Pdf_Double();
  45. static int Get_Uniform_Pdf_Int(int lower, int upper);
  46. static double Get_Hat_Pdf_Double(double lower, double upper);
  47. static double Get_Normalized_Hat_Pdf_Double();
  48. static int Get_Hat_Pdf_Int(int lower, int upper);
  49. static const double PI;
  50. static const double PI_2;
  51. };
  52. #endif // MATHUTIL_H