Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#include <banjo/api.h>
15
16#define _USE_MATH_DEFINES
17#include <math.h>
18
25#define BJ_PI (3.14159265358979323846)
26
33#define bj_acosf acosf
34
41#define bj_cosf cosf
42
49#define bj_expf expf
50
57#define bj_fabs fabs
58
65#define bj_fabsf fabsf
66
73#define bj_floor floor
74
81#define bj_floorf floorf
82
89#define bj_fmaxf fmaxf
90
97#define bj_fminf fminf
98
105#define bj_fmod fmod
106
113#define bj_powf powf
114
121#define bj_round round
122
129#define bj_sin sin
130
137#define bj_sinf sinf
138
145#define bj_sqrtf sqrtf
146
153#define bj_tanf tanf
154
163BANJO_EXPORT float bj_clamp(
164 float x,
165 float min,
166 float max
167);
168
178BANJO_EXPORT float bj_step(
179 float edge,
180 float x
181);
182
191BANJO_EXPORT float bj_smoothstep(
192 float edge0,
193 float edge1,
194 float x
195);
196
203BANJO_EXPORT float bj_fract(
204 float x
205);
206
214BANJO_EXPORT int bj_mod(
215 float x,
216 float y
217);
218
General-purpose definitions for Banjo API.
float bj_clamp(float x, float min, float max)
Clamps a float between a minimum and a maximum value.
int bj_mod(float x, float y)
Computes a floor-style modulus between two floats.
float bj_smoothstep(float edge0, float edge1, float x)
Performs smooth Hermite interpolation between 0 and 1 over a range.
float bj_step(float edge, float x)
Returns 0.0 if x < edge, else 1.0.
float bj_fract(float x)
Returns the fractional part of a float.
Linear math library.