|
楼主 |
发表于 2015-6-11 21:58:46
|
显示全部楼层
- // doc in parent
- void OrbitManipulator::setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up )
- {
- Vec3d lv( center - eye );
- Vec3d f( lv );
- f.normalize();
- Vec3d s( f^up );
- s.normalize();
- Vec3d u( s^f );
- u.normalize();
- osg::Matrixd rotation_matrix( s[0], u[0], -f[0], 0.0f,
- s[1], u[1], -f[1], 0.0f,
- s[2], u[2], -f[2], 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f );
- _center = center;
- _distance = lv.length();
- _rotation = rotation_matrix.getRotate().inverse();
- // fix current rotation
- if( getVerticalAxisFixed() )
- fixVerticalAxis( _center, _rotation, true );
- }
复制代码
rotation_matrix矩阵为什么要进行求逆 |
|