VSToolsT.hh 3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*===========================================================================*\
 *                                                                           *
 *                               CoMISo                                      *
 *      Copyright (C) 2008-2009 by Computer Graphics Group, RWTH Aachen      *
 *                           www.rwth-graphics.de                            *
 *                                                                           *
 *---------------------------------------------------------------------------* 
 *  This file is part of CoMISo.                                             *
 *                                                                           *
 *  CoMISo is free software: you can redistribute it and/or modify           *
 *  it under the terms of the GNU General Public License as published by     *
 *  the Free Software Foundation, either version 3 of the License, or        *
 *  (at your option) any later version.                                      *
 *                                                                           *
 *  CoMISo is distributed in the hope that it will be useful,                *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU General Public License for more details.                             *
 *                                                                           *
 *  You should have received a copy of the GNU General Public License        *
 *  along with CoMISo.  If not, see <http://www.gnu.org/licenses/>.          *
 *                                                                           *
\*===========================================================================*/ 

25
26
#ifndef VSTOOLS_HH
#define VSTOOLS_HH
27

28
29
30
31
32
33

//== FORWARDDECLARATIONS ======================================================

//== NAMESPACES ===============================================================

//== DEFINITION =========================================================
34
35
36
37
38
39

/** These functions are required for Visual Studio to work around missing 
    functions. Basic equivalent functions for double exist in the float 
    header but are named different. So this wrapper makes them standard compatible.
    */
#ifdef WIN32
40
41
#include <math.h>
#include <float.h>
42

43
namespace std {
44

45
46
47
48
inline int isnan(double x)
{
  return _isnan(x);
} 
49

50
51
52
53
// Which idiot defines isinf as a macro somewhere?
#ifdef isinf 
#undef isinf
#endif
54

55
56
57
58
inline int isinf(double x)
{
  return !_finite(x);
} 
59

60
61
62
63
inline int isfinite(double x)
{
  return _finite(x);
}
64

65
}// namespace std
66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
inline double nearbyint(double x) 
{
   if( x >= 0.0 )
     return int( x + 0.5 );
   else
     return int( x - 0.5 );
}

inline double round ( double _value ) 
{
   return nearbyint(_value);
}

#endif //WIN32
81

82
//=============================================================================
83
#endif // VSTOOLS_HH defined
84
85
//=============================================================================