mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-02 20:08:29 +00:00
aux/math: Add m_vec2_lerp
This commit is contained in:
parent
b067d3b0c2
commit
52f1ce14ca
|
@ -102,6 +102,12 @@ m_vec2_dot(struct xrt_vec2 l, struct xrt_vec2 r)
|
|||
return l.x * r.x + l.y * r.y;
|
||||
}
|
||||
|
||||
static inline struct xrt_vec2
|
||||
m_vec2_lerp(struct xrt_vec2 from, struct xrt_vec2 to, float amount)
|
||||
{
|
||||
// Recommend amount being in [0,1]
|
||||
return m_vec2_add(m_vec2_mul_scalar(from, 1.0f - amount), m_vec2_mul_scalar(to, amount));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue