Implement asteroid bouncing
This commit is contained in:
14
maths.c
14
maths.c
@@ -27,6 +27,20 @@ vec3_t vec2_extend(vec2_t v)
|
||||
return (vec3_t) { v.x, v.y, 1 };
|
||||
}
|
||||
|
||||
vec2_t vec2_norm(vec2_t v)
|
||||
{
|
||||
const float l = vec2_len(v);
|
||||
return (vec2_t) {
|
||||
v.x / l,
|
||||
v.y / l,
|
||||
};
|
||||
}
|
||||
|
||||
float vec2_dot(vec2_t v1, vec2_t v2)
|
||||
{
|
||||
return v1.x * v2.x + v1.y * v2.y;
|
||||
}
|
||||
|
||||
mat2_t mat2_rotation(float theta)
|
||||
{
|
||||
return (mat2_t) {
|
||||
|
||||
Reference in New Issue
Block a user