Drag[en]gine Game Engine  1.21
decMath.h File Reference

Class for mathematical calculations. More...

#include <math.h>
#include <stdlib.h>
#include "../../dragengine_export.h"
#include "decVector.h"
#include "decVector2.h"
#include "decVector4.h"
#include "decDVector.h"
#include "decDVector4.h"
#include "decQuaternion.h"
#include "decPoint.h"
#include "decPoint3.h"
#include "decColor.h"
#include "decMatrix.h"
#include "decDMatrix.h"
#include "decTexMatrix.h"
#include "decTexMatrix2.h"
#include "decColorMatrix.h"
#include "decColorMatrix3.h"
#include "decBoundary.h"

Namespaces

 decMath
 

Macros

#define COLOR_THRESHOLD   1e-5f
 
#define CURVE_THRESHOLD   1e-6f
 
#define DEG2RAD   (PI / 180.0f)
 Degree to radians. More...
 
#define DOUBLE_EPSILON   2.220446049250313e-16
 
#define DOUBLE_SAFE_EPSILON   1e-15
 
#define DVECTOR_THRESHOLD   1e-6
 
#define FLOAT_EPSILON   1.1929093e-7f
 Floating point thresholds (epsilons). More...
 
#define FLOAT_SAFE_EPSILON   1e-6f
 
#define HALF_PI   (PI / 2.0f)
 Value of half pi. More...
 
#define PI   3.14159265f
 Value of pi. More...
 
#define QUATERNION_THRESHOLD   1e-5f
 
#define RAD2DEG   (180.0f / PI)
 Radians to degree. More...
 
#define TEXEL_THRESHOLD   1e-5f
 
#define TWO_PI   (PI * 2.0f)
 Value of two pi. More...
 
#define VECTOR_THRESHOLD   1e-6f
 

Functions

DE_DLL_EXPORT double decMath::clamp (double x, double lower, double upper)
 Clamp value to range. More...
 
DE_DLL_EXPORT float decMath::clamp (float x, float lower, float upper)
 Clamp value to range. More...
 
DE_DLL_EXPORT int decMath::clamp (int x, int lower, int upper)
 Clamp value to range. More...
 
DE_DLL_EXPORT double decMath::linearStep (double x, double lower, double upper)
 Linear map x to the range from 0 to 1. More...
 
DE_DLL_EXPORT double decMath::linearStep (double x, double lower, double upper, double mapLower, double mapUpper)
 Linear map x from one range to another range. More...
 
DE_DLL_EXPORT float decMath::linearStep (float x, float lower, float upper)
 Linear map x to the range from 0 to 1. More...
 
DE_DLL_EXPORT float decMath::linearStep (float x, float lower, float upper, float mapLower, float mapUpper)
 Linear map x from one range to another range. More...
 
DE_DLL_EXPORT double decMath::max (double a, double b)
 Larger of two values. More...
 
DE_DLL_EXPORT double decMath::max (double a, double b, double c)
 Larger of three values. More...
 
DE_DLL_EXPORT double decMath::max (double a, double b, double c, double d)
 Larger of four values. More...
 
DE_DLL_EXPORT float decMath::max (float a, float b)
 Larger of two values. More...
 
DE_DLL_EXPORT float decMath::max (float a, float b, float c)
 Larger of three values. More...
 
DE_DLL_EXPORT float decMath::max (float a, float b, float c, float d)
 Larger of four values. More...
 
DE_DLL_EXPORT int decMath::max (int a, int b)
 Larger of two values. More...
 
DE_DLL_EXPORT int decMath::max (int a, int b, int c)
 Larger of three values. More...
 
DE_DLL_EXPORT int decMath::max (int a, int b, int c, int d)
 Larger of four values. More...
 
DE_DLL_EXPORT double decMath::min (double a, double b)
 Smaller of two values. More...
 
DE_DLL_EXPORT double decMath::min (double a, double b, double c)
 Smaller of three values. More...
 
DE_DLL_EXPORT double decMath::min (double a, double b, double c, double d)
 Smaller of four values. More...
 
DE_DLL_EXPORT float decMath::min (float a, float b)
 Smaller of two values. More...
 
DE_DLL_EXPORT float decMath::min (float a, float b, float c)
 Smaller of three values. More...
 
DE_DLL_EXPORT float decMath::min (float a, float b, float c, float d)
 Smaller of four values. More...
 
DE_DLL_EXPORT int decMath::min (int a, int b)
 Smaller of two values. More...
 
DE_DLL_EXPORT int decMath::min (int a, int b, int c)
 Smaller of three values. More...
 
DE_DLL_EXPORT int decMath::min (int a, int b, int c, int d)
 Smaller of four values. More...
 
DE_DLL_EXPORT double decMath::mix (double a, double b, double blend)
 Blend between two values. More...
 
DE_DLL_EXPORT float decMath::mix (float a, float b, float blend)
 Blend between two values. More...
 
DE_DLL_EXPORT double decMath::normalize (double x, double lower, double upper)
 Normalize value. More...
 
DE_DLL_EXPORT double decMath::normalize (double x, double upper)
 Normalize value. More...
 
DE_DLL_EXPORT float decMath::normalize (float x, float lower, float upper)
 Normalize value. More...
 
DE_DLL_EXPORT float decMath::normalize (float x, float upper)
 Normalize value. More...
 
DE_DLL_EXPORT int decMath::normalize (int x, int lower, int upper)
 Normalize value. More...
 
DE_DLL_EXPORT float decMath::random (float lower, float upper)
 Random value. More...
 
DE_DLL_EXPORT int decMath::random (int lower, int upper)
 Random value. More...
 
DE_DLL_EXPORT double decMath::smoothStep (double x, double lower, double upper)
 Smooth map x to the range from 0 to 1. More...
 
DE_DLL_EXPORT double decMath::smoothStep (double x, double lower, double upper, double mapLower, double mapUpper)
 Smooth map x from one range to another range. More...
 
DE_DLL_EXPORT float decMath::smoothStep (float x, float lower, float upper)
 Smooth map x to the range from 0 to 1. More...
 
DE_DLL_EXPORT float decMath::smoothStep (float x, float lower, float upper, float mapLower, float mapUpper)
 Smooth map x from one range to another range. More...
 

Detailed Description

Class for mathematical calculations.

Macro Definition Documentation

◆ COLOR_THRESHOLD

#define COLOR_THRESHOLD   1e-5f

◆ CURVE_THRESHOLD

#define CURVE_THRESHOLD   1e-6f

◆ DEG2RAD

#define DEG2RAD   (PI / 180.0f)

Degree to radians.

◆ DOUBLE_EPSILON

#define DOUBLE_EPSILON   2.220446049250313e-16

◆ DOUBLE_SAFE_EPSILON

#define DOUBLE_SAFE_EPSILON   1e-15

◆ DVECTOR_THRESHOLD

#define DVECTOR_THRESHOLD   1e-6

◆ FLOAT_EPSILON

#define FLOAT_EPSILON   1.1929093e-7f

Floating point thresholds (epsilons).

◆ FLOAT_SAFE_EPSILON

#define FLOAT_SAFE_EPSILON   1e-6f

◆ HALF_PI

#define HALF_PI   (PI / 2.0f)

Value of half pi.

◆ PI

#define PI   3.14159265f

Value of pi.

◆ QUATERNION_THRESHOLD

#define QUATERNION_THRESHOLD   1e-5f

◆ RAD2DEG

#define RAD2DEG   (180.0f / PI)

Radians to degree.

◆ TEXEL_THRESHOLD

#define TEXEL_THRESHOLD   1e-5f

◆ TWO_PI

#define TWO_PI   (PI * 2.0f)

Value of two pi.

◆ VECTOR_THRESHOLD

#define VECTOR_THRESHOLD   1e-6f