Macros

#define HAL_GFX_E   2.71828182845904523536f
 
#define HAL_GFX_LOG2E   1.44269504088896340736f
 
#define HAL_GFX_LOG10E   0.434294481903251827651f
 
#define HAL_GFX_LN2   0.693147180559945309417f
 
#define HAL_GFX_LN10   2.30258509299404568402f
 
#define HAL_GFX_PI   3.14159265358979323846f
 
#define HAL_GFX_PI_2   1.57079632679489661923f
 
#define HAL_GFX_PI_4   0.785398163397448309616f
 
#define HAL_GFX_1_PI   0.318309886183790671538f
 
#define HAL_GFX_2_PI   0.636619772367581343076f
 
#define HAL_GFX_2_SQRTPI   1.12837916709551257390f
 
#define HAL_GFX_SQRT2   1.41421356237309504880f
 
#define HAL_GFX_SQRT1_2   0.707106781186547524401f
 
#define hal_gfx_min2(a, b)   (((a)<(b))?( a):(b))
 
#define hal_gfx_max2(a, b)   (((a)>(b))?( a):(b))
 
#define hal_gfx_clamp(val, min, max)   hal_gfx_min2((max), hal_gfx_max2((min), (val)))
 
#define hal_gfx_abs(a)   (((a)< 0 )?(-(a)):(a))
 
#define hal_gfx_absf(a)   (((a)< 0.f )?(-(a)):(a))
 
#define hal_gfx_floats_equal(x, y)   (hal_gfx_absf((x) - (y)) <= 0.00001f * hal_gfx_min2(hal_gfx_absf(x), hal_gfx_absf(y)))
 
#define hal_gfx_float_is_zero(x)   (hal_gfx_absf(x) <= 0.00001f)
 
#define hal_gfx_deg_to_rad(d)   (0.0174532925199f * (d))
 
#define hal_gfx_rad_to_deg(r)   (57.295779513f * (r))
 
#define hal_gfx_i2fx(a)   ((a)*0x10000)
 
#define hal_gfx_floor(f)   ((int)(f) - ( (int)(f) > (f) ))
 
#define hal_gfx_ceil(f)   ((int)(f) + ( (int)(f) < (f) ))
 

Detailed Description

Macro Definition Documentation

◆ HAL_GFX_1_PI

#define HAL_GFX_1_PI   0.318309886183790671538f

1/pi

Definition at line 31 of file hal_gfx_math.h.

◆ HAL_GFX_2_PI

#define HAL_GFX_2_PI   0.636619772367581343076f

2/pi

Definition at line 32 of file hal_gfx_math.h.

◆ HAL_GFX_2_SQRTPI

#define HAL_GFX_2_SQRTPI   1.12837916709551257390f

2/sqrt(pi)

Definition at line 33 of file hal_gfx_math.h.

◆ hal_gfx_abs

#define hal_gfx_abs (   a)    (((a)< 0 )?(-(a)):(a))

Calculate the absolute value of int.

Definition at line 40 of file hal_gfx_math.h.

◆ hal_gfx_absf

#define hal_gfx_absf (   a)    (((a)< 0.f )?(-(a)):(a))

Calculate the absolute value of float.

Definition at line 41 of file hal_gfx_math.h.

◆ hal_gfx_ceil

#define hal_gfx_ceil (   f)    ((int)(f) + ( (int)(f) < (f) ))

Ceiling function.

Definition at line 48 of file hal_gfx_math.h.

◆ hal_gfx_clamp

#define hal_gfx_clamp (   val,
  min,
  max 
)    hal_gfx_min2((max), hal_gfx_max2((min), (val)))

Clamp value.

Definition at line 39 of file hal_gfx_math.h.

◆ hal_gfx_deg_to_rad

#define hal_gfx_deg_to_rad (   d)    (0.0174532925199f * (d))

Convert degrees to radians.

Definition at line 44 of file hal_gfx_math.h.

◆ HAL_GFX_E

#define HAL_GFX_E   2.71828182845904523536f

e

Definition at line 23 of file hal_gfx_math.h.

◆ hal_gfx_float_is_zero

#define hal_gfx_float_is_zero (   x)    (hal_gfx_absf(x) <= 0.00001f)

Checks if value x is zero.

Definition at line 43 of file hal_gfx_math.h.

◆ hal_gfx_floats_equal

#define hal_gfx_floats_equal (   x,
 
)    (hal_gfx_absf((x) - (y)) <= 0.00001f * hal_gfx_min2(hal_gfx_absf(x), hal_gfx_absf(y)))

Compare two floats.

Definition at line 42 of file hal_gfx_math.h.

◆ hal_gfx_floor

#define hal_gfx_floor (   f)    ((int)(f) - ( (int)(f) > (f) ))

Floor function.

Definition at line 47 of file hal_gfx_math.h.

◆ hal_gfx_i2fx

#define hal_gfx_i2fx (   a)    ((a)*0x10000)

Convert integer to 16.16 fixed point.

Definition at line 46 of file hal_gfx_math.h.

◆ HAL_GFX_LN10

#define HAL_GFX_LN10   2.30258509299404568402f

ln(10)

Definition at line 27 of file hal_gfx_math.h.

◆ HAL_GFX_LN2

#define HAL_GFX_LN2   0.693147180559945309417f

ln(2)

Definition at line 26 of file hal_gfx_math.h.

◆ HAL_GFX_LOG10E

#define HAL_GFX_LOG10E   0.434294481903251827651f

log10(e)

Definition at line 25 of file hal_gfx_math.h.

◆ HAL_GFX_LOG2E

#define HAL_GFX_LOG2E   1.44269504088896340736f

log2(e)

Definition at line 24 of file hal_gfx_math.h.

◆ hal_gfx_max2

#define hal_gfx_max2 (   a,
 
)    (((a)>(b))?( a):(b))

Find the maximum of two values

Definition at line 38 of file hal_gfx_math.h.

◆ hal_gfx_min2

#define hal_gfx_min2 (   a,
 
)    (((a)<(b))?( a):(b))

Find the minimum of two values

Definition at line 37 of file hal_gfx_math.h.

◆ HAL_GFX_PI

#define HAL_GFX_PI   3.14159265358979323846f

pi

Definition at line 28 of file hal_gfx_math.h.

◆ HAL_GFX_PI_2

#define HAL_GFX_PI_2   1.57079632679489661923f

pi/2

Definition at line 29 of file hal_gfx_math.h.

◆ HAL_GFX_PI_4

#define HAL_GFX_PI_4   0.785398163397448309616f

pi/4

Definition at line 30 of file hal_gfx_math.h.

◆ hal_gfx_rad_to_deg

#define hal_gfx_rad_to_deg (   r)    (57.295779513f * (r))

onvert radians to degries.

Definition at line 45 of file hal_gfx_math.h.

◆ HAL_GFX_SQRT1_2

#define HAL_GFX_SQRT1_2   0.707106781186547524401f

1/sqrt(2)

Definition at line 35 of file hal_gfx_math.h.

◆ HAL_GFX_SQRT2

#define HAL_GFX_SQRT2   1.41421356237309504880f

sqrt(2)

Definition at line 34 of file hal_gfx_math.h.