Overture  Version 25
MatrixMapping.h
Go to the documentation of this file.
1 #ifndef MATRIX_MAPPING_H
2 #define MATRIX_MAPPING_H "matrixMapping.h"
3 
4 #include "Mapping.h"
5 
6 class MatrixMapping : public Mapping{
7 //-------------------------------------------------------------
8 //
9 // Matrix Mapping: transformation represented by a 3x4 matrix
10 // can be used for scaling, rotation, shifts etc.
11 // x(0:2) <- Matrix(0:2,0:2)*t(0:2) + matrix(0:2,3)
12 //
13 //------------------------------------------------------------
14 protected:
16 
17 public:
18 
21 
23 
24  // Copy constructor is deep by default
25  MatrixMapping( const MatrixMapping &, const CopyType copyType=DEEP );
26 
28 
29  MatrixMapping & operator =( const MatrixMapping & X );
30 
31  void rotate( const int axis, const real theta );
32  void rotate( const RealArray & rotate, bool incremental=false ); // specify a 3x3 rotation matrix
33 
34  void scale( const real scalex=1., const real scaley=1., const real scalez=1., bool incremental=true );
35 
36  void shift( const real shiftx=1., const real shifty=1., const real shiftz=1., bool incremental=true );
37 
38  // reset the matrix to the identity:
39  void reset();
40 
41  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
42  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
43 
45 
47 
50 
53 
56 
57  void mapS( const RealArray & r, RealArray & x, RealArray &xr = Overture::nullRealArray(),
59 
60  void inverseMapS( const RealArray & x, RealArray & r, RealArray & rx =Overture::nullRealArray(),
62 
63  void basicInverseS(const RealArray & x,
64  RealArray & r,
67 
68 
69  // utility routines
70  static void matrixMatrixProduct( RealArray & m1, const RealArray & m2, const RealArray & m3 );
71  static void matrixVectorProduct( RealArray & v1, const RealArray & m2, const RealArray & v3 );
72  static int matrixInversion( RealArray & m1Inverse, const RealArray & m1 );
73 
74  private:
75 
76  //
77  // Virtual member functions used only through class ReferenceCounting:
78  //
80  { return operator=((MatrixMapping &)x); }
81  virtual void reference( const ReferenceCounting& x)
82  { reference((MatrixMapping &)x); } // *** Conversion to this class for the virtual = ****
83  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
84  { return ::new MatrixMapping(*this, ct); }
85 };
86 
87 #endif
88