FastMath.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @file FastMath.h
  3. * @brief lookup tables and more
  4. * @author Erik Rodner
  5. * @date 07/31/2008
  6. */
  7. #ifndef FASTMATHINCLUDE
  8. #define FASTMATHINCLUDE
  9. namespace NICE {
  10. /** @brief some lookup tables suitable for image gradients */
  11. class FastMath
  12. {
  13. public:
  14. /** maximum value of image gradients */
  15. static const int gradientMaximum = 255;
  16. /** sqrt(.) 2*255^2 is the maximum value of the argument */
  17. static const int sqrtTableMaximum = 2*gradientMaximum*gradientMaximum+1;
  18. /** access to the sqrt table sqrtTable[y*gradientMaximum + x] */
  19. double *sqrtTable;
  20. /** lookup table for atan2 */
  21. static const int atan2TableMaximum = (2*gradientMaximum+1)*(2*gradientMaximum+1);
  22. /** access to the atan2 table atan2Table[y*gradientMaximum + x] */
  23. double *atan2Table;
  24. /** do not use this constructor directly */
  25. FastMath ();
  26. /** destructor: removes all lookup tables */
  27. ~FastMath ();
  28. /** get the singleton object instance */
  29. static FastMath & getSingleton () {
  30. static FastMath fastMathSingleton;
  31. return fastMathSingleton;
  32. }
  33. };
  34. } // namespace
  35. #endif