Subversion Repositories gelsvn

Rev

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

Rev 328 Rev 417
Line 14... Line 14...
14
using namespace std;
14
using namespace std;
15
using namespace CGLA;
15
using namespace CGLA;
16
 
16
 
17
void make_ran_point(Vec3f& p0)
17
void make_ran_point(Vec3f& p0)
18
{
18
{
19
	p0=Vec3f(10.0f*rand()/RAND_MAX,
19
	p0=Vec3f(10.0f*gel_rand()/GEL_RAND_MAX,
20
					 10.0f*rand()/RAND_MAX,
20
					 10.0f*gel_rand()/GEL_RAND_MAX,
21
					 10.0f*rand()/RAND_MAX);
21
					 10.0f*gel_rand()/GEL_RAND_MAX);
22
}
22
}
23
 
23
 
24
int main()
24
int main()
25
{
25
{
26
	cout << "\n\nTest 1: Insert and find " << endl;
26
	cout << "\n\nTest 1: Insert and find " << endl;
27
	int sizes[15] = {1,2,3,4,7,21,134,256,589,678,751,892,1023,1024,1025};
27
	int sizes[15] = {1,2,3,4,7,21,134,256,589,678,751,892,1023,1024,1025};
28
	for(int i=0;i<15;++i)
28
	for(int i=0;i<15;++i)
29
		{
29
		{
30
			int N=sizes[i];
30
			int N=sizes[i];
31
			cout << "Tree size " << N << endl;
31
			cout << "Tree size " << N << endl;
32
			srand(0);	
32
			gel_srand(0);	
33
			cout << "Insert and find points " << endl;
33
			cout << "Insert and find points " << endl;
34
			KDTree<Vec3f,int> tree;
34
			KDTree<Vec3f,int> tree;
35
			for(int i=0;i<N;++i)
35
			for(int i=0;i<N;++i)
36
				{
36
				{
37
					Vec3f p0;
37
					Vec3f p0;
38
					make_ran_point(p0);
38
					make_ran_point(p0);
39
					tree.insert(p0, i);
39
					tree.insert(p0, i);
40
				}
40
				}
41
			tree.build();
41
			tree.build();
42
			srand(0);
42
			gel_srand(0);
43
			for(int i=0;i<N;++i)
43
			for(int i=0;i<N;++i)
44
				{
44
				{
45
					Vec3f p0;
45
					Vec3f p0;
46
					make_ran_point(p0);
46
					make_ran_point(p0);
47
					Vec3f pos;
47
					Vec3f pos;