00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef CEYLAN_ENDOMORPHISM_H_ 00028 #define CEYLAN_ENDOMORPHISM_H_ 00029 00030 00031 #include "CeylanLinear.h" // for Real, LinearException 00032 #include "CeylanMathsBasic.h" // for Functor 00033 #include "CeylanVector3.h" // for Vector3 00034 00035 #include <string> 00036 00037 00038 00039 namespace Ceylan 00040 { 00041 00042 00043 namespace Maths 00044 { 00045 00046 00047 namespace Linear 00048 { 00049 00050 00051 00052 /* 00053 * Here are declared various 2D and 3D endomorphisms which 00054 * are all functors, including rotations and line projections. 00055 * 00056 */ 00057 00058 00059 // Used by 2D endomorphisms. 00060 class Vector2 ; 00061 00062 00063 00080 class CEYLAN_DLL Endomorphism2DFunctor : public Functor 00081 { 00082 00083 00084 public: 00085 00086 00087 00092 Endomorphism2DFunctor() ; 00093 00094 00095 00097 virtual ~Endomorphism2DFunctor() throw() ; 00098 00099 00100 00106 virtual Vector2 operator() ( const Vector2 & v ) = 0 ; 00107 00108 00109 00122 virtual const std::string toString( 00123 VerbosityLevels level = high ) const ; 00124 00125 00126 } ; 00127 00128 00129 00130 00135 class CEYLAN_DLL Rotation2DFunctor : public Endomorphism2DFunctor 00136 { 00137 00138 00139 public: 00140 00141 00142 00155 explicit Rotation2DFunctor( AngleInDegrees angle ) ; 00156 00157 00158 00160 virtual ~Rotation2DFunctor() throw() ; 00161 00162 00163 00169 virtual Vector2 operator() ( const Vector2 & v ) ; 00170 00171 00172 00185 virtual const std::string toString( 00186 VerbosityLevels level = high ) const ; 00187 00188 00189 00190 protected: 00191 00192 00194 AngleInRadians _angle ; 00195 00196 00197 } ; 00198 00199 00200 00201 00218 class CEYLAN_DLL Endomorphism3DFunctor : public Functor 00219 { 00220 00221 00222 00223 public: 00224 00225 00226 00231 Endomorphism3DFunctor() ; 00232 00233 00234 00236 virtual ~Endomorphism3DFunctor() throw() ; 00237 00238 00239 00245 virtual Vector3 operator() ( const Vector3 & v ) = 0 ; 00246 00247 00248 00261 virtual const std::string toString( 00262 VerbosityLevels level = high ) const ; 00263 00264 00265 } ; 00266 00267 00268 00269 00274 class CEYLAN_DLL LineProjection3DFunctor : 00275 public Endomorphism3DFunctor 00276 { 00277 00278 00279 public: 00280 00281 00282 00291 explicit LineProjection3DFunctor( const Vector3 & axis ) ; 00292 00293 00294 00296 ~LineProjection3DFunctor() throw() ; 00297 00298 00299 00305 virtual Vector3 operator() ( const Vector3 & v ) ; 00306 00307 00308 00321 virtual const std::string toString( 00322 VerbosityLevels level = high ) const ; 00323 00324 00325 00326 protected: 00327 00328 00330 Vector3 _axis ; 00331 00332 } ; 00333 00334 00335 00336 00342 class CEYLAN_DLL Rotation3DFunctor : public Endomorphism3DFunctor 00343 { 00344 00345 00346 public: 00347 00348 00361 explicit Rotation3DFunctor( const Vector3 & axis, 00362 AngleInDegrees angle ) ; 00363 00364 00365 00367 virtual ~Rotation3DFunctor() throw() ; 00368 00369 00370 00376 virtual Vector3 operator() ( const Vector3 & v ) ; 00377 00378 00379 00392 virtual const std::string toString( 00393 VerbosityLevels level = high ) const ; 00394 00395 00396 00397 protected: 00398 00399 00401 Vector3 _axis ; 00402 00403 00405 AngleInRadians _angle ; 00406 00407 00408 } ; 00409 00410 } 00411 00412 } 00413 00414 } 00415 00416 00417 00418 #endif // CEYLAN_ENDOMORPHISM_H_ 00419