CG  Version 25
TimeFunction.h
Go to the documentation of this file.
1 #ifndef TIME_FUNCTION_H
2 #define TIME_FUNCTION_H
3 
4 #include "Overture.h"
5 
6 
7 // ============================================================================
10 // ===========================================================================
11 class TimeFunction : public ReferenceCounting
12 {
13 public:
14 
16 {
22 };
23 
24 
26 {
29 };
30 
31 
32 
33 TimeFunction();
34 
35 // copy constructor
36 TimeFunction( const TimeFunction & tf, const CopyType ct = DEEP );
37 
39 
40 // operator =
41 TimeFunction & operator =( const TimeFunction & tf );
42 
44 
45 int eval( const real t, real & f );
46 int eval( const real t, real & f, real & ft );
47 // int eval( const real t, real & f, real & ft , real & ftt );
48 int evalDerivative( const real t, real & fp, int derivative, bool computeComposed=true );
49 
50 int setLinearFunction( const real a0, const real a1 );
51 int setSinusoidFunction( const real b0, const real f0, const real t0 );
52 
53 // interactively update parameters:
54 int update(GenericGraphicsInterface & gi );
55 
56 // get from a data base file
57 int get( const GenericDataBase & dir, const aString & name);
58 
59 // put to a data base file
60 int put( GenericDataBase & dir, const aString & name) const;
61 
62 private:
63 
64  virtual ReferenceCounting& operator=( const ReferenceCounting & x)
65  { return operator=( *(TimeFunction*) & x ); }
66  virtual void reference( const ReferenceCounting & x)
67  { reference( (TimeFunction &) x ); }
68  virtual ReferenceCounting* virtualConstructor(const CopyType ct = DEEP) const
69  { return ::new TimeFunction(*this, ct); }
70 
71 
72 FunctionTypeEnum functionType;
73 ComposeTypeEnum composeType;
74 
75 real a0,a1; // for linear function
76 real b0,f0,t0; // for sinusoid
77 real rampStart,rampEnd,rampStartTime,rampEndTime; // for ramp
78 int rampOrder; // for ramp
79 
80 IntegerArray ipar; // put user defined integer parameters here
81 RealArray rpar; // put user defined real parameters here
82 
83 TimeFunction *preFunction; // optionally specify a function to compose with
84 
85 MappingRC mapFunction; // for a time function defined from a Mapping
86 real timeParameterizationScaleFactor; // factor to scale time to the unit interval, used for the mappingFunction
87 
88 };
89 
90 #endif