예제 #1
0
        /**
         * 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();
        }
예제 #2
0
        /**
         * Mouse press.
         * @param e the MouseEvent
         */
        public void mousePressed(MouseEvent e)
        {
            if (e.getComponent() != this)
            {
                return;
            }
            Pnt point = new Pnt(e.getX(), e.getY());

            if (debug)
            {
                Console.WriteLine("Click " + point);
            }
            dt.delaunayPlace(point);
            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();
    }