Autopysta
Loading...
Searching...
No Matches
trajectory.h
Go to the documentation of this file.
1
12#ifndef TRAJECTORY_H
13#define TRAJECTORY_H
14
15#include <vector>
16#include "point.h"
17#include "clock.h"
18#include "Exception.h"
19
27public:
33 virtual point* current() = 0;
34
41 virtual point* operator[](int idx) const = 0;
42
49 virtual point* operator[](double idx) const = 0;
50};
51
59class trajectory: public std::vector<point*>, public generalized_trajectory {
60 bool updation_check;
61
69 point* extrapolate(double idx) const;
70
71public:
77 trajectory(point* _point);
78
84 void push_back(point* p);
85
92 point* add(point* newPoint);
93
100 point* get(int i);
101
107 int length();
108
114 point* current() override;
115
122 point* operator[](int idx) const override;
123
130 point* operator[](double idx) const override;
131};
132
139 point* pos;
140
141public:
148
154 point* current() override;
155
162 point* operator[](int idx) const override;
163
170 point* operator[](double idx) const override;
171};
172
173#endif
Base class for different types of trajectories.
Definition trajectory.h:26
virtual point * operator[](int idx) const =0
Get a point by integer index.
virtual point * current()=0
Get the current point of the trajectory.
virtual point * operator[](double idx) const =0
Get a point by interpolating a floating-point index.
Represents a point in time for a vehicle in a traffic simulation.
Definition point.h:23
Represents a static trajectory for a fixed object on the road.
Definition trajectory.h:138
point * operator[](double idx) const override
Retrieves the point by floating-point index (always returns the static position).
point * current() override
Returns the current position of the static object.
static_trajectory(point *pos)
Constructs a static trajectory with a fixed position.
point * operator[](int idx) const override
Retrieves the point by integer index (always returns the static position).
Represents a dynamic trajectory of a moving object.
Definition trajectory.h:59
point * add(point *newPoint)
Adds a point and returns it.
point * current() override
Gets the current position of the vehicle in the trajectory.
point * operator[](double idx) const override
Retrieves a point by floating-point index using interpolation.
point * operator[](int idx) const override
Retrieves a point by integer index.
point * get(int i)
Retrieves a point at the specified index.
int length()
Returns the length of the trajectory.
void push_back(point *p)
Adds a point to the trajectory.
trajectory(point *_point)
Constructs a trajectory with an initial starting point.
File for the clock class definition (short description).
File for the point class definition.