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