![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
|
Themen-Optionen | Ansicht |
![]() |
#1 |
Elite
![]() |
![]() kann mir wer folgendes erklären?
lgende methode liefert mir falsche ergebnisse für x/y Code:
public void rotate(double phi, int rotX, int rotY) { double cosPhi = Math.cos(phi); double sinPhi = Math.sin(phi); x= Math.round((x-rotX)*cosPhi-(y-rotY)*sinPhi)+rotX; y= Math.round((x-rotX)*sinPhi+(y-rotY)*cosPhi)+rotY; } Code:
public void rotate(double phi, int rotX, int rotY) { double cosPhi = Math.cos(phi); double sinPhi = Math.sin(phi); int x1, y1; x1= Math.round((x-rotX)*cosPhi-(y-rotY)*sinPhi)+rotX; y1= Math.round((x-rotX)*sinPhi+(y-rotY)*cosPhi)+rotY; } bin gestern etliche zeit gesessen und habs bis jetzt nicht verstanden. ein anderer fehler ist ausgeschlossen, da auf mehreren rechnern unabhängig dann ausprobiert, das x1, y1 hat dann immer den unterschied gemacht. alle rechner dagegen mit gleichem jdk. trotzdem kann ich mir das nicht erklären... [EDIT] roots, bitte löschen bin den moment draufgekommen ich öch! ![]()
____________________________________
Whoever built humanity left in a major design flaw: it was the tendency to bend at the knees. |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|