|

INTRODUCTION
Overview
Download and Install
Documentation
Publications
REPOSITORY
Libraries
DEVELOPER
Dev Guide
Dashboard
PEOPLE
Contributors
Users

Project
Download
Mailing lists
|
|
|
17#ifndef GBXUTILACFR_MATH_DEFINITIONS_H
18#define GBXUTILACFR_MATH_DEFINITIONS_H
21 #if defined (GBXUTILACFR_STATIC)
22 #define GBXUTILACFR_EXPORT
23 #elif defined (GBXUTILACFR_EXPORTS)
24 #define GBXUTILACFR_EXPORT __declspec (dllexport)
26 #define GBXUTILACFR_EXPORT __declspec (dllimport)
29 #define GBXUTILACFR_EXPORT
41#define _USE_MATH_DEFINES
52#define M_PI 3.14159265358979323846
57#define NAN (__builtin_nanf(""))
62#define INF (__builtin_inff())
70#define DEG2RAD_RATIO (M_PI/180.0)
74#define DEG2RAD(deg) ((deg)*DEG2RAD_RATIO)
76#define RAD2DEG(rad) ((rad)/DEG2RAD_RATIO)
81GBXUTILACFR_EXPORT inline void NORMALISE_ANGLE( double &theta )
85 if (theta >= -M_PI && theta < M_PI)
88 multiplier = std::floor(theta / (2*M_PI));
89 theta -= multiplier*2*M_PI;
92 else if (theta < -M_PI)
99GBXUTILACFR_EXPORT inline void NORMALISE_ANGLE( float &theta )
101 double thDouble = theta;
102 NORMALISE_ANGLE( thDouble );
103 theta = (float)thDouble;
115#define MIN(x, y) (((x) < (y)) ? (x) : (y))
119#define MAX(x, y) (((x) > (y)) ? (x) : (y))
125#define APPLY_LIMITS(max_x, x, min_x) \
126 if((x)>(max_x)) x=(max_x); if((x)<(min_x)) x=(min_x);
130#define NORM2(x, y) (sqrt((x)*(x)+(y)*(y)))
134#define NORM3(x, y, z) (sqrt((x)*(x)+(y)*(y)+(z)*(z)))
138#define ROUND(x) ((int)(x+0.5))
143#define ROUND_TO(n,d) (d*rint(n/d))
147#define SIGN(A) ((A)<0?(-1):(1))
151#define COS_LAW(side1, side2, theta) \
152 (sqrt(SQR(side1)+SQR(side2)-2.0*(side1)*(side2)*cos(theta)))
156#define INV_COS_LAW(oppSide, side1, side2) \
157 (acos((SQR(side1)+SQR(side2)-SQR(oppSide))/(2.0*(side1)*(side2))))
161#if defined (__SVR4) && defined (__sun)
163 __extension__ ({ __typeof (x) __x_f = (x); \
164 __builtin_expect(!isnan(__x_f - __x_f), 1); })
167 __extension__ ({ __typeof (x) __x_i = (x); \
168 __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })
178#define NEAR(x,y,epsilon) (((x) > (y)-(epsilon)) && ((x) < (y)+(epsilon)))
184GBXUTILACFR_EXPORT void
185CLIP_TO_LIMITS( const T &min_x, T &x, const T &max_x )
187 assert( min_x <= max_x );
190 else if ( x < min_x )
|
|