CARLA
Classes | Typedefs | Enumerations | Functions | Variables
MapGen Namespace Reference

Classes

class  CityAreaDescription
 
class  DoublyConnectedEdgeList
 Simple doubly-connected edge list structure. More...
 
class  GraphGenerator
 Random DoublyConnectedEdgeList generator. More...
 
class  GraphParser
 
class  Position
 
class  RoadSegmentBuilder
 
class  RoadSegmentDescription
 

Typedefs

using Graph = DoublyConnectedEdgeList
 

Enumerations

enum  EIntersectionType { EIntersectionType::Turn90Deg, EIntersectionType::TIntersection, EIntersectionType::XIntersection }
 

Functions

static std::pair< DoublyConnectedEdgeList::HalfEdge *, DoublyConnectedEdgeList::HalfEdge * > FindPositionInNode (DoublyConnectedEdgeList::HalfEdge &halfEdge)
 Return the pair {prev, next}, where prev/next is the previous/next edge counterclockwise around edge's source node. More...
 
static void fixGraphData (Graph &graph)
 
static Graph::Position getDirection (const Graph::HalfEdge &edge)
 
static int getQuadrant (float angle)
 
static std::pair< Graph::HalfEdge *, Graph::HalfEdge * > getRandomOpposingEdges (Graph::Face &face, FRandomStream &random)
 
static float getRotation (float angle0, float angle1)
 
static float getRotation (float angle0, float angle1, float angle2)
 
static const Graph::PositiongetSourcePosition (const Graph::HalfEdge &edge)
 
static const Graph::PositiongetTargetPosition (const Graph::HalfEdge &edge)
 
struct GraphHalfEdge INHERIT_GRAPH_TYPE_BASE_CLASS ('e')
 
struct GraphNode INHERIT_GRAPH_TYPE_BASE_CLASS ('n')
 
struct GraphFace INHERIT_GRAPH_TYPE_BASE_CLASS ('f')
 
static void randomize (Graph &graph, const int32 seed)
 
static int32 signOf (int32 val)
 
static Graph::FacesplitFace (Graph &graph, Graph::Face &face, FRandomStream &random)
 

Variables

static constexpr int32 MARGIN = 6
 

Typedef Documentation

◆ Graph

Definition at line 14 of file GraphGenerator.cpp.

Enumeration Type Documentation

◆ EIntersectionType

Enumerator
Turn90Deg 
TIntersection 
XIntersection 

Definition at line 11 of file CityMapDefinitions.h.

Function Documentation

◆ FindPositionInNode()

static std::pair<DoublyConnectedEdgeList::HalfEdge *, DoublyConnectedEdgeList::HalfEdge *> MapGen::FindPositionInNode ( DoublyConnectedEdgeList::HalfEdge halfEdge)
static

Return the pair {prev, next}, where prev/next is the previous/next edge counterclockwise around edge's source node.

I.e., edge's position is in between prev and next.

Note: Always returns the half-edge pointing out from node.

The time complexity is O(n*log(n)) where n is the number of edges of edge's source.

Definition at line 42 of file DoublyConnectedEdgeList.cpp.

References MapGen::DoublyConnectedEdgeList::GetAngle().

Referenced by MapGen::DoublyConnectedEdgeList::AddNode(), MapGen::DoublyConnectedEdgeList::ConnectNodes(), and MapGen::DoublyConnectedEdgeList::SplitEdge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixGraphData()

static void MapGen::fixGraphData ( Graph graph)
static
Todo:
This can probably be done at graph creation.

Definition at line 53 of file GraphParser.cpp.

References MapGen::DoublyConnectedEdgeList::GetAngle(), MapGen::DoublyConnectedEdgeList::GetLeavingHalfEdge(), MapGen::DoublyConnectedEdgeList::GetNextInNode(), MapGen::DoublyConnectedEdgeList::GetNodes(), getRotation(), TIntersection, Turn90Deg, and XIntersection.

Referenced by MapGen::GraphParser::GraphParser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDirection()

static Graph::Position MapGen::getDirection ( const Graph::HalfEdge edge)
static

Definition at line 34 of file GraphGenerator.cpp.

References getSourcePosition(), and getTargetPosition().

Referenced by splitFace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuadrant()

static int MapGen::getQuadrant ( float  angle)
static

Definition at line 23 of file GraphParser.cpp.

Referenced by getRotation().

+ Here is the caller graph for this function:

◆ getRandomOpposingEdges()

static std::pair<Graph::HalfEdge *, Graph::HalfEdge *> MapGen::getRandomOpposingEdges ( Graph::Face face,
FRandomStream &  random 
)
static

Definition at line 38 of file GraphGenerator.cpp.

References MapGen::DoublyConnectedEdgeList::GetHalfEdge(), and MapGen::DoublyConnectedEdgeList::GetNextInFace().

Referenced by splitFace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRotation() [1/2]

static float MapGen::getRotation ( float  angle0,
float  angle1 
)
static

Definition at line 28 of file GraphParser.cpp.

References getQuadrant(), and min().

Referenced by fixGraphData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRotation() [2/2]

static float MapGen::getRotation ( float  angle0,
float  angle1,
float  angle2 
)
static
Todo:
There has to be a better way.

Definition at line 35 of file GraphParser.cpp.

References getQuadrant(), and carla::traffic_manager::constants::MotionPlan::PI.

+ Here is the call graph for this function:

◆ getSourcePosition()

static const Graph::Position& MapGen::getSourcePosition ( const Graph::HalfEdge edge)
static

Definition at line 26 of file GraphGenerator.cpp.

References MapGen::DoublyConnectedEdgeList::Node::GetPosition(), and MapGen::DoublyConnectedEdgeList::GetSource().

Referenced by getDirection(), and splitFace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetPosition()

static const Graph::Position& MapGen::getTargetPosition ( const Graph::HalfEdge edge)
static

Definition at line 30 of file GraphGenerator.cpp.

References MapGen::DoublyConnectedEdgeList::Node::GetPosition(), and MapGen::DoublyConnectedEdgeList::GetTarget().

Referenced by getDirection(), and splitFace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [1/3]

struct GraphHalfEdge MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'e'  )

Definition at line 56 of file GraphTypes.h.

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [2/3]

struct GraphNode MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'n'  )

Definition at line 47 of file GraphTypes.h.

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [3/3]

struct GraphFace MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'f'  )

Definition at line 61 of file GraphTypes.h.

◆ randomize()

static void MapGen::randomize ( Graph graph,
const int32  seed 
)
static
Todo:
We skip first face because is the surrounding face. But this won't be always the case, if the graph is generated differently it might be a different one.

Definition at line 75 of file GraphGenerator.cpp.

References MapGen::DoublyConnectedEdgeList::CountFaces(), MapGen::DoublyConnectedEdgeList::CountHalfEdges(), MapGen::DoublyConnectedEdgeList::CountNodes(), MapGen::DoublyConnectedEdgeList::GetFaces(), and splitFace().

Referenced by MapGen::GraphGenerator::Generate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ signOf()

static int32 MapGen::signOf ( int32  val)
static

Definition at line 22 of file GraphGenerator.cpp.

Referenced by splitFace().

+ Here is the caller graph for this function:

◆ splitFace()

static Graph::Face* MapGen::splitFace ( Graph graph,
Graph::Face face,
FRandomStream &  random 
)
static

Definition at line 55 of file GraphGenerator.cpp.

References MapGen::DoublyConnectedEdgeList::ConnectNodes(), getDirection(), getRandomOpposingEdges(), getSourcePosition(), getTargetPosition(), signOf(), and MapGen::DoublyConnectedEdgeList::SplitEdge().

Referenced by randomize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ MARGIN

constexpr int32 MapGen::MARGIN = 6
static

Definition at line 16 of file GraphGenerator.cpp.