1 package sample;
2
3 import java.awt.Color;
4
5 import fi.jyu.mit.graphics.*;
6
7
12 public class GraphicsSample {
13
14
18 public static void main(String[] args) {
19
20 EasySpace space = new EasySpace();
22 double points[][] = {
23 { 0, -2 , 1},
24 { 2, -2 , 2},
25 { 2, 0 , 3},
26 { 0, 2 , 2},
27 {-2, 0 , 1}
28 };
29
30 space.addPolygon(points).setColor(255, 0, 0);
32 space.addCircle(0, 0, 2).setColor(0, 255, 0);
33
34 space.addLine(-2.7, 2.5, 1, 1).setColor(0, 0 , 255);
35
36 space.addCircle(0, -2.5, 0.2);
37
38 double tr[][] = {{1,1},{1,2},{2,1}};
39 space.add(new FillPolygon(tr)).setColor(Color.YELLOW);
40
41 Window window = new Window();
42 window.scale(-3, -3, 3, 3);
43 space.addAxis(5, 5, 5);
45 window.setSpace(space);
47 window.showWindow();
48
49 EasyWindow w2 = new EasyWindow(400, 400);
50 w2.scale(-5, -5, 5, 5);
51
52 w2.rotate(Axis.Y, 45); w2.rotate(Axis.Z, 45);
55 w2.setSpace(space);
56 w2.showWindow();
57 w2.getPanel().setAllowRescale(false);
58
59 space.addCircle(0, 0, -3, 1).setColor(192, 52, 200);
60 }
61 }
62