00001 00002 00003 00005 00006 00011 00016 00021 // SFVec3f.h // 00023 00024 #ifndef VECTOR3F_H 00025 #define VECTOR3F_H 00026 00027 #include <math.h> 00028 #include <iostream> 00029 00030 namespace X3DTK { 00031 00032 class SFString; 00033 class SFPoint3f; 00034 00038 00039 class SFVec3f 00040 { 00041 public: 00043 float x; 00045 float y; 00047 float z; 00048 00050 SFVec3f(); 00052 SFVec3f(float x, float y, float z); 00054 SFVec3f(const SFVec3f &v); 00056 SFVec3f &operator= (const SFVec3f &v); 00058 SFVec3f &operator+= (const SFVec3f &v); 00060 SFVec3f &operator-= (const SFVec3f &v); 00062 explicit SFVec3f(const SFString &s); 00064 explicit SFVec3f(const SFPoint3f &P); 00065 00067 friend bool operator== (const SFVec3f &v1, const SFVec3f &v2); 00069 friend bool operator!= (const SFVec3f &v1, const SFVec3f &v2); 00071 friend SFVec3f operator+ (const SFVec3f &v1, const SFVec3f &v2); 00073 friend SFVec3f operator- (const SFVec3f &v1, const SFVec3f &v2); 00075 friend float operator* (const SFVec3f &v1, const SFVec3f &v2); 00077 friend SFVec3f operator* (const float a, const SFVec3f &v); 00079 friend SFVec3f crossprod(const SFVec3f &v1, const SFVec3f &v2); 00081 float norm() const; 00083 SFVec3f normalize(); 00085 SFVec3f normalized() const; 00087 inline float *f_data() {return &x;}; 00088 }; 00089 00090 } 00091 00092 #endif