GLManager.cpp
// Performs axis-angle rotation.
Performs axis-angle rotation.
Performs axis - angle rotation .
gmtl::Matrix44f GLManager::Rotate(float angle, gmtl::Vec3f axis)
{
    gmtl::Matrix44f result;
    float c = cosf(angle);
    float s = sinf(angle);
    float omc = 1.0f - c;
    result.set((axis[0] * axis[0] * omc + c), (axis[1] * axis[0] * omc + axis[2] * s), (axis[0] * axis[2] * omc - axis[1] * s), 0.0f,
               (axis[0] * axis[1] * omc - axis[2] * s), (axis[1] * axis[1] * omc + c), (axis[1] * axis[2] * omc + axis[0] * s), 0.0f,
               (axis[0] * axis[2] * omc + axis[1] * s), (axis[1] * axis[2] * omc - axis[0] * s), (axis[2]* axis[2] * omc + c), 0.0f,
               0.0f, 0.0f, 0.0f, 1.0f);
    result = gmtl::transpose(result);
    return result;
}
gmtl :: Matrix44f GLManager :: Rotate ( float angle , gmtl :: Vec3f axis ) { gmtl :: Matrix44f result ; float c = cosf ( angle ) ; float s = sinf ( angle ) ; float omc = 1.0f - c ; result . set ( ( axis [ 0 ] * axis [ 0 ] * omc + c ) , ( axis [ 1 ] * axis [ 0 ] * omc + axis [ 2 ] * s ) , ( axis [ 0 ] * axis [ 2 ] * omc - axis [ 1 ] * s ) , 0.0f , ( axis [ 0 ] * axis [ 1 ] * omc - axis [ 2 ] * s ) , ( axis [ 1 ] * axis [ 1 ] * omc + c ) , ( axis [ 1 ] * axis [ 2 ] * omc + axis [ 0 ] * s ) , 0.0f , ( axis [ 0 ] * axis [ 2 ] * omc + axis [ 1 ] * s ) , ( axis [ 1 ] * axis [ 2 ] * omc - axis [ 0 ] * s ) , ( axis [ 2 ] * axis [ 2 ] * omc + c ) , 0.0f , 0.0f , 0.0f , 0.0f , 1.0f ) ; result = gmtl :: transpose ( result ) ; return result ; }
Performs axis-angle rotation.
Performs axis - angle rotation .