00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Math Library 00005 * Module : CoordinatesTransformator 00006 * Package : Zeus.ZeusMath.Geometry 00007 * Author : Martin Abbuehl 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef CoordinatesTransformatorH 00033 #define CoordinatesTransformatorH 00034 00035 00036 #include <zeusmath/Geometry/Interfaces/ICoordinatesTransformator.hpp> // Must be first to disable Visual Studio 6 warnings. 00037 #include <zeusbase/System/ZObject.h> 00038 #include <zeusmath/System/SquareMatrix3.h> 00039 00040 00041 BEGIN_NAMESPACE_Zeus 00042 00043 00044 /******************************************************************************/ 00050 /******************************************************************************/ 00051 zeusmath_class TCoordinatesTransformator : public TZObject, 00052 public ICoordinatesTransformator 00053 00054 { 00055 public: 00057 inline TCoordinatesTransformator() { initAsIdentity(); } 00058 00059 protected: 00061 virtual inline ~TCoordinatesTransformator() { } 00062 00063 public: 00064 //Methods of ICoordinatesTransformator 00065 virtual void MQUALIFIER initAsIdentity(); 00066 virtual bool MQUALIFIER isIdentity() const; 00067 00068 virtual void MQUALIFIER addRotationX(const IAngle& rAngle); 00069 virtual void MQUALIFIER addRotationY(const IAngle& rAngle); 00070 virtual void MQUALIFIER addRotationZ(const IAngle& rAngle); 00071 00072 virtual void MQUALIFIER addTranslation(const IVector3D& rVector); 00073 virtual bool MQUALIFIER setStretchFactor(const Float& fFactor); 00074 00075 virtual void MQUALIFIER transform(const IVector3D& rVecOriginalSystem, 00076 IVector3D& rVecTransformedSystem) const; 00077 00078 virtual void MQUALIFIER transformReverse(const IVector3D& rVecTransformedSystem, 00079 IVector3D& rVecOriginalSystem) const; 00080 00081 virtual inline const ISquareMatrix3& MQUALIFIER getRotationMatrix() const { return m_RotationMatrix; } 00082 virtual inline const ISquareMatrix3& MQUALIFIER getReverseRotationMatrix() const { return m_ReverseRotationMatrix; } 00083 virtual inline const IVector3D& MQUALIFIER getTranslationVector() const { return m_vecTranslation; } 00084 virtual inline const Float& MQUALIFIER getStretchFactor() const { return m_fStretchFactor; } 00085 00086 virtual inline void MQUALIFIER assign(const ICoordinatesTransformator& Transformator) { *this = Transformator; } 00087 00089 const TCoordinatesTransformator& operator=(const ICoordinatesTransformator& Transformator); 00090 00092 const TCoordinatesTransformator& operator=(const TCoordinatesTransformator& Transformator); 00093 00094 #ifdef _MSC_VER 00095 #pragma warning (push) 00096 #pragma warning (disable: 4065) // The following macros will lead to a switch with default mark, but without any case mark. 00097 #endif 00098 //Methods of IZUnknown 00099 MEMORY_MANAGER_INLINEIMPL() 00100 MEMORY_MANAGER_IMPL_END; 00101 00102 private: 00103 void addRotationMatrix(const TSquareMatrix3& rRotationToAdd, 00104 const TSquareMatrix3& rReverseRotationToAdd); 00105 00106 private: 00108 TSquareMatrix3 m_RotationMatrix; 00110 TSquareMatrix3 m_ReverseRotationMatrix; 00112 TVector3D m_vecTranslation; 00114 Float m_fStretchFactor; 00115 }; 00116 00117 #ifdef _MSC_VER 00118 #pragma warning (pop) 00119 #endif 00120 00121 00122 00123 END_NAMESPACE_Zeus 00124 00125 #endif 00126