/** * Will do a warmup run to let the JVM optimize the triangulation code */ public static void warmup() { /* * After a method is run 10000 times, the Hotspot compiler will compile * it into native code. Periodically, the Hotspot compiler may recompile * the method. After an unspecified amount of time, then the compilation * system should become quiet. */ Polygon poly = PolygonGenerator.RandomCircleSweep2( 50, 50000 ); TriangulationProcess process = new TriangulationProcess(); process.triangulate( poly ); } }
/** * Triangulate a Polygon * * @param ps */ public void triangulate( Polygon polygon ) { _triangulations.clear(); _triangulations.add( polygon ); start(); }
private void start() { if( _thread == null || _thread.getState() == State.TERMINATED ) { _isTerminated = false; _thread = new Thread( this, _algorithm.name() + "." + _tcx.getTriangulationMode() ); _thread.start(); sendEvent( TriangulationProcessEvent.Started ); } else { // Triangulation already running. Terminate it so we can start a new shutdown(); _restart = true; } }
public void shutdown() { _awaitingTermination = true; _tcx.terminateTriangulation(); resume(); }
/** * Triangulate a PointSet with eventual constraints * * @param cps */ public void triangulate( PointSet ps ) { _triangulations.clear(); _triangulations.add( ps ); start(); }
/** * Triangulate a PointSet with eventual constraints * * @param cps */ public void triangulate( ConstrainedPointSet cps ) { _triangulations.clear(); _triangulations.add( cps ); start(); }
/** * Triangulate a List of Triangulatables * * @param ps */ public void triangulate( List<Triangulatable> list ) { _triangulations.clear(); _triangulations.addAll( list ); start(); }
/** * Triangulate a PolygonSet * * @param ps */ public void triangulate( PolygonSet ps ) { _triangulations.clear(); _triangulations.addAll( ps.getPolygons() ); start(); }