Subversion Repositories gelsvn

Rev

Rev 443 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 443 Rev 595
-
 
1
/* ----------------------------------------------------------------------- *
-
 
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
-
 
3
 * Copyright (C) the authors and DTU Informatics
-
 
4
 * For license and list of authors, see ../../doc/intro.pdf
-
 
5
 * ----------------------------------------------------------------------- */
-
 
6
 
-
 
7
/**
-
 
8
 * @file BoundingINode.h
-
 
9
 * @brief Interior node class of a bounding hierarchy
-
 
10
 */
-
 
11
 
1
#ifndef __GEOMETRY_BOUNDINGINODE_H
12
#ifndef __GEOMETRY_BOUNDINGINODE_H
2
#define __GEOMETRY_BOUNDINGINODE_H
13
#define __GEOMETRY_BOUNDINGINODE_H
3
 
14
 
4
#include "Ray.h"
15
#include "Ray.h"
5
#include "BoundingNode.h"
16
#include "BoundingNode.h"
6
 
17
 
7
namespace Geometry
18
namespace Geometry
8
{
19
{
9
 
20
 
10
/** Interior node of bounding box tree. Contains
21
/** Interior node of bounding box tree. Contains
11
		pointers to left and right tree. */
22
		pointers to left and right tree. */
12
template<class BoxType>
23
template<class BoxType>
13
class BoundingINode: public BoundingNode<BoxType>
24
class BoundingINode: public BoundingNode<BoxType>
14
{
25
{
15
	BoundingNode<BoxType>* left;
26
	BoundingNode<BoxType>* left;
16
	BoundingNode<BoxType>* right;
27
	BoundingNode<BoxType>* right;
17
 public:
28
 public:
18
 
29
 
19
	BoundingINode(const BoxType& box,
30
	BoundingINode(const BoxType& box,
20
								BoundingNode<BoxType>* _left,
31
								BoundingNode<BoxType>* _left,
21
								BoundingNode<BoxType>* _right): 
32
								BoundingNode<BoxType>* _right): 
22
		BoundingNode<BoxType>(box), left(_left), right(_right) {}
33
		BoundingNode<BoxType>(box), left(_left), right(_right) {}
23
 
34
 
24
	virtual ~BoundingINode() {delete left; delete right;}
35
	virtual ~BoundingINode() {delete left; delete right;}
25
 
36
 
26
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const; 
37
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const; 
27
	void intersect(Ray&  r) const; 
38
	void intersect(Ray&  r) const; 
28
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
39
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
29
 
40
 
30
	const BoundingNode<BoxType>* get_left() const {return left;}
41
	const BoundingNode<BoxType>* get_left() const {return left;}
31
	const BoundingNode<BoxType>* get_right() const {return right;}
42
	const BoundingNode<BoxType>* get_right() const {return right;}
32
};
43
};
33
 
44
 
34
}
45
}
35
#endif
46
#endif
36
 
47