00001 #ifndef X3DTK_SFPOINT3F_H 00002 #define X3DTK_SFPOINT3F_H 00003 00004 #include "SFVec3f.h" 00005 00006 #include <math.h> 00007 #include <iostream> 00008 00009 namespace X3DTK { 00010 00011 class SFString; 00012 00021 class SFPoint3f 00022 { 00023 public: 00025 float x; 00027 float y; 00029 float z; 00030 00032 SFPoint3f(); 00034 SFPoint3f(float x, float y, float z); 00036 SFPoint3f(const SFPoint3f &p); 00038 SFPoint3f &operator= (const SFPoint3f &v); 00040 SFPoint3f &operator+= (const SFVec3f &v); 00042 SFPoint3f &operator+= (const SFPoint3f &v); 00044 SFPoint3f &operator-= (const SFVec3f &v); 00046 explicit SFPoint3f(const SFString &s); 00047 // Conversion from vector to point. 00048 explicit SFPoint3f(const SFVec3f &V); 00050 inline float &operator[](int i) {return (&x)[i];}; 00052 inline const float &operator[](int i) const {return (&x)[i];}; 00053 00055 friend SFPoint3f operator+ (const SFPoint3f &v1, const SFVec3f &v2); 00057 friend SFPoint3f operator+ (const SFPoint3f &v1, const SFPoint3f &v2); 00059 friend SFPoint3f operator- (const SFPoint3f &v1, const SFVec3f &v2); 00061 friend SFVec3f operator- (const SFPoint3f &v1, const SFPoint3f &v2); 00063 friend SFPoint3f operator* (const float a, const SFPoint3f &v); 00065 friend float distance(const SFPoint3f &A, const SFPoint3f &B); 00067 inline float *f_data() {return &x;}; 00069 inline const float *f_data() const {return &x;}; 00071 inline operator float *() {return &x;}; 00073 inline operator const float *() const {return &x;}; 00075 static const SFPoint3f null; 00076 }; 00077 00078 } 00079 00080 #endif