Represents a road connecting two Intersections in 2D space, with a computed length and a maximum speed. More...
#include <Road.h>
Public Member Functions | |
Road () | |
Default constructor. Initializes both endpoints at (0,0), length to 0.0, and maxSpeed to 0. | |
Road (const Intersection &from, const Intersection &to, int maxSpeed) | |
Parameterized constructor. | |
Intersection | getFrom () const |
Retrieves the starting Intersection. | |
Intersection | getTo () const |
Retrieves the ending Intersection. | |
double | getLength () const |
Retrieves the computed length of the road. | |
int | getMaxSpeed () const |
Retrieves the maximum speed for this road. | |
Represents a road connecting two Intersections in 2D space, with a computed length and a maximum speed.
Road::Road | ( | const Intersection & | from, |
const Intersection & | to, | ||
int | maxSpeed | ||
) |
Parameterized constructor.
from | The starting Intersection. |
to | The ending Intersection. |
maxSpeed | The maximum allowed speed on this road. |
Automatically computes the Euclidean length between from
and to
.
Intersection Road::getFrom | ( | ) | const |
Retrieves the starting Intersection.
double Road::getLength | ( | ) | const |
Retrieves the computed length of the road.
int Road::getMaxSpeed | ( | ) | const |
Retrieves the maximum speed for this road.
Intersection Road::getTo | ( | ) | const |
Retrieves the ending Intersection.