31 static constexpr double EPSILON = 10.0 * std::numeric_limits<double>::epsilon();
32 static constexpr double MESH_EPSILON = 50.0 * std::numeric_limits<double>::epsilon();
39 return std::make_unique<Mesh>(out_mesh);
44 for (
auto &&lane_pair : lane_section.
GetLanes()) {
45 out_mesh += *
Generate(lane_pair.second);
47 return std::make_unique<Mesh>(out_mesh);
53 return Generate(lane, s_start, s_end);
63 const road::Lane &lane,
const double s_start,
const double s_end)
const {
71 if (lane.
GetId() == 0) {
72 return std::make_unique<Mesh>(out_mesh);
74 double s_current = s_start;
76 std::vector<geom::Vector3D> vertices;
81 vertices.push_back(edges.first);
82 vertices.push_back(edges.second);
88 vertices.push_back(edges.first);
89 vertices.push_back(edges.second);
93 }
while(s_current < s_end);
100 vertices.push_back(edges.first);
101 vertices.push_back(edges.second);
109 return std::make_unique<Mesh>(out_mesh);
113 const road::Lane& lane,
const double s_start,
const double s_end)
const {
121 if (lane.
GetId() == 0) {
122 return std::make_unique<Mesh>(out_mesh);
124 double s_current = s_start;
126 std::vector<geom::Vector3D> vertices;
129 const int segments_number = vertices_in_width - 1;
131 std::vector<geom::Vector2D> uvs;
138 const geom::Vector3D segments_size = ( edges.second - edges.first ) / segments_number;
141 for (
int i = 0; i < vertices_in_width; ++i) {
143 vertices.push_back(current_vertex);
144 current_vertex = current_vertex + segments_size;
150 }
while (s_current < s_end);
156 std::pair<carla::geom::Vector3D, carla::geom::Vector3D> edges =
158 const geom::Vector3D segments_size = (edges.second - edges.first) / segments_number;
161 for (
int i = 0; i < vertices_in_width; ++i)
164 vertices.push_back(current_vertex);
165 current_vertex = current_vertex + segments_size;
176 const size_t number_of_rows = (vertices.size() / vertices_in_width);
178 for (
size_t i = 0; i < (number_of_rows - 1); ++i) {
179 for (
size_t j = 0; j < vertices_in_width - 1; ++j) {
180 out_mesh.
AddIndex( j + ( i * vertices_in_width ) + 1);
181 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
182 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
184 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
185 out_mesh.
AddIndex( ( j + 1 ) + ( ( i + 1 ) * vertices_in_width ) + 1);
186 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
190 return std::make_unique<Mesh>(out_mesh);
199 std::vector<size_t> redirections;
200 for (
auto &&lane_pair : lane_section.
GetLanes()) {
201 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
202 if ( it == redirections.end() ) {
203 redirections.push_back(lane_pair.first);
204 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
206 size_t PosToAdd = it - redirections.begin();
209 switch(lane_pair.second.GetType())
232 if( result[lane_pair.second.GetType()].size() <= PosToAdd ){
233 result[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(out_mesh));
236 (result[lane_pair.second.GetType()][PosToAdd])->ConcatMesh(out_mesh, verticesinwidth);
244 for (
auto &&lane_pair : lane_section.
GetLanes()) {
245 const double s_start = lane_pair.second.GetDistance() +
EPSILON;
246 const double s_end = lane_pair.second.GetDistance() + lane_pair.second.GetLength() -
EPSILON;
249 return std::make_unique<Mesh>(out_mesh);
258 const double s_end )
const {
267 if (lane.
GetId() == 0) {
268 return std::make_unique<Mesh>(out_mesh);
270 double s_current = s_start;
272 std::vector<geom::Vector3D> vertices;
274 const int vertices_in_width = 6;
275 const int segments_number = vertices_in_width - 1;
276 std::vector<geom::Vector2D> uvs;
282 std::pair<geom::Vector3D, geom::Vector3D> edges =
287 vertices.push_back(low_vertex_first);
290 vertices.push_back(edges.first);
293 vertices.push_back(edges.first);
296 vertices.push_back(edges.second);
299 vertices.push_back(edges.second);
302 vertices.push_back(low_vertex_second);
308 }
while (s_current < s_end);
314 std::pair<carla::geom::Vector3D, carla::geom::Vector3D> edges =
320 vertices.push_back(low_vertex_first);
323 vertices.push_back(edges.first);
326 vertices.push_back(edges.first);
329 vertices.push_back(edges.second);
332 vertices.push_back(edges.second);
335 vertices.push_back(low_vertex_second);
346 const int number_of_rows = (vertices.size() / vertices_in_width);
348 for (
size_t i = 0; i < (number_of_rows - 1); ++i) {
349 for (
size_t j = 0; j < vertices_in_width - 1; ++j) {
351 if(j == 1 || j == 3){
355 out_mesh.
AddIndex( j + ( i * vertices_in_width ) + 1);
356 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
357 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
359 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
360 out_mesh.
AddIndex( ( j + 1 ) + ( ( i + 1 ) * vertices_in_width ) + 1);
361 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
366 return std::make_unique<Mesh>(out_mesh);
371 const auto min_lane = lane_section.
GetLanes().begin()->first == 0 ?
372 1 : lane_section.
GetLanes().begin()->first;
373 const auto max_lane = lane_section.
GetLanes().rbegin()->first == 0 ?
374 -1 : lane_section.
GetLanes().rbegin()->first;
376 for (
auto &&lane_pair : lane_section.
GetLanes()) {
377 const auto &lane = lane_pair.second;
378 const double s_start = lane.GetDistance() +
EPSILON;
379 const double s_end = lane.GetDistance() + lane.GetLength() -
EPSILON;
380 if (lane.GetId() == max_lane) {
383 if (lane.GetId() == min_lane) {
387 return std::make_unique<Mesh>(out_mesh);
391 const road::Lane &lane,
const double s_start,
const double s_end)
const {
399 if (lane.
GetId() == 0) {
400 return std::make_unique<Mesh>(out_mesh);
402 double s_current = s_start;
405 std::vector<geom::Vector3D> r_vertices;
410 r_vertices.push_back(edges.first + height_vector);
411 r_vertices.push_back(edges.first);
417 r_vertices.push_back(edges.first + height_vector);
418 r_vertices.push_back(edges.first);
422 }
while(s_current < s_end);
429 r_vertices.push_back(edges.first + height_vector);
430 r_vertices.push_back(edges.first);
438 return std::make_unique<Mesh>(out_mesh);
442 const road::Lane &lane,
const double s_start,
const double s_end)
const {
450 if (lane.
GetId() == 0) {
451 return std::make_unique<Mesh>(out_mesh);
453 double s_current = s_start;
456 std::vector<geom::Vector3D> l_vertices;
461 l_vertices.push_back(edges.second);
462 l_vertices.push_back(edges.second + height_vector);
468 l_vertices.push_back(edges.second);
469 l_vertices.push_back(edges.second + height_vector);
473 }
while(s_current < s_end);
480 l_vertices.push_back(edges.second);
481 l_vertices.push_back(edges.second + height_vector);
489 return std::make_unique<Mesh>(out_mesh);
494 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
497 mesh_uptr_list.insert(
498 mesh_uptr_list.end(),
499 std::make_move_iterator(section_uptr_list.begin()),
500 std::make_move_iterator(section_uptr_list.end()));
502 return mesh_uptr_list;
507 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
509 mesh_uptr_list.emplace_back(
Generate(lane_section));
515 Mesh lane_section_mesh;
516 for (
auto &&lane_pair : lane_section.
GetLanes()) {
517 lane_section_mesh += *
Generate(lane_pair.second, s_current, s_until);
519 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
522 if (s_end - s_current > EPSILON) {
523 Mesh lane_section_mesh;
524 for (
auto &&lane_pair : lane_section.
GetLanes()) {
525 lane_section_mesh += *
Generate(lane_pair.second, s_current, s_end);
527 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
530 return mesh_uptr_list;
535 std::map<road::Lane::LaneType , std::vector<std::unique_ptr<Mesh>>> mesh_uptr_list;
537 std::map<road::Lane::LaneType , std::vector<std::unique_ptr<Mesh>>> section_uptr_list =
GenerateOrderedWithMaxLen(lane_section);
538 mesh_uptr_list.insert(
539 std::make_move_iterator(section_uptr_list.begin()),
540 std::make_move_iterator(section_uptr_list.end()));
542 return mesh_uptr_list;
548 std::map<road::Lane::LaneType , std::vector<std::unique_ptr<Mesh>>> mesh_uptr_list;
555 std::vector<size_t> redirections;
559 for (
auto &&lane_pair : lane_section.
GetLanes()) {
560 Mesh lane_section_mesh;
561 switch(lane_pair.second.GetType())
574 lane_section_mesh += *
GenerateSidewalk(lane_pair.second, s_current, s_until);
583 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
584 if (it == redirections.end()) {
585 redirections.push_back(lane_pair.first);
586 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
589 size_t PosToAdd = it - redirections.begin();
590 if (mesh_uptr_list[lane_pair.second.GetType()].size() <= PosToAdd) {
591 mesh_uptr_list[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(lane_section_mesh));
594 (mesh_uptr_list[lane_pair.second.GetType()][PosToAdd])->ConcatMesh(lane_section_mesh, verticesinwidth);
599 if (s_end - s_current > EPSILON) {
600 for (
auto &&lane_pair : lane_section.
GetLanes()) {
601 Mesh lane_section_mesh;
602 switch(lane_pair.second.GetType())
625 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
626 if (it == redirections.end()) {
627 redirections.push_back(lane_pair.first);
628 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
631 size_t PosToAdd = it - redirections.begin();
633 if (mesh_uptr_list[lane_pair.second.GetType()].size() <= PosToAdd) {
634 mesh_uptr_list[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(lane_section_mesh));
636 *(mesh_uptr_list[lane_pair.second.GetType()][PosToAdd]) += lane_section_mesh;
641 return mesh_uptr_list;
646 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
649 mesh_uptr_list.insert(
650 mesh_uptr_list.end(),
651 std::make_move_iterator(section_uptr_list.begin()),
652 std::make_move_iterator(section_uptr_list.end()));
654 return mesh_uptr_list;
659 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
661 const auto min_lane = lane_section.
GetLanes().begin()->first == 0 ?
662 1 : lane_section.
GetLanes().begin()->first;
663 const auto max_lane = lane_section.
GetLanes().rbegin()->first == 0 ?
664 -1 : lane_section.
GetLanes().rbegin()->first;
673 Mesh lane_section_mesh;
674 for (
auto &&lane_pair : lane_section.
GetLanes()) {
675 const auto &lane = lane_pair.second;
676 if (lane.GetId() == max_lane) {
679 if (lane.GetId() == min_lane) {
683 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
686 if (s_end - s_current > EPSILON) {
687 Mesh lane_section_mesh;
688 for (
auto &&lane_pair : lane_section.
GetLanes()) {
689 const auto &lane = lane_pair.second;
690 if (lane.GetId() == max_lane) {
693 if (lane.GetId() == min_lane) {
697 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
700 return mesh_uptr_list;
705 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
709 mesh_uptr_list.insert(
710 mesh_uptr_list.end(),
711 std::make_move_iterator(roads.begin()),
712 std::make_move_iterator(roads.end()));
718 if (roads.size() == walls.size()) {
719 for (
size_t i = 0; i < walls.size(); ++i) {
720 *mesh_uptr_list[i] += *walls[i];
723 mesh_uptr_list.insert(
724 mesh_uptr_list.end(),
725 std::make_move_iterator(walls.begin()),
726 std::make_move_iterator(walls.end()));
730 return mesh_uptr_list;
740 for (
auto &pair_map : result)
742 std::vector<std::unique_ptr<Mesh>>& origin = roads[pair_map.first];
743 std::vector<std::unique_ptr<Mesh>>& source = pair_map.second;
744 std::move(source.begin(), source.end(), std::back_inserter(origin));
750 std::vector<std::unique_ptr<Mesh>>& inout,
751 std::vector<std::string>& outinfo )
const
754 for (
auto&& lane : lane_section.GetLanes()) {
755 if (lane.first != 0) {
756 switch(lane.second.GetType())
763 outinfo.push_back(
"white");
770 outinfo.push_back(
"yellow");
780 std::vector<std::unique_ptr<Mesh>>& inout,
781 std::vector<std::string>& outinfo )
const {
785 double s_current = s_start;
786 std::vector<geom::Vector3D> vertices;
787 std::vector<size_t> indices;
792 if (road_info_mark !=
nullptr) {
795 switch (lane_mark_info.
type) {
797 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
799 std::pair<geom::Vector3D, geom::Vector3D> edges =
806 out_mesh.
AddIndex(currentIndex + 1);
807 out_mesh.
AddIndex(currentIndex + 2);
809 out_mesh.
AddIndex(currentIndex + 1);
810 out_mesh.
AddIndex(currentIndex + 3);
811 out_mesh.
AddIndex(currentIndex + 2);
817 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
819 std::pair<geom::Vector3D, geom::Vector3D> edges =
826 if (s_current > s_end)
837 out_mesh.
AddIndex(currentIndex + 1);
838 out_mesh.
AddIndex(currentIndex + 2);
840 out_mesh.
AddIndex(currentIndex + 1);
841 out_mesh.
AddIndex(currentIndex + 3);
842 out_mesh.
AddIndex(currentIndex + 2);
886 }
while (s_current < s_end);
890 if (road_info_mark !=
nullptr) {
893 std::pair<geom::Vector3D, geom::Vector3D> edges =
899 inout.push_back(std::make_unique<Mesh>(out_mesh));
907 std::vector<std::unique_ptr<Mesh>>& inout,
908 std::vector<std::string>& outinfo )
const
913 double s_current = s_start;
914 std::vector<geom::Vector3D> vertices;
915 std::vector<size_t> indices;
920 if (road_info_mark !=
nullptr) {
923 switch (lane_mark_info.
type) {
925 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
941 out_mesh.
AddIndex(currentIndex + 1);
942 out_mesh.
AddIndex(currentIndex + 2);
944 out_mesh.
AddIndex(currentIndex + 1);
945 out_mesh.
AddIndex(currentIndex + 3);
946 out_mesh.
AddIndex(currentIndex + 2);
952 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
954 std::pair<geom::Vector3D, geom::Vector3D> edges =
961 if (s_current > s_end) {
971 out_mesh.
AddIndex(currentIndex + 1);
972 out_mesh.
AddIndex(currentIndex + 2);
974 out_mesh.
AddIndex(currentIndex + 1);
975 out_mesh.
AddIndex(currentIndex + 3);
976 out_mesh.
AddIndex(currentIndex + 2);
1020 }
while (s_current < s_end);
1024 if (road_info_mark !=
nullptr)
1041 inout.push_back(std::make_unique<Mesh>(out_mesh));
1067 return {neighbor_info.
vertex, 0};
1069 if(abs(distance3D) < EPSILON) {
1070 return {neighbor_info.
vertex, 0};
1072 float weight = geom::Math::Clamp<float>(1.0f / distance3D, 0.0f, 100000.0f);
1082 return {neighbor_info.
vertex, weight};
1088 std::vector<std::unique_ptr<Mesh>> &lane_meshes) {
1091 using Point = Rtree::BPoint;
1093 for (
size_t lane_mesh_idx = 0; lane_mesh_idx < lane_meshes.size(); ++lane_mesh_idx) {
1094 auto& mesh = lane_meshes[lane_mesh_idx];
1095 for(
size_t i = 0; i < mesh->GetVerticesNum(); ++i) {
1096 auto& vertex = mesh->GetVertices()[i];
1097 Point point(vertex.x, vertex.y, vertex.z);
1098 if (i < 2 || i >= mesh->GetVerticesNum() - 2) {
1099 rtree.InsertElement({point, {&vertex, lane_mesh_idx,
true}});
1101 rtree.InsertElement({point, {&vertex, lane_mesh_idx,
false}});
1107 std::vector<VertexNeighbors> vertices_neighborhoods;
1108 for (
size_t lane_mesh_idx = 0; lane_mesh_idx < lane_meshes.size(); ++lane_mesh_idx) {
1109 auto& mesh = lane_meshes[lane_mesh_idx];
1110 for(
size_t i = 0; i < mesh->GetVerticesNum(); ++i) {
1111 if (i > 2 && i < mesh->GetVerticesNum() - 2) {
1112 auto& vertex = mesh->GetVertices()[i];
1113 Point point(vertex.x, vertex.y, vertex.z);
1114 auto closest_vertices = rtree.GetNearestNeighbours(point, 20);
1116 vertex_neighborhood.
vertex = &vertex;
1117 for(
auto& close_vertex : closest_vertices) {
1118 auto &vertex_info = close_vertex.second;
1119 if(&vertex == vertex_info.vertex) {
1123 road_param, {&vertex, lane_mesh_idx,
false}, vertex_info);
1124 if(vertex_weight.weight > 0)
1125 vertex_neighborhood.
neighbors.push_back(vertex_weight);
1127 vertices_neighborhoods.push_back(vertex_neighborhood);
1131 return vertices_neighborhoods;
1140 auto Laplacian = [&](
const Mesh::vertex_type* vertex,
const std::vector<VertexWeight> &neighbors) ->
double {
1142 double sum_weight = 0;
1143 for(
auto &element : neighbors) {
1144 sum += (element.vertex->z - vertex->
z)*element.weight;
1145 sum_weight += element.weight;
1148 return sum / sum_weight;
1153 double lambda = 0.5;
1154 int iterations = 100;
1155 for(
int iter = 0; iter < iterations; ++iter) {
1156 for (
auto& vertex_neighborhood : vertices_neighborhoods) {
1157 auto * vertex = vertex_neighborhood.vertex;
1158 vertex->
z +=
static_cast<float>(lambda*Laplacian(vertex, vertex_neighborhood.neighbors));
1162 for(
auto &mesh : lane_meshes) {
1166 return std::make_unique<Mesh>(out_mesh);
1177 return default_num_vertices;
1195 const double s_current,
1196 const double lanemark_width)
const {
1197 std::pair<geom::Vector3D, geom::Vector3D> edges =
1201 if (edges.first != edges.second) {
1202 director = edges.second - edges.first;
1203 director /= director.
Length();
1205 const std::map<road::LaneId, road::Lane> & lanes = lane_section.
GetLanes();
1206 for (
const auto& lane_pair : lanes) {
1207 std::pair<geom::Vector3D, geom::Vector3D> another_edge =
1209 if (another_edge.first != another_edge.second) {
1210 director = another_edge.second - another_edge.first;
1211 director /= director.
Length();
1216 geom::Vector3D endmarking = edges.first + director * lanemark_width;
1217 return std::make_pair(edges.first, endmarking);
#define DEBUG_ASSERT(predicate)
#define RELEASE_ASSERT(pred)
static auto Distance(const Vector3D &a, const Vector3D &b)
static uint32_t SelectVerticesInWidth(uint32_t default_num_vertices, road::Lane::LaneType type)
std::unique_ptr< Mesh > GenerateRightWall(const road::Lane &lane, const double s_start, const double s_end) const
Generates a wall-like mesh at the right side of the lane
std::unique_ptr< Mesh > GenerateSidewalk(const road::LaneSection &lane_section) const
std::unique_ptr< Mesh > GenerateLeftWall(const road::Lane &lane, const double s_start, const double s_end) const
Generates a wall-like mesh at the left side of the lane
std::unique_ptr< Mesh > MergeAndSmooth(std::vector< std::unique_ptr< Mesh > > &lane_meshes) const
std::pair< geom::Vector3D, geom::Vector3D > ComputeEdgesForLanemark(const road::LaneSection &lane_section, const road::Lane &lane, const double s_current, const double lanemark_width) const
void GenerateLaneMarksForCenterLine(const road::Road &road, const road::LaneSection &lane_section, const road::Lane &lane, std::vector< std::unique_ptr< Mesh > > &inout, std::vector< std::string > &outinfo) const
std::vector< std::unique_ptr< Mesh > > GenerateWallsWithMaxLen(const road::Road &road) const
Generates a list of meshes that defines a road safety wall with a maximum length
void GenerateLaneMarkForRoad(const road::Road &road, std::vector< std::unique_ptr< Mesh > > &inout, std::vector< std::string > &outinfo) const
MeshFactory(rpc::OpendriveGenerationParameters params=rpc::OpendriveGenerationParameters())
RoadParameters road_param
std::unique_ptr< Mesh > Generate(const road::Road &road) const
Generates a mesh that defines a road
void GenerateLaneMarksForNotCenterLine(const road::LaneSection &lane_section, const road::Lane &lane, std::vector< std::unique_ptr< Mesh > > &inout, std::vector< std::string > &outinfo) const
void GenerateLaneSectionOrdered(const road::LaneSection &lane_section, std::map< carla::road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > &result) const
Generates a mesh that defines a lane section
std::unique_ptr< Mesh > GenerateTesselated(const road::Lane &lane, const double s_start, const double s_end) const
Generates a mesh that defines a lane from a given s start and end with bigger tesselation
std::vector< std::unique_ptr< Mesh > > GenerateAllWithMaxLen(const road::Road &road) const
Generates a chunked road with all the features needed for simulation
std::vector< std::unique_ptr< Mesh > > GenerateWithMaxLen(const road::Road &road) const
Generates a list of meshes that defines a road with a maximum length
std::map< carla::road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > GenerateOrderedWithMaxLen(const road::Road &road) const
Generates a list of meshes that defines a road with a maximum length
std::unique_ptr< Mesh > GenerateWalls(const road::LaneSection &lane_section) const
Genrates a mesh representing a wall on the road corners to avoid cars falling down
void GenerateAllOrderedWithMaxLen(const road::Road &road, std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > &roads) const
Mesh data container, validator and exporter.
void AddIndex(index_type index)
Appends a index to the indexes list.
void AddVertex(vertex_type vertex)
Appends a vertex to the vertices list.
void AddVertices(const std::vector< vertex_type > &vertices)
Appends a vertex to the vertices list.
bool IsValid() const
Check if the mesh can be valid or not.
void AddUVs(const std::vector< uv_type > &uv)
Appends uvs.
void AddMaterial(const std::string &material_name)
Starts applying a new material to the new added triangles.
void EndMaterial()
Stops applying the material to the new added triangles.
void AddTriangleStrip(const std::vector< vertex_type > &vertices)
Adds a triangle strip to the mesh, vertex order is counterclockwise.
const std::vector< vertex_type > & GetVertices() const
Rtree class working with 3D point clouds.
double GetDistance() const
std::map< LaneId, Lane > & GetLanes()
bool IsStraight() const
Checks whether the geometry is straight or not
const T * GetInfo(const double s) const
LaneType
Can be used as flags
double GetDistance() const
std::pair< geom::Vector3D, geom::Vector3D > GetCornerPositions(const double s, const float extra_width=0.f) const
Computes the location of the edges given a s
auto GetLaneSections() const
element::DirectedPoint GetDirectedPointIn(const double s) const
Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and el...
Each lane within a road cross section can be provided with several road markentries.
static constexpr double EPSILON
We use this epsilon to shift the waypoints away from the edges of the lane sections to avoid floating...
static VertexWeight ComputeVertexWeight(const MeshFactory::RoadParameters &road_param, const VertexInfo &vertex_info, const VertexInfo &neighbor_info)
static constexpr double MESH_EPSILON
std::vector< VertexNeighbors > GetVertexNeighborhoodAndWeights(const MeshFactory::RoadParameters &road_param, std::vector< std::unique_ptr< Mesh > > &lane_meshes)
This file contains definitions of common data structures used in traffic manager.
Parameters for the road generation
float lane_ends_multiplier
float same_lane_weight_multiplier
float max_weight_distance
float vertex_width_resolution
Mesh::vertex_type * vertex
Mesh::vertex_type * vertex
std::vector< VertexWeight > neighbors
Mesh::vertex_type * vertex
void ApplyLateralOffset(float lateral_offset)
Seting for map generation from opendrive without additional geometry
double vertex_width_resolution