Subversion Repositories gelsvn

Rev

Rev 299 | Rev 443 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 299 Rev 309
1
#ifndef __BOUNDINGTREE_H
1
#ifndef __BOUNDINGTREE_H
2
#define __BOUNDINGTREE_H
2
#define __BOUNDINGTREE_H
3
 
3
 
4
#include "BoundingNode.h"
4
#include "BoundingNode.h"
5
#include "BoundingLNode.h"
5
#include "BoundingLNode.h"
6
#include "BoundingINode.h"
6
#include "BoundingINode.h"
-
 
7
#include "Ray.h"
7
 
8
 
8
namespace Geometry
9
namespace Geometry
9
{
10
{
10
 
11
 
11
template<class BoxType>
12
template<class BoxType>
12
class BoundingTree
13
class BoundingTree
13
{
14
{
14
 public:
15
 public:
15
 
16
 
16
	typedef BoundingNode<BoxType> Node;
17
	typedef BoundingNode<BoxType> Node;
17
	typedef BoundingLNode<BoxType> LeafNode;
18
	typedef BoundingLNode<BoxType> LeafNode;
18
	typedef BoundingINode<BoxType> IntNode;
19
	typedef BoundingINode<BoxType> IntNode;
19
	
20
	
20
	Node* root;
21
	Node* root;
21
 
22
 
22
 public:
23
 public:
23
 
24
 
24
	BoundingTree(): root(0) {}
25
	BoundingTree(): root(0) {}
25
 
26
 
26
	~BoundingTree() {delete root;}
27
	~BoundingTree() {delete root;}
27
 
28
 
28
	void build(std::vector<Triangle>& triangles);
29
	void build(std::vector<Triangle>& triangles);
-
 
30
 
29
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
31
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
-
 
32
 
-
 
33
	void intersect(Ray& r) const;
-
 
34
 
30
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
35
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
31
 
36
 
32
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
37
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
33
};
38
};
34
 
39
 
35
}
40
}
36
 
41
 
37
#endif
42
#endif
38
 
43