diff options
author | Leonard Kugis <leonard@kug.is> | 2022-04-25 18:36:30 +0200 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2022-04-25 18:36:30 +0200 |
commit | 84e220b332bfffb0f2dcc39b9697a6fd6691d265 (patch) | |
tree | 0b861a9a099017ffd9bf00bae12e33ed6a309bbe /src/aufgaben/b20160604 |
Diffstat (limited to 'src/aufgaben/b20160604')
-rwxr-xr-x | src/aufgaben/b20160604/Aufgabe1.java | 109 | ||||
-rwxr-xr-x | src/aufgaben/b20160604/Aufgabe2.java | 63 | ||||
-rwxr-xr-x | src/aufgaben/b20160604/Aufgabe3.java | 67 | ||||
-rwxr-xr-x | src/aufgaben/b20160604/Aufgabe4.java | 79 |
4 files changed, 318 insertions, 0 deletions
diff --git a/src/aufgaben/b20160604/Aufgabe1.java b/src/aufgaben/b20160604/Aufgabe1.java new file mode 100755 index 0000000..9574334 --- /dev/null +++ b/src/aufgaben/b20160604/Aufgabe1.java @@ -0,0 +1,109 @@ +package aufgaben.b20160604;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import function.Display;
+import function.Grade1;
+import function.Grade2;
+import function.Sin;
+import function.SquareRoot;
+import misc.Utils;
+import aufgaben.Aufgabe;
+import aufgaben.blatt2.Objekt;
+
+public class Aufgabe1 extends Aufgabe implements Runnable {
+
+ private final int width = 500, height = 500;
+ private volatile boolean done;
+ private String name;
+ private Display wasser, boot, segel;
+ private Display[] regenbogen;
+
+ public Aufgabe1() {
+ name = "BV 2 - Aufgabe 1";
+ done = false;
+ this.setSize(width, height);
+ this.setTitle(name);
+ this.addWindowListener(
+ new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.out.println("close");
+ done = true;
+ }
+ }
+ );
+ }
+
+ @Override
+ public boolean done() {
+ return done;
+ }
+
+ public void paint(Graphics g) {
+ wasser.draw(g);
+ boot.draw(g);
+ g.drawLine(250, 385, 350, 385);
+ g.drawLine(350, 385, 350, 415);
+ g.drawLine(300, 385, 300, 300);
+ segel.draw(g);
+ g.drawLine(300, 385, 330, 370);
+ g.drawOval(450, 0, 100, 100);
+ g.drawLine(400, 50, 450, 50);
+ g.drawLine(400, 60, 450, 60);
+ //ziel1 bei 475, 75
+ g.drawLine(419, 100, 457, 75);
+ g.drawLine(426, 110, 464, 85);
+ for(int i = 0; i<regenbogen.length/5; i++) {
+ g.setColor(new Color(255, i*10, 0));
+ regenbogen[i].draw(g);
+ }
+ for(int i = 0; i<regenbogen.length/5; i++) {
+ g.setColor(new Color(255-(i*10), 255, 0));
+ regenbogen[(regenbogen.length/5)+i].draw(g);
+ }
+ for(int i = 0; i<regenbogen.length/5; i++) {
+ g.setColor(new Color(0, 255, i*10));
+ regenbogen[((regenbogen.length/5)*2)+i].draw(g);
+ }
+ for(int i = 0; i<regenbogen.length/5; i++) {
+ g.setColor(new Color(0, 255-(i*10), 255));
+ regenbogen[((regenbogen.length/5)*3)+i].draw(g);
+ }
+ for(int i = 0; i<regenbogen.length/5; i++) {
+ g.setColor(new Color(i*10, 0, 255));
+ regenbogen[((regenbogen.length/5)*4)+i].draw(g);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void init() {
+ wasser = new Display(0, 400, 500, 10, 0, 7, -1, 1);
+ wasser.addFunction(new Sin(1, 10, 0, 0));
+ boot = new Display(250, 375, 100, 100, 0, 10, 0, 10);
+ boot.addFunction(new SquareRoot(1, 1, 0));
+ segel = new Display(300, 300, 100, 70, 0, 10, 0, 10);
+ segel.addFunction(new Grade2(1, 0, 0));
+ regenbogen = new Display[125];
+ for(int i = 0; i<regenbogen.length; i++) {
+ regenbogen[i] = new Display(0, 100+i, 500, 100, 0, 10, 0, 10);
+ regenbogen[i].addFunction(new Grade2(0.4, -4.0, 10.0));
+ }
+ new Thread(this).start();
+ }
+
+ @Override
+ public void run() {
+ while(!done);
+ done = false;
+ this.setVisible(false);
+ }
+
+}
diff --git a/src/aufgaben/b20160604/Aufgabe2.java b/src/aufgaben/b20160604/Aufgabe2.java new file mode 100755 index 0000000..1527727 --- /dev/null +++ b/src/aufgaben/b20160604/Aufgabe2.java @@ -0,0 +1,63 @@ +package aufgaben.b20160604;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import function.Display;
+import function.Grade1;
+import function.Grade2;
+import function.Sin;
+import function.SquareRoot;
+import misc.Utils;
+import aufgaben.Aufgabe;
+
+public class Aufgabe2 extends Aufgabe {
+
+ private final int width = 500, height = 500;
+ private boolean done;
+ private String name;
+
+ public Aufgabe2() {
+ name = "BV 2 - Aufgabe 2";
+ done = false;
+ this.setSize(width, height);
+ this.setTitle(name);
+ this.addWindowListener(
+ new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.out.println("close");
+ done = true;
+ }
+ }
+ );
+
+ }
+
+ @Override
+ public boolean done() {
+ return done;
+ }
+
+ public void paint(Graphics g) {
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(255-i, 0, i));
+ g.drawLine(100+i, 100, 100+i, 355);
+ }
+ g.setColor(new Color(0,0,0));
+ g.drawRect(100, 100, 255, 255);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void init() {
+
+ }
+
+}
diff --git a/src/aufgaben/b20160604/Aufgabe3.java b/src/aufgaben/b20160604/Aufgabe3.java new file mode 100755 index 0000000..0b5212a --- /dev/null +++ b/src/aufgaben/b20160604/Aufgabe3.java @@ -0,0 +1,67 @@ +package aufgaben.b20160604;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import function.Display;
+import function.Grade1;
+import function.Grade2;
+import function.Sin;
+import function.SquareRoot;
+import misc.Utils;
+import aufgaben.Aufgabe;
+
+public class Aufgabe3 extends Aufgabe {
+
+ private final int width = 700, height = 500;
+ private boolean done;
+ private String name;
+
+ public Aufgabe3() {
+ name = "BV 2 - Aufgabe 3";
+ done = false;
+ this.setSize(width, height);
+ this.setTitle(name);
+ this.addWindowListener(
+ new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.out.println("close");
+ done = true;
+ }
+ }
+ );
+
+ }
+
+ @Override
+ public boolean done() {
+ return done;
+ }
+
+ public void paint(Graphics g) {
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(255-i, 0, i));
+ g.drawLine(100+i, 100, 100+i, 355);
+ }
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(0, i, 255-i));
+ g.drawLine(355+i, 100, 355+i, 355);
+ }
+ g.setColor(new Color(0,0,0));
+ g.drawRect(100, 100, 510, 255);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void init() {
+
+ }
+
+}
diff --git a/src/aufgaben/b20160604/Aufgabe4.java b/src/aufgaben/b20160604/Aufgabe4.java new file mode 100755 index 0000000..4bb8dc3 --- /dev/null +++ b/src/aufgaben/b20160604/Aufgabe4.java @@ -0,0 +1,79 @@ +package aufgaben.b20160604;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import function.Display;
+import function.Grade1;
+import function.Grade2;
+import function.Sin;
+import function.SquareRoot;
+import misc.Utils;
+import aufgaben.Aufgabe;
+
+public class Aufgabe4 extends Aufgabe {
+
+ private final int width = 1475, height = 500;
+ private boolean done;
+ private String name;
+
+ public Aufgabe4() {
+ name = "BV 2 - Aufgabe 4";
+ done = false;
+ this.setSize(width, height);
+ this.setTitle(name);
+ this.addWindowListener(
+ new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.out.println("close");
+ done = true;
+ }
+ }
+ );
+
+ }
+
+ @Override
+ public boolean done() {
+ return done;
+ }
+
+ public void paint(Graphics g) {
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(255, i, 0));
+ g.drawLine(100+i, 100, 100+i, 355);
+ }
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(255-i, 255, 0));
+ g.drawLine(355+i, 100, 355+i, 355);
+ }
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(0, 255, i));
+ g.drawLine(610+i, 100, 610+i, 355);
+ }
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(0, 255-i, 255));
+ g.drawLine(865+i, 100, 865+i, 355);
+ }
+ for(int i = 0; i<255; i++) {
+ g.setColor(new Color(i, 0, 255));
+ g.drawLine(1120+i, 100, 1120+i, 355);
+ }
+ g.setColor(new Color(0,0,0));
+ g.drawRect(100, 100, 1275, 255);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void init() {
+
+ }
+
+}
|