Cleaned up debug prints and debug statements

This commit is contained in:
2025-05-21 21:48:27 -04:00
parent 3426829c2b
commit e5f98f6844
2 changed files with 26 additions and 402 deletions

View File

@@ -893,7 +893,7 @@ public class Mesh< T extends Region > {
// TODO Provide triangles
// and preferrably a simple polygon
public Collection< EdgePolygon > mesh( boolean b ) {
public Collection< EdgePolygon > mesh() {
if ( state != MeshState.TRIANGULATION_READY ) {
throw new IllegalStateException( "Mesh has not been split into regions!" );
}
@@ -954,72 +954,20 @@ public class Mesh< T extends Region > {
// Sort each vertex so that the edge they are pointing to is the least edge
vertices.parallelStream().forEach( v -> sort( v ) );
try {
final Collection< Chain > chains = reduceCollinear2( vertices, edges, b );
this.chains = new ArrayDeque< Chain >();
for ( Chain chain : chains ) {
List< HalfEdge > newEdges = new ArrayList< HalfEdge >();
for ( HalfEdge e : chain.links ) {
HalfEdge edge = new HalfEdge();
edge.getOrigin().setPosition( e.getOrigin().getPosition() );
edge.getDest().setPosition( e.getDest().getPosition() );
newEdges.add( edge );
}
this.chains.add( new Chain( newEdges ) );
final Collection< Chain > chains = reduceCollinear2( vertices, edges );
this.chains = new ArrayDeque< Chain >();
for ( Chain chain : chains ) {
List< HalfEdge > newEdges = new ArrayList< HalfEdge >();
for ( HalfEdge e : chain.links ) {
HalfEdge edge = new HalfEdge();
edge.getOrigin().setPosition( e.getOrigin().getPosition() );
edge.getDest().setPosition( e.getDest().getPosition() );
newEdges.add( edge );
}
} catch ( IllegalStateException e ) {
e.printStackTrace();
throw e;
this.chains.add( new Chain( newEdges ) );
}
// boolean a = true;
if ( b ) {
final Collection< EdgePolygon > newPolygons = new ArrayDeque< EdgePolygon >();
// Keep track of all edges that we've seen
final Set< HalfEdge > scanned2 = new HashSet< HalfEdge >();
for ( final HalfEdge edge : edges ) {
if ( scanned2.add( edge ) ) {
// We have not looked at this edge yet, so loop over it
// and create a new polygon from it
final EdgePolygon newPoly = new EdgePolygon();
HalfEdge temp = edge;
do {
// As we iterate over each edge, if the origin has more than
// 2 edges, then we need to split the vertex.
if ( temp.getPrev().getPrev() != temp ) {
temp.getOrigin().setEdge( temp.getPrev().getPrev() );
HalfEdge.splice( temp.getPrev(), temp.getSym().getNext() );
// Set their origins to a new vertex
final Vertex vertex = new Vertex( temp, temp.getOrigin().getPosition() );
temp.setOrigin( vertex );
temp.getPrev().setOrigin( vertex );
}
newPoly.addEdge( temp );
} while ( scanned2.add( temp = temp.getNext() ) );
newPolygons.add( newPoly );
}
}
return newPolygons;
}
// boolean b = true;
if ( b ) {
return partitionMonotone( vertices, edges, b );
}
return partitionMonotone( vertices, edges, b ).parallelStream()
// .map( p -> {
// mergeAdjacentCollinearEdges( p.getVertices(), p.getEdges() ).forEach( e -> p.getVertices().remove( e.getOrigin() ) );
//
// return p;
// } )
return partitionMonotone( vertices, edges ).parallelStream()
.map( Mesh::triangulate )
.flatMap( p -> p.parallelStream() )
.collect( Collectors.toSet() );
@@ -1067,7 +1015,7 @@ public class Mesh< T extends Region > {
*
* The complexity comes from analyzing which combinations of chain links provides the greatest reduction of vertices.
*/
private static Collection< Chain > reduceCollinear2( final TreeSet< Vertex > vertices, final Collection< HalfEdge > interior, boolean b ) {
private static Collection< Chain > reduceCollinear2( final TreeSet< Vertex > vertices, final Collection< HalfEdge > interior ) {
final Vector2d CROSS = new Vector2d( 1, 0 );
// Set maximum and minimum cross values that won't occur naturally
final double MAX_CROSS = 1.1;
@@ -1416,6 +1364,10 @@ public class Mesh< T extends Region > {
* intersection collection for each chain is synchronized, but otherwise entirely possible.
*
* TODO Good idea, now someone needs to implement that.
*
* Also, just because the origin or destination may be the midpoint of another chain
* does not necessarily mean they coincide with each other... such as if the origin
* or endpoint are connected to the midpoint for one chain, but not the other
*/
void addChain( final Chain chain ) {
final Vertex chainOrigin = chain.getOrigin();
@@ -1687,6 +1639,8 @@ public class Mesh< T extends Region > {
// This may cause duplication of chains, but
// we should be able to check them when we add them
// TODO Can this be simplified?
// As in, can we prove that this chain will connect, while
// the upper region's chain will not, or vice versa?
if ( region.upper != MAX_CROSS ) {
copyRegion.upper = region.upper;
@@ -1868,30 +1822,6 @@ public class Mesh< T extends Region > {
throw new IllegalStateException( "Dangling partitions!" );
}
System.out.println( "Found links: " + chains.size() );
Map< Vertex, Collection< Vertex > > mappings = new HashMap< Vertex, Collection< Vertex > >();
for ( final Chain c : chains ) {
// System.out.println( c + ":\t" + c.links.get( 0 ) + "\t to \t" + c.links.get( 1 ) + "\t to \t" + c.links.get( 2 ) );
// System.out.println( "\tIntersects with: " + c.intersections.size() );
// for ( final Chain i : c.intersections ) {
// System.out.println( "\t\t" + i + ":\t" + i.getOrigin() + "\t to \t" + i.getDest() );
// }
// if ( c.previous != null ) {
// System.out.println( "\tPrev: " + c.previous );
// }
// if ( c.next != null ) {
// System.out.println( "\tNext: " + c.next );
// }
Collection< Vertex > destinations;
if ( mappings.containsKey( c.getOrigin() ) ) {
destinations = mappings.get( c.getOrigin() );
} else {
destinations = new HashSet< Vertex >();
mappings.put( c.getOrigin(), destinations );
}
}
// Given a chain link, select the links which intersect the least, and remove any that it intersects with from the
// queue. Essentially, a greedy method, which is more or less guaranteed optimal results.
// This is also unfortunately an O(n^2) time algorithm that can't be simplified.
@@ -1931,20 +1861,9 @@ public class Mesh< T extends Region > {
selectedChains.add( least );
}
// if ( b ) {
// return selectedChains;
// }
final Collection< Chain > cs = new HashSet< Chain >( selectedChains );
System.out.println( "After reducing the amount of intersecting chains: " + selectedChains.size() );
final EdgeSet added = new EdgeSet();
int i = 0;
while ( !selectedChains.isEmpty() ) {
System.out.println( "Iteration " + ++i );
// Get a chain
Chain chain = selectedChains.iterator().next();
@@ -1960,11 +1879,8 @@ public class Mesh< T extends Region > {
// Get the direction of this chain
final Vector2d chainDirection = chain.getDest().getPosition().subtracted( chain.getOrigin().getPosition() );
System.out.println( "Linking chain" );
// Setup the left and right edges if the first link is not a direct edge from the origin to the midpoint
if ( chain.links.get( 0 ).getDest() != chain.getMidpoint() ) {
System.out.println( "Not!" );
System.out.println( chain.links.get( 0 ) );
final HalfEdge attach = findPrevious( chainDirection, chain.getOrigin() );
left = new HalfEdge();
HalfEdge.splice( left, attach );
@@ -1975,37 +1891,20 @@ public class Mesh< T extends Region > {
HalfEdge.splice( right, attach );
right.setOrigin( chain.getOrigin() );
interior.add( right.getSym() );
added.add( left );
added.add( right );
}
System.out.println( "Starting chain " + chain.getOrigin() );
Chain initial = chain;
Chain previousChain;
do {
selectedChains.remove( chain );
// {
// HalfEdge e1 = chain.links.get( 0 );
// HalfEdge e2 = chain.links.get( 1 );
//
// if ( e1.getDest() == e2.getOrigin() && e2.getDest() == chain.getDest() ) {
// throw new IllegalStateException( "Double collinear lines!" );
// }
// }
final HalfEdge head = chain.links.get( 0 );
final Vertex origin = chain.getOrigin();
final Vertex midpoint = chain.getMidpoint();
final Vertex destination = chain.getDest();
if ( head.getDest() == midpoint ) {
System.out.println( "Edge" );
// Extend one, and start a new chain
if ( interior.contains( head ) ) {
System.out.println( "Left" );
// Left handed
if ( right != null ) {
throw new IllegalStateException( "Unterminated left edge!" );
@@ -2020,8 +1919,6 @@ public class Mesh< T extends Region > {
interior.add( right.getSym() );
added.add( right );
// The left edge may not be null
// If it is not, then discard head
if ( left != null ) {
@@ -2044,17 +1941,13 @@ public class Mesh< T extends Region > {
interior.add( left );
interior.remove( head );
added.add( left );
}
} else {
// System.out.println( "Right" );
// Right handed
if ( left != null ) {
throw new IllegalStateException( "Unterminated right edge!" );
}
left = new HalfEdge();
// System.out.println( "4 \t" + chain.getMidpoint() );
// Attach the new edge to the midpoint
HalfEdge.splice( head.getNext(), left );
@@ -2064,9 +1957,6 @@ public class Mesh< T extends Region > {
interior.add( left );
added.add( left );
// System.out.println( "3 \t" + chain.getMidpoint() );
if ( right != null ) {
origin.setEdge( head.getPrev() );
@@ -2087,26 +1977,15 @@ public class Mesh< T extends Region > {
interior.add( right.getSym() );
interior.remove( head.getSym() );
added.add( right );
}
// System.out.println( "2 \t" + chain.getMidpoint() );
}
// Detach the head from the midpoint
HalfEdge.splice( head.getSym(), head.getNext() );
// System.out.println( "1 \t" + chain.getMidpoint() );
} else {
// Attach one edge to the midpoint
// System.out.println( "Vertex" );
// boolean test = true;
// if ( test ) {
// break;
// }
final HalfEdge tail = chain.links.get( 1 );
if ( tail.getDest() == destination ) {
// System.out.println( "Ends in solid" );
if ( interior.contains( tail ) ) {
// Attach and unset the right edge
HalfEdge.splice( right.getSym(), tail );
@@ -2127,7 +2006,6 @@ public class Mesh< T extends Region > {
left = null;
}
} else {
// System.out.println( "Ends in vertex" );
// Get which edge to splice with to attach to the midpoint
final HalfEdge midEdge = findPrevious( chainDirection, chain.getMidpoint() );
@@ -2146,8 +2024,6 @@ public class Mesh< T extends Region > {
interior.add( newRight.getSym() );
added.add( newRight );
right = newRight;
} else {
HalfEdge.splice( left.getSym(), midEdge );
@@ -2163,21 +2039,14 @@ public class Mesh< T extends Region > {
interior.add( newLeft );
added.add( newLeft );
left = newLeft;
}
}
}
previousChain = chain;
// selectedChains.remove( chain.next );
// cs.remove( chain.next );
// break;
} while ( ( chain = chain.next ) != null && selectedChains.contains( chain ) );
// TODO Make sure the edges are fully attached/detached! Dangling edges are detected!
// Terminate the chain
final Vertex destination = previousChain.getDest();
final HalfEdge tail = previousChain.links.get( 1 );
@@ -2207,17 +2076,8 @@ public class Mesh< T extends Region > {
interior.remove( tail.getSym() );
}
} else {
// System.out.println( "Linking the ends to a vertex" );
// System.out.println( "0 \t" + previousChain.getMidpoint() );
//
// System.out.println( "Dest size: " + destination.size() );
if ( destination.size() == 1 ) {
throw new IllegalStateException( "ONE EDGE!" );
}
// Get which edge to splice with to attach to the destination
final HalfEdge destEdge = findPrevious( chainDirection.multiply( -1 ), destination );
// System.out.println( "Dest edge is " + destEdge );
// Attach both the right and left edges
HalfEdge.splice( right.getSym(), destEdge );
@@ -2225,119 +2085,6 @@ public class Mesh< T extends Region > {
right.getSym().setOrigin( destination );
left.getSym().setOrigin( destination );
// System.out.println( "-1 \t" + previousChain.getMidpoint() );
}
System.out.println( "Start:" );
for ( HalfEdge e : initial.getOrigin() ) {
System.out.println( e );
}
do {
System.out.println( "Mid:" );
for ( HalfEdge e : initial.getMidpoint() ) {
System.out.println( e );
}
} while ( previousChain != initial && ( initial = initial.next ) != null );
System.out.println( "End:" );
for ( HalfEdge e : previousChain.getDest() ) {
System.out.println( e );
}
// System.out.println( "Origin: " + previousChain.getOrigin() );
// for ( HalfEdge e : previousChain.getOrigin() ) {
// System.out.println( e + "\t" + e.toVector2d() );
// }
//
// System.out.println( "Mid: " + previousChain.getMidpoint() );
// for ( HalfEdge e : previousChain.getMidpoint() ) {
// System.out.println( e + "\t" + e.toVector2d() );
// }
//
// System.out.println( "Dest " + previousChain.getDest() );
// for ( HalfEdge e : previousChain.getDest() ) {
// System.out.println( e + "\t" + e.toVector2d() );
// }
}
// boolean b = true;
// if ( b ) {
// return cs;
// }
// Scan for consistency
for ( Vertex vert : vertices ) {
for ( HalfEdge edge : vert ) {
if ( edge.getOrigin() != vert ) {
throw new IllegalStateException( "Inconsistent origin!" );
} else if ( !vertices.contains( edge.getDest() ) ) {
throw new IllegalStateException( "Missing destination!" );
}
boolean found = false;
for ( HalfEdge e : edge.getDest() ) {
if ( e == edge.getSym() ) {
found = true;
break;
}
}
if ( !found ) {
if ( added.contains( edge ) ) {
throw new IllegalStateException( "Was a newly created edge!" );
}
throw new IllegalStateException( "Bad edge/vertex!" );
} else if ( edge.isZero() ) {
throw new IllegalStateException( "Zero edge!" );
}
}
}
{
Set< HalfEdge > scanned = new HashSet< HalfEdge >();
for ( final HalfEdge edge : interior ) {
if ( !scanned.add( edge ) ) {
HalfEdge temp = edge;
do {
if ( scanned.contains( temp.getSym() ) ) {
if ( added.contains( temp ) ) {
throw new IllegalStateException( "Double interior chain!" );
}
throw new IllegalStateException( "Double interior edge!!" );
}
if ( !interior.contains( temp ) ) {
if ( added.contains( temp ) ) {
throw new IllegalStateException( "Unregistered chain!" );
}
throw new IllegalStateException( "Unregistered interior edge!" );
}
} while ( scanned.add( temp = temp.getNext() ) );
}
}
}
{
final Set< HalfEdge > scanned = new HashSet< HalfEdge >();
for ( final HalfEdge edge : interior ) {
if ( scanned.add( edge ) ) {
final Set< Vertex > verts = new HashSet< Vertex >();
HalfEdge e = edge;
do {
// if ( !verts.add( e.getOrigin() ) ) {
// System.out.println( "Poly" );
// HalfEdge t = edge;
// do {
// System.out.println( t );
// } while ( ( t = t.getNext() ) != edge );
//
// throw new IllegalStateException( "Intersecting polygon!" );
// }
if ( !scanned.add( e.getSym() ) ) {
throw new IllegalStateException( "Mobius polygon!" );
}
scanned.add( e );
} while ( scanned.add( e = e.getNext() ) );
}
}
}
@@ -2364,9 +2111,6 @@ public class Mesh< T extends Region > {
final Vector2d normalized = vector.normalized();
// TODO Remove this check
double size = vertex.size();
// This is a fairly simple use case, so compare absolute angles
HalfEdge edge = hint;
while ( true ) {
@@ -2383,17 +2127,13 @@ public class Mesh< T extends Region > {
lowest = angle;
}
edge = edge.getPrev();
if ( --size < 0 ) {
throw new IllegalStateException( "Infinite loop! Vertex size: " + vertex.size() );
}
}
}
/*
* Partitions all polygons into simple monotone polygons. The vertices must be sorted, and the interiors must contain all interior edges.
*/
private static Collection< EdgePolygon > partitionMonotone( final TreeSet< Vertex > vertices, final Collection< HalfEdge > interior, boolean deb ) {
private static Collection< EdgePolygon > partitionMonotone( final TreeSet< Vertex > vertices, final Collection< HalfEdge > interior ) {
// Helper class to keep track of the immediate upper and lower
// edges for a given vertex
class MarkedEdge {
@@ -2411,7 +2151,6 @@ public class Mesh< T extends Region > {
}
// Keep track of edges from bottom top
// final SortedEdgeCollection< HalfEdge > edgeCollection = new SortedEdgeCollection< HalfEdge >( Mesh::greaterThanOrEqualTo );
// Use a custom comparator that sorts by if the edges are interior or exterior... interior edges are greater than exterior.
// Only applicable in this situation where only two edges maximum of opposite sides may overlap.
final SortedEdgeCollection< HalfEdge > edgeCollection = new SortedEdgeCollection< HalfEdge >( ( a, b ) -> {
@@ -2451,8 +2190,6 @@ public class Mesh< T extends Region > {
}
}
// System.out.println( a + " vs " + b + " is " + cross );
if ( Math.abs( cross ) > CROSS_TOLERANCE ) {
return cross > 0;
} else {
@@ -2478,7 +2215,6 @@ public class Mesh< T extends Region > {
rightGoing.add( edge );
} else {
leftGoing.add( edge );
// System.out.println( "Removing " + edge.getSym() );
if ( !edgeCollection.remove( edge.getSym() ) ) {
throw new IllegalStateException( "Edge not added to the edge collection!" );
}
@@ -2514,20 +2250,8 @@ public class Mesh< T extends Region > {
// The current vertex must be between the upper and the lower
// edge, and it cannot be part of either edge
if ( upper == null ) {
System.out.println( "Event: " + event );
System.out.println( "Edges:" );
for ( HalfEdge e : edgeCollection ) {
System.out.println( interior.contains( e ) + "\t" + e + "\t" + e.hashCode() );
}
throw new IllegalStateException( "Lower does not have an upper edge!" );
} if ( !interior.contains( upper.getSym() ) ) {
System.out.println( "Current: " + event );
System.out.println( "Lower: " + lower );
System.out.println( "Upper: " + upper );
System.out.println( "Edges:" );
for ( final HalfEdge e : edgeCollection ) {
System.out.println( e + "\t" + interior.contains( e ) + "\t" + interior.contains( e.getSym() ) );
}
throw new IllegalStateException( "Polygon is not simple!" );
} else if ( upper.getOrigin() == event || lower.getOrigin() == event ) {
throw new IllegalStateException( "Vertex is invalid!" );
@@ -2620,21 +2344,7 @@ public class Mesh< T extends Region > {
supportEdges.add( edge );
if ( compare( lower.getOrigin(), upper.getOrigin() ) > 0 ) {
// for ( Vertex v : vertices ) {
// System.out.println( v );
// }
// Lower comes before upper
// System.out.println( "At " + event );
// System.out.println( "lower " + lower );
// System.out.println( "upper " + upper );
// System.out.println( "Before:" );
// for ( HalfEdge e : lower.getOrigin() ) {
// System.out.println( interior.contains( e ) + "\t" + e );
// }
// System.out.println( "And" );
// for ( HalfEdge e : event ) {
// System.out.println( interior.contains( e ) + "\t" + e );
// }
edge.getSym().setOrigin( lower.getOrigin() );
final Vector2d toLower = lower.getOrigin().getPosition().subtracted( event.getPosition() );
@@ -2645,16 +2355,6 @@ public class Mesh< T extends Region > {
HalfEdge.splice( edge, vertexPrevious );
HalfEdge.splice( edge.getSym(), lowerPrevious );
// System.out.println( "Edge: " + lowerPrevious );
// System.out.println( "After:" );
// for ( HalfEdge e : lower.getOrigin() ) {
// System.out.println( interior.contains( e ) + "\t" + e );
// }
// System.out.println( "And" );
// for ( HalfEdge e : event ) {
// System.out.println( interior.contains( e ) + "\t" + e );
// }
} else {
// Upper comes before lower
edge.getSym().setOrigin( upper.getOrigin() );
@@ -2678,7 +2378,6 @@ public class Mesh< T extends Region > {
// now that we have finally finished adding new edges.
for ( final HalfEdge edge : rightGoing ) {
if ( isPositive( edge ) ) {
// System.out.println( "Adding " + edge );
edgeCollection.insert( edge );
} else {
throw new IllegalStateException( "Edge suddenly changed sign!" );
@@ -2691,29 +2390,6 @@ public class Mesh< T extends Region > {
throw new IllegalStateException( "Unresolved right marked vertices!" );
}
// boolean b = true;
// if ( b ) {
// final Collection< EdgePolygon > newPolygons = new ArrayDeque< EdgePolygon >();
//
// // Keep track of all edges that we've seen
// final Set< HalfEdge > scanned = new HashSet< HalfEdge >();
// for ( final HalfEdge edge : interior ) {
// if ( scanned.add( edge ) ) {
// // We have not looked at this edge yet, so loop over it
// // and create a new polygon from it
// final EdgePolygon newPoly = new EdgePolygon();
// HalfEdge temp = edge;
//
// do {
// newPoly.addEdge( temp );
// } while ( scanned.add( temp = temp.getNext() ) );
// newPolygons.add( newPoly );
// }
// }
//
// return newPolygons;
// }
// In preparation for the generation of new regions,
// we need to duplicate each support edge so that the
// upper and lower polygons can have their edge.
@@ -2766,42 +2442,6 @@ public class Mesh< T extends Region > {
}
}
{
final Set< Vertex > verts = new HashSet< Vertex >();
for ( EdgePolygon poly : newPolygons ) {
final int size = verts.size();
if ( verts.addAll( poly.getVertices() ) ) {
if ( size + poly.getVertices().size() != verts.size() ) {
throw new IllegalStateException( "Shared vertex!" );
}
}
}
}
if ( !deb ) {
for ( EdgePolygon poly : newPolygons ) {
// System.out.println( "New Poly" );
final Set< Vertex > verts = new HashSet< Vertex >();
final Set< HalfEdge > scanned2 = new HashSet< HalfEdge >();
HalfEdge e = poly.getEdges().iterator().next();
scanned2.add( e );
do {
// System.out.println( e );
// if ( !verts.add( e.getOrigin() ) ) {
// System.out.println( "Around " + e.getOrigin() );
// for ( HalfEdge edge : e.getOrigin() ) {
// System.out.println( edge );
// }
//
// throw new IllegalStateException( "Intersecting polygon!" );
// }
if ( !scanned2.add( e.getSym() ) ) {
throw new IllegalStateException( "Mobius polygon!" );
}
} while ( scanned2.add( e = e.getNext() ) );
}
}
return newPolygons;
}
@@ -2845,10 +2485,6 @@ public class Mesh< T extends Region > {
polygon.addEdge( newEdge );
if ( newEdge.isZero() ) {
throw new IllegalStateException( "Zero during initial pop!" );
}
toSort.add( edge.getOrigin() );
toSort.add( current.getOrigin() );
@@ -2881,10 +2517,6 @@ public class Mesh< T extends Region > {
polygon.addEdge( newEdge );
if ( newEdge.isZero() ) {
throw new IllegalStateException( "Zero during second pop!" );
}
leftEdge = newEdge;
current = stack.pop();
@@ -2913,10 +2545,6 @@ public class Mesh< T extends Region > {
polygon.addEdge( newEdge );
if ( newEdge.isZero() ) {
throw new IllegalStateException( "Zero during last pop!" );
}
toSort.add( last.getOrigin() );
toSort.add( popped.getOrigin() );
}
@@ -2937,10 +2565,6 @@ public class Mesh< T extends Region > {
poly.addEdge( temp );
} while ( scanned.add( temp = temp.getNext() ) );
if ( poly.getVertices().size() != poly.getEdges().size() ) {
throw new IllegalStateException( "Polygon has inconsistent edges/vertices! " + poly.getVertices().size() + "/" + poly.getEdges().size() );
}
if ( poly.getVertices().size() != 3 ) {
throw new IllegalStateException( "Not a triangle! " + poly.getVertices().size() );
}

View File

@@ -180,7 +180,7 @@ public class MeshingTest2 extends JPanel {
private static void test( final Collection< Plane > planes ) {
final long processAllStart = System.currentTimeMillis();
planes.stream().forEach( plane -> {
planes.parallelStream().forEach( plane -> {
try {
Mesh< RegionSimple > mesh = new Mesh< RegionSimple >( () -> { return new RegionSimple( GluWindingRule.ODD ); } );
@@ -190,7 +190,7 @@ public class MeshingTest2 extends JPanel {
long start = System.currentTimeMillis();
mesh.simplify();
mesh.generateRegions();
final Collection< EdgePolygon > polys = mesh.copyOf().mesh( false );
final Collection< EdgePolygon > polys = mesh.copyOf().mesh();
long end = System.currentTimeMillis();
System.out.println( plane.polygons.size() + " to " + polys.size() + ":\t " + ( end - start ) + "ms" );
} catch ( IllegalStateException e ) {
@@ -268,12 +268,12 @@ public class MeshingTest2 extends JPanel {
Collection< EdgePolygon > polys;
try {
polys = mesh.mesh( false );
polys = mesh.mesh();
chains = mesh.chains;
} catch ( IllegalStateException e ) {
e.printStackTrace();
polys = mesh.mesh( true );
polys = mesh.mesh( );
chains = mesh.chains;
}
@@ -414,14 +414,14 @@ public class MeshingTest2 extends JPanel {
mesh.generateRegions();
try {
final Collection< EdgePolygon > polys = mesh.mesh( false );
final Collection< EdgePolygon > polys = mesh.mesh();
chains = mesh.chains;
return polys;
} catch ( Exception e ) {
e.printStackTrace();
}
final Collection< EdgePolygon > polys = mesh.mesh( true );
final Collection< EdgePolygon > polys = mesh.mesh();
chains = mesh.chains;
return polys;