/* ImLib3D
 * Copyright (c) 2001, ULP-IPB Strasbourg.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
/*! \file Size3D.hpp */
#ifndef _Size3D_hpp
#define _Size3D_hpp


// ********************** Size3D ********************
// simple struct: width height depth
// *******************************************************
//!  simple struct: width height depth
class Size3D
{
public:
	Size3D(int _width,int _height,int _depth):
		width(_width),height(_height),depth(_depth)
	{;}

	Size3D(const Vect3Di &V):
		width(V.x), height(V.y), depth(V.z)
	{;}
	Size3D():
		width(0), height(0), depth(0)
	{;}
	Size3D LargerBound(const Size3D &other)
	{
		Size3D res=*this;
		res.width =max(width ,other.width );
		res.height=max(height,other.height);
		res.depth =max(depth ,other.depth );
		return res;
	}
	Size3D SmallerBound(const Size3D &other)
	{
		Size3D res=*this;
		res.width =min(width ,other.width );
		res.height=min(height,other.height);
		res.depth =min(depth ,other.depth );
		return res;
	}
	Vect3Di GetV() const {return Vect3Di(width,height,depth);}
	operator Vect3Di (){return GetV();}
	int operator==(const Size3D &other) const
	{
		return width==other.width && height==other.height && depth==other.depth;
	}
	int operator!=(const Size3D &other) const
	{
		return width!=other.width || height!=other.height || depth!=other.depth;
	}
	int width,height,depth;
};

inline ostream& operator<<(ostream& s, const Size3D& size)
{
	s << "Size3D (w, h, d): ("<< size.width<< ", "<< size.height << ", " << size.depth << ")"<< endl;
	return s;
}
#endif //_Size3D_hpp
