00001 #ifndef X3DTK_SFVEC2F_H 00002 #define X3DTK_SFVEC2F_H 00003 00004 #include "Platform.h" 00005 00006 #include <math.h> 00007 #include <iostream> 00008 00009 namespace X3DTK { 00010 00011 class SFString; 00012 00021 class SFVec2f 00022 { 00023 public: 00025 float x; 00027 float y; 00028 00030 SFVec2f(); 00032 SFVec2f(float x, float y); 00034 SFVec2f(const SFVec2f &v); 00036 SFVec2f &operator= (const SFVec2f &v); 00038 SFVec2f &operator+= (const SFVec2f &v); 00040 SFVec2f &operator-= (const SFVec2f &v); 00042 explicit SFVec2f(const SFString &s); 00043 00045 friend bool operator== (const SFVec2f &v1, const SFVec2f &v2); 00047 friend bool operator!= (const SFVec2f &v1, const SFVec2f &v2); 00049 friend SFVec2f operator+ (const SFVec2f &v1, const SFVec2f &v2); 00051 friend SFVec2f operator- (const SFVec2f &v1, const SFVec2f &v2); 00053 friend SFVec2f operator- (const SFVec2f &v); 00055 friend float operator* (const SFVec2f &v1, const SFVec2f &v2); 00057 friend SFVec2f operator* (const float a, const SFVec2f &v); 00059 float norm() const; 00061 SFVec2f normalize(); 00063 SFVec2f normalized() const; 00065 inline float *f_data() {return &x;}; 00067 inline const float *f_data() const {return &x;}; 00069 static const SFVec2f null; 00070 }; 00071 00072 } 00073 00074 #endif