XdkWrl: sfvec3f.h Source File

Home | Hierarchy | Members | Alphabetical | Related Pages

# sfvec3f.h

Go to the documentation of this file.

    00001 #ifndef XDKWRL_SFVEC3F_H
    00002 #define XDKWRL_SFVEC3F_H
    00003
    00004 #include <xdkwrl/config.h>
    00005 #include <xdkwrl/fieldtypes.h>
    00006 #include <iostream>
    00007
    00008 namespace wrl
    00009 {
    00010   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    00011   // Interface of  SFVec3f
    00012   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    00013   /*! \ingroup fieldtypes
    00014    *
    00015    * Represents a 3 coordinates (X,Y,Z) vector. Below is included the
    00016    * documentation for this field type from the ISO standard.
    00017    * \htmlinclude sfvec3f.html
    00018    */
    00019   class XDKWRL_EXPORT SFVec3f
    00020   {
    00021   public:
    00022     inline SFVec3f();
    00023     inline SFVec3f(const float* c);
    00024     inline SFVec3f(const float x,const float y,const float z);
    00025     inline operator const float*() const;
    00026     inline operator float*();
    00027     inline float x() const;
    00028     inline float y() const;
    00029     inline float z() const;
    00030     inline void setXYZ(const float x,const float y,const float z);
    00031     inline void setX(const float);
    00032     inline void setY(const float);
    00033     inline void setZ(const float);
    00034     static inline const char* typeName();
    00035     static inline FieldTypeId typeId();
    00036     inline bool operator==(const SFVec3f& c) const;
    00037     friend std::ostream& operator<<(std::ostream& s,const SFVec3f& f);
    00038   protected:
    00039   private:
    00040     float x_;
    00041     float y_;
    00042     float z_;
    00043   };
    00044   //************************************************************
    00045   // Implementation of SFVec3f
    00046   //************************************************************
    00047   inline
    00048   SFVec3f::SFVec3f()
    00049     : x_(0.0f),y_(0.0f),z_(0.0f)
    00050   {
    00051   }
    00052   inline
    00053   SFVec3f::SFVec3f(const float* c)
    00054     : x_(c[0]),y_(c[1]),z_(c[2])
    00055   {
    00056   }
    00057   inline
    00058   SFVec3f::SFVec3f(const float x,const float y,const float z)
    00059     : x_(x),y_(y),z_(z)
    00060   {
    00061   }
    00062   inline
    00063   SFVec3f::operator const float*() const
    00064   {
    00065     return &x_;
    00066   }
    00067   inline
    00068   SFVec3f::operator float*()
    00069   {
    00070     return &x_;
    00071   }
    00072   inline float
    00073   SFVec3f::x() const
    00074   {
    00075     return x_;
    00076   }
    00077   inline float
    00078   SFVec3f::y() const
    00079   {
    00080     return y_;
    00081   }
    00082   inline float
    00083   SFVec3f::z() const
    00084   {
    00085     return z_;
    00086   }
    00087   inline void
    00088   SFVec3f::setX(const float x)
    00089   {
    00090     x_ = x;
    00091   }
    00092   inline void
    00093   SFVec3f::setY(const float y)
    00094   {
    00095     y_ = y;
    00096   }
    00097   inline void
    00098   SFVec3f::setZ(const float z)
    00099   {
    00100     z_ = z;
    00101   }
    00102   inline void
    00103   SFVec3f::setXYZ(const float x,const float y,const float z)
    00104   {
    00105     x_ = x;
    00106     y_ = y;
    00107     z_ = z;
    00108   }
    00109   inline bool
    00110   SFVec3f::operator==(const SFVec3f& c) const
    00111   {
    00112     return x_ == c.x_ && y_ == c.y_ && z_ == c.z_;
    00113   }
    00114   inline const char*
    00115   SFVec3f::typeName()
    00116   {
    00117     return "SFVec3f";
    00118   }
    00119   inline FieldTypeId
    00120   SFVec3f::typeId()
    00121   {
    00122     return sfVec3f;
    00123   }
    00124 };
    00125
    00126 #endif // XDKWRL_SFVEC3F_H

Generated on 5 Jan 2007 with version 1.5.1. |