import gdi.util.*; // UEBUNG 10 Aufgabe 2 // 2-dimensionale Vektoren public class u10a2 { public static void main(String[ ] args) { Vector2D v1 = new Vector2D(1,2); Vector2D v2 = new Vector2D(2,2); Vector2D v3 = new Vector2D(2,3); Vector2D v4 = new Vector2D((float)1.33,(float)2.5); v1.addInPlace(v2); Out.println("v1: " + v1.v1 + ", " + v1.v2); // ((v1.add(v2)).add(v3)).add(v4) Vector2D v = v1.add(v2).add(v3).add(v4); Out.println("v: " + v.v1 + ", " + v.v2); // Test von normalize() v.normalize(); Out.println("v normal: " + v.v1 + ", " + v.v2); // Test von equals() if(v.equals(v1)) Out.println("Vektoren v und v1 sind gleich"); else Out.println("Vektoren v und v1 sind nicht gleich"); } }