Subversion Repositories gelsvn

Rev

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

Rev 291 Rev 299
1
#ifndef __BOUNDINGNODE_H
1
#ifndef __BOUNDINGNODE_H
2
#define __BOUNDINGNODE_H
2
#define __BOUNDINGNODE_H
3
 
3
 
4
#include <vector>
4
#include <vector>
5
#include "CGLA/Vec3f.h"
5
#include "CGLA/Vec3f.h"
6
#include "Triangle.h"
6
#include "Triangle.h"
7
#include "AABox.h"
7
#include "AABox.h"
8
#include "OBox.h"
8
#include "OBox.h"
9
 
9
 
10
namespace Geometry
10
namespace Geometry
11
{
11
{
12
 
12
 
13
/// Abstract BOUNDINGNODE node.
13
/// Abstract BOUNDINGNODE node.
14
template<class BoxType>
14
template<class BoxType>
15
class BoundingNode: public BoxType
15
class BoundingNode: public BoxType
16
{
16
{
17
 public:
17
 public:
18
	
18
	
19
	BoundingNode(const BoxType& box): BoxType(box) {}
19
	BoundingNode(const BoxType& box): BoxType(box) {}
20
 
20
 
21
	/// Count number of intersections from a point in a given direction
21
	/// Count number of intersections from a point in a given direction
22
	virtual int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const=0;
22
	virtual int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const=0;
23
 
23
 
24
	/// Find the surface intersection point
24
	/// Find the surface intersection point
25
	virtual bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const=0;
25
	virtual bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const=0;
26
 
26
 
27
	/** For a given point, return the min and max square distance and the
27
	/** For a given point, return the min and max square distance and the
28
			sign. Non-leafs return zero for the sign. Leaves
28
			sign. Non-leafs return zero for the sign. Leaves
29
			return the square of the true distance as both min and max. */
29
			return the square of the true distance as both min and max. */
30
	virtual void sq_distance(const CGLA::Vec3f&, float&, float&, float&) const;
30
	virtual void sq_distance(const CGLA::Vec3f&, float&, float&, float&) const;
31
	
31
	
32
	static BoundingNode* build(std::vector<Triangle>& triangles);
32
	static BoundingNode* build(std::vector<Triangle>& triangles);
33
};
33
};
34
 
34
 
35
}
35
}
36
#endif
36
#endif
37
 
37