Subversion Repositories gelsvn

Rev

Rev 324 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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