Macros
Defines
Graphics » HAL GFX » GFX MATH
Collaboration diagram for Defines:

## Macros
#define | HAL_GFX_E 2.71828182845904523536f
| e More...
#define | HAL_GFX_LOG2E 1.44269504088896340736f
| log2(e) More...
#define | HAL_GFX_LOG10E 0.434294481903251827651f
| log10(e) More...
#define | HAL_GFX_LN2 0.693147180559945309417f
| ln(2) More...
#define | HAL_GFX_LN10 2.30258509299404568402f
| ln(10) More...
#define | HAL_GFX_PI 3.14159265358979323846f
| pi More...
#define | HAL_GFX_PI_2 1.57079632679489661923f
| pi/2 More...
#define | HAL_GFX_PI_4 0.785398163397448309616f
| pi/4 More...
#define | HAL_GFX_1_PI 0.318309886183790671538f
| 1/pi More...
#define | HAL_GFX_2_PI 0.636619772367581343076f
| 2/pi More...
#define | HAL_GFX_2_SQRTPI 1.12837916709551257390f
| 2/sqrt(pi) More...
#define | HAL_GFX_SQRT2 1.41421356237309504880f
| sqrt(2) More...
#define | HAL_GFX_SQRT1_2 0.707106781186547524401f
| 1/sqrt(2) More...
#define | hal_gfx_min2(a, b) (((a)<(b))?( a):(b))
| Find the minimum of two values. More...
#define | hal_gfx_max2(a, b) (((a)>(b))?( a):(b))
| Find the maximum of two values. More...
#define | hal_gfx_clamp(val, min, max) hal_gfx_min2((max), hal_gfx_max2((min), (val)))
| Clamp value. More...
#define | hal_gfx_abs(a) (((a)< 0 )?(-(a)):(a))
| Calculate the absolute value of int. More...
#define | hal_gfx_absf(a) (((a)< 0.f )?(-(a)):(a))
| Calculate the absolute value of float. More...
#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)))
| Compare two floats. More...
#define | hal_gfx_float_is_zero(x) (hal_gfx_absf(x) <= 0.00001f)
| Checks if value x is zero. More...
#define | hal_gfx_deg_to_rad(d) (0.0174532925199f * (d))
| Convert degrees to radians. More...
#define | hal_gfx_rad_to_deg(r) (57.295779513f * (r))
| onvert radians to degries. More...
#define | hal_gfx_i2fx(a) ((a)*0x10000)
| Convert integer to 16.16 fixed point. More...
#define | hal_gfx_floor(f) ((int)(f) - ( (int)(f) > (f) ))
| Floor function. More...
#define | hal_gfx_ceil(f) ((int)(f) + ( (int)(f) < (f) ))
| Ceiling function. More...

## Detailed Description

## Macro Definition Documentation

## ◆ HAL_GFX_1_PI

#define HAL_GFX_1_PI 0.318309886183790671538f

1/pi

Definition at line 70 of file hal_gfx_math.h.

## ◆ HAL_GFX_2_PI

#define HAL_GFX_2_PI 0.636619772367581343076f

2/pi

Definition at line 71 of file hal_gfx_math.h.

## ◆ HAL_GFX_2_SQRTPI

#define HAL_GFX_2_SQRTPI 1.12837916709551257390f

2/sqrt(pi)

Definition at line 72 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 79 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 80 of file hal_gfx_math.h.

## ◆ hal_gfx_ceil

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

Ceiling function.

Definition at line 87 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 78 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 83 of file hal_gfx_math.h.

## ◆ HAL_GFX_E

#define HAL_GFX_E 2.71828182845904523536f

e

Definition at line 62 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 82 of file hal_gfx_math.h.

## ◆ hal_gfx_floats_equal

#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)))

Compare two floats.

Definition at line 81 of file hal_gfx_math.h.

## ◆ hal_gfx_floor

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

Floor function.

Definition at line 86 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 85 of file hal_gfx_math.h.

## ◆ HAL_GFX_LN10

#define HAL_GFX_LN10 2.30258509299404568402f

ln(10)

Definition at line 66 of file hal_gfx_math.h.

## ◆ HAL_GFX_LN2

#define HAL_GFX_LN2 0.693147180559945309417f

ln(2)

Definition at line 65 of file hal_gfx_math.h.

## ◆ HAL_GFX_LOG10E

#define HAL_GFX_LOG10E 0.434294481903251827651f

log10(e)

Definition at line 64 of file hal_gfx_math.h.

## ◆ HAL_GFX_LOG2E

#define HAL_GFX_LOG2E 1.44269504088896340736f

log2(e)

Definition at line 63 of file hal_gfx_math.h.

## ◆ hal_gfx_max2

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

Find the maximum of two values.

Definition at line 77 of file hal_gfx_math.h.

## ◆ hal_gfx_min2

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

Find the minimum of two values.

Definition at line 76 of file hal_gfx_math.h.

## ◆ HAL_GFX_PI

#define HAL_GFX_PI 3.14159265358979323846f

pi

Definition at line 67 of file hal_gfx_math.h.

## ◆ HAL_GFX_PI_2

#define HAL_GFX_PI_2 1.57079632679489661923f

pi/2

Definition at line 68 of file hal_gfx_math.h.

## ◆ HAL_GFX_PI_4

#define HAL_GFX_PI_4 0.785398163397448309616f

pi/4

Definition at line 69 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 84 of file hal_gfx_math.h.

## ◆ HAL_GFX_SQRT1_2

#define HAL_GFX_SQRT1_2 0.707106781186547524401f

1/sqrt(2)

Definition at line 74 of file hal_gfx_math.h.

## ◆ HAL_GFX_SQRT2

#define HAL_GFX_SQRT2 1.41421356237309504880f

sqrt(2)

Definition at line 73 of file hal_gfx_math.h.