VectorInt3 v;
v.x = 0;
v.y = 0;
v.z = 1;
applyQuaternion(&v, q);
result = v.z;
void applyQuaternion(VectorInt3 *v, int16_t *q) {
int32_t x = v->x;
int32_t y = v->y;
int32_t z = v->z;
int16_t qx = q[1];
int16_t qy = q[2];
int16_t qz = q[3];
int16_t qw = q[0];
int32_t ix = qw * x + qy * z - qz * y;
int32_t iy = qw * y + qz * x - qx * z;
int32_t iz = qw * z + qx * y - qy * x;
int32_t iw = -qx * x - qy * y - qz * z;
v->x = (ix * qw + iw * -qx + iy * -qz - iz * -qy) / 16384;
v->y = (iy * qw + iw * -qy + iz * -qx - ix * -qz) / 16384;
v->z = (iz * qw + iw * -qz + ix * -qy - iy * -qx) / 16384;
}