00001 #ifndef COIN_SBBOX2S_H
00002 #define COIN_SBBOX2S_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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