Home Hierarchy Members Alphabetical Related Pages

sfrotation.h

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

Generated on 5 Jan 2007 with doxygen version 1.5.1. Valid HTML 4.0! Valid CSS!