twn_vec.h: add vec2_length(), remove legacy code
This commit is contained in:
parent
a20be2c523
commit
e281ba593c
@ -29,6 +29,10 @@ static inline Vec2 vec2_scale(Vec2 a, float s) {
|
||||
return (Vec2) { a.x * s, a.y * s };
|
||||
}
|
||||
|
||||
static inline float vec2_length(Vec2 a) {
|
||||
return sqrtf(a.x * a.x + a.y * a.y);
|
||||
}
|
||||
|
||||
static inline Vec3 vec3_add(Vec3 a, Vec3 b) {
|
||||
return (Vec3) { a.x + b.x, a.y + b.y, a.z + b.z };
|
||||
}
|
||||
@ -98,10 +102,8 @@ static inline Vec3 vec3_rotate(Vec3 v, float angle, Vec3 axis) {
|
||||
return v;
|
||||
}
|
||||
|
||||
#define m_vec2_from(p_any_vec2) (_Generic((p_any_vec2), \
|
||||
Vec2i: vec2_from_vec2i, \
|
||||
)(p_any_vec2))
|
||||
|
||||
/* TODO: remove. */
|
||||
#define m_vec_add(p_any_vec0, p_any_vec1) (_Generic((p_any_vec0), \
|
||||
Vec2: vec2_add, \
|
||||
Vec3: vec3_add \
|
||||
|
Loading…
Reference in New Issue
Block a user