Emergency 20 Dokumentation  4.2.0
qsf::ai::voronoi::TrafficLaneConverter Class Reference

#include <VoronoiTrafficLaneConverter.h>

Public Member Functions

 TrafficLaneConverter (TrafficLaneWorld *mapToWrite, const SegmentFinder &segmentFinder, const DynamicGraph &graph, unsigned int laneType, const HeightRestriction &restriction, int walkableLevel, bool testAtTerrainHeight)
 
void convert ()
 
void convertGridSegments ()
 
void convertNodes ()
 
void convertNode (const DynamicGraph::HubNodeIdentifier &hubNodeId, glm::vec3 &position, std::vector< unsigned int > &connectedLanes) const
 

Detailed Description

The functionality to create Voronoi diagrams is separated into distinct algorithmic steps. This part creates the final traffic lanes from the result of identified and connected segments. It is realized as a function object purely for coding reasons. The whole logic is triggered with the convert call and the result can be fetched exactly once afterwards at any point.

Constructor & Destructor Documentation

qsf::ai::voronoi::TrafficLaneConverter::TrafficLaneConverter ( TrafficLaneWorld mapToWrite,
const SegmentFinder segmentFinder,
const DynamicGraph graph,
unsigned int  laneType,
const HeightRestriction restriction,
int  walkableLevel,
bool  testAtTerrainHeight 
)

The algorithm is executed by creating an instance of this class passing all relevant inputs to the constructor and calling convert().

The segment collection and the segment connector are the results of previous steps of the algorithm. The grid configuration needs to contain the values that were used to create the grid. The y coordinate of the origin will be used as height for all positions created by the algorithm as it is now a strictly 2D algorithm. TODO(vs) replace by using a getHeightAt(2DPos) function once we have terrain and similar stuff. The lane type is assigned to all lanes created by this algorithm.

Note
The creation process assumes a bidirectional type as relying on a specific direction for the automatically created lanes doesn't really make sense.

Member Function Documentation

void qsf::ai::voronoi::TrafficLaneConverter::convert ( )
void qsf::ai::voronoi::TrafficLaneConverter::convertGridSegments ( )
void qsf::ai::voronoi::TrafficLaneConverter::convertNode ( const DynamicGraph::HubNodeIdentifier hubNodeId,
glm::vec3 &  position,
std::vector< unsigned int > &  connectedLanes 
) const
void qsf::ai::voronoi::TrafficLaneConverter::convertNodes ( )

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