00001 00002 // SFVec3f.h // 00004 00005 #ifndef VECTOR3F_H 00006 #define VECTOR3F_H 00007 00008 #include <math.h> 00009 #include <iostream> 00010 00011 namespace X3DTK { 00012 00013 class SFString; 00014 class SFPoint3f; 00015 00019 00020 class SFVec3f 00021 { 00022 public: 00024 float x; 00026 float y; 00028 float z; 00029 00031 SFVec3f(); 00033 SFVec3f(float x, float y, float z); 00035 SFVec3f(const SFVec3f &v); 00037 SFVec3f &operator= (const SFVec3f &v); 00039 SFVec3f &operator+= (const SFVec3f &v); 00041 SFVec3f &operator-= (const SFVec3f &v); 00043 explicit SFVec3f(const SFString &s); 00045 explicit SFVec3f(const SFPoint3f &P); 00046 00048 friend bool operator== (const SFVec3f &v1, const SFVec3f &v2); 00050 friend bool operator!= (const SFVec3f &v1, const SFVec3f &v2); 00052 friend SFVec3f operator+ (const SFVec3f &v1, const SFVec3f &v2); 00054 friend SFVec3f operator- (const SFVec3f &v1, const SFVec3f &v2); 00056 friend float operator* (const SFVec3f &v1, const SFVec3f &v2); 00058 friend SFVec3f operator* (const float a, const SFVec3f &v); 00060 friend SFVec3f crossprod(const SFVec3f &v1, const SFVec3f &v2); 00062 float norm() const; 00064 SFVec3f normalize(); 00066 SFVec3f normalized() const; 00068 inline float *f_data() {return &x;}; 00070 inline const float *f_data() const {return &x;}; 00071 }; 00072 00073 } 00074 00075 #endif