Subversion Repositories gelsvn

Rev

Rev 595 | Details | Compare with Previous | Last modification | View Log | RSS feed

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