Subversion Repositories gelsvn

Rev

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

Rev 291 Rev 299
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
 
7
 
8
namespace Geometry
8
namespace Geometry
9
{
9
{
10
 
10
 
11
template<class BoxType>
11
template<class BoxType>
12
class BoundingTree
12
class BoundingTree
13
{
13
{
14
 public:
14
 public:
15
 
15
 
16
	typedef BoundingNode<BoxType> Node;
16
	typedef BoundingNode<BoxType> Node;
17
	typedef BoundingLNode<BoxType> LeafNode;
17
	typedef BoundingLNode<BoxType> LeafNode;
18
	typedef BoundingINode<BoxType> IntNode;
18
	typedef BoundingINode<BoxType> IntNode;
19
	
19
	
20
	Node* root;
20
	Node* root;
21
 
21
 
22
 public:
22
 public:
23
 
23
 
24
	BoundingTree(): root(0) {}
24
	BoundingTree(): root(0) {}
25
 
25
 
26
	~BoundingTree() {delete root;}
26
	~BoundingTree() {delete root;}
27
 
27
 
28
	void build(std::vector<Triangle>& triangles);
28
	void build(std::vector<Triangle>& triangles);
29
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
29
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
30
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
30
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
31
 
31
 
32
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
32
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
33
};
33
};
34
 
34
 
35
}
35
}
36
 
36
 
37
#endif
37
#endif
38
 
38