00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __HOM_BoundingBox_h__
00017 #define __HOM_BoundingBox_h__
00018
00019 #include "HOM_API.h"
00020 #include "HOM_Defines.h"
00021 #include "HOM_Errors.h"
00022 #include "HOM_Module.h"
00023 #include "HOM_Vector3.h"
00024 #include <UT/UT_BoundingBox.h>
00025 #include <vector>
00026
00027 class HOM_Matrix4;
00028
00029 SWIGOUT(%rename(BoundingBox) HOM_BoundingBox;)
00030
00031 class HOM_API HOM_BoundingBox
00032 {
00033 public:
00034 HOM_BoundingBox() throw(HOM_Error)
00035 : myBoundingBox(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)
00036 { HOM_CONSTRUCT_OBJECT(this) }
00037
00038 HOM_BoundingBox(float xmin, float ymin, float zmin,
00039 float xmax, float ymax, float zmax) throw(HOM_Error)
00040 : myBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax)
00041 { HOM_CONSTRUCT_OBJECT(this) }
00042
00043 SWIGOUT(%ignore HOM_BoundingBox(const UT_BoundingBox&);)
00044 HOM_BoundingBox(const UT_BoundingBox &bbox) throw(HOM_Error)
00045 : myBoundingBox(bbox)
00046 { HOM_CONSTRUCT_OBJECT(this) }
00047
00048 ~HOM_BoundingBox()
00049 { HOM_DESTRUCT_OBJECT(this) }
00050
00051 bool operator==(HOM_BoundingBox &bbox)
00052 { return myBoundingBox == bbox.myBoundingBox; }
00053
00054 bool operator!=(HOM_BoundingBox &bbox)
00055 { return myBoundingBox != bbox.myBoundingBox; }
00056
00057 bool isAlmostEqual(HOM_BoundingBox &bbox, float tolerance=0.00001);
00058
00059
00060 bool almostEqual(HOM_BoundingBox &bbox, float tolerance=0.00001)
00061 { return isAlmostEqual(bbox, tolerance); }
00062
00063 int __hash__();
00064 std::string __str__();
00065 std::string __repr__();
00066
00067 HOM_BoundingBox __mul__(const HOM_Matrix4 &matrix4);
00068
00069 void setTo(const std::vector<float> &tuple) throw(HOM_InvalidSize);
00070
00071 HOM_Vector3 minvec()
00072 { return myBoundingBox.minvec(); }
00073 HOM_Vector3 maxvec()
00074 { return myBoundingBox.maxvec(); }
00075 HOM_Vector3 sizevec()
00076 { return myBoundingBox.size(); }
00077
00078 HOM_Vector3 center()
00079 { return myBoundingBox.center(); }
00080
00081 void enlargeToContain(const HOM_Vector3 &point)
00082 { myBoundingBox.enlargeBounds(point.myVector3); }
00083 void enlargeToContain(const HOM_BoundingBox &bbox)
00084 { myBoundingBox.enlargeBounds(bbox.myBoundingBox); }
00085
00086 SWIGOUT(%ignore operator=;)
00087 HOM_BoundingBox &operator=(const HOM_BoundingBox& bbox)
00088 {
00089 myBoundingBox = bbox.myBoundingBox;
00090 return *this;
00091 }
00092
00093 SWIGOUT(%ignore myBoundingBox;)
00094 UT_BoundingBox myBoundingBox;
00095 };
00096
00097 #endif