1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-09-19 22:35:24 +00:00
qb64/internal/c/parts/core/android_core/progs/demos/spaceball/vmath.c

17 lines
348 B
C
Raw Normal View History

#include <math.h>
#include "vmath.h"
quat_t quat_rotate(quat_t q, float angle, float x, float y, float z)
{
quat_t rq;
float half_angle = angle * 0.5f;
float sin_half = (float)sin(half_angle);
rq.w = (float)cos(half_angle);
rq.x = x * sin_half;
rq.y = y * sin_half;
rq.z = z * sin_half;
return quat_mul(q, rq);
}