Subversion Repositories gelsvn

Rev

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

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