CG  Version 25
MatrixMotion.h
Go to the documentation of this file.
1 #ifndef MATRIX_MOTION_H
2 #define MATRIX_MOTION_H
3 
4 #include "TimeFunction.h"
5 
6 
7 // ===========================================================================================
9 // ===========================================================================================
10 class MatrixMotion : public ReferenceCounting
11 {
12 public:
13 
15 {
18 };
19 
20 
21 MatrixMotion();
22 
23 // copy constructor
24 MatrixMotion( const MatrixMotion & mm, const CopyType ct = DEEP );
25 
27 
28 // operator =
29 MatrixMotion & operator =( const MatrixMotion & mm );
30 
31 // evaluate the motion matrix
32 int getMotion( const real & t, RealArray & r );
33 // evaluate the motion matrix and a time derivative
34 int getMotion( const real & t, RealArray & r, RealArray & rp, int derivative, bool computeComposed=true );
35 
36 // set the line of rotation or line of translation
37 int setLine( const real *x0, const real *v, const MotionTypeEnum motion = rotateAroundALine );
38 
39 int setMotionType( const MotionTypeEnum motion );
40 
41 // compose this MatrixMotion with another which is applied first (set to NULL for none)
42 int compose( MatrixMotion *motion );
43 
44 // interactively update parameters:
45 int update(GenericGraphicsInterface & gi );
46 
47 // get from a data base file
48 int get( const GenericDataBase & dir, const aString & name);
49 
50 // put to a data base file
51 int put( GenericDataBase & dir, const aString & name) const;
52 
53 private:
54 
55  virtual ReferenceCounting& operator=( const ReferenceCounting & x)
56  { return operator=( *(MatrixMotion*) & x ); }
57  virtual void reference( const ReferenceCounting & x)
58  { reference( (MatrixMotion &) x ); }
59  virtual ReferenceCounting* virtualConstructor(const CopyType ct = DEEP) const
60  { return ::new MatrixMotion(*this, ct); }
61 
62 
63 MotionTypeEnum motionType;
64 
65 real x0[3]; // a point on the line of rotation
66 real v[3]; // tangent to the line of rotation
67 
68 TimeFunction timeFunction; // a function of time (can define the angle as a function of time, for e.g.)
69 
70 MatrixMotion *preMotion; // if non NULL then the current motion follows this motion (i.e. we compose the motions)
71 
72 
73 };
74 
75 #endif