void rotate(mat4 target, float angle, float x, float y, float z) { float q[4]; setQuat(q, angle, x, y, z); rotateQ(target, q); }
void rotate3D(quat target, vec3 angles) { float quatX[4], quatY[4], quatZ[4]; // make quat for every axis setQuat(quatY, angles[1], 1, 0, 0); setQuat(quatX, angles[0], 0, 1, 0); setQuat(quatZ, angles[2], 0, 0, -1); // X * Y float quatXY[4]; multQ(quatX, quatY, quatXY); // XY * Z float quatXYZ[4]; multQ(quatXY, quatZ, quatXYZ); // write to target quat target[0] = quatXYZ[0]; target[1] = quatXYZ[1]; target[2] = quatXYZ[2]; target[3] = quatXYZ[3]; }
void ArcBall::setViewDefault() { setQuat(Quat::VIEWDEFAULT); }
void ArcBall::setViewYZ() { setQuat(Quat::VIEWYZ); }
void ArcBall::setViewXZ() { setQuat(Quat::VIEWXZ); }
// set view void ArcBall::setViewXY() { setQuat(Quat::VIEWXY); }