Adjusten mesh generation EPSILON

This commit is contained in:
Marc Garcia Puig 2020-05-07 15:27:27 +02:00
parent f99a06f7e5
commit 3afd89074c
1 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@ namespace geom {
/// We use this epsilon to shift the waypoints away from the edges of the lane
/// sections to avoid floating point precision errors.
static constexpr double EPSILON = 10.0 * std::numeric_limits<double>::epsilon();
static constexpr double MESH_EPSILON = 50.0 * std::numeric_limits<double>::epsilon();
std::unique_ptr<Mesh> MeshFactory::Generate(const road::Road &road) const {
Mesh out_mesh;
@ -77,7 +78,7 @@ namespace geom {
// This ensures the mesh is constant and have no gaps between roads,
// adding geometry at the very end of the lane
if (s_end - (s_current - road_param.resolution) > EPSILON) {
const auto edges = lane.GetCornerPositions(s_end, road_param.extra_lane_width);
const auto edges = lane.GetCornerPositions(s_end * MESH_EPSILON, road_param.extra_lane_width);
vertices.push_back(edges.first);
vertices.push_back(edges.second);
}
@ -150,7 +151,7 @@ namespace geom {
// This ensures the mesh is constant and have no gaps between roads,
// adding geometry at the very end of the lane
if (s_end - (s_current - road_param.resolution) > EPSILON) {
const auto edges = lane.GetCornerPositions(s_end, road_param.extra_lane_width);
const auto edges = lane.GetCornerPositions(s_end * MESH_EPSILON, road_param.extra_lane_width);
r_vertices.push_back(edges.first + height_vector);
r_vertices.push_back(edges.first);
}
@ -201,7 +202,7 @@ namespace geom {
// This ensures the mesh is constant and have no gaps between roads,
// adding geometry at the very end of the lane
if (s_end - (s_current - road_param.resolution) > EPSILON) {
const auto edges = lane.GetCornerPositions(s_end, road_param.extra_lane_width);
const auto edges = lane.GetCornerPositions(s_end * MESH_EPSILON, road_param.extra_lane_width);
l_vertices.push_back(edges.second);
l_vertices.push_back(edges.second + height_vector);
}