eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // LinearTransformation.h Math.Component package 00003 //============================================================================ 00004 // Usage : linear image transformation class definition 00005 //---------------------------------------------------------------------------- 00006 // Inheritance : 00007 // LinearTransformation 00008 // +AbstractTransformation 00009 //---------------------------------------------------------------------------- 00010 // Copyright (C) 2006 by eLynx project 00011 // 00012 // This library is free software; you can redistribute it and/or 00013 // modify it under the terms of the GNU Library General Public 00014 // License as published by the Free Software Foundation; either 00015 // version 2 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. 00020 // See the GNU Library General Public License for more details. 00021 //---------------------------------------------------------------------------- 00022 #ifndef __LinearTransformation_h__ 00023 #define __LinearTransformation_h__ 00024 00025 #include "AbstractTransformation.h" 00026 #include <boost/scoped_ptr.hpp> 00027 00028 namespace eLynx { 00029 namespace Math { 00030 00037 class ExportedByMath LinearTransformation : public AbstractTransformation { 00038 00039 public: 00040 00042 LinearTransformation(); 00043 00046 LinearTransformation(const LinearTransformation &c); 00047 00051 LinearTransformation& operator = (const LinearTransformation &c); 00052 00055 virtual boost::shared_ptr<AbstractTransformation> Clone() const; 00056 00061 double GetValue(uint32 iRow, uint32 iCol) const; 00062 00067 void SetValue(uint32 iRow, uint32 iCol, double iValue); 00068 00072 LinearTransformation& NullTransformation(); 00073 00077 LinearTransformation& Identity(); 00078 00082 virtual bool IsIdentity() const; 00083 00088 LinearTransformation& Translation(double iDX, double iDY); 00089 00094 LinearTransformation& Rotation(double iAngle); 00095 00101 LinearTransformation& Scale(double iSX, double iSY); 00102 00114 LinearTransformation& GeneralTransformation(double iA, double iB, double iC, 00115 double iD, double iE, double iF); 00116 00122 LinearTransformation& Multiply(const LinearTransformation &iTrf); 00123 00130 LinearTransformation& Inverse(const LinearTransformation &iTrf); 00131 00139 virtual void Transform(double iX, double iY, double& oX, double& oY) const; 00140 00151 virtual void GetTransformedBBox(uint32 iWidth, uint32 iHeight, 00152 double& oLeft, double& oTop, double& oWidth, double& oHeight) const; 00153 00161 virtual void InverseTransform(double iX, double iY, double& oX, double& oY) const; 00162 00173 virtual void GetInverseBBox(uint32 iWidth, uint32 iHeight, 00174 double& oLeft, double& oTop, double& oWidth, double& oHeight) const; 00175 00176 private: 00177 00180 void CopyData(const LinearTransformation &c); 00181 00187 double SubDeterminant(uint32 iExceptRow, uint32 iExceptCol) const; 00188 00191 double Determinant() const; 00192 00194 double _Matrix[3][3]; 00195 00197 mutable boost::scoped_ptr<LinearTransformation> _spInverted; 00198 }; 00199 00200 } // namespace Image 00201 } // namespace eLynx 00202 00203 #endif // __LinearTransformation_h__