00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019 #ifndef _Size3D_hpp
00020 #define _Size3D_hpp
00021
00022
00023
00024
00025
00027 class Size3D
00028 {
00029 public:
00030 Size3D(int _width,int _height,int _depth):
00031 width(_width),height(_height),depth(_depth)
00032 {;}
00033
00034 Size3D(const Vect3Di &V):
00035 width(V.x), height(V.y), depth(V.z)
00036 {;}
00037 Size3D():
00038 width(0), height(0), depth(0)
00039 {;}
00040 Size3D LargerBound(const Size3D &other)
00041 {
00042 Size3D res=*this;
00043 res.width =max(width ,other.width );
00044 res.height=max(height,other.height);
00045 res.depth =max(depth ,other.depth );
00046 return res;
00047 }
00048 Size3D SmallerBound(const Size3D &other)
00049 {
00050 Size3D res=*this;
00051 res.width =min(width ,other.width );
00052 res.height=min(height,other.height);
00053 res.depth =min(depth ,other.depth );
00054 return res;
00055 }
00056 Vect3Di GetV() const {return Vect3Di(width,height,depth);}
00057 operator Vect3Di (){return GetV();}
00058 int operator==(const Size3D &other) const
00059 {
00060 return width==other.width && height==other.height && depth==other.depth;
00061 }
00062 int operator!=(const Size3D &other) const
00063 {
00064 return width!=other.width || height!=other.height || depth!=other.depth;
00065 }
00066 int width,height,depth;
00067 };
00068
00069 inline ostream& operator<<(ostream& s, const Size3D& size)
00070 {
00071 s << "Size3D (w, h, d): ("<< size.width<< ", "<< size.height << ", " << size.depth << ")"<< endl;
00072 return s;
00073 }
00074 #endif //_Size3D_hpp