00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#ifndef TYPES_H
00019
#define TYPES_H
00020
00021
#if defined(__GNUC__) && (__GNUC__ < 3)
00022
00023
00024
00025
#define WRONG_INNER_CLASSES_ACCESS
00026
00027
00028
#else
00029
00030
#define HAS_LIMITS
00031
00032
#endif
00033
00034
00035
#ifdef HAS_LIMITS
00036
#include<limits>
00037
#endif
00038
00039
#include <algorithm>
00040
00041
00042
00043
00044
00048
typedef double DBL;
00049
00051
typedef float FLT;
00052
00054
typedef float CLR;
00055
00056
00058
typedef unsigned short int CNT8;
00059
00061
typedef unsigned int CNT;
00062
00066
typedef unsigned int CNTREF;
00067
00068
00069
00070
00071
00072
00073
static const DBL PI = 3.1415926535897932384626;
00074
00075
#ifdef HAS_LIMITS
00076
static const DBL DBL_INFINITY = std::numeric_limits<DBL>::max();
00077
#else
00078
static const DBL DBL_INFINITY = 1.79769e308;
00079
#endif
00080
00081
static const DBL DIRECTION_EPSILON = 1e-10;
00082
00083
static const DBL INTERSECTION_INFINIT_TIME = DBL_INFINITY;
00084
static const DBL INTERSECTION_TIME_EPSILON = 1e-6;
00085
00086
class Scene;
00087
extern Scene* globalscene;
00088
00089
00090
00091
00092
00093
inline FLT rad2deg(FLT angle) {
return angle * (180.0/PI);}
00094
inline DBL rad2deg(DBL angle) {
return angle * (180.0/PI);}
00095
00096
inline FLT deg2rad(FLT angle) {
return angle * (PI/180.0);}
00097
inline DBL deg2rad(DBL angle) {
return angle * (PI/180.0);}
00098
00099
template<
class T>
static T sqr(T a) {
return a*a;}
00100
template<
class T>
static T pow3(T a) {
return a*a*a;}
00101
template<
class T>
static T pow4(T a) {
return a*a*a*a;}
00102
template<
class T>
static T pow5(T a) {
return a*a*a*a*a;}
00103
00104
template<
class T>
static T clip01(T a) {
return std::max(std::min((T)1,a),(T)0);}
00105
00106
00107
00108
00109
00110
00111
00112
#endif