Commit 3861e88c authored by lombardo's avatar lombardo
Browse files

add pathContainsVertex() method

update findPaths() to exclude path that go more than once through the same vertex
parent 95543ea9
......@@ -395,7 +395,7 @@ public class SkeletonAnalyser {
}
else
{
if (!pathContainsEdge(current, edge))
if ( !( pathContainsVertex(current, edge.getV2()) || junctionsEqual(edge.getV1(),edge.getV2()) ) )
{
current.add(edge);
findPaths(edge.getV2(), v2, current);
......@@ -425,6 +425,35 @@ public class SkeletonAnalyser {
return visitedAlready;
}
/**
* Check if a vertex is part of a path
* @param path Path to be checked
* @param vertex Vertex to be searched for
* @return true if the vertex is part of the Path
*/
public static boolean pathContainsVertex(ArrayList<Edge> path, Vertex vertex)
{
boolean visitedAlready = false;
if ( path.size()==0 )
return visitedAlready;
if (junctionsEqual(path.get(0).getV1(), vertex))
{
visitedAlready = true;
}
for (Edge edge : path) {
if (junctionsEqual(edge.getV2(), vertex) || visitedAlready )
{
visitedAlready = true;
break;
}
}
return visitedAlready;
}
/**
* Check if two edges (flipped or not flipped) are equal
* @param edge1 First Edge to check
......
Markdown is supported
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