Use the region lower and upper edge instead of an arbitrary edge when constructing a link

This commit is contained in:
2025-05-17 18:19:13 -04:00
parent 566a7fb15f
commit be12cf26e0

View File

@@ -1222,7 +1222,7 @@ public class Mesh< T extends Region > {
// New cross value for this vertex, so create a new queue
// Also add in the original vertex
final List< HalfEdge > links = new ArrayList< HalfEdge >();
links.add( vert.getEdge() );
links.add( region.upperEdge );
links.add( edge );
if ( region.links.put( region.upper, links ) != null ) {
throw new IllegalStateException( "Cross value already used!" );
@@ -1373,7 +1373,7 @@ public class Mesh< T extends Region > {
// New cross value for this vertex, so create a new queue
// Also add in the original vertex
final List< HalfEdge > links = new ArrayList< HalfEdge >();
links.add( vert.getEdge() );
links.add( region.lowerEdge );
links.add( edge );
if ( region.links.put( region.lower, links ) != null ) {
throw new IllegalStateException( "Cross value already used!" );
@@ -1883,12 +1883,6 @@ public class Mesh< T extends Region > {
return Integer.compare( c1.intersections.size(), c2.intersections.size() );
} ).get();
System.out.println( "Removing chain " + least.getOrigin() + ",\t" + least.getDest() );
System.out.println( "Intersection with " + least.intersections.size() );
for ( Chain c : least.intersections ) {
System.out.println( "\t" + c.getOrigin() + ",\t" + c.getDest() );
}
// Now remove this chain and all other chains that it intersects with
remainingChains.remove( least );
if ( !least.intersections.isEmpty() ) {
@@ -1903,6 +1897,8 @@ public class Mesh< T extends Region > {
System.out.println( "After reducing the amount of intersecting chains: " + selectedChains.size() );
// TODO Now resolve the chains into the collection!!!
return selectedChains;
}