Added support for using quat_scaled sx sy sz for testing getting quats from scaled
matrices. Removed broken Matrixd/quat test
This commit is contained in:
@@ -7,57 +7,6 @@
|
||||
namespace osg
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrixd Tests
|
||||
//
|
||||
|
||||
class MatrixdTestFixture
|
||||
{
|
||||
public:
|
||||
|
||||
MatrixdTestFixture();
|
||||
|
||||
void testMatrixToQuat(const osgUtx::TestContext& ctx);
|
||||
|
||||
private:
|
||||
|
||||
// Some convenience variables for use in the tests
|
||||
Matrixd m1_, m2_;
|
||||
double l1_, l2_;
|
||||
|
||||
};
|
||||
|
||||
MatrixdTestFixture::MatrixdTestFixture():
|
||||
m1_(0.3583681546368404100000000000000, -0.933580347769909500000000000000, 3.006977197034146200000000000000e-011, 000000000000000,
|
||||
-0.933580347769909500000000000000, -0.3583681546368404100000000000000, -1.275368738108216700000000000000e-010, 000000000000000,
|
||||
1.298419676971558500000000000000e-010, 1.763260594230249800000000000000e-011, -0.9999999999999997800000000000000, 000000000000000,
|
||||
-4.134153519264493800000000000000e-005, 8.473552245044272300000000000000e-008, 0.9999996934706840700000000000000, 100000000000000.0 ),
|
||||
|
||||
m2_( 0.3583681546368407400000000000000, -0.9335803477699099500000000000000, 3.007582030796253300000000000000e-011, 000000000000000,
|
||||
-0.9335803477699099500000000000000, -0.3583681546368407400000000000000, -1.265511449721884600000000000000e-010, 000000000000000,
|
||||
1.289238781567697100000000000000e-010, 1.727370550828948600000000000000e-011, -1.000000000000000400000000000000, 000000000000000,
|
||||
-4.134153473360120600000000000000e-005, 8.473570190103158800000000000000e-008, 0.999999693471385400000000000000, 100000000000000.0),
|
||||
l1_(1),
|
||||
l2_(1)
|
||||
{
|
||||
}
|
||||
|
||||
void MatrixdTestFixture::testMatrixToQuat(const osgUtx::TestContext&)
|
||||
{
|
||||
Quat q1,q2;
|
||||
q1.set(m1_);
|
||||
q2.set(m2_);
|
||||
OSGUTX_TEST_F( q1.length() == l1_ )
|
||||
OSGUTX_TEST_F( q2.length() == l2_ )
|
||||
}
|
||||
|
||||
|
||||
OSGUTX_BEGIN_TESTSUITE(Matrixd)
|
||||
OSGUTX_ADD_TESTCASE(MatrixdTestFixture, testMatrixToQuat)
|
||||
OSGUTX_END_TESTSUITE
|
||||
|
||||
OSGUTX_AUTOREGISTER_TESTSUITE_AT(Matrixd, root.osg)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -150,7 +150,8 @@ void sizeOfTest()
|
||||
/// versus
|
||||
/// (mat(q1)*mat(q2)*scale).getRotate()
|
||||
/// for a range of rotations
|
||||
void testGetQuatFromMatrix() {
|
||||
void testGetQuatFromMatrix(const osg::Vec3d& scale)
|
||||
{
|
||||
|
||||
// Options
|
||||
|
||||
@@ -161,7 +162,7 @@ void testGetQuatFromMatrix() {
|
||||
// To not test with scale, use 1,1,1
|
||||
// Not sure if 0's or negative values are acceptable
|
||||
osg::Matrixd scalemat;
|
||||
scalemat.makeScale(osg::Vec3d(0.9,0.5,0.1));
|
||||
scalemat.makeScale(scale);
|
||||
|
||||
// range of rotations
|
||||
#if 1
|
||||
@@ -300,7 +301,7 @@ void testQuatRotate(const osg::Vec3d& from, const osg::Vec3d& to)
|
||||
std::cout<<" from * M4x4(q_original) = "<<from * osg::Matrixd::rotate(q_original)<<std::endl;
|
||||
}
|
||||
|
||||
void testQuat()
|
||||
void testQuat(const osg::Vec3d& quat_scale)
|
||||
{
|
||||
osg::Quat q1;
|
||||
q1.makeRotate(osg::DegreesToRadians(30.0),0.0f,0.0f,1.0f);
|
||||
@@ -342,7 +343,7 @@ void testQuat()
|
||||
testQuatRotate(osg::Vec3d(0.0,0.0,-1.0),osg::Vec3d(0.0,0.0,1.0));
|
||||
|
||||
// Test a range of rotations
|
||||
testGetQuatFromMatrix();
|
||||
testGetQuatFromMatrix(quat_scale);
|
||||
|
||||
// This is a specific test case for a matrix containing scale and rotation
|
||||
osg::Matrix matrix(0.5, 0.0, 0.0, 0.0,
|
||||
@@ -366,6 +367,8 @@ int main( int argc, char** argv )
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("quat","Display extended quaternion tests.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("quat_scaled sx sy sz","Display extended quaternion tests of pre scaled matrix.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("sizeof","Display sizeof tests.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("matrix","Display qualified tests.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("performance","Display qualified tests.");
|
||||
@@ -389,6 +392,9 @@ int main( int argc, char** argv )
|
||||
bool printQuatTest = false;
|
||||
while (arguments.read("quat")) printQuatTest = true;
|
||||
|
||||
osg::Vec3d quat_scale(1.0,1.0,1.0);
|
||||
while (arguments.read("quat_scaled", quat_scale.x(), quat_scale.y(), quat_scale.z() )) printQuatTest = true;
|
||||
|
||||
bool performanceTest = false;
|
||||
while (arguments.read("p") || arguments.read("performance")) performanceTest = true;
|
||||
|
||||
@@ -412,7 +418,7 @@ int main( int argc, char** argv )
|
||||
|
||||
if (printQuatTest)
|
||||
{
|
||||
testQuat();
|
||||
testQuat(quat_scale);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user