CARLA
Loading...
Searching...
No Matches
MapGen::DoublyConnectedEdgeList Class Reference

Simple doubly-connected edge list structure. More...

#include <DoublyConnectedEdgeList.h>

Inheritance diagram for MapGen::DoublyConnectedEdgeList:

Classes

struct  Face
struct  HalfEdge
struct  Node

Public Types

using ConstFaceIterator = typename FaceContainer::const_iterator
using ConstHalfEdgeIterator = typename HalfEdgeContainer::const_iterator
using ConstNodeIterator = typename NodeContainer::const_iterator
using FaceContainer = std::list<Face>
using FaceIterator = typename FaceContainer::iterator
using HalfEdgeContainer = std::list<HalfEdge>
using HalfEdgeIterator = typename HalfEdgeContainer::iterator
using NodeContainer = std::list<Node>
using NodeIterator = typename NodeContainer::iterator
using Position = MapGen::Position<int32>

Public Member Functions

 DoublyConnectedEdgeList (const Position &Position0, const Position &Position1)
 Create a DoublyConnectedEdgeList with two nodes, two edges and one face.
template<size_t N>
 DoublyConnectedEdgeList (const std::array< Position, N > &Cycle)
 Create a DoublyConnectedEdgeList consisting of a cycle of N nodes.
 ~DoublyConnectedEdgeList ()
Adding elements to the graph ----------------------------------—
Node & AddNode (const Position &NodePosition, Node &OtherNode)
 {
Node & SplitEdge (const PositionPosition &PositionPosition, HalfEdge &HalfEdge)
 Split HalfEdge (and its pair) at Position.
Face & ConnectNodes (Node &Node0, Node &Node1)
 Connect two nodes by a pair of edges.
Counting graph elements ---------------------------------------—
size_t CountNodes () const
size_t CountHalfEdges () const
size_t CountFaces () const
Accessing graph elements --------------------------------------—
ListView< NodeIterator > GetNodes ()
ListView< ConstNodeIterator > GetNodes () const
ListView< HalfEdgeIterator > GetHalfEdges ()
ListView< ConstHalfEdgeIterator > GetHalfEdges () const
ListView< FaceIterator > GetFaces ()
ListView< ConstFaceIterator > GetFaces () const

Static Public Member Functions

Accessing graph pointers --------------------------------------—
static Node & GetSource (HalfEdge &halfEdge)
static const Node & GetSource (const HalfEdge &halfEdge)
static Node & GetTarget (HalfEdge &halfEdge)
static const Node & GetTarget (const HalfEdge &halfEdge)
static HalfEdge & GetPair (HalfEdge &halfEdge)
static const HalfEdge & GetPair (const HalfEdge &halfEdge)
static Face & GetFace (HalfEdge &halfEdge)
static const Face & GetFace (const HalfEdge &halfEdge)
static HalfEdge & GetLeavingHalfEdge (Node &node)
static const HalfEdge & GetLeavingHalfEdge (const Node &node)
static HalfEdge & GetHalfEdge (Face &face)
static const HalfEdge & GetHalfEdge (const Face &face)
static HalfEdge & GetNextInFace (HalfEdge &halfEdge)
static const HalfEdge & GetNextInFace (const HalfEdge &halfEdge)
static HalfEdge & GetNextInNode (HalfEdge &halfEdge)
static const HalfEdge & GetNextInNode (const HalfEdge &halfEdge)
Other member functions ----------------------------------------—
static float GetAngle (const HalfEdge &halfEdge)
 Return the angle [-pi, pi] of the half-edge.

Private Attributes

FaceContainer Faces
HalfEdgeContainer HalfEdges
NodeContainer Nodes

Additional Inherited Members

Private Member Functions inherited from NonCopyable
 NonCopyable ()=default
 NonCopyable (const NonCopyable &)=delete
void operator= (const NonCopyable &)=delete

Detailed Description

Simple doubly-connected edge list structure.

It only allows adding elements, not removing them.

Definition at line 20 of file DoublyConnectedEdgeList.h.

Member Typedef Documentation

◆ ConstFaceIterator

using MapGen::DoublyConnectedEdgeList::ConstFaceIterator = typename FaceContainer::const_iterator

Definition at line 86 of file DoublyConnectedEdgeList.h.

◆ ConstHalfEdgeIterator

using MapGen::DoublyConnectedEdgeList::ConstHalfEdgeIterator = typename HalfEdgeContainer::const_iterator

Definition at line 82 of file DoublyConnectedEdgeList.h.

◆ ConstNodeIterator

using MapGen::DoublyConnectedEdgeList::ConstNodeIterator = typename NodeContainer::const_iterator

Definition at line 78 of file DoublyConnectedEdgeList.h.

◆ FaceContainer

Definition at line 84 of file DoublyConnectedEdgeList.h.

◆ FaceIterator

using MapGen::DoublyConnectedEdgeList::FaceIterator = typename FaceContainer::iterator

Definition at line 85 of file DoublyConnectedEdgeList.h.

◆ HalfEdgeContainer

◆ HalfEdgeIterator

using MapGen::DoublyConnectedEdgeList::HalfEdgeIterator = typename HalfEdgeContainer::iterator

Definition at line 81 of file DoublyConnectedEdgeList.h.

◆ NodeContainer

Definition at line 76 of file DoublyConnectedEdgeList.h.

◆ NodeIterator

using MapGen::DoublyConnectedEdgeList::NodeIterator = typename NodeContainer::iterator

Definition at line 77 of file DoublyConnectedEdgeList.h.

◆ Position

Constructor & Destructor Documentation

◆ DoublyConnectedEdgeList() [1/2]

MapGen::DoublyConnectedEdgeList::DoublyConnectedEdgeList ( const Position & Position0,
const Position & Position1 )
explicit

Create a DoublyConnectedEdgeList with two nodes, two edges and one face.

Definition at line 74 of file DoublyConnectedEdgeList.cpp.

References Faces, HalfEdges, and Nodes.

Referenced by DoublyConnectedEdgeList().

◆ DoublyConnectedEdgeList() [2/2]

template<size_t N>
MapGen::DoublyConnectedEdgeList::DoublyConnectedEdgeList ( const std::array< Position, N > & Cycle)
inlineexplicit

Create a DoublyConnectedEdgeList consisting of a cycle of N nodes.

Definition at line 99 of file DoublyConnectedEdgeList.h.

References AddNode(), ConnectNodes(), DoublyConnectedEdgeList(), and Nodes.

◆ ~DoublyConnectedEdgeList()

MapGen::DoublyConnectedEdgeList::~DoublyConnectedEdgeList ( )

Definition at line 102 of file DoublyConnectedEdgeList.cpp.

Member Function Documentation

◆ AddNode()

DoublyConnectedEdgeList::Node & MapGen::DoublyConnectedEdgeList::AddNode ( const Position & NodePosition,
Node & OtherNode )

{

Add a node at NodePosition and attach it to OtherNode.

The time complexity is O(n*log(n)) where n is the number of edges leaving OtherNode.

Returns
The newly generated node.

Definition at line 113 of file DoublyConnectedEdgeList.cpp.

References MapGen::DoublyConnectedEdgeList::HalfEdge::Face, MapGen::FindPositionInNode(), HalfEdges, MapGen::DoublyConnectedEdgeList::HalfEdge::Next, Nodes, and MapGen::DoublyConnectedEdgeList::HalfEdge::Pair.

Referenced by DoublyConnectedEdgeList().

◆ ConnectNodes()

DoublyConnectedEdgeList::Face & MapGen::DoublyConnectedEdgeList::ConnectNodes ( Node & Node0,
Node & Node1 )

Connect two nodes by a pair of edges.

It is assumed that both nodes are connected by the same face.

The time complexity is O(n0*log(n0) + n1*log(n1) + nf) where n0 and n1 are the number of edges leaving Node0 and Node1 respectively, and nf is the number of edges in the face containing both nodes.

Returns
The newly generated face.

Definition at line 194 of file DoublyConnectedEdgeList.cpp.

References MapGen::DoublyConnectedEdgeList::HalfEdge::Face, Faces, MapGen::FindPositionInNode(), GetHalfEdge(), GetNextInFace(), MapGen::DoublyConnectedEdgeList::Face::HalfEdge, HalfEdges, MapGen::DoublyConnectedEdgeList::HalfEdge::Next, and MapGen::DoublyConnectedEdgeList::HalfEdge::Pair.

Referenced by DoublyConnectedEdgeList(), and MapGen::splitFace().

◆ CountFaces()

size_t MapGen::DoublyConnectedEdgeList::CountFaces ( ) const
inline

Definition at line 161 of file DoublyConnectedEdgeList.h.

References Faces.

Referenced by MapGen::GraphParser::GraphParser(), and MapGen::randomize().

◆ CountHalfEdges()

size_t MapGen::DoublyConnectedEdgeList::CountHalfEdges ( ) const
inline

Definition at line 156 of file DoublyConnectedEdgeList.h.

References HalfEdges.

Referenced by MapGen::GraphParser::GraphParser(), and MapGen::randomize().

◆ CountNodes()

size_t MapGen::DoublyConnectedEdgeList::CountNodes ( ) const
inline

Definition at line 151 of file DoublyConnectedEdgeList.h.

References Nodes.

Referenced by MapGen::GraphParser::GraphParser(), and MapGen::randomize().

◆ GetAngle()

float MapGen::DoublyConnectedEdgeList::GetAngle ( const HalfEdge & halfEdge)
static

Return the angle [-pi, pi] of the half-edge.

Definition at line 250 of file DoublyConnectedEdgeList.cpp.

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

Referenced by MapGen::FindPositionInNode(), and MapGen::fixGraphData().

◆ GetFace() [1/2]

const Face & MapGen::DoublyConnectedEdgeList::GetFace ( const HalfEdge & halfEdge)
inlinestatic

◆ GetFace() [2/2]

Face & MapGen::DoublyConnectedEdgeList::GetFace ( HalfEdge & halfEdge)
inlinestatic

◆ GetFaces() [1/2]

ListView< FaceIterator > MapGen::DoublyConnectedEdgeList::GetFaces ( )
inline

◆ GetFaces() [2/2]

ListView< ConstFaceIterator > MapGen::DoublyConnectedEdgeList::GetFaces ( ) const
inline

Definition at line 198 of file DoublyConnectedEdgeList.h.

References Faces, and ListView< IT >::ListView().

◆ GetHalfEdge() [1/2]

const HalfEdge & MapGen::DoublyConnectedEdgeList::GetHalfEdge ( const Face & face)
inlinestatic

◆ GetHalfEdge() [2/2]

HalfEdge & MapGen::DoublyConnectedEdgeList::GetHalfEdge ( Face & face)
inlinestatic

◆ GetHalfEdges() [1/2]

ListView< HalfEdgeIterator > MapGen::DoublyConnectedEdgeList::GetHalfEdges ( )
inline

Definition at line 183 of file DoublyConnectedEdgeList.h.

References HalfEdges, and ListView< IT >::ListView().

◆ GetHalfEdges() [2/2]

ListView< ConstHalfEdgeIterator > MapGen::DoublyConnectedEdgeList::GetHalfEdges ( ) const
inline

Definition at line 188 of file DoublyConnectedEdgeList.h.

References HalfEdges, and ListView< IT >::ListView().

◆ GetLeavingHalfEdge() [1/2]

const HalfEdge & MapGen::DoublyConnectedEdgeList::GetLeavingHalfEdge ( const Node & node)
inlinestatic

◆ GetLeavingHalfEdge() [2/2]

HalfEdge & MapGen::DoublyConnectedEdgeList::GetLeavingHalfEdge ( Node & node)
inlinestatic

◆ GetNextInFace() [1/2]

const HalfEdge & MapGen::DoublyConnectedEdgeList::GetNextInFace ( const HalfEdge & halfEdge)
inlinestatic

◆ GetNextInFace() [2/2]

HalfEdge & MapGen::DoublyConnectedEdgeList::GetNextInFace ( HalfEdge & halfEdge)
inlinestatic

◆ GetNextInNode() [1/2]

const HalfEdge & MapGen::DoublyConnectedEdgeList::GetNextInNode ( const HalfEdge & halfEdge)
inlinestatic

Definition at line 303 of file DoublyConnectedEdgeList.h.

References GetNextInFace(), and GetPair().

◆ GetNextInNode() [2/2]

HalfEdge & MapGen::DoublyConnectedEdgeList::GetNextInNode ( HalfEdge & halfEdge)
inlinestatic

Definition at line 298 of file DoublyConnectedEdgeList.h.

References GetNextInFace(), and GetPair().

Referenced by MapGen::fixGraphData().

◆ GetNodes() [1/2]

ListView< NodeIterator > MapGen::DoublyConnectedEdgeList::GetNodes ( )
inline

Definition at line 173 of file DoublyConnectedEdgeList.h.

References ListView< IT >::ListView(), and Nodes.

Referenced by MapGen::fixGraphData().

◆ GetNodes() [2/2]

ListView< ConstNodeIterator > MapGen::DoublyConnectedEdgeList::GetNodes ( ) const
inline

Definition at line 178 of file DoublyConnectedEdgeList.h.

References ListView< IT >::ListView(), and Nodes.

◆ GetPair() [1/2]

const HalfEdge & MapGen::DoublyConnectedEdgeList::GetPair ( const HalfEdge & halfEdge)
inlinestatic

◆ GetPair() [2/2]

HalfEdge & MapGen::DoublyConnectedEdgeList::GetPair ( HalfEdge & halfEdge)
inlinestatic

◆ GetSource() [1/2]

const Node & MapGen::DoublyConnectedEdgeList::GetSource ( const HalfEdge & halfEdge)
inlinestatic

◆ GetSource() [2/2]

Node & MapGen::DoublyConnectedEdgeList::GetSource ( HalfEdge & halfEdge)
inlinestatic

◆ GetTarget() [1/2]

const Node & MapGen::DoublyConnectedEdgeList::GetTarget ( const HalfEdge & halfEdge)
inlinestatic

◆ GetTarget() [2/2]

Node & MapGen::DoublyConnectedEdgeList::GetTarget ( HalfEdge & halfEdge)
inlinestatic

◆ SplitEdge()

DoublyConnectedEdgeList::Node & MapGen::DoublyConnectedEdgeList::SplitEdge ( const Position & Position,
HalfEdge & HalfEdge )

Member Data Documentation

◆ Faces

FaceContainer MapGen::DoublyConnectedEdgeList::Faces
private

◆ HalfEdges

HalfEdgeContainer MapGen::DoublyConnectedEdgeList::HalfEdges
private

◆ Nodes

NodeContainer MapGen::DoublyConnectedEdgeList::Nodes
private

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