Subversion Repositories gelsvn

Rev

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

Rev 443 Rev 460
1
#ifndef __GEOMETRY_OBOX__H
1
#ifndef __GEOMETRY_OBOX__H
2
#define __GEOMETRY_OBOX__H
2
#define __GEOMETRY_OBOX__H
3
 
3
 
4
#include <iostream>
4
#include <iostream>
5
#include <vector>
5
#include <vector>
6
#include "Triangle.h"
6
#include "Triangle.h"
7
#include "AABox.h"
7
#include "AABox.h"
8
 
8
 
9
namespace Geometry
9
namespace Geometry
10
{
10
{
11
 
11
 
12
class OBox
12
class OBox
13
{
13
{
14
	const CGLA::Mat3x3f R;
14
	const CGLA::Mat3x3f R;
15
	const AABox aabox;
15
	const AABox aabox;
16
 
16
 
17
public:
17
public:
18
	OBox() {}
18
	OBox() {}
19
 
19
 
20
	OBox(const CGLA::Mat3x3f& _R, const AABox& _aabox):
20
	OBox(const CGLA::Mat3x3f& _R, const AABox& _aabox):
21
		R(_R), aabox(_aabox) {}
21
		R(_R), aabox(_aabox) {}
22
 
22
 
23
	bool intersect(const CGLA::Vec3f&, const CGLA::Vec3f&) const;
23
	bool intersect(const CGLA::Vec3f&, const CGLA::Vec3f&) const;
24
 
24
 
25
	void minmax_sq_dist(const CGLA::Vec3f& p, float& dmin, float& dmax) const;
25
	void minmax_sq_dist(const CGLA::Vec3f& p, float& dmin, float& dmax) const
-
 
26
	{
-
 
27
		aabox.minmax_sq_dist(R * p, dmin, dmax);
-
 
28
	}
-
 
29
	
26
 
30
 
27
	static OBox box_triangle(const Triangle&);
31
	static OBox box_triangle(const Triangle&);
28
 
32
 
29
	static OBox box_and_split(const std::vector<Triangle>& invec,
33
	static OBox box_and_split(const std::vector<Triangle>& invec,
30
														 std::vector<Triangle>& lvec,
34
														 std::vector<Triangle>& lvec,
31
														 std::vector<Triangle>& rvec);
35
														 std::vector<Triangle>& rvec);
32
														 
36
														 
33
	const CGLA::Mat3x3f& get_rotation() const { return R; }
37
	const CGLA::Mat3x3f& get_rotation() const { return R; }
34
	const AABox& get_aabox() const { return aabox; }
38
	const AABox& get_aabox() const { return aabox; }
35
 
39
 
36
/* 	const CGLA::Vec3f& get_pmin() const {assert(0); return CGLA::Vec3f(0);} */
40
/* 	const CGLA::Vec3f& get_pmin() const {assert(0); return CGLA::Vec3f(0);} */
37
 
41
 
38
/* 	const CGLA::Vec3f& get_pmax() const {assert(0); return CGLA::Vec3f(0);} */
42
/* 	const CGLA::Vec3f& get_pmax() const {assert(0); return CGLA::Vec3f(0);} */
39
 
43
 
40
};
44
};
41
 
45
 
42
}
46
}
43
#endif
47
#endif
44
 
48