Overture  Version 25
MatrixTransform.h
Go to the documentation of this file.
1 #ifndef MATRIX_TRANSFORM
2 #define MATRIX_TRANSFORM
3 
4 #include "ComposeMapping.h"
5 #include "MatrixMapping.h"
6 
8 //----------------------------------------------------------------
9 // Rotate, Scale and or Shift a Mapping
10 // ------------------------------------
11 //
12 //
13 // Constructor example:
14 // ComposeMapping mapc( mapa,mapb );
15 // ...means
16 // mapc <- (mapb o mapa)
17 // mapc means to apply mapa followed by mapb
18 //----------------------------------------------------------------
19 private:
20  aString className;
21 
22  public:
23  MatrixMapping *matrix; // this mapping is use to rotate/scale/shift
24 
25 
26  MatrixTransform( );
27 
28  // Apply a matrix transform to a given mapping
30 
31 
32  // Copy constructor is deep by default
33  MatrixTransform( const MatrixTransform &, const CopyType copyType=DEEP );
34 
36 
38 
39  // reset the matrix to the identity:
40  void reset();
41 
42  void rotate( const int axis, const real theta );
43  void rotate( const RealArray & rotate, bool incremental =false ); // specify a 3x3 rotation matrix
44 
45  void scale( const real scalex=1., const real scaley=1., const real scalez=1., bool incremental=true );
46 
47  void shift( const real shiftx=0., const real shifty=0., const real shiftz=0., bool incremental=true );
48 
49  void display( const aString & label=blankString) const;
50 
51  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
52  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
53 
55 
56  aString getClassName() const { return MatrixTransform::className; }
57 
58  int update( MappingInformation & mapInfo ) ;
59 
60 
61  private:
62 
63  int setMappingProperties();
64 
65  // Virtual member functions used only through class ReferenceCounting:
66  //
68  { return operator=((MatrixTransform &)x); }
69  virtual void reference( const ReferenceCounting& x)
70  { reference((MatrixTransform &)x); } // *** Conversion to this class for the virtual = ****
71  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
72  { return ::new MatrixTransform(*this, ct); }
73  };
74 
75 
76 #endif