Subversion Repositories gelsvn

Rev

Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 20
Line 4... Line 4...
4
#include "CGLA/Vec2i.h"
4
#include "CGLA/Vec2i.h"
5
#include "CGLA/Vec3i.h"
5
#include "CGLA/Vec3i.h"
6
#include "CGLA/Vec3f.h"
6
#include "CGLA/Vec3f.h"
7
#include "CGLA/Vec3d.h"
7
#include "CGLA/Vec3d.h"
8
#include "CGLA/Vec3Hf.h"
8
#include "CGLA/Vec3Hf.h"
-
 
9
#include "Timer.h"
9
 
10
 
10
using namespace std;
11
using namespace std;
11
using namespace CGLA;
12
using namespace CGLA;
12
 
13
 
13
 
14
 
Line 48... Line 49...
48
		orthogonal(ad, dd, ed);
49
		orthogonal(ad, dd, ed);
49
		assert(dd == Vec3d(0,1,0));
50
		assert(dd == Vec3d(0,1,0));
50
		assert(ed == Vec3d(0,0,1));
51
		assert(ed == Vec3d(0,0,1));
51
		cout << " dd ed (should be 010 and 001) " << dd << ed << endl;
52
		cout << " dd ed (should be 010 and 001) " << dd << ed << endl;
52
	}
53
	}
-
 
54
	{
-
 
55
	  Vec3f af(1,3,2);
-
 
56
	  cout << "max_element af (should be 3): " << af.max_coord() << endl;
-
 
57
	  cout << "min_element af (should be 1): " << af.min_coord() << endl;
-
 
58
	  Vec3f bf(2,1,3);
-
 
59
	  cout << "v_max af bf (should be 233): " << v_max(af, bf) << endl;
-
 
60
	  cout << "v_min af bf (should be 112): " << v_min(af, bf) << endl;
-
 
61
	  Vec3f cf(2,2,2);
-
 
62
	  cout << "cf==3 (should be 0): " << (cf == 3) << endl;
-
 
63
	  cout << "cf==2 (should be 1): " << (cf == 2) << endl;
-
 
64
	  Timer t;
-
 
65
 
-
 
66
	  float d;
-
 
67
	  t.start();
-
 
68
	  for(int i = 0; i < 10000000; ++i)
-
 
69
	  {
-
 
70
	    cf = cross(af, bf);
-
 
71
	    d = dot(af, bf);
-
 
72
	  }
-
 
73
	  t.stop();
-
 
74
	  cout << "Time 10,000,000 af cross bf" << endl
-
 
75
	       << "   + 10,000,000 af dot bf: "   << t.get_time() << endl;
-
 
76
	  cout << "Results: " << cf << " " << d;
-
 
77
	}
53
}
78
}