Autopysta
Loading...
Searching...
No Matches
trajectory Class Reference

Represents a dynamic trajectory of a moving object. More...

#include <trajectory.h>

Inheritance diagram for trajectory:
generalized_trajectory

Public Member Functions

 trajectory (point *_point)
 Constructs a trajectory with an initial starting point.
 
void push_back (point *p)
 Adds a point to the trajectory.
 
pointadd (point *newPoint)
 Adds a point and returns it.
 
pointget (int i)
 Retrieves a point at the specified index.
 
int length ()
 Returns the length of the trajectory.
 
pointcurrent () override
 Gets the current position of the vehicle in the trajectory.
 
pointoperator[] (int idx) const override
 Retrieves a point by integer index.
 
pointoperator[] (double idx) const override
 Retrieves a point by floating-point index using interpolation.
 
- Public Member Functions inherited from generalized_trajectory

Detailed Description

Represents a dynamic trajectory of a moving object.

This class stores a series of point objects that define the trajectory of a moving vehicle. It allows retrieving points using integer or floating-point indices, and handles extrapolation for negative indices.

Constructor & Destructor Documentation

◆ trajectory()

trajectory::trajectory ( point * _point)

Constructs a trajectory with an initial starting point.

Parameters
_pointInitial point of the trajectory.

Member Function Documentation

◆ add()

point * trajectory::add ( point * newPoint)

Adds a point and returns it.

Parameters
newPointPointer to the new point to add.
Returns
The added point.

◆ current()

point * trajectory::current ( )
overridevirtual

Gets the current position of the vehicle in the trajectory.

Returns
The current point.

Implements generalized_trajectory.

◆ get()

point * trajectory::get ( int i)

Retrieves a point at the specified index.

Parameters
iIndex of the point to retrieve.
Returns
Pointer to the point at the specified index.

◆ length()

int trajectory::length ( )

Returns the length of the trajectory.

Returns
Number of points in the trajectory.

◆ operator[]() [1/2]

point * trajectory::operator[] ( double idx) const
overridevirtual

Retrieves a point by floating-point index using interpolation.

Parameters
idxFloating-point index for interpolating the point.
Returns
Interpolated point.

Implements generalized_trajectory.

◆ operator[]() [2/2]

point * trajectory::operator[] ( int idx) const
overridevirtual

Retrieves a point by integer index.

Parameters
idxIndex of the point to retrieve.
Returns
Pointer to the point at the given index.

Implements generalized_trajectory.

◆ push_back()

void trajectory::push_back ( point * p)

Adds a point to the trajectory.

Parameters
pPointer to the point to add.

The documentation for this class was generated from the following file: