00001 #ifndef COIN_SBBOX2F_H
00002 #define COIN_SBBOX2F_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/SbVec2f.h>
00029
00030 class COIN_DLL_API SbBox2f {
00031 public:
00032 SbBox2f(void);
00033 SbBox2f(float xmin, float ymin, float xmax, float ymax);
00034 SbBox2f(const SbVec2f & min, const SbVec2f & max);
00035 ~SbBox2f(void);
00036
00037 const SbVec2f & getMin(void) const;
00038 const SbVec2f & getMax(void) const;
00039 SbVec2f getCenter(void) const;
00040 void extendBy(const SbVec2f & point);
00041 void extendBy(const SbBox2f & box);
00042 SbBool intersect(const SbVec2f & point) const;
00043 SbBool intersect(const SbBox2f & box) const;
00044 SbVec2f getClosestPoint(const SbVec2f & p) const;
00045 void setBounds(float xmin, float ymin, float xmax, float ymax);
00046 void setBounds(const SbVec2f & min, const SbVec2f & max);
00047 void getBounds(float & xmin, float & ymin, float & xmax, float & ymax) const;
00048 void getBounds(SbVec2f & min, SbVec2f & max) const;
00049 void getOrigin(float & x0, float & y0) const;
00050 void getSize(float & w, float & h) const;
00051 float getAspectRatio(void) const;
00052 void makeEmpty(void);
00053 SbBool isEmpty(void) const;
00054 SbBool hasArea(void) const;
00055
00056 friend COIN_DLL_API int operator ==(const SbBox2f & b1, const SbBox2f & b2);
00057 friend COIN_DLL_API int operator !=(const SbBox2f & b1, const SbBox2f & b2);
00058
00059 private:
00060 SbVec2f minpt, maxpt;
00061
00062 float width(void) const;
00063 float height(void) const;
00064 };
00065
00066 COIN_DLL_API int operator ==(const SbBox2f & b1, const SbBox2f & b2);
00067 COIN_DLL_API int operator !=(const SbBox2f & b1, const SbBox2f & b2);
00068
00069 #endif // !COIN_SBBOX2F_H