Subversion Repositories gelsvn

Rev

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

Rev Author Line No. Line
290 jrf 1
#ifndef __BOUNDINGNODE_H
2
#define __BOUNDINGNODE_H
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) {}
21
 
22
	/// Count number of intersections from a point in a given direction
23
	virtual int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const=0;
24
 
25
	/// Find the surface intersection point
26
	virtual bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const=0;
27
 
309 jab 28
	virtual void intersect(Ray& r) const = 0;
29
 
290 jrf 30
	/** For a given point, return the min and max square distance and the
31
			sign. Non-leafs return zero for the sign. Leaves
32
			return the square of the true distance as both min and max. */
33
	virtual void sq_distance(const CGLA::Vec3f&, float&, float&, float&) const;
34
 
35
	static BoundingNode* build(std::vector<Triangle>& triangles);
36
};
37
 
291 jrf 38
}
290 jrf 39
#endif