Commit 9a133da5 authored by Kučera Petr RNDr. Ph.D.'s avatar Kučera Petr RNDr. Ph.D.
Browse files

Section detection

parent c3c4224a
......@@ -33,11 +33,11 @@ default-directory = data/simple_two_track
[debug]
# If any of the following properties is empty (or commented), the corresponding
# file is not written to
# phys-graph = out/graph/phys_graph.dot
# phys-line-graph = out/graph/phys_line_graph.dot
# logical-graph = out/graph/logical_graph.dot
# section-graph = out/graph/section_graph.dot
# section-graph-info = out/graph/section_graph_info.txt
phys-graph = out/graph/phys_graph.dot
phys-line-graph = out/graph/phys_line_graph.dot
logical-graph = out/graph/logical_graph.dot
section-graph = out/graph/section_graph.dot
section-graph-info = out/graph/section_graph_info.txt
# Parameters of model creation
#
......
......@@ -190,7 +190,7 @@ auto
Loco::LogicalGraph::FindSectionVertices(const SectionCPtr &sect) const
-> std::pair<std::vector<Vertex>, length_type>
{
std::cout << "Section " << sect->Ident() << std::endl;
// std::cout << "Section " << sect->Ident() << std::endl;
auto [vertex_id, len] = FindInnerVertices(VerticesOfPoints(sect->Points()));
std::vector<Vertex> vert;
vert.reserve(vertex_id.size());
......@@ -275,16 +275,33 @@ Loco::LogicalGraph::FindInnerVertices(
--remain_count;
[[fallthrough]];
case SEARCH_STATE::UNVISITED:
{
auto new_dist = d + nb.mDistance;
state[nb.mVertexId] = SEARCH_STATE::OPEN;
pred[nb.mVertexId] = v;
dist[nb.mVertexId] = d + nb.mDistance; // dist[v] + nb.mDistance;
dist[nb.mVertexId] = new_dist; // dist[v] + nb.mDistance;
// std::cout << "......unvisited, new crosscount: "
//<< (IsNode(nb.mVertexId) ? cross_count + 1 : cross_count)
//<< std::endl;
q.push({nb.mVertexId, dist[nb.mVertexId]});
q.push({nb.mVertexId, new_dist});
// IsNode(nb.mVertexId) ? cross_count + 1 : cross_count});
break;
}
break;
case SEARCH_STATE::OPEN:
{
auto new_dist = d + nb.mDistance;
if (new_dist < nb.mVertexId)
{
pred[nb.mVertexId] = v;
dist[nb.mVertexId] = new_dist; // dist[v] + nb.mDistance;
// std::cout << "......unvisited, new crosscount: "
//<< (IsNode(nb.mVertexId) ? cross_count + 1 : cross_count)
//<< std::endl;
q.push({nb.mVertexId, new_dist});
// IsNode(nb.mVertexId) ? cross_count + 1 : cross_count});
}
}
break;
case SEARCH_STATE::CLOSED:
break;
default:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment