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 BoundingTree.h
-
 
9
 * @brief Template representing a bounding hierarchy.
-
 
10
 */
-
 
11
 
1
#ifndef __GEOMETRY_BOUNDINGTREE_H
12
#ifndef __GEOMETRY_BOUNDINGTREE_H
2
#define __GEOMETRY_BOUNDINGTREE_H
13
#define __GEOMETRY_BOUNDINGTREE_H
3
 
14
 
4
#include "BoundingNode.h"
15
#include "BoundingNode.h"
5
#include "BoundingLNode.h"
16
#include "BoundingLNode.h"
6
#include "BoundingINode.h"
17
#include "BoundingINode.h"
7
#include "Ray.h"
18
#include "Ray.h"
8
 
19
 
9
namespace Geometry
20
namespace Geometry
10
{
21
{
11
 
22
 
-
 
23
/** Template representing a bounding hierarchy. The argument should be the bounding box type - 
-
 
24
    either ABox or OOBox */
12
template<class BoxType>
25
template<class BoxType>
13
class BoundingTree
26
class BoundingTree
14
{
27
{
15
 public:
28
 public:
16
 
29
 
17
	typedef BoundingNode<BoxType> Node;
30
	typedef BoundingNode<BoxType> Node;
18
	typedef BoundingLNode<BoxType> LeafNode;
31
	typedef BoundingLNode<BoxType> LeafNode;
19
	typedef BoundingINode<BoxType> IntNode;
32
	typedef BoundingINode<BoxType> IntNode;
20
	
33
	
21
	Node* root;
34
	Node* root;
22
 
35
 
23
 public:
36
 public:
24
 
37
 
25
	BoundingTree(): root(0) {}
38
	BoundingTree(): root(0) {}
26
 
39
 
27
	~BoundingTree() {delete root;}
40
	~BoundingTree() {delete root;}
28
 
41
 
29
	void build(std::vector<Triangle>& triangles);
42
	void build(std::vector<Triangle>& triangles);
30
 
43
 
31
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
44
	bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const;
32
 
45
 
33
	void intersect(Ray& r) const;
46
	void intersect(Ray& r) const;
34
 
47
 
35
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
48
	int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const;
36
 
49
 
37
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
50
	float compute_signed_distance(const CGLA::Vec3f& p,	float=FLT_MAX) const;
38
};
51
};
39
 
52
 
40
}
53
}
41
 
54
 
42
#endif
55
#endif
43
 
56