Home Hierarchy Members Alphabetical Related Pages

sfvec2f.h

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

Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!