private Graphics g; // Stored graphics context /** * Create and initialize the DT. */ public DelaunayPanel() { initialTriangle = new Simplex(new Pnt[] { new Pnt(-initialSize, -initialSize), new Pnt(initialSize, -initialSize), new Pnt(0, initialSize) }); dt = new DelaunayTriangulation(initialTriangle); }
/** * Main program; used for testing. */ public static void main(String[] args) { Simplex tri = new Simplex(new Pnt[] { new Pnt(-10, 10), new Pnt(10, 10), new Pnt(0, -10) }); Console.WriteLine("Triangle created: " + tri); DelaunayTriangulation dt = new DelaunayTriangulation(tri); Console.WriteLine("DelaunayTriangulation created: " + dt); dt.delaunayPlace(new Pnt(0, 0)); dt.delaunayPlace(new Pnt(1, 0)); dt.delaunayPlace(new Pnt(0, 1)); Console.WriteLine("After adding 3 points, the DelaunayTriangulation is a " + dt); dt.printStuff(); }
/* Events */ /** * Actions for button presses. * @param e the ActionEvent */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (debug) { Console.WriteLine(command); } if (command == "voronoi") { isVoronoi = true; } else if (command == "delaunay") { isVoronoi = false; } else if (command == "clear") { dt = new DelaunayTriangulation(initialTriangle); } repaint(); }
/** * Main program; used for testing. */ public static void main(String[] args) { Simplex tri = new Simplex(new Pnt[] {new Pnt(-10,10), new Pnt(10,10), new Pnt(0,-10)}); Console.WriteLine("Triangle created: " + tri); DelaunayTriangulation dt = new DelaunayTriangulation(tri); Console.WriteLine("DelaunayTriangulation created: " + dt); dt.delaunayPlace(new Pnt(0,0)); dt.delaunayPlace(new Pnt(1,0)); dt.delaunayPlace(new Pnt(0,1)); Console.WriteLine("After adding 3 points, the DelaunayTriangulation is a " + dt); dt.printStuff(); }
/* Events */ /** * Actions for button presses. * @param e the ActionEvent */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (debug) Console.WriteLine(command); if (command == "voronoi") isVoronoi = true; else if (command == "delaunay") isVoronoi = false; else if (command == "clear") dt = new DelaunayTriangulation(initialTriangle); repaint(); }
private Graphics g; // Stored graphics context /** * Create and initialize the DT. */ public DelaunayPanel() { initialTriangle = new Simplex(new Pnt[] { new Pnt(-initialSize, -initialSize), new Pnt( initialSize, -initialSize), new Pnt( 0, initialSize)}); dt = new DelaunayTriangulation(initialTriangle); }