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