Skip to content
Snippets Groups Projects
Commit 8124cc9b authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

use the ValueFactory class to create test rotations

[[Imported from SVN: r8193]]
parent 6e0de088
No related branches found
No related tags found
No related merge requests found
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
#include <dune/gfe/rotation.hh> #include <dune/gfe/rotation.hh>
#include <dune/gfe/svd.hh> #include <dune/gfe/svd.hh>
#include "valuefactory.hh"
using namespace Dune; using namespace Dune;
void testUnitQuaternion(Rotation<double,3> q) void testRotation(Rotation<double,3> q)
{ {
// Make sure it really is a unit quaternion // Make sure it really is a unit quaternion
q.normalize(); q.normalize();
...@@ -108,14 +109,14 @@ void testUnitQuaternion(Rotation<double,3> q) ...@@ -108,14 +109,14 @@ void testUnitQuaternion(Rotation<double,3> q)
int main (int argc, char *argv[]) try int main (int argc, char *argv[]) try
{ {
// Make a few random unit quaternions and pipe them into the test std::vector<Rotation<double,3> > testPoints;
for (int i=-5; i<5; i++) ValueFactory<Rotation<double,3> >::get(testPoints);
for (int j=-5; j<5; j++)
for (int k=-5; k<5; k++)
for (int l=-5; l<5; l++)
if (i!=0 || j!=0 || k!=0 || l!=0)
testUnitQuaternion(Quaternion<double>(i,j,k,l));
int nTestPoints = testPoints.size();
// Test each element in the list
for (int i=0; i<nTestPoints; i++)
testRotation(testPoints[i]);
} catch (Exception e) { } catch (Exception e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment