GEL
2
GEL is a library for Geometry and Linear Algebra
|
00001 #ifndef __GEOMETRY_OBOX__H 00002 #define __GEOMETRY_OBOX__H 00003 00004 #include <iostream> 00005 #include <vector> 00006 #include "Triangle.h" 00007 #include "AABox.h" 00008 00009 namespace Geometry 00010 { 00011 00012 class OBox 00013 { 00014 const CGLA::Mat3x3f R; 00015 const AABox aabox; 00016 00017 public: 00018 OBox() {} 00019 00020 OBox(const CGLA::Mat3x3f& _R, const AABox& _aabox): 00021 R(_R), aabox(_aabox) {} 00022 00023 bool intersect(const CGLA::Vec3f&, const CGLA::Vec3f&) const; 00024 00025 void minmax_sq_dist(const CGLA::Vec3f& p, float& dmin, float& dmax) const 00026 { 00027 aabox.minmax_sq_dist(R * p, dmin, dmax); 00028 } 00029 00030 00031 static OBox box_triangle(const Triangle&); 00032 00033 static OBox box_and_split(const std::vector<Triangle>& invec, 00034 std::vector<Triangle>& lvec, 00035 std::vector<Triangle>& rvec); 00036 00037 const CGLA::Mat3x3f& get_rotation() const { return R; } 00038 const AABox& get_aabox() const { return aabox; } 00039 00040 /* const CGLA::Vec3f& get_pmin() const {assert(0); return CGLA::Vec3f(0);} */ 00041 00042 /* const CGLA::Vec3f& get_pmax() const {assert(0); return CGLA::Vec3f(0);} */ 00043 00044 }; 00045 00046 } 00047 #endif