Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# SbBox2s.h

    00001 #ifndef COIN_SBBOX2S_H
    00002 #define COIN_SBBOX2S_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/SbBasic.h>
    00028 #include <Inventor/SbVec2s.h>
    00029
    00030 class COIN_DLL_API SbBox2s {
    00031 public:
    00032   SbBox2s(void);
    00033   SbBox2s(short xmin, short ymin, short xmax, short ymax);
    00034   SbBox2s(const SbVec2s & boxmin, const SbVec2s & boxmax);
    00035   ~SbBox2s(void);
    00036
    00037   const SbVec2s & getMin(void) const;
    00038   const SbVec2s & getMax(void) const;
    00039   void extendBy(const SbVec2s & point);
    00040   void extendBy(const SbBox2s & box);
    00041   SbBool intersect(const SbVec2s & point) const;
    00042   SbBool intersect(const SbBox2s & box) const;
    00043   void setBounds(short xmin, short ymin, short xmax, short ymax);
    00044   void setBounds(const SbVec2s & boxmin, const SbVec2s & boxmax);
    00045   void getBounds(short & xmin, short & ymin, short & xmax, short & ymax) const;
    00046   void getBounds(SbVec2s & boxmin, SbVec2s & boxmax) const;
    00047   void getOrigin(short & originX, short & originY) const;
    00048   void getSize(short & sizeX, short & sizeY) const;
    00049   float getAspectRatio(void) const;
    00050   void makeEmpty(void);
    00051   friend COIN_DLL_API int operator ==(const SbBox2s & b1, const SbBox2s & b2);
    00052   friend COIN_DLL_API int operator !=(const SbBox2s & b1, const SbBox2s & b2);
    00053
    00054 private:
    00055   SbVec2s minpt, maxpt;
    00056
    00057   short width(void) const;
    00058   short height(void) const;
    00059   SbBool hasArea(void) const;
    00060 };
    00061
    00062 COIN_DLL_API int operator ==(const SbBox2s & b1, const SbBox2s & b2);
    00063 COIN_DLL_API int operator !=(const SbBox2s & b1, const SbBox2s & b2);
    00064
    00065 #endif // !COIN_SBBOX2S_H