Search in sources :

Example 1 with Quat4d

use of javax.vecmath.Quat4d in project ImmersiveEngineering by BluSunrize.

the class ClientUtils method degreeToQuaterion.

public static Quat4d degreeToQuaterion(double x, double y, double z) {
    x = Math.toRadians(x);
    y = Math.toRadians(y);
    z = Math.toRadians(z);
    Quat4d qYaw = new Quat4d(0, Math.sin(y / 2), 0, Math.cos(y / 2));
    Quat4d qPitch = new Quat4d(Math.sin(x / 2), 0, 0, Math.cos(x / 2));
    Quat4d qRoll = new Quat4d(0, 0, Math.sin(z / 2), Math.cos(z / 2));
    Quat4d quat = qYaw;
    quat.mul(qRoll);
    quat.mul(qPitch);
    return quat;
}
Also used : Quat4d(javax.vecmath.Quat4d)

Aggregations

Quat4d (javax.vecmath.Quat4d)1