195 lines
4.3 KiB
Markdown
195 lines
4.3 KiB
Markdown
---
|
||
summary: "Würfelrotation mit Matrizen die Multipliziert werden erkläret"
|
||
---
|
||
|
||
# Rotation eines Würfels mit Matrizen
|
||
|
||
## 1. Der Würfel im Raum
|
||
|
||
Ein Würfel im Ursprung des Koordinatensystems (Mittelpunkt bei ( (0,0,0) )) und der Kantenlänge 2 besitzt die Eckpunkte:
|
||
|
||
$$
|
||
\begin{aligned}
|
||
A &= (1, 1, 1), & B &= (1, 1, -1), & C &= (1, -1, 1), \\
|
||
D &= (1, -1, -1), & E &= (-1, 1, 1), & F &= (-1, 1, -1), \\
|
||
G &= (-1, -1, 1), & H &= (-1, -1, -1)
|
||
\end{aligned}
|
||
$$
|
||
|
||
Jeder Punkt kann als Spaltenvektor dargestellt werden:
|
||
$$
|
||
\mathbf{v} =
|
||
\begin{pmatrix}
|
||
x \\
|
||
y \\
|
||
z
|
||
\end{pmatrix}.
|
||
|
||
$$
|
||
|
||
Eine Drehung des Würfels im Raum kann mathematisch durch **Multiplikation mit einer Rotationsmatrix** beschrieben werden.
|
||
|
||
---
|
||
|
||
## 2. Rotationsmatrizen im 3D-Raum
|
||
|
||
Eine Rotationsmatrix beschreibt eine Drehung um eine bestimmte Achse. Dabei bleibt die Länge der Vektoren unverändert, ebenso die Winkel zwischen ihnen.
|
||
Es gibt drei elementare Rotationen: um die **x-Achse**, die **y-Achse** und die **z-Achse**.
|
||
|
||
---
|
||
|
||
### a) Rotation um die x-Achse
|
||
|
||
$$
|
||
\mathbf{v}' = R_x(\theta)\mathbf{v} =
|
||
\begin{pmatrix}
|
||
x \\
|
||
y \cos\theta - z \sin\theta \\
|
||
y \sin\theta + z \cos\theta
|
||
\end{pmatrix}
|
||
|
||
$$
|
||
|
||
Die x-Koordinate bleibt bei dieser Drehung unverändert. Der Punkt
|
||
$$
|
||
\mathbf{v}' = R_x(\theta)\mathbf{v} =
|
||
\begin{pmatrix}
|
||
x \\
|
||
y \cos\theta - z \sin\theta \\
|
||
y \sin\theta + z \cos\theta
|
||
\end{pmatrix}
|
||
|
||
$$
|
||
|
||
---
|
||
|
||
### b) Rotation um die y-Achse
|
||
|
||
$$
|
||
R_y(\theta) =
|
||
\begin{pmatrix}
|
||
\cos\theta & 0 & \sin\theta \\
|
||
0 & 1 & 0 \\
|
||
-\sin\theta & 0 & \cos\theta
|
||
\end{pmatrix}
|
||
$$
|
||
|
||
Dabei bleibt die y-Koordinate gleich, x und z verändern sich.
|
||
|
||
$$
|
||
\mathbf{v}' = R_y(\theta)\mathbf{v} =
|
||
\begin{pmatrix}
|
||
x \cos\theta + z \sin\theta \\
|
||
y \\
|
||
- x \sin\theta + z \cos\theta
|
||
\end{pmatrix}
|
||
$$
|
||
|
||
---
|
||
|
||
### c) Rotation um die z-Achse
|
||
|
||
$$
|
||
R_z(\theta) =
|
||
\begin{pmatrix}
|
||
\cos\theta & -\sin\theta & 0 \\
|
||
\sin\theta & \cos\theta & 0 \\
|
||
0 & 0 & 1
|
||
\end{pmatrix}
|
||
$$
|
||
|
||
Hier bleibt z unverändert, während x und y rotieren.
|
||
|
||
$$
|
||
\mathbf{v}' = R_z(\theta)\mathbf{v} =
|
||
\begin{pmatrix}
|
||
x \cos\theta - y \sin\theta \\
|
||
x \sin\theta + y \cos\theta \\
|
||
z
|
||
\end{pmatrix}
|
||
$$
|
||
|
||
---
|
||
|
||
## 3. Kombination mehrerer Rotationen
|
||
|
||
Oft wird ein Objekt nacheinander um mehrere Achsen gedreht.
|
||
Die Gesamtrotation ergibt sich durch **Multiplikation der einzelnen Rotationsmatrizen**.
|
||
|
||
Beispiel:
|
||
$$
|
||
R_{\text{gesamt}} = R_x(\alpha) \cdot R_y(\beta) \cdot R_z(\gamma).
|
||
$$
|
||
Ein Punkt $v$ wird dann abgebildet auf:
|
||
$$
|
||
\mathbf{v}' = R_{\text{gesamt}}\mathbf{v}.
|
||
$$
|
||
|
||
Die Reihenfolge ist dabei wesentlich, da die Matrixmultiplikation **nicht kommutativ** ist:
|
||
$$
|
||
R_x R_y \neq R_y R_x.
|
||
$$
|
||
|
||
Das bedeutet: Zuerst um die x-Achse und danach um die y-Achse zu drehen führt zu einem anderen Ergebnis, als die Reihenfolge umzukehren.
|
||
|
||
---
|
||
|
||
## 4. Matrixmultiplikation
|
||
|
||
Die Multiplikation zweier Matrizen (A) und (B) (jeweils 3×3) ergibt eine neue Matrix (C = A \cdot B) mit den Einträgen:
|
||
$$
|
||
c_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + a_{i3}b_{3j}.
|
||
$$
|
||
|
||
Allgemein gilt:
|
||
|
||
* Jede Zeile von (A) wird mit jeder Spalte von (B) multipliziert.
|
||
* Die Summe dieser Produkte ergibt das jeweilige Element von (C).
|
||
|
||
So kann man Schritt für Schritt die Gesamtrotationsmatrix berechnen.
|
||
|
||
---
|
||
|
||
## 5. Beispiel für ($\theta = 45^\circ$)
|
||
|
||
Für den Winkel $\theta = 45^\circ = \frac{\pi}{4}$ gilt:
|
||
$$
|
||
\cos\theta = \sin\theta = \frac{\sqrt{2}}{2}.
|
||
$$
|
||
|
||
Damit lautet die Rotationsmatrix um die x-Achse:
|
||
$$
|
||
R_x(45^\circ) =
|
||
\begin{pmatrix}
|
||
1 & 0 & 0 \\
|
||
0 & \tfrac{\sqrt{2}}{2} & -\tfrac{\sqrt{2}}{2} \\
|
||
0 & \tfrac{\sqrt{2}}{2} & \tfrac{\sqrt{2}}{2}
|
||
\end{pmatrix}
|
||
$$
|
||
|
||
Wendet man diese Matrix auf den Punkt $\mathbf{A} = (1, 1, 1)$ an, ergibt sich:
|
||
$$
|
||
\begin{aligned}
|
||
x' &= 1, \\
|
||
y' &= 1 \cdot \tfrac{\sqrt{2}}{2} - 1 \cdot \tfrac{\sqrt{2}}{2} = 0, \\
|
||
z' &= 1 \cdot \tfrac{\sqrt{2}}{2} + 1 \cdot \tfrac{\sqrt{2}}{2} = \sqrt{2}.
|
||
\end{aligned}
|
||
|
||
$$
|
||
|
||
Der neue Punkt ist also:
|
||
$$
|
||
\mathbf{A}' = (1, 0, \sqrt{2}).
|
||
$$
|
||
Der Punkt wurde damit um die x-Achse um 45° gedreht.
|
||
|
||
---
|
||
|
||
## 6. Zusammenfassung
|
||
|
||
* Eine **Rotationsmatrix** beschreibt eine Drehung im Raum.
|
||
* Die Länge eines Vektors bleibt bei der Rotation unverändert.
|
||
* Es gibt drei Grundmatrizen: $R_x(\theta)$, $R_y(\theta)$ und $R_z(\theta)$.
|
||
* Durch **Multiplikation** kann man mehrere Drehungen kombinieren.
|
||
* Die Reihenfolge der Rotationen ist **nicht vertauschbar**.
|
||
* Bei $45^\circ$ erscheinen häufig die Werte $\frac{\sqrt{2}}{2}$ und $\frac{1}{2}$. |