Subversion Repositories gelsvn

Rev

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

Rev 309 Rev 324
1
#ifndef __BOUNDINGINODE_H
1
#ifndef __BOUNDINGINODE_H
2
#define __BOUNDINGINODE_H
2
#define __BOUNDINGINODE_H
3
 
3
 
4
#include "Ray.h"
4
#include "Ray.h"
5
#include "BoundingNode.h"
5
#include "BoundingNode.h"
6
 
6
 
7
namespace Geometry
7
namespace Geometry
8
{
8
{
9
 
9
 
10
/** Interior node of bounding box tree. Contains
10
/** Interior node of bounding box tree. Contains
11
		pointers to left and right tree. */
11
		pointers to left and right tree. */
12
template<class BoxType>
12
template<class BoxType>
13
class BoundingINode: public BoundingNode<BoxType>
13
class BoundingINode: public BoundingNode<BoxType>
14
{
14
{
15
	BoundingNode<BoxType>* left;
15
	BoundingNode<BoxType>* left;
16
	BoundingNode<BoxType>* right;
16
	BoundingNode<BoxType>* right;
17
 public:
17
 public:
18
 
18
 
19
	BoundingINode(const BoxType& box,
19
	BoundingINode(const BoxType& box,
20
								BoundingNode<BoxType>* _left,
20
								BoundingNode<BoxType>* _left,
21
								BoundingNode<BoxType>* _right): 
21
								BoundingNode<BoxType>* _right): 
22
		BoundingNode<BoxType>(box), left(_left), right(_right) {}
22
		BoundingNode<BoxType>(box), left(_left), right(_right) {}
23
 
23
 
24
	~BoundingINode() {delete left; delete right;}
24
	virtual ~BoundingINode() {delete left; delete right;}
25
 
25
 
26
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const; 
26
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const; 
27
	void intersect(Ray&  r) const; 
27
	void intersect(Ray&  r) const; 
28
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
28
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
29
 
29
 
30
	const BoundingNode<BoxType>* get_left() const {return left;}
30
	const BoundingNode<BoxType>* get_left() const {return left;}
31
	const BoundingNode<BoxType>* get_right() const {return right;}
31
	const BoundingNode<BoxType>* get_right() const {return right;}
32
};
32
};
33
 
33
 
34
}
34
}
35
#endif
35
#endif
36
 
36