//===========================================================================// // File: rotation.tst // // Project: MUNGA Brick: Math Library // // Contents: Test code for rotation classes // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 11/20/94 JMA Initial coding. // // 12/01/94 JMA Made compatible with SGI CC // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EulerAngles ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // //############################################################################# //############################################################################# // Logical EulerAngles::TestClass() { DEBUG_STREAM << "Starting EulerAngle test...\n"; const EulerAngles a(Identity); EulerAngles b; const EulerAngles c(PI_OVER_4,PI_OVER_6,PI_OVER_3); Test(!a.pitch && !a.yaw && !a.roll); Test(c.pitch == PI_OVER_4 && c.yaw == PI_OVER_6 && c.roll == PI_OVER_3); Test(!a); b = c; Test(b == c); Test(b != a); Test(b[Y_Axis] == b.yaw); Test(c[Z_Axis] == c.roll); b.Lerp(a,c,0.5f); Test(b == EulerAngles(::Lerp(a.pitch,c.pitch,0.5f),::Lerp(a.yaw,c.yaw,0.5f),::Lerp(a.roll,c.roll,0.5f))); LinearMatrix m(True); m = c; b = m; Test(b == c); Quaternion q; q = Hinge(X_Axis, PI_OVER_4); b = q; Test(b == EulerAngles(PI_OVER_4,0.0f,0.0f)); return True; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Quaternion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // //############################################################################# //############################################################################# // #define NUMBER_OF_MULTIPLICATIONS 30 #include "random.hpp" #include class fstream; Logical Quaternion::TestClass() { Tell("Starting Quaternion Test...\n"); #if 0 // ofstream testout("gene.tst",ios::app); //GY Vector3D r_vec; Quaternion // q[2], q[NUMBER_OF_MULTIPLICATIONS+1], multiplied_q(Identity), converted_q; LinearMatrix // lm[2], lm[NUMBER_OF_MULTIPLICATIONS+1], multiplied_lm(True); Scalar r_float; //cerr<<"Starting Quaternion::TestClass()\n"; for (int k=0; k