Subversion Repositories gelsvn

Rev

Rev 307 | Details | Compare with Previous | Last modification | View Log | RSS feed

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