Exemple #1
0
// create a quaternion from Euler angles
void Quaternion::from_vector312(float roll ,float pitch, float yaw)
{
    Matrix3f m;
    m.from_euler312(roll, pitch, yaw);

    from_rotation_matrix(m);
}
Exemple #2
0
// create a quaternion from Euler angles
void Quaternion::from_vector312(float roll ,float pitch, float yaw)
{
    float c3 = cosf(pitch);
    float s3 = sinf(pitch);
    float s2 = sinf(roll);
    float c2 = cosf(roll);
    float s1 = sinf(yaw);
    float c1 = cosf(yaw);

    Matrix3f m;
    m.a.x = c1 * c3 - s1 * s2 * s3;
    m.b.y = c1 * c2;
    m.c.z = c3 * c2;
    m.a.y = -c2*s1;
    m.a.z = s3*c1 + c3*s2*s1;
    m.b.x = c3*s1 + s3*s2*c1;
    m.b.z = s1*s3 - s2*c1*c3;
    m.c.x = -s3*c2;
    m.c.y = s2;

    from_rotation_matrix(m);
}