Skip to content

Commit

Permalink
[Amibe] RemeshSkeleton collapse between polyline extremities
Browse files Browse the repository at this point in the history
when RemeshPolyline return only 2 points. Those two points are supposed to
already be the extremities of the polyline but sometime they are not.
  • Loading branch information
jeromerobert committed Aug 26, 2019
1 parent 073d53b commit 24fe7a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public EdgesCollapserNG(Mesh mesh)

private AbstractHalfEdge getEdge(Vertex v1, Triangle t, Vertex v2)
{
assert v1 == t.getV0() || v1 == t.getV1() || v1 == t.getV2();
assert v1 != v2;
AbstractHalfEdge e = v1.getIncidentAbstractHalfEdge(t, null);
Vertex start = e.destination();
Expand Down
22 changes: 11 additions & 11 deletions amibe/src/org/jcae/mesh/amibe/algos3d/RemeshSkeleton.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ public void compute()
edgeIndex.add(e);
}

if(toInsert.size() == 2)
{
int n = Math.max(1, polyline.size() / 2);
if(toInsert.get(0) != toInsert.get(1))
edgeCollapser.collapse(polyline.get(0), polyline.get(polyline.size() - 1), polyline.get(n));
continue main;
}

for(int k = 0; k < toInsert.size(); k++)
{
Vertex v = toInsert.get(k);
Expand Down Expand Up @@ -157,17 +165,9 @@ else if(dd <= tolerance)
vertexSwapper.swap(v);
}
}
if(toInsert.size() == 2)
{
int n = Math.max(1, polyline.size() / 2);
if(toInsert.get(0) != toInsert.get(1))
edgeCollapser.collapse(toInsert.get(0), toInsert.get(1), polyline.get(n));
}
else
{
for(int k = 0; k < toInsert.size() - 1; k++)
edgeCollapser.collapse(toInsert.get(k), toInsert.get(k+1), null);
}

for(int k = 0; k < toInsert.size() - 1; k++)
edgeCollapser.collapse(toInsert.get(k), toInsert.get(k+1), null);

for(Vertex v:toInsert)
v.setMutable(false);
Expand Down

0 comments on commit 24fe7a4

Please sign in to comment.