Mesh helper generator. More...
#include <MeshFactory.h>
Classes | |
struct | RoadParameters |
Parameters for the road generation. More... | |
Public Member Functions | |
std::unique_ptr< Mesh > | Generate (const road::Road &road) const |
Generates a mesh that defines a road. More... | |
std::unique_ptr< Mesh > | Generate (const road::LaneSection &lane_section) const |
Generates a mesh that defines a lane section. More... | |
std::unique_ptr< Mesh > | Generate (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. More... | |
std::unique_ptr< Mesh > | Generate (const road::Lane &lane) const |
Generates a mesh that defines the whole lane. More... | |
void | GenerateAllOrderedWithMaxLen (const road::Road &road, std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh >>> &roads) const |
std::vector< std::unique_ptr< Mesh > > | GenerateAllWithMaxLen (const road::Road &road) const |
Generates a chunked road with all the features needed for simulation. More... | |
void | GenerateLaneMarkForRoad (const road::Road &road, std::vector< std::unique_ptr< Mesh >> &inout, std::vector< std::string > &outinfo) 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 |
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. More... | |
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. More... | |
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. More... | |
std::map< carla::road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > | GenerateOrderedWithMaxLen (const road::LaneSection &lane_section) const |
Generates a list of meshes that defines a lane_section with a maximum length. More... | |
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. More... | |
std::unique_ptr< Mesh > | GenerateSidewalk (const road::LaneSection &lane_section) const |
std::unique_ptr< Mesh > | GenerateSidewalk (const road::Lane &lane) const |
std::unique_ptr< Mesh > | GenerateSidewalk (const road::Lane &lane, const double s_start, const double s_end) const |
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. More... | |
std::unique_ptr< Mesh > | GenerateTesselated (const road::Lane &lane) const |
Generates a mesh that defines the whole lane with bigger tesselation. More... | |
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. More... | |
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. More... | |
std::vector< std::unique_ptr< Mesh > > | GenerateWallsWithMaxLen (const road::LaneSection &lane_section) const |
Generates a list of meshes that defines a lane_section safety wall with a maximum length. More... | |
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. More... | |
std::vector< std::unique_ptr< Mesh > > | GenerateWithMaxLen (const road::LaneSection &lane_section) const |
Generates a list of meshes that defines a lane_section with a maximum length. More... | |
std::unique_ptr< Mesh > | MergeAndSmooth (std::vector< std::unique_ptr< Mesh >> &lane_meshes) const |
MeshFactory (rpc::OpendriveGenerationParameters params=rpc::OpendriveGenerationParameters()) | |
Public Attributes | |
RoadParameters | road_param |
Mesh helper generator.
Definition at line 22 of file MeshFactory.h.
carla::geom::MeshFactory::MeshFactory | ( | rpc::OpendriveGenerationParameters | params = rpc::OpendriveGenerationParameters() | ) |
Definition at line 21 of file MeshFactory.cpp.
References carla::rpc::OpendriveGenerationParameters::additional_width, carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::geom::MeshFactory::RoadParameters::max_road_len, carla::rpc::OpendriveGenerationParameters::max_road_length, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::rpc::OpendriveGenerationParameters::vertex_distance, carla::rpc::OpendriveGenerationParameters::vertex_width_resolution, carla::geom::MeshFactory::RoadParameters::vertex_width_resolution, carla::rpc::OpendriveGenerationParameters::wall_height, and carla::geom::MeshFactory::RoadParameters::wall_height.
std::unique_ptr< Mesh > carla::geom::MeshFactory::Generate | ( | const road::Road & | road | ) | const |
Generates a mesh that defines a road.
Definition at line 34 of file MeshFactory.cpp.
References carla::road::Road::GetLaneSections().
Referenced by Generate(), carla::road::Map::GenerateChunkedMesh(), carla::road::Map::GenerateMesh(), and GenerateWithMaxLen().
std::unique_ptr< Mesh > carla::geom::MeshFactory::Generate | ( | const road::LaneSection & | lane_section | ) | const |
Generates a mesh that defines a lane section.
Definition at line 42 of file MeshFactory.cpp.
References Generate(), and carla::road::LaneSection::GetLanes().
std::unique_ptr< Mesh > carla::geom::MeshFactory::Generate | ( | 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.
Definition at line 62 of file MeshFactory.cpp.
References carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddTriangleStrip(), DEBUG_ASSERT, carla::geom::Mesh::EndMaterial(), carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Lane::GetDistance(), carla::road::Lane::GetId(), carla::road::Lane::GetLength(), carla::road::Lane::GetType(), carla::road::Lane::IsStraight(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, road_param, and carla::road::Lane::Sidewalk.
std::unique_ptr< Mesh > carla::geom::MeshFactory::Generate | ( | const road::Lane & | lane | ) | const |
Generates a mesh that defines the whole lane.
Definition at line 50 of file MeshFactory.cpp.
References carla::geom::EPSILON, Generate(), carla::road::Lane::GetDistance(), and carla::road::Lane::GetLength().
void carla::geom::MeshFactory::GenerateAllOrderedWithMaxLen | ( | const road::Road & | road, |
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh >>> & | roads | ||
) | const |
Definition at line 705 of file MeshFactory.cpp.
References GenerateOrderedWithMaxLen().
Referenced by carla::road::Map::GenerateRoadsMultithreaded().
std::vector< std::unique_ptr< Mesh > > carla::geom::MeshFactory::GenerateAllWithMaxLen | ( | const road::Road & | road | ) | const |
Generates a chunked road with all the features needed for simulation.
Definition at line 675 of file MeshFactory.cpp.
References GenerateWallsWithMaxLen(), GenerateWithMaxLen(), and carla::road::Road::IsJunction().
Referenced by carla::road::Map::GenerateChunkedMesh().
void carla::geom::MeshFactory::GenerateLaneMarkForRoad | ( | const road::Road & | road, |
std::vector< std::unique_ptr< Mesh >> & | inout, | ||
std::vector< std::string > & | outinfo | ||
) | const |
Definition at line 720 of file MeshFactory.cpp.
References carla::road::Lane::Driving, GenerateLaneMarksForCenterLine(), GenerateLaneMarksForNotCenterLine(), carla::road::Road::GetLaneSections(), and carla::road::Lane::None.
Referenced by carla::road::Map::GenerateLineMarkings().
void carla::geom::MeshFactory::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 |
Definition at line 879 of file MeshFactory.cpp.
References carla::geom::Mesh::AddIndex(), carla::geom::Mesh::AddVertex(), carla::road::element::DirectedPoint::ApplyLateralOffset(), carla::road::element::LaneMarking::BottsDots, carla::road::element::LaneMarking::Broken, carla::road::element::LaneMarking::BrokenBroken, carla::road::element::LaneMarking::BrokenSolid, carla::road::element::LaneMarking::Curb, carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Road::GetDirectedPointIn(), carla::road::LaneSection::GetDistance(), carla::road::Lane::GetInfo(), carla::road::LaneSection::GetLength(), carla::geom::Mesh::GetVertices(), carla::road::element::LaneMarking::Grass, carla::geom::Mesh::IsValid(), carla::geom::Vector3D::Length(), carla::road::element::DirectedPoint::location, carla::road::element::LaneMarking::Other, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::road::element::LaneMarking::Solid, carla::road::element::LaneMarking::SolidBroken, carla::road::element::LaneMarking::SolidSolid, carla::road::element::LaneMarking::type, carla::road::element::LaneMarking::width, and carla::geom::Vector3D::y.
Referenced by GenerateLaneMarkForRoad().
void carla::geom::MeshFactory::GenerateLaneMarksForNotCenterLine | ( | const road::LaneSection & | lane_section, |
const road::Lane & | lane, | ||
std::vector< std::unique_ptr< Mesh >> & | inout, | ||
std::vector< std::string > & | outinfo | ||
) | const |
Definition at line 742 of file MeshFactory.cpp.
References carla::geom::Mesh::AddIndex(), carla::geom::Mesh::AddVertex(), carla::road::element::LaneMarking::BottsDots, carla::road::element::LaneMarking::Broken, carla::road::element::LaneMarking::BrokenBroken, carla::road::element::LaneMarking::BrokenSolid, carla::road::element::LaneMarking::Curb, carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::LaneSection::GetDistance(), carla::road::Lane::GetInfo(), carla::road::LaneSection::GetLength(), carla::geom::Mesh::GetVertices(), carla::road::element::LaneMarking::Grass, carla::geom::Mesh::IsValid(), carla::geom::Vector3D::Length(), carla::road::element::LaneMarking::Other, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::road::element::LaneMarking::Solid, carla::road::element::LaneMarking::SolidBroken, carla::road::element::LaneMarking::SolidSolid, carla::road::element::LaneMarking::type, and carla::road::element::LaneMarking::width.
Referenced by GenerateLaneMarkForRoad().
void carla::geom::MeshFactory::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.
Definition at line 194 of file MeshFactory.cpp.
References carla::road::Lane::Driving, GenerateSidewalk(), GenerateTesselated(), carla::road::LaneSection::GetLanes(), road_param, carla::road::Lane::Sidewalk, and carla::geom::MeshFactory::RoadParameters::vertex_width_resolution.
Referenced by GenerateOrderedWithMaxLen().
std::unique_ptr< Mesh > carla::geom::MeshFactory::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.
Definition at line 431 of file MeshFactory.cpp.
References carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddTriangleStrip(), DEBUG_ASSERT, carla::geom::Mesh::EndMaterial(), carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Lane::GetDistance(), carla::road::Lane::GetId(), carla::road::Lane::GetLength(), carla::road::Lane::GetType(), carla::road::Lane::IsStraight(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::road::Lane::Sidewalk, and carla::geom::MeshFactory::RoadParameters::wall_height.
Referenced by GenerateWalls(), and GenerateWallsWithMaxLen().
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > carla::geom::MeshFactory::GenerateOrderedWithMaxLen | ( | const road::Road & | road | ) | const |
Generates a list of meshes that defines a road with a maximum length.
Definition at line 523 of file MeshFactory.cpp.
References carla::road::Road::GetLaneSections().
Referenced by GenerateAllOrderedWithMaxLen().
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< Mesh > > > carla::geom::MeshFactory::GenerateOrderedWithMaxLen | ( | const road::LaneSection & | lane_section | ) | const |
Generates a list of meshes that defines a lane_section with a maximum length.
Definition at line 535 of file MeshFactory.cpp.
References carla::road::Lane::Driving, carla::geom::EPSILON, GenerateLaneSectionOrdered(), GenerateSidewalk(), GenerateTesselated(), carla::road::LaneSection::GetDistance(), carla::road::LaneSection::GetLanes(), carla::road::LaneSection::GetLength(), carla::geom::MeshFactory::RoadParameters::max_road_len, road_param, carla::road::Lane::Sidewalk, and carla::geom::MeshFactory::RoadParameters::vertex_width_resolution.
std::unique_ptr< Mesh > carla::geom::MeshFactory::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.
Definition at line 380 of file MeshFactory.cpp.
References carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddTriangleStrip(), DEBUG_ASSERT, carla::geom::Mesh::EndMaterial(), carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Lane::GetDistance(), carla::road::Lane::GetId(), carla::road::Lane::GetLength(), carla::road::Lane::GetType(), carla::road::Lane::IsStraight(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::road::Lane::Sidewalk, and carla::geom::MeshFactory::RoadParameters::wall_height.
Referenced by GenerateWalls(), and GenerateWallsWithMaxLen().
std::unique_ptr< Mesh > carla::geom::MeshFactory::GenerateSidewalk | ( | const road::LaneSection & | lane_section | ) | const |
Definition at line 232 of file MeshFactory.cpp.
References carla::geom::EPSILON, and carla::road::LaneSection::GetLanes().
Referenced by GenerateLaneSectionOrdered(), GenerateOrderedWithMaxLen(), GenerateSidewalk(), and carla::road::Map::GenerateSingleJunction().
std::unique_ptr< Mesh > carla::geom::MeshFactory::GenerateSidewalk | ( | const road::Lane & | lane | ) | const |
Definition at line 241 of file MeshFactory.cpp.
References carla::geom::EPSILON, GenerateSidewalk(), carla::road::Lane::GetDistance(), and carla::road::Lane::GetLength().
std::unique_ptr< Mesh > carla::geom::MeshFactory::GenerateSidewalk | ( | const road::Lane & | lane, |
const double | s_start, | ||
const double | s_end | ||
) | const |
Definition at line 246 of file MeshFactory.cpp.
References carla::geom::Mesh::AddIndex(), carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddUVs(), carla::geom::Mesh::AddVertices(), DEBUG_ASSERT, carla::geom::Mesh::EndMaterial(), carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Lane::GetDistance(), carla::road::Lane::GetId(), carla::road::Lane::GetLength(), carla::road::Lane::GetType(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, road_param, and carla::road::Lane::Sidewalk.
std::unique_ptr< Mesh > carla::geom::MeshFactory::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.
Definition at line 112 of file MeshFactory.cpp.
References carla::geom::Mesh::AddIndex(), carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddUVs(), carla::geom::Mesh::AddVertices(), DEBUG_ASSERT, carla::geom::Mesh::EndMaterial(), carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::road::Lane::GetCornerPositions(), carla::road::Lane::GetDistance(), carla::road::Lane::GetId(), carla::road::Lane::GetLength(), carla::road::Lane::GetType(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, road_param, carla::road::Lane::Sidewalk, and carla::geom::MeshFactory::RoadParameters::vertex_width_resolution.
Referenced by GenerateLaneSectionOrdered(), GenerateOrderedWithMaxLen(), carla::road::Map::GenerateSingleJunction(), and GenerateTesselated().
std::unique_ptr< Mesh > carla::geom::MeshFactory::GenerateTesselated | ( | const road::Lane & | lane | ) | const |
Generates a mesh that defines the whole lane with bigger tesselation.
Definition at line 56 of file MeshFactory.cpp.
References carla::geom::EPSILON, GenerateTesselated(), carla::road::Lane::GetDistance(), and carla::road::Lane::GetLength().
std::unique_ptr< Mesh > carla::geom::MeshFactory::GenerateWalls | ( | const road::LaneSection & | lane_section | ) | const |
Genrates a mesh representing a wall on the road corners to avoid cars falling down.
Definition at line 358 of file MeshFactory.cpp.
References carla::geom::EPSILON, GenerateLeftWall(), GenerateRightWall(), and carla::road::LaneSection::GetLanes().
Referenced by GenerateWallsWithMaxLen().
std::vector< std::unique_ptr< Mesh > > carla::geom::MeshFactory::GenerateWallsWithMaxLen | ( | const road::Road & | road | ) | const |
Generates a list of meshes that defines a road safety wall with a maximum length.
Definition at line 616 of file MeshFactory.cpp.
References carla::road::Road::GetLaneSections().
Referenced by GenerateAllWithMaxLen().
std::vector< std::unique_ptr< Mesh > > carla::geom::MeshFactory::GenerateWallsWithMaxLen | ( | const road::LaneSection & | lane_section | ) | const |
Generates a list of meshes that defines a lane_section safety wall with a maximum length.
Definition at line 629 of file MeshFactory.cpp.
References carla::geom::EPSILON, GenerateLeftWall(), GenerateRightWall(), GenerateWalls(), carla::road::LaneSection::GetDistance(), carla::road::LaneSection::GetLanes(), carla::road::LaneSection::GetLength(), carla::geom::MeshFactory::RoadParameters::max_road_len, and road_param.
std::vector< std::unique_ptr< Mesh > > carla::geom::MeshFactory::GenerateWithMaxLen | ( | const road::Road & | road | ) | const |
Generates a list of meshes that defines a road with a maximum length.
Definition at line 482 of file MeshFactory.cpp.
References carla::road::Road::GetLaneSections().
Referenced by GenerateAllWithMaxLen().
std::vector< std::unique_ptr< Mesh > > carla::geom::MeshFactory::GenerateWithMaxLen | ( | const road::LaneSection & | lane_section | ) | const |
Generates a list of meshes that defines a lane_section with a maximum length.
Definition at line 495 of file MeshFactory.cpp.
References carla::geom::EPSILON, Generate(), carla::road::LaneSection::GetDistance(), carla::road::LaneSection::GetLanes(), carla::road::LaneSection::GetLength(), carla::geom::MeshFactory::RoadParameters::max_road_len, and road_param.
std::unique_ptr< Mesh > carla::geom::MeshFactory::MergeAndSmooth | ( | std::vector< std::unique_ptr< Mesh >> & | lane_meshes | ) | const |
Definition at line 1118 of file MeshFactory.cpp.
References carla::geom::GetVertexNeighborhoodAndWeights(), road_param, and carla::geom::Vector3D::z.
Referenced by carla::road::Map::GenerateChunkedMesh(), and carla::road::Map::GenerateMesh().
RoadParameters carla::geom::MeshFactory::road_param |
Definition at line 149 of file MeshFactory.h.
Referenced by Generate(), GenerateLaneMarksForCenterLine(), GenerateLaneMarksForNotCenterLine(), GenerateLaneSectionOrdered(), GenerateLeftWall(), carla::road::Map::GenerateMesh(), GenerateOrderedWithMaxLen(), GenerateRightWall(), GenerateSidewalk(), GenerateTesselated(), GenerateWallsWithMaxLen(), GenerateWithMaxLen(), MergeAndSmooth(), and MeshFactory().