667 |
khor |
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 |
|
|
|
12 |
#ifndef __GEOMETRY_BOUNDINGINODE_H
|
|
|
13 |
#define __GEOMETRY_BOUNDINGINODE_H
|
|
|
14 |
|
|
|
15 |
#include "Ray.h"
|
|
|
16 |
#include "BoundingNode.h"
|
|
|
17 |
|
|
|
18 |
namespace Geometry
|
|
|
19 |
{
|
|
|
20 |
|
|
|
21 |
/** Interior node of bounding box tree. Contains
|
|
|
22 |
pointers to left and right tree. */
|
|
|
23 |
template<class BoxType>
|
|
|
24 |
class BoundingINode: public BoundingNode<BoxType>
|
|
|
25 |
{
|
|
|
26 |
BoundingNode<BoxType>* left;
|
|
|
27 |
BoundingNode<BoxType>* right;
|
|
|
28 |
public:
|
|
|
29 |
|
|
|
30 |
BoundingINode(const BoxType& box,
|
|
|
31 |
BoundingNode<BoxType>* _left,
|
|
|
32 |
BoundingNode<BoxType>* _right):
|
|
|
33 |
BoundingNode<BoxType>(box), left(_left), right(_right) {}
|
|
|
34 |
|
|
|
35 |
virtual ~BoundingINode() {delete left; delete right;}
|
|
|
36 |
|
|
|
37 |
bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
|
|
|
38 |
void intersect(Ray& r) const;
|
|
|
39 |
int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
|
|
|
40 |
|
|
|
41 |
const BoundingNode<BoxType>* get_left() const {return left;}
|
|
|
42 |
const BoundingNode<BoxType>* get_right() const {return right;}
|
|
|
43 |
};
|
|
|
44 |
|
|
|
45 |
}
|
|
|
46 |
#endif
|