Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgMath.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file SgMath.h
00003     Math utility functions. */
00004 //----------------------------------------------------------------------------
00005 
00006 #ifndef SG_MATH_H
00007 #define SG_MATH_H
00008 
00009 #include <cmath>
00010 
00011 //----------------------------------------------------------------------------
00012 
00013 /** Square-root of 2.
00014     Can be used instead of M_SQRT2 to support systems that don't define
00015     BSD math constants (Mac OS X Tiger?) */
00016 #define SG_SQRT2 1.41421356237309504880
00017 
00018 //----------------------------------------------------------------------------
00019 
00020 /** Math utility functions. */
00021 namespace SgMath
00022 {
00023     /** Round to the closest integer value. */
00024     int RoundToInt(double v);
00025 }
00026 
00027 inline int SgMath::RoundToInt(double v)
00028 {
00029     return static_cast<int>(std::floor(v + 0.5));
00030 }
00031 //----------------------------------------------------------------------------
00032 
00033 #endif // SG_MATH_H


Sun Mar 13 2011 Doxygen 1.7.1