Zum allgemeinen:
x, y, z ... sind Punkte die den Abstand vom Ursprung angeben
a ... alfa
b ... beta
c ... gama
Code: Alles auswählen
X - Rotation:
x' = x
y' = cos(a) * y - sin(a) * z
z' = sin(a) * y + cos(a) * z
Y - Rotation:
x' = cos(b) * x - sin(b) * z
y' = y
z' = sin(b) * x + cos(b) * z
Z - Rotation:
x' = cos(c) * x - sin(c) * y
y' = sin(c) * x + cos(c) * y
z' = z
Um dies allgemeinen Gleichungen in Matrizen umzuformen nimmt man jeweils die Faktoren der entsprechenden x, y, z Koordinaten:
Code: Alles auswählen
X - Rotation:
x --> x ... 1, y ... 0 , z ... 0
cos(a) * y - sin(a) * z --> x ... 0, y ... cos(a), z ... -sin(a)
sin(a) * y + cos(a) * z --> x ... 0, y ... sin(a), z ... cos(a)
Y - Rotation:
cos(b) * x - sin(b) * z --> x ... cos(b), y ... 0, z ... -sin(b)
y --> x ... 0 , y ... 1, z ... 0
sin(b) * x + cos(b) * z --> x ... sin(b), y ... 0, z ... cos(b)
Z - Rotation:
cos(c) * x - sin(c) * y --> x ... cos(c), y ... -sin(c), z ... 0
sin(c) * x + cos(c) * y --> x ... sin(c), y ... cos(c) , z ... 0
z --> x ... 0 , y ... 0 , z ... 1
Das entspricht dann volgenden Matrizen:
Code: Alles auswählen
X - Rotation:
┌ ┐
| 1 0 0 |
| |
A = | 0 cos(a) -sin(a) |
| |
| 0 sin(a) cos(a) |
└ ┘
Y - Rotation:
┌ ┐
| cos(b) 0 -sin(b) |
| |
B = | 0 1 0 |
| |
| sin(b) 0 cos(b) |
└ ┘
Z - Rotation:
┌ ┐
| cos(c) -sin(c) 0 |
| |
C = | sin(c) cos(c) 0 |
| |
| 0 0 1 |
└ ┘
(Man könnte hier eigendlich noch
Code: Alles auswählen
┌ ┐
| x |
| |
* | y |
| |
| z |
└ ┘
Um aus diesen Matrizen eine zu machen rechnen wir einfach A * B * C
-> ps. achtung es dürfen bei Matrizen nie die Factoren vertauscht werden weil hier das Kommuntativgesetzt (oder wie das heißt) nicht gilt!
Code: Alles auswählen
┌ ┐
| cos(b) * cos(c) -cos(b) * sin(c) -sin(b) |
| |
A * B * C = | -sin(x) * sin(y) * cos(z) + cos(x) * sin(z) sin(x) * sin(y) * sin(z) + cos(x) * cos(z) -sin(a) * cos(b) |
| |
| cos(x) * sin(y) * cos(z) + sin(x) * sin(z) -cos(x) * sin(y) * sin(z) + sin(x) * cos(z) cos(a) * cos(b) |
└ ┘
Das "Ergebnis" wird jetzt wieder
Code: Alles auswählen
┌ ┐
| x |
| |
* | y |
| |
| z |
└ ┘
Code: Alles auswählen
x' = x * ( cos(y) * cos(z) ) +
y * ( -cos(y) * sin(z) ) +
z * ( -sin(y) )
y' = x * ( -sin(x) * sin(y) * cos(z) + cos(x) * sin(z) ) +
y * ( sin(x) * sin(y) * sin(z) + cos(x) * cos(z) ) +
z * ( -sin(x) * cos(y) );
z' = x * ( cos(x) * sin(y) * cos(z) + sin(x) * sin(z) ) +
y * ( -cos(x) * sin(y) * sin(z) + sin(x) * cos(z) ) +
z * ( cos(x) * cos(y) )
Also wenns noch Fragen gibt, vil. kann ich sie beantworten...
Man glaubt garnicht wie schwer es ist Matrizen zu posten...
Andreas