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