00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef COIN_SBBOX2S_H
00021 #define COIN_SBBOX2S_H
00022 
00023 #include <Inventor/SbBasic.h>
00024 #include <Inventor/SbVec2s.h>
00025 
00026 class COIN_DLL_API SbBox2s {
00027 public:
00028   SbBox2s(void);
00029   SbBox2s(short xmin, short ymin, short xmax, short ymax);
00030   SbBox2s(const SbVec2s& _min, const SbVec2s& _max);
00031   ~SbBox2s(void);
00032 
00033   const SbVec2s& getMin(void) const;
00034   const SbVec2s& getMax(void) const;
00035   void extendBy(const SbVec2s& point);
00036   void extendBy(const SbBox2s& box);
00037   SbBool intersect(const SbVec2s& point) const;
00038   SbBool intersect(const SbBox2s& box) const;
00039   void setBounds(short xmin, short ymin, short xmax, short ymax);
00040   void setBounds(const SbVec2s& _min, const SbVec2s& _max);
00041   void getBounds(short& xmin, short& ymin, short& xmax, short& ymax) const;
00042   void getBounds(SbVec2s& _min, SbVec2s& _max) const;
00043   void getOrigin(short& originX, short& originY) const;
00044   void getSize(short& sizeX, short& sizeY) const;
00045   float getAspectRatio(void) const;
00046   void makeEmpty(void);
00047   friend COIN_DLL_API int operator ==(const SbBox2s& b1, const SbBox2s& b2);
00048   friend COIN_DLL_API int operator !=(const SbBox2s& b1, const SbBox2s& b2);
00049 
00050 private:
00051   SbVec2s minpt, maxpt;
00052 
00053   short width(void) const;
00054   short height(void) const;
00055   SbBool hasArea(void) const;
00056 };
00057 
00058 COIN_DLL_API int operator ==(const SbBox2s& b1, const SbBox2s& b2);
00059 COIN_DLL_API int operator !=(const SbBox2s& b1, const SbBox2s& b2);
00060 
00061 #endif // !COIN_SBBOX2S_H