Autopysta
Loading...
Searching...
No Matches
geometry.h
Go to the documentation of this file.
1
11#ifndef GEOMETRY_H
12#define GEOMETRY_H
13
14#include "point.h"
15#include "Exception.h"
16
17namespace Geometry
18{
25 class geometry {
26 private:
27 double _length;
28 int _lanes;
29 double _merge;
30 double _diverge;
31
42 bool can_change_lanes(point *p, bool left);
43
49 double diverge();
50
51 public:
61 geometry(double _length, int _lanes, double _merge, double _diverge);
62
70
76 double length();
77
83 int lanes();
84
92
100
106 bool has_merge();
107
113 double merge();
114
121 };
122}
123
124#endif
Represents the geometry of a highway segment in the simulation.
Definition geometry.h:25
bool has_merge()
Checks if the highway segment has an on-ramp (merge).
bool can_change_left(point *p)
Checks if a vehicle can change lanes to the left.
bool has_diverge()
Checks if the highway segment has an off-ramp (diverge).
double merge()
Returns the position where the on-ramp ends.
bool can_change_right(point *p)
Checks if a vehicle can change lanes to the right.
int lanes()
Returns the number of lanes on the highway.
double length()
Returns the total length of the highway segment.
geometry(double _length, int _lanes, double _merge, double _diverge)
Constructs a geometry object with specified physical properties.
geometry(double length, int lanes)
Constructs a geometry object with minimal properties (no ramps).
Definition geometry.h:69
Represents a point in time for a vehicle in a traffic simulation.
Definition point.h:23
File for the point class definition.