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();
40 return std::make_unique<Mesh>(out_mesh);
46 for (
auto &&lane_pair : lane_section.
GetLanes()) {
47 out_mesh += *
Generate(lane_pair.second);
49 return std::make_unique<Mesh>(out_mesh);
56 return Generate(lane, s_start, s_end);
68 const road::Lane& lane,
const double s_start,
const double s_end)
const {
77 if (lane.
GetId() == 0) {
78 return std::make_unique<Mesh>(out_mesh);
81 double s_current = s_start;
83 std::vector<geom::Vector3D> vertices;
87 vertices.push_back(edges.first);
88 vertices.push_back(edges.second);
95 vertices.push_back(edges.first);
96 vertices.push_back(edges.second);
100 }
while (s_current < s_end);
107 vertices.push_back(edges.first);
108 vertices.push_back(edges.second);
116 return std::make_unique<Mesh>(out_mesh);
120 const road::Lane& lane,
const double s_start,
const double s_end)
const {
128 if (lane.
GetId() == 0) {
129 return std::make_unique<Mesh>(out_mesh);
131 double s_current = s_start;
133 std::vector<geom::Vector3D> vertices;
136 const int segments_number = vertices_in_width - 1;
138 std::vector<geom::Vector2D> uvs;
145 const geom::Vector3D segments_size = (edges.second - edges.first) / segments_number;
148 for (
int i = 0; i < vertices_in_width; ++i) {
150 vertices.push_back(current_vertex);
151 current_vertex = current_vertex + segments_size;
157 }
while (s_current < s_end);
163 std::pair<carla::geom::Vector3D, carla::geom::Vector3D> edges =
165 const geom::Vector3D segments_size = (edges.second - edges.first) / segments_number;
168 for (
int i = 0; i < vertices_in_width; ++i)
171 vertices.push_back(current_vertex);
172 current_vertex = current_vertex + segments_size;
183 const size_t number_of_rows = (vertices.size() / vertices_in_width);
185 for (
size_t i = 0; i < (number_of_rows - 1); ++i) {
186 for (
size_t j = 0; j < vertices_in_width - 1; ++j) {
187 out_mesh.
AddIndex( j + ( i * vertices_in_width ) + 1);
188 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
189 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
191 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
192 out_mesh.
AddIndex( ( j + 1 ) + ( ( i + 1 ) * vertices_in_width ) + 1);
193 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
197 return std::make_unique<Mesh>(out_mesh);
205 std::vector<size_t> redirections;
206 for (
auto &&lane_pair : lane_section.
GetLanes()) {
207 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
208 if ( it == redirections.end() ) {
209 redirections.push_back(lane_pair.first);
210 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
212 size_t PosToAdd = it - redirections.begin();
215 switch(lane_pair.second.GetType())
238 if( result[lane_pair.second.GetType()].size() <= PosToAdd ){
239 result[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(out_mesh));
242 (result[lane_pair.second.GetType()][PosToAdd])->ConcatMesh(out_mesh, verticesinwidth);
249 for (
auto &&lane_pair : lane_section.
GetLanes()) {
250 const double s_start = lane_pair.second.GetDistance() +
EPSILON;
251 const double s_end = lane_pair.second.GetDistance() + lane_pair.second.GetLength() -
EPSILON;
254 return std::make_unique<Mesh>(out_mesh);
264 const double s_end )
const {
273 if (lane.
GetId() == 0) {
274 return std::make_unique<Mesh>(out_mesh);
276 double s_current = s_start;
278 std::vector<geom::Vector3D> vertices;
280 const int vertices_in_width = 6;
281 const int segments_number = vertices_in_width - 1;
282 std::vector<geom::Vector2D> uvs;
288 std::pair<geom::Vector3D, geom::Vector3D> edges =
293 vertices.push_back(low_vertex_first);
296 vertices.push_back(edges.first);
299 vertices.push_back(edges.first);
302 vertices.push_back(edges.second);
305 vertices.push_back(edges.second);
308 vertices.push_back(low_vertex_second);
314 }
while (s_current < s_end);
320 std::pair<carla::geom::Vector3D, carla::geom::Vector3D> edges =
326 vertices.push_back(low_vertex_first);
329 vertices.push_back(edges.first);
332 vertices.push_back(edges.first);
335 vertices.push_back(edges.second);
338 vertices.push_back(edges.second);
341 vertices.push_back(low_vertex_second);
352 const int number_of_rows = (vertices.size() / vertices_in_width);
354 for (
size_t i = 0; i < (number_of_rows - 1); ++i) {
355 for (
size_t j = 0; j < vertices_in_width - 1; ++j) {
357 if(j == 1 || j == 3){
361 out_mesh.
AddIndex( j + ( i * vertices_in_width ) + 1);
362 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
363 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
365 out_mesh.
AddIndex( ( j + 1 ) + ( i * vertices_in_width ) + 1);
366 out_mesh.
AddIndex( ( j + 1 ) + ( ( i + 1 ) * vertices_in_width ) + 1);
367 out_mesh.
AddIndex( j + ( ( i + 1 ) * vertices_in_width ) + 1);
372 return std::make_unique<Mesh>(out_mesh);
378 const auto min_lane = lane_section.
GetLanes().begin()->first == 0 ?
379 1 : lane_section.
GetLanes().begin()->first;
380 const auto max_lane = lane_section.
GetLanes().rbegin()->first == 0 ?
381 -1 : lane_section.
GetLanes().rbegin()->first;
384 for (
auto &&lane_pair : lane_section.
GetLanes()) {
385 const auto &lane = lane_pair.second;
386 const double s_start = lane.GetDistance() +
EPSILON;
387 const double s_end = lane.GetDistance() + lane.GetLength() -
EPSILON;
388 if (lane.GetId() == max_lane) {
391 if (lane.GetId() == min_lane) {
395 return std::make_unique<Mesh>(out_mesh);
399 const road::Lane &lane,
const double s_start,
const double s_end)
const {
407 if (lane.
GetId() == 0) {
408 return std::make_unique<Mesh>(out_mesh);
410 double s_current = s_start;
413 std::vector<geom::Vector3D> r_vertices;
417 r_vertices.push_back(edges.first + height_vector);
418 r_vertices.push_back(edges.first);
424 r_vertices.push_back(edges.first + height_vector);
425 r_vertices.push_back(edges.first);
429 }
while(s_current < s_end);
436 r_vertices.push_back(edges.first + height_vector);
437 r_vertices.push_back(edges.first);
445 return std::make_unique<Mesh>(out_mesh);
449 const road::Lane &lane,
const double s_start,
const double s_end)
const {
457 if (lane.
GetId() == 0) {
458 return std::make_unique<Mesh>(out_mesh);
461 double s_current = s_start;
464 std::vector<geom::Vector3D> l_vertices;
468 l_vertices.push_back(edges.second);
469 l_vertices.push_back(edges.second + height_vector);
475 l_vertices.push_back(edges.second);
476 l_vertices.push_back(edges.second + height_vector);
480 }
while(s_current < s_end);
487 l_vertices.push_back(edges.second);
488 l_vertices.push_back(edges.second + height_vector);
496 return std::make_unique<Mesh>(out_mesh);
501 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
504 mesh_uptr_list.insert(
505 mesh_uptr_list.end(),
506 std::make_move_iterator(section_uptr_list.begin()),
507 std::make_move_iterator(section_uptr_list.end()));
509 return mesh_uptr_list;
515 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
517 mesh_uptr_list.emplace_back(
Generate(lane_section));
523 Mesh lane_section_mesh;
524 for (
auto &&lane_pair : lane_section.
GetLanes()) {
525 lane_section_mesh += *
Generate(lane_pair.second, s_current, s_until);
527 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
530 if (s_end - s_current > EPSILON) {
531 Mesh lane_section_mesh;
532 for (
auto &&lane_pair : lane_section.
GetLanes()) {
533 lane_section_mesh += *
Generate(lane_pair.second, s_current, s_end);
535 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
538 return mesh_uptr_list;
543 std::map<road::Lane::LaneType , std::vector<std::unique_ptr<Mesh>>> mesh_uptr_list;
545 std::map<road::Lane::LaneType , std::vector<std::unique_ptr<Mesh>>> section_uptr_list =
GenerateOrderedWithMaxLen(lane_section);
546 mesh_uptr_list.insert(
547 std::make_move_iterator(section_uptr_list.begin()),
548 std::make_move_iterator(section_uptr_list.end()));
550 return mesh_uptr_list;
556 std::map<road::Lane::LaneType, std::vector<std::unique_ptr<Mesh>>> mesh_uptr_list;
564 std::vector<size_t> redirections;
569 for (
auto&& lane_pair : lane_section.
GetLanes()) {
570 Mesh lane_section_mesh;
572 switch (lane_pair.second.GetType())
585 lane_section_mesh += *
GenerateSidewalk(lane_pair.second, s_current, s_until);
594 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
595 if (it == redirections.end()) {
596 redirections.push_back(lane_pair.first);
597 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
600 size_t PosToAdd = it - redirections.begin();
601 if (mesh_uptr_list[lane_pair.second.GetType()].size() <= PosToAdd) {
602 mesh_uptr_list[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(lane_section_mesh));
606 (mesh_uptr_list[lane_pair.second.GetType()][PosToAdd])->ConcatMesh(lane_section_mesh, verticesinwidth);
611 if (s_end - s_current > EPSILON) {
612 for (
auto&& lane_pair : lane_section.
GetLanes()) {
613 Mesh lane_section_mesh;
615 switch (lane_pair.second.GetType())
638 auto it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
639 if (it == redirections.end()) {
640 redirections.push_back(lane_pair.first);
641 it = std::find(redirections.begin(), redirections.end(), lane_pair.first);
644 size_t PosToAdd = it - redirections.begin();
646 if (mesh_uptr_list[lane_pair.second.GetType()].size() <= PosToAdd) {
647 mesh_uptr_list[lane_pair.second.GetType()].push_back(std::make_unique<Mesh>(lane_section_mesh));
650 *(mesh_uptr_list[lane_pair.second.GetType()][PosToAdd]) += lane_section_mesh;
655 return mesh_uptr_list;
660 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
663 mesh_uptr_list.insert(
664 mesh_uptr_list.end(),
665 std::make_move_iterator(section_uptr_list.begin()),
666 std::make_move_iterator(section_uptr_list.end()));
668 return mesh_uptr_list;
673 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
675 const auto min_lane = lane_section.
GetLanes().begin()->first == 0 ?
676 1 : lane_section.
GetLanes().begin()->first;
677 const auto max_lane = lane_section.
GetLanes().rbegin()->first == 0 ?
678 -1 : lane_section.
GetLanes().rbegin()->first;
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 if (s_end - s_current > EPSILON) {
701 Mesh lane_section_mesh;
702 for (
auto &&lane_pair : lane_section.
GetLanes()) {
703 const auto &lane = lane_pair.second;
704 if (lane.GetId() == max_lane) {
707 if (lane.GetId() == min_lane) {
711 mesh_uptr_list.emplace_back(std::make_unique<Mesh>(lane_section_mesh));
714 return mesh_uptr_list;
719 std::vector<std::unique_ptr<Mesh>> mesh_uptr_list;
723 mesh_uptr_list.insert(
724 mesh_uptr_list.end(),
725 std::make_move_iterator(roads.begin()),
726 std::make_move_iterator(roads.end()));
732 if (roads.size() == walls.size()) {
733 for (
size_t i = 0; i < walls.size(); ++i) {
734 *mesh_uptr_list[i] += *walls[i];
737 mesh_uptr_list.insert(
738 mesh_uptr_list.end(),
739 std::make_move_iterator(walls.begin()),
740 std::make_move_iterator(walls.end()));
744 return mesh_uptr_list;
754 for (
auto &pair_map : result) {
755 std::vector<std::unique_ptr<Mesh>>& origin = roads[pair_map.first];
756 std::vector<std::unique_ptr<Mesh>>& source = pair_map.second;
757 std::move(source.begin(), source.end(), std::back_inserter(origin));
763 std::vector<std::unique_ptr<Mesh>>& inout,
764 std::vector<std::string>& outinfo )
const
766 for (
auto&& lane_section : road.GetLaneSections()) {
767 for (
auto&& lane : lane_section.GetLanes()) {
768 if (lane.first != 0) {
769 switch(lane.second.GetType())
775 GenerateLaneMarksForNotCenterLine(lane_section, lane.second, inout, outinfo);
776 outinfo.push_back(
"white");
782 GenerateLaneMarksForCenterLine(road, lane_section, lane.second, inout, outinfo);
783 outinfo.push_back(
"yellow");
793 std::vector<std::unique_ptr<Mesh>>& inout,
794 std::vector<std::string>& outinfo )
const {
798 double s_current = s_start;
799 std::vector<geom::Vector3D> vertices;
800 std::vector<size_t> indices;
805 if (road_info_mark !=
nullptr) {
808 switch (lane_mark_info.
type) {
810 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
812 std::pair<geom::Vector3D, geom::Vector3D> edges =
819 out_mesh.
AddIndex(currentIndex + 1);
820 out_mesh.
AddIndex(currentIndex + 2);
822 out_mesh.
AddIndex(currentIndex + 1);
823 out_mesh.
AddIndex(currentIndex + 3);
824 out_mesh.
AddIndex(currentIndex + 2);
830 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
832 std::pair<geom::Vector3D, geom::Vector3D> edges =
839 if (s_current > s_end)
850 out_mesh.
AddIndex(currentIndex + 1);
851 out_mesh.
AddIndex(currentIndex + 2);
853 out_mesh.
AddIndex(currentIndex + 1);
854 out_mesh.
AddIndex(currentIndex + 3);
855 out_mesh.
AddIndex(currentIndex + 2);
899 }
while (s_current < s_end);
903 if (road_info_mark !=
nullptr) {
906 std::pair<geom::Vector3D, geom::Vector3D> edges =
912 inout.push_back(std::make_unique<Mesh>(out_mesh));
921 std::vector<std::unique_ptr<Mesh>>& inout,
922 std::vector<std::string>& outinfo )
const
927 double s_current = s_start;
928 std::vector<geom::Vector3D> vertices;
929 std::vector<size_t> indices;
934 if (road_info_mark !=
nullptr) {
937 switch (lane_mark_info.
type) {
939 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
955 out_mesh.
AddIndex(currentIndex + 1);
956 out_mesh.
AddIndex(currentIndex + 2);
958 out_mesh.
AddIndex(currentIndex + 1);
959 out_mesh.
AddIndex(currentIndex + 3);
960 out_mesh.
AddIndex(currentIndex + 2);
966 size_t currentIndex = out_mesh.
GetVertices().size() + 1;
968 std::pair<geom::Vector3D, geom::Vector3D> edges =
975 if (s_current > s_end) {
985 out_mesh.
AddIndex(currentIndex + 1);
986 out_mesh.
AddIndex(currentIndex + 2);
988 out_mesh.
AddIndex(currentIndex + 1);
989 out_mesh.
AddIndex(currentIndex + 3);
990 out_mesh.
AddIndex(currentIndex + 2);
1034 }
while (s_current < s_end);
1038 if (road_info_mark !=
nullptr)
1055 inout.push_back(std::make_unique<Mesh>(out_mesh));
1081 return {neighbor_info.
vertex, 0};
1083 if(abs(distance3D) < EPSILON) {
1084 return {neighbor_info.
vertex, 0};
1086 float weight = geom::Math::Clamp<float>(1.0f / distance3D, 0.0f, 100000.0f);
1096 return {neighbor_info.
vertex, weight};
1101 std::vector<std::unique_ptr<Mesh>> &lane_meshes) {
1104 using Point = Rtree::BPoint;
1106 for (
size_t lane_mesh_idx = 0; lane_mesh_idx < lane_meshes.size(); ++lane_mesh_idx) {
1107 auto& mesh = lane_meshes[lane_mesh_idx];
1108 for(
size_t i = 0; i < mesh->GetVerticesNum(); ++i) {
1109 auto& vertex = mesh->GetVertices()[i];
1110 Point point(vertex.x, vertex.y, vertex.z);
1111 if (i < 2 || i >= mesh->GetVerticesNum() - 2) {
1112 rtree.InsertElement({point, {&vertex, lane_mesh_idx,
true}});
1114 rtree.InsertElement({point, {&vertex, lane_mesh_idx,
false}});
1120 std::vector<VertexNeighbors> vertices_neighborhoods;
1121 for (
size_t lane_mesh_idx = 0; lane_mesh_idx < lane_meshes.size(); ++lane_mesh_idx) {
1122 auto& mesh = lane_meshes[lane_mesh_idx];
1123 for(
size_t i = 0; i < mesh->GetVerticesNum(); ++i) {
1124 if (i > 2 && i < mesh->GetVerticesNum() - 2) {
1125 auto& vertex = mesh->GetVertices()[i];
1126 Point point(vertex.x, vertex.y, vertex.z);
1127 auto closest_vertices = rtree.GetNearestNeighbours(point, 20);
1129 vertex_neighborhood.
vertex = &vertex;
1130 for(
auto& close_vertex : closest_vertices) {
1131 auto &vertex_info = close_vertex.second;
1132 if(&vertex == vertex_info.vertex) {
1136 road_param, {&vertex, lane_mesh_idx,
false}, vertex_info);
1137 if(vertex_weight.weight > 0)
1138 vertex_neighborhood.
neighbors.push_back(vertex_weight);
1140 vertices_neighborhoods.push_back(vertex_neighborhood);
1144 return vertices_neighborhoods;
1153 auto Laplacian = [&](
const Mesh::vertex_type* vertex,
const std::vector<VertexWeight> &neighbors) ->
double {
1155 double sum_weight = 0;
1156 for(
auto &element : neighbors) {
1157 sum += (element.vertex->z - vertex->
z)*element.weight;
1158 sum_weight += element.weight;
1161 return sum / sum_weight;
1167 double lambda = 0.5;
1168 int iterations = 100;
1169 for(
int iter = 0; iter < iterations; ++iter) {
1170 for (
auto& vertex_neighborhood : vertices_neighborhoods) {
1171 auto * vertex = vertex_neighborhood.vertex;
1172 vertex->
z +=
static_cast<float>(lambda*Laplacian(vertex, vertex_neighborhood.neighbors));
1176 for(
auto &mesh : lane_meshes) {
1180 return std::make_unique<Mesh>(out_mesh);
1189 return default_num_vertices;
1207 const double s_current,
1208 const double lanemark_width)
const {
1209 std::pair<geom::Vector3D, geom::Vector3D> edges =
1213 if (edges.first != edges.second) {
1214 director = edges.second - edges.first;
1215 director /= director.
Length();
1217 const std::map<road::LaneId, road::Lane> & lanes = lane_section.
GetLanes();
1218 for (
const auto& lane_pair : lanes) {
1219 std::pair<geom::Vector3D, geom::Vector3D> another_edge =
1221 if (another_edge.first != another_edge.second) {
1222 director = another_edge.second - another_edge.first;
1223 director /= director.
Length();
1228 geom::Vector3D endmarking = edges.first + director * lanemark_width;
1229 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
在车道的右侧生成一个墙状网格
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
在车道的左侧生成一个墙状网格
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
计算车道标记的当前s位置两侧的点
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
仅为中心线(ID为0的线)生成车道标记
std::vector< std::unique_ptr< Mesh > > GenerateWallsWithMaxLen(const road::Road &road) const
生成一个定义道路安全墙的网格列表,限制最大长度
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
生成定义一条道路的网格
void GenerateLaneMarksForNotCenterLine(const road::LaneSection &lane_section, const road::Lane &lane, std::vector< std::unique_ptr< Mesh > > &inout, std::vector< std::string > &outinfo) const
为非中心线(即ID不为0的所有线)生成车道标记
void GenerateLaneSectionOrdered(const road::LaneSection &lane_section, std::map< carla::road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > &result) const
生成按顺序排列的车道段网格
std::unique_ptr< Mesh > GenerateTesselated(const road::Lane &lane, const double s_start, const double s_end) const
用更高的细分生成从给定的s起始和结束的车道网格
std::vector< std::unique_ptr< Mesh > > GenerateAllWithMaxLen(const road::Road &road) const
生成带有所有模拟所需特性的分块道路
std::vector< std::unique_ptr< Mesh > > GenerateWithMaxLen(const road::Road &road) const
生成一个定义道路的网格列表,限制最大长度
std::map< carla::road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > GenerateOrderedWithMaxLen(const road::Road &road) const
生成一个定义道路的按顺序排列的网格列表,限制最大长度
std::unique_ptr< Mesh > GenerateWalls(const road::LaneSection &lane_section) const
生成一个网格,表示道路角落的墙,以避免车辆掉下去
void GenerateAllOrderedWithMaxLen(const road::Road &road, std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > &roads) const
生成按顺序排列的道路网格,限制最大长度
void AddIndex(index_type index)
将索引附加到索引列表。
void AddVertex(vertex_type vertex)
将顶点附加到顶点列表。
void AddVertices(const std::vector< vertex_type > &vertices)
将顶点附加到顶点列表。
bool IsValid() const
检查网格是否有效。
void AddUVs(const std::vector< uv_type > &uv)
添加纹理映射坐标(Texture-Mapping Coordinates, UV)
void AddMaterial(const std::string &material_name)
开始将新材质应用到新添加的三角形。
void EndMaterial()
停止将材质应用到新添加的三角形。
void AddTriangleStrip(const std::vector< vertex_type > &vertices)
向网格添加三角形带,顶点顺序为逆时针。
const std::vector< vertex_type > & GetVertices() const
PointCloudRtree 类用于处理 3D 点云。 将类型 T 的元素与 3D 点关联,用于快速 k-NN 搜索。
double GetDistance() const
std::map< LaneId, Lane > & GetLanes()
bool IsStraight() const
检查几何形状是否是直线
const T * GetInfo(const double s) const
double GetDistance() const
std::pair< geom::Vector3D, geom::Vector3D > GetCornerPositions(const double s, const float extra_width=0.f) const
计算给定位置s的车道边缘位置
auto GetLaneSections() const
element::DirectedPoint GetDirectedPointIn(const double s) const
返回指定距离的中心点(车道 0)的导向点
每条车道在道路横截面内可以提供多个道路标记条目。 道路标记信息定义了车道外边界的线条样式。 对于左侧车道,这是左边界;对于右侧车道,这是右边界。 左右车道之间的分隔线样式由零号车道(即中央车道)的道路标...
static constexpr double EPSILON
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)
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