|
/************************************************************/
// MathDefinitions.h
// Coment: Defini��es e utilitarios
//
/************************************************************/
#pragma once
/*********** [ Constants ] *************/
/*********** [ Epsilon constants ] *************/
#define _EPSIOLON_H (1.0E-16)
#define _EPSIOLON_M (1.0E-12)
#define _EPSIOLON_L (1.0E-08)
#define _EPSLN _EPSIOLON_M
/*********** [ Fuzzy equality and zero tests for real numbers ] *************/
#define _FUZZ_REAL (1e-15) /*** [ Approximate floating point accuracy ] ***/
#define _FUZZ_GEN (1e-9) /*** [ General fuzz - nine decimal digits ] ***/
#define _FUZZ_DEG (3e-4) /*** [ Approximately one arc second, as degrees ] ***/
#define _FUZZ_RAD (5e-6) /*** [ Approximately one arc second, as radians ] ***/
#define _FUZZ_DIST (1e-6) /*** [ Geometric coincidence toelrance ] ***/
/*********** [ Angular constants ] *************/
#define _PIOVER2 (1.5707963267948966192313216916398)
#define _PI (3.141592653589793238462643383279500)
#define _3PIOVER2 (4.7123889803846898576939650749193)
#define _2PI (6.283185307179586476925286766559000)
#define _PI_OVER_180 (0.017453292519943295769236907684886)
#define _MAX_RADIANS 2PI
#define _MAX_DEGREES (360.0)
#define _MAX_GRADIANS (400.0)
#define _MAX_THOUSAND (6400.0)
/*********** [ Angular conversions ] *************/
#define _DEG2RAD (1.7453292519943295769236907684886e-2)
#define _RAD2DEG (57.295779513082320876798154814105)
#define _ONE_SEC_RAD (4.8481368110953599358991410235795e-6)
#define _ONE_MIN_RAD (2.9088820866572159615394846141477e-4)
/*********** [ Distance conversions ] *************/
#define _METER2FEET (3.2808398950131233595800524934383)
#define _FEET2METER (0.3048)
#define _MILE2FEET (5280.0)
#define _FEET2MILE (1.8939393939393939393939393939394e-4)
#define _METERS2MILE (0.0006213688756330195420511386584646)
#define _MILE2METER (1609.35)
#define _NAUTMILE2FEET (6076.1154855643044619422572178472)
#define _FEET2NAUTMILE (1.6457883369330453563714902807777e-4)
/*********** [ Speed conversions ] *************/
#define _METER_SEC2MPH (2.2369279522788703513840991704726)
#define _METER_SEC2KMPH (3.6)
#define _METER_SEC2KNOTS (1.942524361582627087283952850778)
#define _FEET_SEC2METER_SEC (0.3048)
#define _FEET_SEC2KNOTS (0.59208797017731120493004422500974)
#define _FEET_SEC2MPH (0.68181818181818181818181818181818)
/*********** [ Macros ] *************/
#define SQUARE(x) x * x /*** [ x**2 ] ***/
#define CUBE(x) x * x * x /*** [ x**3 ] ***/
#define QUAD(x) x * x * x * x /*** [ x**4 ] ***/
#define GMAX(A, B) ((A) > (B) ? (A) : (B)) /*** [ Assign maximum of a and b ] ***/
#define GMIN(A, B) ((A) < (B) ? (A) : (B)) /*** [ Assign minimum of a and b ] ***/
#define IMOD(A, B) (A) - (((A) / (B)) * (B)) /*** [ Integer mod function ] ***/
#define EQ(a,b) (fabs(a-b)<1.666E-15)
#define ABS(x) ((x) < 0.0 ? -(x) : (x))
#define SWAP(x,y,type)\
{\
type z = x;\
x = y;\
y = z;\
}
#define DATA_EXCHANGE_NUMBER_UNITS 2
#define DEG2RAD(a) (_PI_OVER_180*(a))
#define RAD2DEG(a) (_RAD2DEG*(a))
/*********** [ GDI+ ] *************/
#define RECTFTOP(rec) (rec.Y+rec.Height)
/*********** [ Inline definitions ] *************/
inline int Double2Integer(double dValue) /*** [ Double => int (faster than a (cast)) ] ***/
{
static double dScale = 6755399441055744.0;
static double dDouble = 0.0;
static int *pnInteger = (int*) &dDouble;
dDouble = dValue + dScale;
return *pnInteger;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Matão, a small city in Brazil. I studied as Programmer in a College for Software Development in Database.
After finishing the College I have been working with java, c# and Computer Graphics with searches for OpenGL.