Show
Ignore:
Timestamp:
01/27/05 15:39:58 (9 years ago)
Author:
robert
Message:

From Nicolas Brodu, new faster osg::Quat::makeRotate(Vec3d,Vec3d) implmentation.

From Robert Osfield, modes to osg::Quat to keep the original implmentation around
as makeRotate_original(,) and added tests into osgunittest to test the new
methods provide equivilant results to the original implemementation. The
orignal implementation will be removed once the new method is more widely tested.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgunittests/osgunittests.cpp

    r3601 r3790  
    120120 
    121121 
     122void testQuatRotate(const osg::Vec3d& from, const osg::Vec3d& to) 
     123{ 
     124    osg::Quat q_nicolas; 
     125    q_nicolas.makeRotate(from,to); 
     126     
     127    osg::Quat q_original; 
     128    q_original.makeRotate_original(from,to); 
     129     
     130    std::cout<<"osg::Quat::makeRotate("<<from<<", "<<to<<")"<<std::endl; 
     131    std::cout<<"  q_nicolas = "<<q_nicolas<<std::endl; 
     132    std::cout<<"  q_original = "<<q_original<<std::endl; 
     133    std::cout<<"  from * M4x4(q_nicolas) = "<<from * osg::Matrixd::rotate(q_nicolas)<<std::endl; 
     134    std::cout<<"  from * M4x4(q_original) = "<<from * osg::Matrixd::rotate(q_original)<<std::endl; 
     135} 
     136 
    122137void testQuat() 
    123138{ 
     
    148163    std::cout<<"m2*m1 = "<<qm2_1<<std::endl; 
    149164 
     165 
     166    testQuatRotate(osg::Vec3d(1.0,0.0,0.0),osg::Vec3d(0.0,1.0,0.0)); 
     167    testQuatRotate(osg::Vec3d(0.0,1.0,0.0),osg::Vec3d(1.0,0.0,0.0)); 
     168    testQuatRotate(osg::Vec3d(0.0,0.0,1.0),osg::Vec3d(0.0,1.0,0.0)); 
     169    testQuatRotate(osg::Vec3d(1.0,1.0,1.0),osg::Vec3d(1.0,0.0,0.0)); 
     170    testQuatRotate(osg::Vec3d(1.0,0.0,0.0),osg::Vec3d(1.0,0.0,0.0)); 
     171    testQuatRotate(osg::Vec3d(1.0,0.0,0.0),osg::Vec3d(-1.0,0.0,0.0)); 
     172    testQuatRotate(osg::Vec3d(-1.0,0.0,0.0),osg::Vec3d(1.0,0.0,0.0)); 
     173    testQuatRotate(osg::Vec3d(0.0,1.0,0.0),osg::Vec3d(0.0,-1.0,0.0)); 
     174    testQuatRotate(osg::Vec3d(0.0,-1.0,0.0),osg::Vec3d(0.0,1.0,0.0)); 
     175    testQuatRotate(osg::Vec3d(0.0,0.0,1.0),osg::Vec3d(0.0,0.0,-1.0)); 
     176    testQuatRotate(osg::Vec3d(0.0,0.0,-1.0),osg::Vec3d(0.0,0.0,1.0)); 
    150177     
    151178}