Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
transformation-matrix.hh
Go to the documentation of this file.
1 /*
2  * lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-gmapkernel
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #ifndef TRANSFORMATION_MATRIX_HH
26 #define TRANSFORMATION_MATRIX_HH
27 //******************************************************************************
28 #include "math-extension.hh"
29 #include "vertex.hh"
30 #include "inline-macro.hh"
31 
32 #include <iostream>
33 //******************************************************************************
34 
35 class CVector;
36 
44 {
45 private:
46  TCoordinate FElements[4][4];
47 
48 public:
49  // @name Constantes
50  // @{
51 
56 
57  // @}
58  // @name Constructeurs et destructeur
59  // @{
60 
70 
80 
90  TCoordinate A02, TCoordinate A03,
91 
92  TCoordinate A10, TCoordinate A11,
93  TCoordinate A12, TCoordinate A13,
94 
95  TCoordinate A20, TCoordinate A21,
96  TCoordinate A22, TCoordinate A23,
97 
98  TCoordinate A30, TCoordinate A31,
99  TCoordinate A32, TCoordinate A33);
100 
113  CTransformationMatrix(const CVertex& ALine1,
114  const CVertex& ALine2,
115  const CVertex& ALine3);
116 
121 
122  // @}
123  // @name Initialisations
124  // @{
125 
134  void setToNull();
135 
144  void setToIdentity();
145 
153 
154  // @}
155  // @name Accesseur aux éléments de la matrice
156  // @{
157 
165  TCoordinate* operator[](int ARow) const;
166 
167  // @}
168  // @name Fonctions mathématiques (produit, calcul de déterminant, ...)
169  // @{
170 
180 
189  CVector operator*(const CVector& AVector) const;
190 
191  // @}
192  // @name Méthodes correspondant aux transformations géométriques
193  // @{
194 
201  void translate(const CVertex& AVector);
202 
213  void rotate(const CVertex& AAxeDirection, TCoordinate AAngle);
214 
227  void rotate(const CVertex& AAxeVertex,
228  const CVertex& AAxeDirection, TCoordinate AAngle);
229 
244  void rotate(const CVertex& AAngles);
245 
255  void rotate180(const CVertex& AAxeDirection);
256 
264  void scale(TCoordinate ACoef);
265 
273  void scale(const CVertex& ACoef);
274 
282  void scale(const CVertex& ACenter, TCoordinate ACoef);
283 
292  void scale(const CVertex& ACenter, const CVertex& ACoef);
293 
304  void axialScale(const CVertex& AAxeDirection, TCoordinate ACoef);
305 
317  void axialScale(const CVertex& AAxeVertex,
318  const CVertex& AAxeDirection, TCoordinate ACoef);
319 
330  void planarScale(const CVertex& APlaneNormal, TCoordinate ACoef);
331 
343  void planarScale(const CVertex& APlaneVertex,
344  const CVertex& APlaneNormal, TCoordinate ACoef);
345 
358  void orientate(const CVertex& AVector1, const CVertex& AVector2);
359 
374  void orientate(const CVertex& ACenter,
375  const CVertex& AVector1, const CVertex& AVector2);
376 
396  void orientate(const CVertex& AVectorU1, const CVertex& AVectorV1,
397  const CVertex& AVectorU2, const CVertex& AVectorV2);
398 
413  void transform(const CVertex& AOrigin1 ,
414  const CVertex& AVectorU1, const CVertex& AVectorV1,
415  const CVertex& AOrigin2 ,
416  const CVertex& AVectorU2, const CVertex& AVectorV2,
417  const CVertex& ACoef = CVertex(1,1,1));
418 
419  // @}
420  // @name Application de la matrice sur un sommet
421  // @{
422 
426  void applyOn(CVertex& AVertex) const;
427 
432  void applyOn(const CVertex& AVertex, CVertex& AResult) const;
433 
434  // @}
435 };
436 
437 // @name Matrices de lissage
438 // @{
439 
440 extern const CTransformationMatrix COONS ;
441 extern const CTransformationMatrix HERMITE ;
442 extern const CTransformationMatrix BEZIER ;
443 extern const CTransformationMatrix OVERHAUSER;
444 extern const CTransformationMatrix SPLINE ;
445 
446 // @}
447 // @name Affichage
448 // @{
449 
455 std::ostream& operator<<(std::ostream& AStream,
456  const CTransformationMatrix& AMatrix);
457 
458 // @}
459 //******************************************************************************
460 #include INCLUDE_INLINE("transformation-matrix.icc")
461 //******************************************************************************
462 #endif // TRANSFORMATION_MATRIX_HH
463 //******************************************************************************