Ich steh grad auf dem Schlauch



  • Hi,
    ich sitze gerade an den Infohausaufgaben und, peinlich, ich kriegs nicht hin.
    Und zwar finde ich den Fehler hier nicht(erläutere ich gleich)

    System.out.println(x1 + "|" + y1 + "|" + x2 + "|" + y2 + "|" + x3 + "|" + y3);
    
              System.out.println(Math.sqrt(x2*x2 + y2*y2));
              System.out.println(Math.sin(Math.toRadians(angle)));
    
              //drehe
              x1 = (int)(Math.sqrt(x1*x1 + y1*y1) * Math.cos(Math.toRadians(angle)));
              x2 = (int)(Math.sqrt(x2*x2 + y2*y2) * Math.cos(Math.toRadians(angle)));
              x3 = (int)(Math.sqrt(x3*x3 + y3*y3) * Math.cos(Math.toRadians(angle)));
              y1 = (int)(Math.sqrt(x1*x1 + y1*y1) * Math.sin(Math.toRadians(angle)));
              y2 = (int)(Math.sqrt(x2*x2 + y2*y2) * Math.sin(Math.toRadians(angle)));
              y3 = (int)(Math.sqrt(x3*x3 + y3*y3) * Math.sin(Math.toRadians(angle)));
    
              System.out.println(x1 + "|" + y1 + "|" + x2 + "|" + y2 + "|" + x3 + "|" + y3);
    

    Das ist der Code.
    Die Ausgabe ist nun folgende

    0|0|50|100|100|0
    111.80339887498948
    1.0
    0|0|0|100|0|0

    Mein Problem ist, dass y2 am Ende 111 sein sollte und nicht 100.
    Meines Erachtens ist 111.8*1 nämlich nicht 100, daher wollte ich wissen, wo mein Fehler liegt?

    edit: habs gefunden x.x


Anmelden zum Antworten