Easy_rider
 
Loading...
Searching...
No Matches
MotorwayGenerator Class Reference

Builds a continuous "motorway" route by: More...

#include <MotorwayGenerator.h>

Inheritance diagram for MotorwayGenerator:
Collaboration diagram for MotorwayGenerator:

Public Member Functions

 MotorwayGenerator (double thresholdRatio, int defaultSpeed)
 
void generate (Graph< Intersection, Road > &graph) override
 Append new bidirectional motorways into the graph (no duplicates).
 

Additional Inherited Members

- Static Protected Member Functions inherited from RoadGenerator
static double euclid (const Intersection &a, const Intersection &b)
 Compute the Euclidean distance between two intersections.
 

Detailed Description

Builds a continuous "motorway" route by:

  1. Finding the two farthest intersections A and B.
  2. Computing a dynamic perpendicular threshold = thresholdRatio * distance(A,B).
  3. Selecting all intersections within that threshold of the straight line A->B.
  4. Sorting them by their projection along A->B.
  5. Connecting them in sequence (A->…->B) with bidirectional edges.

Constructor & Destructor Documentation

◆ MotorwayGenerator()

MotorwayGenerator::MotorwayGenerator ( double  thresholdRatio,
int  defaultSpeed 
)
Parameters
thresholdRatioFraction of AB's length used as max perpendicular distance for including nodes (e.g. 0.1 = 10%).
defaultSpeedSpeed to assign to each motorway segment.

Member Function Documentation

◆ generate()

void MotorwayGenerator::generate ( Graph< Intersection, Road > &  graph)
overridevirtual

Append new bidirectional motorways into the graph (no duplicates).

Implements RoadGenerator.


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