Trajectory representation between two calculated points in 1d. More...
#include <trajectory.hpp>
Public Member Functions | |
TrajectoryRep1D () | |
Default constructor for empty representation. | |
TrajectoryRep1D (double dt, double x1, double v1, double x2, double v2, trajectory_rep_e force=TRAJ_EMPTY) | |
Constructor for representation of trajectory from (x1,v1) to (x2,v2) in time dt. | |
~TrajectoryRep1D () | |
Destructor. | |
void | construct (double dt, double x1, double v1, double x2, double v2, trajectory_rep_e force=TRAJ_EMPTY) |
Construct representation of trajectory from (x1,v1) to (x2,v2) in time dt. | |
void | coord (double &x, double &v, double K) |
Calculate location x and velocity v at parametric time K. | |
int | solve (double K[3], double x, int extrapolate=0) |
Solves for trajectory intersection with location. | |
void | debug_print (std::ostream &os) const |
Print debugging information to os. | |
Trajectory representation between two calculated points in 1d.
Uses either linear-linear, quadratic-linear or cubic-quadratic representation for location x and velocity v. Time is presented as a parametric, scaled variable K ranging from 0 to 1.
|
inline |
Default constructor for empty representation.
TrajectoryRep1D::TrajectoryRep1D | ( | double | dt, |
double | x1, | ||
double | v1, | ||
double | x2, | ||
double | v2, | ||
trajectory_rep_e | force = TRAJ_EMPTY |
||
) |
Constructor for representation of trajectory from (x1,v1) to (x2,v2) in time dt.
Can be forced to use a specified representation type by setting force. Defaults to TRAJ_EMPTY, which means that the highest numerically stable polynomial is automatically used.
|
inline |
Destructor.
void TrajectoryRep1D::construct | ( | double | dt, |
double | x1, | ||
double | v1, | ||
double | x2, | ||
double | v2, | ||
trajectory_rep_e | force = TRAJ_EMPTY |
||
) |
Construct representation of trajectory from (x1,v1) to (x2,v2) in time dt.
Can be forced to use a specified representation type by setting force. Defaults to TRAJ_EMPTY, which means that the highest numerically stable polynomial is automatically used.
void TrajectoryRep1D::coord | ( | double & | x, |
double & | v, | ||
double | K | ||
) |
Calculate location x and velocity v at parametric time K.
void TrajectoryRep1D::debug_print | ( | std::ostream & | os | ) | const |
Print debugging information to os.
int TrajectoryRep1D::solve | ( | double | K[3], |
double | x, | ||
int | extrapolate = 0 |
||
) |
Solves for trajectory intersection with location.
Solves the trajectory intersection with location x. Saves the valid solutions to array K in increasing order and returns the number of solutions saved. The accepted limit for parametric time K is 0 < K =< 1 if extrapolate is 0, -1.0e-6 < K =< 1 if extrapolate is less than 0 or 0.0 < K <= 1+1.0e-6 if extrapolate is more than 0.