SFVec3f.h

Go to the documentation of this file.
00001 #ifndef X3DTK_SFVEC3F_H
00002 #define X3DTK_SFVEC3F_H
00003 
00004 #include "Platform.h"
00005 
00006 #include <math.h>
00007 #include <iostream>
00008 
00009 namespace X3DTK {
00010 
00011 class SFString;
00012 class SFPoint3f;
00013 
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);
00049   inline float &operator[](int i) {return (&x)[i];};
00051   inline const float &operator[](int i) const {return (&x)[i];};
00052   
00054   friend bool operator== (const SFVec3f &v1, const SFVec3f &v2);
00056   friend bool operator!= (const SFVec3f &v1, const SFVec3f &v2);
00058   friend SFVec3f operator+ (const SFVec3f &v1, const SFVec3f &v2);
00060   friend SFVec3f operator- (const SFVec3f &v1, const SFVec3f &v2);
00062   friend SFVec3f operator- (const SFVec3f &v);
00064   friend float operator* (const SFVec3f &v1, const SFVec3f &v2);
00066   friend SFVec3f operator* (const float a, const SFVec3f &v);
00068   friend SFVec3f crossprod(const SFVec3f &v1, const SFVec3f &v2);
00070   float norm() const;
00072   SFVec3f normalize();
00074   SFVec3f normalized() const;
00076   inline float *f_data() {return &x;};
00078   inline const float *f_data() const {return &x;};
00080   inline operator float *() {return &x;};
00082   inline operator const float *() const {return &x;};
00084   SFString toSFString() const;
00085   
00087   static const SFVec3f null;
00088 };
00089 
00090 }
00091 
00092 #endif

Generated on Fri Jul 30 12:02:28 2004 for X3DToolKit by doxygen 1.3.6