void CoordCompareMetricTest::testCoordTimingIsEqualTest()
   {
      // Test overhead of creation
      const long iters(400000);

      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord11;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord22;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord33;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord34;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord44;
      gmtl::Coord<gmtl::Vec<double,3>, gmtl::EulerAngle<double, gmtl::XYZ> > src_coord101;

      // half will be equal
      src_coord11.pos()[0] = 1.0f;
      src_coord22.pos()[1] = 1.0f;
      src_coord33.pos()[2] = 2.0f;

      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord11( src_coord11 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord22( src_coord22 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord33( src_coord33 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord34( src_coord34 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord44( src_coord44 );
      gmtl::Coord<gmtl::Vec<double,3>, gmtl::EulerAngle<double, gmtl::XYZ> > test_coord101( src_coord101 );

      // half will be not equal
      src_coord34.pos()[0] = 23.0f;
      src_coord44.pos()[2] = 234.0f;
      src_coord101.pos()[1] = 1234.0f;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (gmtl::isEqual( src_coord11,  test_coord11, 0.0f ))
            ++true_count;
         if (gmtl::isEqual( src_coord22,  test_coord22, 0.2f ))
            ++true_count;
         if (gmtl::isEqual( src_coord33,  test_coord33, 0.3f ))
            ++true_count;
         if (gmtl::isEqual( src_coord34,  test_coord34, 0.6f ))
            ++true_count;
         if (gmtl::isEqual( src_coord44,  test_coord44, 0.8f ))
            ++true_count;
         if (gmtl::isEqual( src_coord101, test_coord101, 111.1 ))
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("CoordCompareTest/isEqual(...)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void EulerAngleCompareMetricTest::testEulerAngleTimingIsEqualTest()
   {
      // Test overhead of creation
      const long iters(400000);

      gmtl::EulerAngleXYZf src_quat11;
      gmtl::EulerAngleXYZf src_quat22;
      gmtl::EulerAngleXYZf src_quat33;
      gmtl::EulerAngleXYZf src_quat34;
      gmtl::EulerAngleXYZf src_quat44;
      gmtl::EulerAngleXYZd src_quat101;

      // half will be equal
      src_quat11[0] = 1.0f;
      src_quat22[1] = 1.0f;
      src_quat33[2] = 2.0f;

      gmtl::EulerAngleXYZf test_quat11( src_quat11 );
      gmtl::EulerAngleXYZf test_quat22( src_quat22 );
      gmtl::EulerAngleXYZf test_quat33( src_quat33 );
      gmtl::EulerAngleXYZf test_quat34( src_quat34 );
      gmtl::EulerAngleXYZf test_quat44( src_quat44 );
      gmtl::EulerAngleXYZd test_quat101( src_quat101 );

      // half will be not equal
      src_quat34[0] = 23.0f;
      src_quat44[2] = 234.0f;
      src_quat101[1] = 1234.0f;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (gmtl::isEqual( src_quat11,  test_quat11, 0.0f ))
            ++true_count;
         if (gmtl::isEqual( src_quat22,  test_quat22, 0.2f ))
            ++true_count;
         if (gmtl::isEqual( src_quat33,  test_quat33, 0.3f ))
            ++true_count;
         if (gmtl::isEqual( src_quat34,  test_quat34, 0.6f ))
            ++true_count;
         if (gmtl::isEqual( src_quat44,  test_quat44, 0.8f ))
            ++true_count;
         if (gmtl::isEqual( src_quat101, test_quat101, double(111.1) ))
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleCompareTest/isEqual(...)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void CoordCompareMetricTest::testCoordTimingOpEqualityTest()
   {
      // Test overhead of creation
      const long iters(400000);

      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord11;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord22;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord33;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord34;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > src_coord44;
      gmtl::Coord<gmtl::Vec<double,3>, gmtl::EulerAngle<double, gmtl::XYZ> > src_coord101;

      // half of them will be equal
      src_coord11.pos()[0] = 1.0f;
      src_coord22.pos()[1] = 1.0f;
      src_coord33.pos()[2] = 2.0f;

      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord11( src_coord11 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord22( src_coord22 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord33( src_coord33 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord34( src_coord34 );
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > test_coord44( src_coord44 );
      gmtl::Coord<gmtl::Vec<double,3>, gmtl::EulerAngle<double, gmtl::XYZ> > test_coord101( src_coord101 );

      // half will be not equal
      src_coord34.pos()[0] = 2.0f;
      src_coord44.pos()[1] = 3.0f;
      src_coord101.pos()[2] = 1.0;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (src_coord11 == test_coord11)
            ++true_count;
         if (src_coord22 == test_coord22)
            ++true_count;
         if (src_coord33 == test_coord33)
            ++true_count;
         if (src_coord34 == test_coord34)
            ++true_count;
         if (src_coord44 == test_coord44)
            ++true_count;
         if (src_coord101 == test_coord101)
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("CoordCompareTest/operator==", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void EulerAngleCompareMetricTest::testEulerAngleTimingOpNotEqualityTest()
   {
      // Test overhead of creation
      const long iters(400000);

      gmtl::EulerAngleXYZf src_quat11;
      gmtl::EulerAngleXYZf src_quat22;
      gmtl::EulerAngleXYZf src_quat33;
      gmtl::EulerAngleXYZf src_quat34;
      gmtl::EulerAngleXYZf src_quat44;
      gmtl::EulerAngleXYZd src_quat101;

      // half will be equal
      src_quat11[0] = 1.0f;
      src_quat22[2] = 1.0f;
      src_quat33[1] = 2.0f;

      gmtl::EulerAngleXYZf test_quat11( src_quat11 );
      gmtl::EulerAngleXYZf test_quat22( src_quat22 );
      gmtl::EulerAngleXYZf test_quat33( src_quat33 );
      gmtl::EulerAngleXYZf test_quat34( src_quat34 );
      gmtl::EulerAngleXYZf test_quat44( src_quat44 );
      gmtl::EulerAngleXYZd test_quat101( src_quat101 );

      // half will be not equal
      src_quat34[0] = 2.0f;
      src_quat44[1] = 3.0f;
      src_quat101[2] = 1.0f;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (src_quat11 != test_quat11)
            ++true_count;
         if (src_quat22 != test_quat22)
            ++true_count;
         if (src_quat33 != test_quat33)
            ++true_count;
         if (src_quat34 != test_quat34)
            ++true_count;
         if (src_quat44 != test_quat44)
            ++true_count;
         if (src_quat101 != test_quat101)
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleCompareTest/operator!=", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void QuatCompareMetricTest::testQuatTimingOpEqualityTest()
   {
      // Test overhead of creation
      const long iters(400000);

      gmtl::Quat<float> src_quat11;
      gmtl::Quat<float> src_quat22;
      gmtl::Quat<float> src_quat33;
      gmtl::Quat<float> src_quat34;
      gmtl::Quat<float> src_quat44;
      gmtl::Quat<double> src_quat101;

      // half of them will be equal
      src_quat11[0] = 1.0f;
      src_quat22[2] = 1.0f;
      src_quat33[3] = 2.0f;

      gmtl::Quat<float> test_quat11( src_quat11 );
      gmtl::Quat<float> test_quat22( src_quat22 );
      gmtl::Quat<float> test_quat33( src_quat33 );
      gmtl::Quat<float> test_quat34( src_quat34 );
      gmtl::Quat<float> test_quat44( src_quat44 );
      gmtl::Quat<double> test_quat101( src_quat101 );

      // half will be not equal
      src_quat34[0] = 2.0f;
      src_quat44[1] = 3.0f;
      src_quat101[3] = 1.0;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (src_quat11 == test_quat11)
            ++true_count;
         if (src_quat22 == test_quat22)
            ++true_count;
         if (src_quat33 == test_quat33)
            ++true_count;
         if (src_quat34 == test_quat34)
            ++true_count;
         if (src_quat44 == test_quat44)
            ++true_count;
         if (src_quat101 == test_quat101)
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatCompareTest/operator==", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void MatrixCompareMetricTest::testMatTimingOpNotEqualityTest()
   {
      // Test overhead of creation
      const long iters(25000);

      gmtl::Matrix<float, 1, 1> src_mat11;
      gmtl::Matrix<float, 2, 2> src_mat22;
      gmtl::Matrix<float, 3, 3> src_mat33;
      gmtl::Matrix<float, 3, 4> src_mat34;
      gmtl::Matrix<float, 4, 4> src_mat44;
      gmtl::Matrix<double, 10, 1> src_mat101;

      // half will be equal
      src_mat11.mData[0] = 1.0f;
      src_mat22.mData[0] = 1.0f;
      src_mat33.mData[4] = 2.0f;

      gmtl::Matrix<float, 1, 1> test_mat11( src_mat11 );
      gmtl::Matrix<float, 2, 2> test_mat22( src_mat22 );
      gmtl::Matrix<float, 3, 3> test_mat33( src_mat33 );
      gmtl::Matrix<float, 3, 4> test_mat34( src_mat34 );
      gmtl::Matrix<float, 4, 4> test_mat44( src_mat44 );
      gmtl::Matrix<double, 10, 1> test_mat101( src_mat101 );

      // half will be not equal
      src_mat34.mData[5] = 2.0f;
      src_mat44.mData[15] = 3.0f;
      src_mat101.mData[9] = 1.0f;

      unsigned true_count(0);

      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (src_mat11 != test_mat11)
            ++true_count;
         if (src_mat22 != test_mat22)
            ++true_count;
         if (src_mat33 != test_mat33)
            ++true_count;
         if (src_mat34 != test_mat34)
            ++true_count;
         if (src_mat44 != test_mat44)
            ++true_count;
         if (src_mat101 != test_mat101)
            ++true_count;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("MatrixCompareTest/OpNotEqualityTest", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
      // make sure compiler uses true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
 void QuatOpsMetricTest::testQuatTimingDiv()
 {
    gmtl::Quat<float> q3, q4;
    const long iters(10000);
    CPPUNIT_METRIC_START_TIMING();
    for (long iter = 0; iter < iters; ++iter)
    {
       gmtl::div( q4, q4, q3 );
    }
    CPPUNIT_METRIC_STOP_TIMING();
    CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatOpsTest/invert()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
    // Make sure the compiler doesn't optimize out
    CPPUNIT_ASSERT( q4[2] != 1234.5f );
 }
 void CoordClassMetricTest::testCoordTimingOpEqual()
 {
    const long iters( 400000 );
    gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > q4, q2;
    CPPUNIT_METRIC_START_TIMING();
    for (long iter = 0; iter < iters; ++iter)
    {
       // performance of operator=() function
       q4 = q2;
       q2.pos()[2] += q4.pos()[1];
    }
    CPPUNIT_METRIC_STOP_TIMING();
    CPPUNIT_ASSERT_METRIC_TIMING_LE("CoordTest/operator=()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
    CPPUNIT_ASSERT( q4.pos()[0] != 3498.0f );
 }
   void QuatOpsMetricTest::testQuatTimingLerp()
   {
      gmtl::Quat<float> from, result;
      const long iters(10000);
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::lerp( result, ((float)iter) / ((float)iters), from, result );
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatOpsTest/lerp()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
      // Make sure the compiler doesn't optimize out
      CPPUNIT_ASSERT( result[2] != 1234.5f );

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::slerp( result, ((float)iter) / ((float)iters), from, result );
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatOpsTest/slerp()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
      // Make sure the compiler doesn't optimize out
      CPPUNIT_ASSERT( result[2] != 1234.5f );
   }
 void QuatOpsMetricTest::testQuatTimingOperatorMinus()
 {
    gmtl::Quat<float> q4;
    const long iters(25000);
    CPPUNIT_METRIC_START_TIMING();
    for (long iter = 0; iter < iters; ++iter)
    {
       q4 = -q4;
       q4[1] += q4[2];
    }
    CPPUNIT_METRIC_STOP_TIMING();
    CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatOpsTest/operator-(quat)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
    // Make sure the compiler doesn't optimize out
    CPPUNIT_ASSERT( q4[2] != 1234.5f );
 }
   void QuatOpsMetricTest::testQuatTimingMag()
   {
      gmtl::Quat<float> q1;
      const long iters(10000);
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         q1[2] += gmtl::length( q1 );
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatOpsTest/length(q)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out
      CPPUNIT_ASSERT( q1[2] != 1234.5f );
   }
Пример #12
0
   void QuatGenMetricTest::testGenTimingMakeInvert2()
   {
      gmtl::Quat<float> q2;
      const long iters(25000);
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         q2 = gmtl::makeInvert( q2 );
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/makeInvert(quatf)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // force intelligent compilers to do all the iterations (ie. to not optimize them out),
      // by using the variables computed...
      CPPUNIT_ASSERT( q2[0] != 10000.0f );
   }
Пример #13
0
   void QuatClassMetricTest::testQuatTimingOpEqual()
   {
      const long iters( 400000 );
      gmtl::Quat<float> q4, q2( 0, 2, 1, 3 );
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of operator=() function
         q4 = q2;
         q2[0] += q4[2];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/operator=()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( q4[0] != 3498.0f );
   }
Пример #14
0
   void PointMetricTest::testTimingOpDivScalarEq()
   {
      gmtl::Point<float,3> test_point1(12.0, 8.0, 4.0);

      // -- test op-= performance
      const float iters(400000);
      CPPUNIT_METRIC_START_TIMING();

      for( float iter=0;iter<iters; ++iter)
      {
         test_point1 /= 0.95f;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("PointTest/OpDivScalarEqOverhead", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
   }
   void EulerAngleClassMetricTest::testEulerAngleTimingOpEqual()
   {
      const long iters( 400000 );
      gmtl::EulerAngleXYZf q4, q2( 0.0f, 2.0f, 1.0f );
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of operator=() function
         q4 = q2;
         q2[0] += q4[2];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleTest/operator=()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( q4[0] != 3498.0f );
   }
   void CoordGenMetricTest::testGenTimingMakeMatrix()
   {
      gmtl::Matrix44f mat;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > q1;

      const long iters(25000);
      CPPUNIT_METRIC_START_TIMING();

      for (long iter = 0; iter < iters; ++iter)
      {
         mat = gmtl::make<gmtl::Matrix44f>( q1 );
         q1.pos()[2] += mat[3][3];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "CoordGenTest/make<Matrix44f>(q1,XYZ)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%
      CPPUNIT_ASSERT( q1.pos()[1] != 10000.0f );
   }
   void CoordGenMetricTest::testGenTimingSetCoord()
   {
      gmtl::Matrix44f mat;
      gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > q1;
      const long iters(25000);
      CPPUNIT_METRIC_START_TIMING();

      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::set( q1, mat );
         mat[3][3] += q1.getPos()[2];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "CoordGenTest/set(coord,mat)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( q1.pos()[1] != 10000.0f );
   }
Пример #18
0
   void QuatClassMetricTest::testQuatTimingSet()
   {
      const long iters( 400000 );
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();
      gmtl::Quat<float> q;
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of set...
         q.set( 1, 2, 3, 4 );
         use_value += q[gmtl::Xelt];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/set()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value >= 0.0f );
   }
   void CoordClassMetricTest::testCoordTimingDefaultConstructor()
   {
      const long iters( 400000 );
      float use_value(1);

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of def constructor
         gmtl::Coord<gmtl::Vec<float,3>, gmtl::EulerAngle<float, gmtl::XYZ> > q;
         use_value += q.mPos[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("CoordTest/DefaultConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
   void AxisAngleClassMetricTest::testAxisAngleTimingDefaultConstructor()
   {
      const long iters( 400000 );
      float use_value(1);

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of def constructor
         gmtl::AxisAnglef q;
         use_value += q.mData[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("AxisAngleTest/DefaultConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
Пример #21
0
   void QuatClassMetricTest::testQuatTimingElementConstructor()
   {
      const long iters( 400000 );
      float use_value(1);

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of element constructor
         gmtl::Quat<float> q2( 10, 11, 12, 13 );
         use_value += q2.mData[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/ElementConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
   void EulerAngleClassMetricTest::testEulerAngleTimingElementConstructor()
   {
      const long iters( 400000 );
      float use_value(1);

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of element constructor
         gmtl::EulerAngleXYZf q2( 10.0f, 11.0f, 12.0f );
         use_value += q2[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleTest/ElementConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
Пример #23
0
   void QuatClassMetricTest::testQuatTimingGetData()
   {
      const long iters( 400000 );
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();
      gmtl::Quat<float> q;
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of getData...
         const float* d = q.getData();
         use_value += d[3];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/getData()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value > 0.0f );
   }
   void EulerAngleClassMetricTest::testEulerAngleTimingGetData()
   {
      const long iters( 400000 );
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();
      gmtl::EulerAngleXYZf q( 1, 2, 3 );
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of getData...
         const float* d = q.getData();
         use_value += d[1];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleTest/getData()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value > 0.0f );
   }
   void EulerAngleClassMetricTest::testEulerAngleTimingSet()
   {
      const long iters( 400000 );
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();
      gmtl::EulerAngleXYZf q;
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of set...
         q.set( 1, 2, 3 );
         use_value += q[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleTest/set()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value >= 0.0f );
   }
Пример #26
0
   void QuatClassMetricTest::testQuatTimingCopyConstructor()
   {
      const long iters( 400000 );
      float use_value(1);
      gmtl::Quat<float> q( 67, 68, 69, 60 );

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of copy constructor
         gmtl::Quat<float> q3( q );
         use_value += q3.mData[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/CopyConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
Пример #27
0
   void QuatClassMetricTest::testQuatTimingGet()
   {
      const long iters( 400000 );
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();
      gmtl::Quat<float> q;
      float x = 102, y = 103, z = 101, w = 100;
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of get...
         q.get( x, y, z, w );
         use_value = use_value + x + y + z + w;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatTest/get()", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value > 0.0f );
   }
   void EulerAngleClassMetricTest::testEulerAngleTimingCopyConstructor()
   {
      const long iters( 400000 );
      float use_value(1);
      gmtl::EulerAngleXYZf q( 67.0f, 68.0f, 69.0f );

      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         // performance of copy constructor
         gmtl::EulerAngleXYZf q3( q );
         use_value += q3[0];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("EulerAngleTest/CopyConstructor", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT( use_value != 0 );
   }
   void QuatCompareMetricTest::testQuatTimingEquiv()
   {
      gmtl::Quatf quat1(1.0, 2.0, 34.0, 4.0),
                       quat2(-1.0, -2.0, -34.0, -4.0);

      unsigned true_count(0);
      const long iters(200000);
      CPPUNIT_METRIC_START_TIMING();
      for( long iter=0;iter<iters; ++iter)
      {
         if (gmtl::isEquiv( quat1, quat2, 0.0001f ) )
            ++true_count;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("QuatCompareTest/isEquiv(quat,quat,tol)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // Make sure the compiler doesn't optimize out true_count
      CPPUNIT_ASSERT( true_count > 0 );
   }
   void AABoxContainMetricTest::testTimingIsInVolumePt()
   {
      gmtl::AABoxf box(gmtl::Point3f(-1,-1,-1), gmtl::Point3f(1,1,1));
      gmtl::Point3f origin;
      const long iters(400000);
      float use_value(0);
      CPPUNIT_METRIC_START_TIMING();

      for(long iter=0;iter<iters; ++iter)
      {
         gmtl::isInVolume(box, origin);
         use_value = use_value + box.mMin[0] + 2.0f;
      }

      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE("AABoxContainTest/IsInVolumePt", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      CPPUNIT_ASSERT(use_value > 0.0f);
   }