00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SBVEC2S_H
00021 #define COIN_SBVEC2S_H
00022
00023 #include <stdio.h>
00024 #include <Inventor/SbBasic.h>
00025 #include <Inventor/system/inttypes.h>
00026
00027
00028 class COIN_DLL_API SbVec2s {
00029 public:
00030 SbVec2s(void);
00031 SbVec2s(const short v[2]);
00032 SbVec2s(const short x, const short y);
00033 int32_t dot(const SbVec2s& v) const;
00034 const short * getValue(void) const;
00035 void getValue(short& x, short& y) const;
00036 void negate(void);
00037 SbVec2s& setValue(const short v[2]);
00038 SbVec2s& setValue(short x, short y);
00039 short& operator [](const int i);
00040 const short& operator [](const int i) const;
00041 SbVec2s& operator *=(int d);
00042 SbVec2s& operator *=(double d);
00043 SbVec2s& operator /=(int d);
00044 SbVec2s& operator /=(double d);
00045 SbVec2s& operator +=(const SbVec2s& u);
00046 SbVec2s& operator -=(const SbVec2s& u);
00047 SbVec2s operator -(void) const;
00048 friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
00049 friend COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
00050 friend COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
00051 friend COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
00052 friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
00053 friend COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
00054 friend COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
00055 friend COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
00056 friend COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
00057 friend COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
00058
00059 void print(FILE * fp) const;
00060
00061 private:
00062 short vec[2];
00063 };
00064
00065 COIN_DLL_API SbVec2s operator *(const SbVec2s& v, int d);
00066 COIN_DLL_API SbVec2s operator *(const SbVec2s& v, double d);
00067 COIN_DLL_API SbVec2s operator *(int d, const SbVec2s& v);
00068 COIN_DLL_API SbVec2s operator *(double d, const SbVec2s& v);
00069 COIN_DLL_API SbVec2s operator /(const SbVec2s& v, int d);
00070 COIN_DLL_API SbVec2s operator /(const SbVec2s& v, double d);
00071 COIN_DLL_API SbVec2s operator +(const SbVec2s& v1, const SbVec2s& v2);
00072 COIN_DLL_API SbVec2s operator -(const SbVec2s& v1, const SbVec2s& v2);
00073 COIN_DLL_API int operator ==(const SbVec2s& v1, const SbVec2s& v2);
00074 COIN_DLL_API int operator !=(const SbVec2s& v1, const SbVec2s& v2);
00075
00076 #endif // !COIN_SBVEC2S_H