101 static_assert(N > 2u,
"Not enough nodes to make a cycle!");
102 for (
auto i = 2u; i < Cycle.size(); ++i) {
103 AddNode(Cycle[i], Nodes.back());
105 ConnectNodes(Nodes.front(), Nodes.back());
121 Node &AddNode(
const Position &NodePosition, Node &OtherNode);
139 Face &ConnectNodes(Node &Node0, Node &Node1);
155 return HalfEdges.size();
211 check(halfEdge.
Source !=
nullptr);
217 check(halfEdge.
Source !=
nullptr);
223 check(halfEdge.
Target !=
nullptr);
229 check(halfEdge.
Target !=
nullptr);
235 check(halfEdge.
Pair !=
nullptr);
236 return *halfEdge.
Pair;
241 check(halfEdge.
Pair !=
nullptr);
242 return *halfEdge.
Pair;
247 check(halfEdge.
Face !=
nullptr);
248 return *halfEdge.
Face;
253 check(halfEdge.
Face !=
nullptr);
254 return *halfEdge.
Face;
285 check(halfEdge.
Next !=
nullptr);
286 return *halfEdge.
Next;
291 check(halfEdge.
Next !=
nullptr);
292 return *halfEdge.
Next;
297 return GetNextInFace(GetPair(halfEdge));
302 return GetNextInFace(GetPair(halfEdge));
313 static float GetAngle(
const HalfEdge &halfEdge);
315#ifdef CARLA_ROAD_GENERATOR_EXTRA_LOG
316 void PrintToLog()
const;
简单的双连通边链表结构。它只允许添加元素,不允许删除元素。
typename HalfEdgeContainer::const_iterator ConstHalfEdgeIterator
ListView< FaceIterator > GetFaces()
typename HalfEdgeContainer::iterator HalfEdgeIterator
ListView< HalfEdgeIterator > GetHalfEdges()
ListView< ConstFaceIterator > GetFaces() const
static const Face & GetFace(const HalfEdge &halfEdge)
HalfEdgeContainer HalfEdges
ListView< ConstHalfEdgeIterator > GetHalfEdges() const
static const Node & GetSource(const HalfEdge &halfEdge)
ListView< NodeIterator > GetNodes()
static HalfEdge & GetHalfEdge(Face &face)
static Node & GetTarget(HalfEdge &halfEdge)
typename NodeContainer::const_iterator ConstNodeIterator
ListView< ConstNodeIterator > GetNodes() const
static HalfEdge & GetLeavingHalfEdge(Node &node)
static HalfEdge & GetPair(HalfEdge &halfEdge)
static const Node & GetTarget(const HalfEdge &halfEdge)
static Face & GetFace(HalfEdge &halfEdge)
static const HalfEdge & GetPair(const HalfEdge &halfEdge)
static Node & GetSource(HalfEdge &halfEdge)
std::list< HalfEdge > HalfEdgeContainer
size_t CountNodes() const
typename FaceContainer::iterator FaceIterator
static HalfEdge & GetNextInNode(HalfEdge &halfEdge)
typename NodeContainer::iterator NodeIterator
std::list< Node > NodeContainer
static const HalfEdge & GetHalfEdge(const Face &face)
static HalfEdge & GetNextInFace(HalfEdge &halfEdge)
static const HalfEdge & GetNextInFace(const HalfEdge &halfEdge)
static const HalfEdge & GetNextInNode(const HalfEdge &halfEdge)
size_t CountHalfEdges() const
static const HalfEdge & GetLeavingHalfEdge(const Node &node)
typename FaceContainer::const_iterator ConstFaceIterator
DoublyConnectedEdgeList(const std::array< Position, N > &Cycle)
创建一个由N个节点组成双连通链表DoublyConnectedEdgeList环。
std::list< Face > FaceContainer
size_t CountFaces() const
friend DoublyConnectedEdgeList
Face & operator=(const Face &)=delete
HalfEdge & operator=(const HalfEdge &)=delete
friend DoublyConnectedEdgeList
DoublyConnectedEdgeList::Position Position
const DoublyConnectedEdgeList::Position & GetPosition() const
Node(const Position &Pos)
HalfEdge * LeavingHalfEdge
friend DoublyConnectedEdgeList
Node & operator=(const Node &)=delete