Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Size3D.hpp

Go to the documentation of this file.
00001 /* ImLib3D
00002  * Copyright (c) 2001, ULP-IPB Strasbourg.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00019 #ifndef _Size3D_hpp
00020 #define _Size3D_hpp
00021 
00022 
00023 // ********************** Size3D ********************
00024 // simple struct: width height depth
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

Generated on Fri Jun 17 13:36:07 2005 for ImLib3D by  doxygen 1.4.2