codac 1.5.6
|
One dimensional trajectory \(x(\cdot)\), defined as a temporal map of values. More...
#include <codac_Trajectory.h>
Public Member Functions | |
Definition | |
Trajectory () | |
Creates an empty scalar trajectory \(x(\cdot)\). | |
Trajectory (const Interval &tdomain, const TFunction &f) | |
Creates a scalar trajectory \(x(\cdot)\) from an analytic expression. | |
Trajectory (const Interval &tdomain, const TFunction &f, double timestep) | |
Creates a scalar trajectory \(x(\cdot)\) from an analytic expression, and transforms it as a map of values (sampling procedure) | |
Trajectory (const std::map< double, double > &m_map_values) | |
Creates a scalar trajectory \(x(\cdot)\) from a map of values. | |
Trajectory (const std::list< double > &list_t, const std::list< double > &list_x) | |
Creates a scalar trajectory \(x(\cdot)\) from a list of values. | |
Trajectory (const Trajectory &traj) | |
Creates a copy of a scalar trajectory \(x(\cdot)\). | |
~Trajectory () | |
Trajectory destructor. | |
const Trajectory & | operator= (const Trajectory &x) |
Returns a copy of a Trajectory. | |
int | size () const |
Returns the dimension of the scalar trajectory (always 1) | |
const Interval | tdomain () const |
Returns the temporal definition domain of this trajectory. | |
TrajDefnType | definition_type () const |
Returns the definition type of this trajectory. | |
Accessing values | |
const std::map< double, double > & | sampled_map () const |
Returns the map of values, if the object is defined as a map. | |
const TFunction * | tfunction () const |
Returns the temporal function, if the object is an analytic trajectory. | |
const Interval | codomain () const |
Returns the interval of feasible values. | |
double | operator() (double t) const |
Returns the evaluation of this trajectory at \(t\). | |
const Interval | operator() (const Interval &t) const |
Returns the interval evaluation of this trajectory over \([t]\). | |
double | first_value () const |
Returns the value \(x(t_0)\). | |
double | last_value () const |
Returns the value \(x(t_f)\). | |
Tests | |
bool | not_defined () const |
Tests whether this trajectory is defined or not. | |
bool | operator== (const Trajectory &x) const |
Returns true if this trajectory is equal to \(x(\cdot)\). | |
bool | operator!= (const Trajectory &x) const |
Returns true if this trajectory is different from \(x(\cdot)\). | |
Setting values | |
void | set (double y, double t) |
Sets a value \(y\) at \(t\): \(x(t)=y\). | |
Trajectory & | truncate_tdomain (const Interval &tdomain) |
Truncates the tdomain of \(x(\cdot)\). | |
Trajectory & | shift_tdomain (double a) |
Shifts the tdomain \([t_0,t_f]\) of \(x(\cdot)\). | |
bool | constant_timestep (double &h) const |
Returns true if the same amount of time separates each value. | |
Trajectory & | sample (double timestep) |
Samples the trajectory by adding new points to the map of values. | |
Trajectory & | sample (const Trajectory &x) |
Samples this trajectory so that it will share the same sampling of \(x(\cdot)\). | |
Trajectory & | make_continuous () |
Makes a trajectory continuous by avoiding infinite slopes. | |
Integration | |
const Trajectory | primitive (double c=0.) const |
Computes an approximative primitive of \(x(\cdot)\). | |
const Trajectory | primitive (double c, double timestep) const |
Computes an approximative primitive of \(x(\cdot)\) with some time discretization \(\delta\). | |
const Trajectory | diff () const |
Differentiates this trajectory. | |
double | finite_diff (double t, double h) const |
Computes the finite difference at \(t\), with an automatic order of accuracy. | |
Assignments operators | |
const Trajectory & | operator+= (double x) |
Operates +=. | |
const Trajectory & | operator+= (const Trajectory &x) |
Operates +=. | |
const Trajectory & | operator-= (double x) |
Operates -=. | |
const Trajectory & | operator-= (const Trajectory &x) |
Operates -=. | |
const Trajectory & | operator*= (double x) |
Operates *=. | |
const Trajectory & | operator*= (const Trajectory &x) |
Operates *=. | |
const Trajectory & | operator/= (double x) |
Operates /=. | |
const Trajectory & | operator/= (const Trajectory &x) |
Operates /=. | |
Public Member Functions inherited from codac::DynamicalItem | |
virtual | ~DynamicalItem () |
DynamicalItem destructor. | |
Protected Member Functions | |
const IntervalVector | codomain_box () const |
Returns the box \(x([t_0,t_f])\). | |
void | compute_codomain () |
Computes the envelope of trajectory values. | |
String | |
const std::string | class_name () const |
Returns the name of this class. | |
Additional Inherited Members | |
Static Public Member Functions inherited from codac::DynamicalItem | |
static bool | valid_tdomain (const Interval &tdomain) |
Verifies that this interval is a feasible tdomain. | |
One dimensional trajectory \(x(\cdot)\), defined as a temporal map of values.
codac::Trajectory::Trajectory | ( | ) |
Creates an empty scalar trajectory \(x(\cdot)\).
The trajectory is made of an empty map of values.
codac::Trajectory::Trajectory | ( | const Interval & | tdomain, |
const TFunction & | f ) |
Creates a scalar trajectory \(x(\cdot)\) from an analytic expression.
tdomain | temporal domain \([t_0,t_f]\) |
f | TFunction object defining the trajectory: \(x(t)=f(t)\) |
codac::Trajectory::Trajectory | ( | const Interval & | tdomain, |
const TFunction & | f, | ||
double | timestep ) |
Creates a scalar trajectory \(x(\cdot)\) from an analytic expression, and transforms it as a map of values (sampling procedure)
tdomain | temporal domain \([t_0,t_f]\) |
f | TFunction object defining the trajectory: \(x(t)=f(t)\) |
timestep | sampling value \(\delta\) for the temporal discretization (double) |
|
explicit |
Creates a scalar trajectory \(x(\cdot)\) from a map of values.
m_map_values | map<t,y> defining the trajectory: \(x(t)=y\) |
|
explicit |
Creates a scalar trajectory \(x(\cdot)\) from a list of values.
Values and datations are separated into two lists.
list_t | list of time keys |
list_x | list of values |
codac::Trajectory::Trajectory | ( | const Trajectory & | traj | ) |
Creates a copy of a scalar trajectory \(x(\cdot)\).
traj | Trajectory to be duplicated |
const Trajectory & codac::Trajectory::operator= | ( | const Trajectory & | x | ) |
Returns a copy of a Trajectory.
x | the Trajectory object to be copied |
|
virtual |
|
virtual |
Returns the temporal definition domain of this trajectory.
Implements codac::DynamicalItem.
TrajDefnType codac::Trajectory::definition_type | ( | ) | const |
Returns the definition type of this trajectory.
const std::map< double, double > & codac::Trajectory::sampled_map | ( | ) | const |
Returns the map of values, if the object is defined as a map.
const TFunction * codac::Trajectory::tfunction | ( | ) | const |
Returns the temporal function, if the object is an analytic trajectory.
const Interval codac::Trajectory::codomain | ( | ) | const |
Returns the interval of feasible values.
double codac::Trajectory::operator() | ( | double | t | ) | const |
Returns the evaluation of this trajectory at \(t\).
t | the temporal key (double, must belong to the trajectory's tdomain) |
const Interval codac::Trajectory::operator() | ( | const Interval & | t | ) | const |
Returns the interval evaluation of this trajectory over \([t]\).
t | the subtdomain (Interval, must be a subset of the trajectory's domain) |
double codac::Trajectory::first_value | ( | ) | const |
Returns the value \(x(t_0)\).
double codac::Trajectory::last_value | ( | ) | const |
Returns the value \(x(t_f)\).
bool codac::Trajectory::not_defined | ( | ) | const |
Tests whether this trajectory is defined or not.
bool codac::Trajectory::operator== | ( | const Trajectory & | x | ) | const |
Returns true if this trajectory is equal to \(x(\cdot)\).
x | the Trajectory object |
bool codac::Trajectory::operator!= | ( | const Trajectory & | x | ) | const |
Returns true if this trajectory is different from \(x(\cdot)\).
x | the Trajectory object |
void codac::Trajectory::set | ( | double | y, |
double | t ) |
Sets a value \(y\) at \(t\): \(x(t)=y\).
y | local value of the trajectory |
t | the temporal key (double, must belong to the trajectory's tdomain) |
Trajectory & codac::Trajectory::truncate_tdomain | ( | const Interval & | tdomain | ) |
Truncates the tdomain of \(x(\cdot)\).
tdomain | new temporal domain \([t_0,t_f]\) |
Trajectory & codac::Trajectory::shift_tdomain | ( | double | a | ) |
Shifts the tdomain \([t_0,t_f]\) of \(x(\cdot)\).
a | the offset value so that \([t_0,t_f]:=[t_0-a,t_f-a]\) |
bool codac::Trajectory::constant_timestep | ( | double & | h | ) | const |
Returns true if the same amount of time separates each value.
h | the evaluated timestep (constant if true is returned) |
true
if h is constant Trajectory & codac::Trajectory::sample | ( | double | timestep | ) |
Samples the trajectory by adding new points to the map of values.
timestep | sampling value \(\delta\) for the temporal discretization (double) |
Trajectory & codac::Trajectory::sample | ( | const Trajectory & | x | ) |
Samples this trajectory so that it will share the same sampling of \(x(\cdot)\).
x | the Trajectory from which the new sampling will come from |
Trajectory & codac::Trajectory::make_continuous | ( | ) |
Makes a trajectory continuous by avoiding infinite slopes.
const Trajectory codac::Trajectory::primitive | ( | double | c = 0. | ) | const |
Computes an approximative primitive of \(x(\cdot)\).
c | the constant of integration (0. by default) |
const Trajectory codac::Trajectory::primitive | ( | double | c, |
double | timestep ) const |
Computes an approximative primitive of \(x(\cdot)\) with some time discretization \(\delta\).
c | the constant of integration |
timestep | sampling value \(\delta\) for the temporal discretization (double) |
const Trajectory codac::Trajectory::diff | ( | ) | const |
Differentiates this trajectory.
double codac::Trajectory::finite_diff | ( | double | t, |
double | h ) const |
Computes the finite difference at \(t\), with an automatic order of accuracy.
Central, forward or backward finite differences are computed.
t | the temporal key (double, must belong to the trajectory's tdomain) |
h | temporal timestep around t |
const Trajectory & codac::Trajectory::operator+= | ( | double | x | ) |
Operates +=.
x | double |
const Trajectory & codac::Trajectory::operator+= | ( | const Trajectory & | x | ) |
const Trajectory & codac::Trajectory::operator-= | ( | double | x | ) |
Operates -=.
x | double |
const Trajectory & codac::Trajectory::operator-= | ( | const Trajectory & | x | ) |
const Trajectory & codac::Trajectory::operator*= | ( | double | x | ) |
Operates *=.
x | double |
const Trajectory & codac::Trajectory::operator*= | ( | const Trajectory & | x | ) |
const Trajectory & codac::Trajectory::operator/= | ( | double | x | ) |
Operates /=.
x | double |
const Trajectory & codac::Trajectory::operator/= | ( | const Trajectory & | x | ) |
|
inlinevirtual |
Returns the name of this class.
Implements codac::DynamicalItem.
|
protectedvirtual |
Returns the box \(x([t_0,t_f])\).
Implements codac::DynamicalItem.