CARLA
Loading...
Searching...
No Matches
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 class  EIntersectionType { Turn90Deg , TIntersection , 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.
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::Position & getSourcePosition (const Graph::HalfEdge &edge)
static const Graph::Position & getTargetPosition (const Graph::HalfEdge &edge)
struct GraphHalfEdge INHERIT_GRAPH_TYPE_BASE_CLASS ('e')
struct GraphFace INHERIT_GRAPH_TYPE_BASE_CLASS ('f')
struct GraphNode INHERIT_GRAPH_TYPE_BASE_CLASS ('n')
static void randomize (Graph &graph, const int32 seed)
static int32 signOf (int32 val)
static Graph::Face * splitFace (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

enum class MapGen::EIntersectionType
strong
Enumerator
Turn90Deg 
TIntersection 
XIntersection 

Definition at line 11 of file CityMapDefinitions.h.

Function Documentation

◆ FindPositionInNode()

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 FindPositionInNode(), and MapGen::DoublyConnectedEdgeList::GetAngle().

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

◆ fixGraphData()

◆ getDirection()

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

Definition at line 34 of file GraphGenerator.cpp.

References getDirection(), getSourcePosition(), and getTargetPosition().

Referenced by getDirection(), and splitFace().

◆ getQuadrant()

int MapGen::getQuadrant ( float angle)
static

Definition at line 23 of file GraphParser.cpp.

References getQuadrant().

Referenced by getQuadrant(), getRotation(), and getRotation().

◆ getRandomOpposingEdges()

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

◆ getRotation() [1/2]

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

Definition at line 28 of file GraphParser.cpp.

References getQuadrant(), getRotation(), and min().

Referenced by fixGraphData(), getRotation(), and getRotation().

◆ getRotation() [2/2]

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 getRotation().

◆ getSourcePosition()

◆ getTargetPosition()

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [1/3]

struct GraphHalfEdge MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'e' )

Definition at line 56 of file GraphTypes.h.

References INHERIT_GRAPH_TYPE_BASE_CLASS().

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [2/3]

struct GraphFace MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'f' )

Definition at line 61 of file GraphTypes.h.

References INHERIT_GRAPH_TYPE_BASE_CLASS().

◆ INHERIT_GRAPH_TYPE_BASE_CLASS() [3/3]

struct GraphNode MapGen::INHERIT_GRAPH_TYPE_BASE_CLASS ( 'n' )

◆ randomize()

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(), randomize(), and splitFace().

Referenced by MapGen::GraphGenerator::Generate(), and randomize().

◆ signOf()

int32 MapGen::signOf ( int32 val)
static

Definition at line 22 of file GraphGenerator.cpp.

References signOf().

Referenced by signOf(), and splitFace().

◆ splitFace()

Variable Documentation

◆ MARGIN

int32 MapGen::MARGIN = 6
staticconstexpr

Definition at line 16 of file GraphGenerator.cpp.

Referenced by splitFace().