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= (SFVec3f v); 00039 explicit SFVec3f(const SFString &s); 00041 explicit SFVec3f(const SFPoint3f &P); 00042 00044 friend bool operator== (const SFVec3f &v1, const SFVec3f &v2); 00046 friend bool operator!= (const SFVec3f &v1, const SFVec3f &v2); 00048 friend SFVec3f operator+ (const SFVec3f &v1, const SFVec3f &v2); 00050 friend SFVec3f operator- (const SFVec3f &v1, const SFVec3f &v2); 00052 friend float operator* (const SFVec3f &v1, const SFVec3f &v2); 00054 friend SFVec3f operator* (const float a, const SFVec3f &v); 00056 friend SFVec3f crossprod(const SFVec3f &v1, const SFVec3f &v2); 00058 float norm() const; 00060 SFVec3f normalize(); 00062 SFVec3f normalized() const; 00064 inline float *f_data() {return &x;}; 00065 }; 00066 00067 } 00068 00069 #endif