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 OBox.h
9
 * @brief An oriented bounding box.
10
 */
11
 
443 jab 12
#ifndef __GEOMETRY_OBOX__H
13
#define __GEOMETRY_OBOX__H
290 jrf 14
 
15
#include <iostream>
16
#include <vector>
17
#include "Triangle.h"
18
#include "AABox.h"
19
 
291 jrf 20
namespace Geometry
21
{
22
 
290 jrf 23
class OBox
24
{
25
	const CGLA::Mat3x3f R;
26
	const AABox aabox;
27
 
28
public:
29
	OBox() {}
30
 
31
	OBox(const CGLA::Mat3x3f& _R, const AABox& _aabox):
32
		R(_R), aabox(_aabox) {}
33
 
34
	bool intersect(const CGLA::Vec3f&, const CGLA::Vec3f&) const;
35
 
460 jab 36
	void minmax_sq_dist(const CGLA::Vec3f& p, float& dmin, float& dmax) const
37
	{
38
		aabox.minmax_sq_dist(R * p, dmin, dmax);
39
	}
40
 
290 jrf 41
 
42
	static OBox box_triangle(const Triangle&);
43
 
44
	static OBox box_and_split(const std::vector<Triangle>& invec,
45
														 std::vector<Triangle>& lvec,
46
														 std::vector<Triangle>& rvec);
47
 
291 jrf 48
	const CGLA::Mat3x3f& get_rotation() const { return R; }
49
	const AABox& get_aabox() const { return aabox; }
290 jrf 50
 
51
/* 	const CGLA::Vec3f& get_pmin() const {assert(0); return CGLA::Vec3f(0);} */
52
 
53
/* 	const CGLA::Vec3f& get_pmax() const {assert(0); return CGLA::Vec3f(0);} */
54
 
55
};
56
 
291 jrf 57
}
290 jrf 58
#endif