summaryrefslogtreecommitdiff
path: root/ws2015/eip/blaetter/06/Test.java
blob: c8232a29462a35f5b06416bb2e3130959cacdde2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gameoflifetest.GraphicsWindow;

class Test {
    public static void main (String[] args)
    {
	GraphicsWindow gw = new GraphicsWindow();

        Position[] points = { new Position(10, 10)
			      , new Position(20, 10)
			      , new Position(30, 10)
			      , new Position(30, 20)
			      , new Position(20, 20)
			      , new Position(10, 20)
	};

	Polygon p = new Polygon(points);

	p.zeichneDich(gw);
	gw.mouseClick();

	p = p.translate(10, 10);
	gw.clear();
	p.zeichneDich(gw);
	gw.mouseClick();

	p = p.erweitere(new Position(5, 20));
	gw.clear();
	p.zeichneDich(gw);
	gw.mouseClick();

	p = p.reduziere(2);
	gw.clear();
	p.zeichneDich(gw);
	gw.mouseClick();

	System.out.format("%.2f\n", p.berechneFlaeche());
	
	System.exit(0);
    }
}