10#include <unordered_set>
16 using Graph = DoublyConnectedEdgeList;
25 return static_cast<int>(std::round(angle/HALF_PI));
32 const int max =
getQuadrant(std::max(angle0, angle1));
33 return HALF_PI * std::min(
min,
min * max);
39 static float getRotation(
float angle0,
float angle1,
float angle2) {
47 return -1.0 * HALF_PI;
51 UE_LOG(LogCarla, Error, TEXT(
"Wrong quadrants"));
60 for (
auto &node : graph.
GetNodes()) {
61 std::vector<float> angles;
65 auto *edge = &firstEdge;
70 angles.emplace_back(edge->Angle);
73 }
while (edge!= &firstEdge);
75 check(!angles.empty());
76 node.EdgeCount = angles.size();
77 node.bIsIntersection =
true;
79 switch (node.EdgeCount) {
81 node.Rotation =
getRotation(angles[0u], angles[1u]);
85 node.Rotation =
getRotation(angles[0u], angles[1u], angles[2u]);
94 node.Rots.swap(angles);
106 std::vector<TUniquePtr<RoadSegmentDescription>>
Segments;
117 Segments.emplace_back(MakeUnique<RoadSegmentDescription>());
177 auto it = faceList.begin();
180 for (; it!= faceList.end(); ++it) {
182 CityAreas.emplace_back(MakeUnique<CityAreaDescription>(*it));
UE_LOG(LogCarla, Log, TEXT("UActorDispatcher::Destroying actor: '%s' %x"), *Id, Actor)
double min(double v1, double v2)
返回两个数中的较小值
void Add(const GraphNode &Node)
简单的双连通边链表结构。它只允许添加元素,不允许删除元素。
ListView< FaceIterator > GetFaces()
static float GetAngle(const HalfEdge &halfEdge)
返回 half-edge 的角度,范围为 [-pi, pi]
ListView< NodeIterator > GetNodes()
static HalfEdge & GetHalfEdge(Face &face)
static HalfEdge & GetLeavingHalfEdge(Node &node)
static HalfEdge & GetPair(HalfEdge &halfEdge)
static Node & GetSource(HalfEdge &halfEdge)
size_t CountNodes() const
static HalfEdge & GetNextInNode(HalfEdge &halfEdge)
static HalfEdge & GetNextInFace(HalfEdge &halfEdge)
size_t CountHalfEdges() const
size_t CountFaces() const
RoadSegmentList RoadSegments
GraphParser(DoublyConnectedEdgeList &Dcel)
RoadSegmentBuilder(const Graph &graph)
std::unordered_set< const Graph::HalfEdge * > _visitedEdges
void Add(Graph::HalfEdge &edge)
std::vector< const Graph::HalfEdge * > _initial
std::vector< TUniquePtr< RoadSegmentDescription > > Segments
bool insert(Graph::HalfEdge &edge)
static int getQuadrant(float angle)
static void fixGraphData(Graph &graph)
DoublyConnectedEdgeList Graph
static float getRotation(float angle0, float angle1)