Subversion Repositories gelsvn

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 bj 1
#include <iostream>
2
 
3
#include "CGLA/Vec2f.h"
4
#include "CGLA/Vec2i.h"
5
#include "CGLA/Vec3i.h"
6
#include "CGLA/Vec3f.h"
7
#include "CGLA/Vec3d.h"
8
#include "CGLA/Vec3Hf.h"
9
 
10
using namespace std;
11
using namespace CGLA;
12
 
13
 
14
/* This is a non-exhaustive test program for CGLA */
15
main()
16
{
17
	// Test that the right cross products get called;
18
 
19
	{
20
		Vec2f a2(1,0),b2(0,1),c2;
21
		Vec3f af(1,0,0),bf(0,1,0),cf;
22
		Vec3d ad(1,0,0),bd(0,1,0),cd;
23
		Vec3i ai(1,0,0),bi(0,1,0),ci;
24
 
25
		float x = cross(a2, b2);
26
		cross(a2-b2, a2-b2);
27
		cf = cross(af, bf);
28
		ci = cross(ai, bi);
29
 
30
		assert(x == 1.0f);
31
		assert(cf == Vec3f(0,0,1));
32
		assert(ci == Vec3i(0,0,1));
33
		cout << " x (should be 1) " << x << endl;
34
		cout << " cf (should be 0,0,1) " << cf << endl;
35
		cout << " ci (should be 0,0,1) " << ci << endl;
36
	}
37
 
38
	{
39
		Vec3f af(1,0,0);
40
		Vec3f df,ef;
41
		orthogonal(af, df, ef);
42
		assert(df == Vec3f(0,1,0));
43
		assert(ef == Vec3f(0,0,1));
44
		cout << " df ef (should be 010 and 001) " << df << ef << endl;
45
 
46
		Vec3d ad(1,0,0);
47
		Vec3d dd,ed;
48
		orthogonal(ad, dd, ed);
49
		assert(dd == Vec3d(0,1,0));
50
		assert(ed == Vec3d(0,0,1));
51
		cout << " dd ed (should be 010 and 001) " << dd << ed << endl;
52
	}
53
}