mk_clampffunction
float mk_clampf(float v, float lo, float hi)Clamp v to [lo,hi].
| Parameter | Type | Description |
|---|---|---|
v | float | Value for v. |
lo | float | Value for lo. |
hi | float | Value for hi. |
Returns The resulting value.
#include <modkit/math/ease.h>39 functions · 1 enums · 1 typedefs · 1 macros
Easing functions and interpolation helpers.
Standard Robert Penner easing set (https://easings.net), plus scalar/vector lerp and remap helpers. All functions take a normalized time t in [0,1] and return an eased value (typically in [0,1], though back/elastic overshoot). Header-only, like math/mat4.h. Use directly:
mk_clampffunctionfloat mk_clampf(float v, float lo, float hi)Clamp v to [lo,hi].
| Parameter | Type | Description |
|---|---|---|
v | float | Value for v. |
lo | float | Value for lo. |
hi | float | Value for hi. |
Returns The resulting value.
mk_easefunctionfloat mk_ease(mk_ease_type type, float t)Evaluate an easing function selected at runtime.
| Parameter | Type | Description |
|---|---|---|
type | mk_ease_type | Value for type. |
t | float | Value for t. |
Returns The resulting value.
mk_ease_back_infunctionfloat mk_ease_back_in(float t)Perform the ease back in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_back_inoutfunctionfloat mk_ease_back_inout(float t)Perform the ease back inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_back_outfunctionfloat mk_ease_back_out(float t)Perform the ease back out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_bounce_infunctionfloat mk_ease_bounce_in(float t)Perform the ease bounce in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_bounce_inoutfunctionfloat mk_ease_bounce_inout(float t)Perform the ease bounce inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_bounce_outfunctionfloat mk_ease_bounce_out(float t)Perform the ease bounce out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_circ_infunctionfloat mk_ease_circ_in(float t)Perform the ease circ in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_circ_inoutfunctionfloat mk_ease_circ_inout(float t)Perform the ease circ inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_circ_outfunctionfloat mk_ease_circ_out(float t)Perform the ease circ out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_cubic_infunctionfloat mk_ease_cubic_in(float t)Perform the ease cubic in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_cubic_inoutfunctionfloat mk_ease_cubic_inout(float t)Perform the ease cubic inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_cubic_outfunctionfloat mk_ease_cubic_out(float t)Perform the ease cubic out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_elastic_infunctionfloat mk_ease_elastic_in(float t)Perform the ease elastic in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_elastic_inoutfunctionfloat mk_ease_elastic_inout(float t)Perform the ease elastic inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_elastic_outfunctionfloat mk_ease_elastic_out(float t)Perform the ease elastic out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_expo_infunctionfloat mk_ease_expo_in(float t)Perform the ease expo in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_expo_inoutfunctionfloat mk_ease_expo_inout(float t)Perform the ease expo inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_expo_outfunctionfloat mk_ease_expo_out(float t)Perform the ease expo out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_linearfunctionfloat mk_ease_linear(float t)Perform the ease linear operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quad_infunctionfloat mk_ease_quad_in(float t)Perform the ease quad in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quad_inoutfunctionfloat mk_ease_quad_inout(float t)Perform the ease quad inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quad_outfunctionfloat mk_ease_quad_out(float t)Perform the ease quad out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quart_infunctionfloat mk_ease_quart_in(float t)Perform the ease quart in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quart_inoutfunctionfloat mk_ease_quart_inout(float t)Perform the ease quart inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quart_outfunctionfloat mk_ease_quart_out(float t)Perform the ease quart out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quint_infunctionfloat mk_ease_quint_in(float t)Perform the ease quint in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quint_inoutfunctionfloat mk_ease_quint_inout(float t)Perform the ease quint inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_quint_outfunctionfloat mk_ease_quint_out(float t)Perform the ease quint out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_sine_infunctionfloat mk_ease_sine_in(float t)Perform the ease sine in operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_sine_inoutfunctionfloat mk_ease_sine_inout(float t)Perform the ease sine inout operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_ease_sine_outfunctionfloat mk_ease_sine_out(float t)Perform the ease sine out operation.
| Parameter | Type | Description |
|---|---|---|
t | float | Value for t. |
Returns The resulting value.
mk_lerpfunctionfloat mk_lerp(float a, float b, float t)Linear interpolation between a and b by t.
| Parameter | Type | Description |
|---|---|---|
a | float | Value for a. |
b | float | Value for b. |
t | float | Value for t. |
Returns The resulting value.
mk_quat_slerpfunctionmk_quat mk_quat_slerp(mk_quat a, mk_quat b, float t)Spherical lerp between unit quaternions (thin cglm wrap).
| Parameter | Type | Description |
|---|---|---|
a | mk_quat | Value for a. |
b | mk_quat | Value for b. |
t | float | Value for t. |
Returns The resulting value.
mk_remapfunctionfloat mk_remap(float v, float in_lo, float in_hi, float out_lo, float out_hi)Remap v from [in_lo,in_hi] onto [out_lo,out_hi].
| Parameter | Type | Description |
|---|---|---|
v | float | Value for v. |
in_lo | float | Value for in lo. |
in_hi | float | Value for in hi. |
out_lo | float | Receives the lo. |
out_hi | float | Receives the hi. |
Returns The resulting value.
mk_unlerpfunctionfloat mk_unlerp(float a, float b, float v)Inverse lerp: where v sits in [a,b] as a 0..1 fraction.
| Parameter | Type | Description |
|---|---|---|
a | float | Value for a. |
b | float | Value for b. |
v | float | Value for v. |
Returns The resulting value.
mk_vec2_lerpfunctionmk_vec2 mk_vec2_lerp(mk_vec2 a, mk_vec2 b, float t)Component-wise lerp of two vec2.
| Parameter | Type | Description |
|---|---|---|
a | mk_vec2 | Value for a. |
b | mk_vec2 | Value for b. |
t | float | Value for t. |
Returns The resulting value.
mk_vec3_lerpfunctionmk_vec3 mk_vec3_lerp(mk_vec3 a, mk_vec3 b, float t)Component-wise lerp of two vec3.
| Parameter | Type | Description |
|---|---|---|
a | mk_vec3 | Value for a. |
b | mk_vec3 | Value for b. |
t | float | Value for t. |
Returns The resulting value.
mk_ease_typeenumValues for ease type.
| Value | Description |
|---|---|
MK_EASE_LINEAR | Selects linear. |
MK_EASE_QUAD_IN | Quadratic acceleration. |
MK_EASE_QUAD_OUT | Quadratic deceleration. |
MK_EASE_QUAD_INOUT | Quadratic acceleration then deceleration. |
MK_EASE_CUBIC_IN | Cubic acceleration. |
MK_EASE_CUBIC_OUT | Cubic deceleration. |
MK_EASE_CUBIC_INOUT | Cubic acceleration then deceleration. |
MK_EASE_QUART_IN | Quartic acceleration. |
MK_EASE_QUART_OUT | Quartic deceleration. |
MK_EASE_QUART_INOUT | Quartic acceleration then deceleration. |
MK_EASE_QUINT_IN | Quintic acceleration. |
MK_EASE_QUINT_OUT | Quintic deceleration. |
MK_EASE_QUINT_INOUT | Quintic acceleration then deceleration. |
MK_EASE_SINE_IN | Sinusoidal acceleration. |
MK_EASE_SINE_OUT | Sinusoidal deceleration. |
MK_EASE_SINE_INOUT | Sinusoidal acceleration then deceleration. |
MK_EASE_EXPO_IN | Exponential acceleration. |
MK_EASE_EXPO_OUT | Exponential deceleration. |
MK_EASE_EXPO_INOUT | Exponential acceleration then deceleration. |
MK_EASE_CIRC_IN | Circular acceleration. |
MK_EASE_CIRC_OUT | Circular deceleration. |
MK_EASE_CIRC_INOUT | Circular acceleration then deceleration. |
MK_EASE_BACK_IN | Backtracking acceleration with overshoot. |
MK_EASE_BACK_OUT | Backtracking deceleration with overshoot. |
MK_EASE_BACK_INOUT | Backtracking acceleration and deceleration. |
MK_EASE_ELASTIC_IN | Elastic acceleration with oscillation. |
MK_EASE_ELASTIC_OUT | Elastic deceleration with oscillation. |
MK_EASE_ELASTIC_INOUT | Elastic acceleration and deceleration. |
MK_EASE_BOUNCE_IN | Bouncing acceleration. |
MK_EASE_BOUNCE_OUT | Bouncing deceleration. |
MK_EASE_BOUNCE_INOUT | Bouncing acceleration and deceleration. |
MK_EASE_COUNT | Number of easing functions. |
mk_ease_typetypedeftypedef enum mk_ease_type mk_ease_typeValues for ease type.
MK_PIdefineMK_PIConstant for pi.