- Cal3D 0.11 API Reference -

transform.h

00001 //****************************************************************************//
00002 // coordsys.h                                                                    //
00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger                       //
00004 //****************************************************************************//
00005 // This library is free software; you can redistribute it and/or modify it    //
00006 // under the terms of the GNU Lesser General Public License as published by   //
00007 // the Free Software Foundation; either version 2.1 of the License, or (at    //
00008 // your option) any later version.                                            //
00009 //****************************************************************************//
00010 
00011 #ifndef CAL_TRANSFORM_H
00012 #define CAL_TRANSFORM_H
00013 
00014 #include "cal3d/global.h"
00015 #include "cal3d/vector.h"
00016 #include "cal3d/quaternion.h"
00017 
00018 namespace cal3d
00019 {
00024   class CAL3D_API Transform
00025   {
00026   public:
00027     Transform() { }
00028 
00029     Transform(const CalVector& translation, const CalQuaternion& rotation)
00030     : m_translation(translation)
00031     , m_rotation(rotation)
00032     {
00033     }
00034 
00035     ~Transform() { }
00036 
00037     const CalVector& getTranslation() const
00038     {
00039       return m_translation;
00040     }
00041 
00042     CalVector& getTranslation()
00043     {
00044       return m_translation;
00045     }
00046 
00047     const CalQuaternion& getRotation() const
00048     {
00049       return m_rotation;
00050     }
00051 
00052     CalQuaternion& getRotation()
00053     {
00054       return m_rotation;
00055     }
00056 
00057     void setTranslation(const CalVector& translation)
00058     {
00059       m_translation = translation;
00060     }
00061 
00062     void setRotation(const CalQuaternion& rotation)
00063     {
00064       m_rotation = rotation;
00065     }
00066 
00068     void setIdentity()
00069     {
00070       m_translation.clear();
00071       m_rotation.clear();
00072     }
00073 
00074     void blend(float t, const Transform& end)
00075     {
00076       m_translation.blend(t, end.getTranslation());
00077       m_rotation.blend(t, end.getRotation());
00078     }
00079 
00080     bool operator==(const Transform& rhs) const
00081     {
00082       return m_translation == rhs.m_translation &&
00083              m_rotation == rhs.m_rotation;
00084     }
00085 
00086     bool operator!=(const Transform& rhs) const
00087     {
00088       return !operator==(rhs);
00089     }
00090 
00091   private:
00092      CalVector m_translation;
00093      CalQuaternion m_rotation;
00094   };
00095 }
00096 
00097 typedef cal3d::Transform CalTransform;
00098 
00099 #endif

Generated at Thu Jun 29 19:03:59 2006 by The Cal3D Team with Doxygen 1.4.6