Um den Abstand eines Punktes $P$ von einer Strecke $\overline{AB}$ im zweidimensionalen Raum zu berechnen, gehst du wie folgt vor: --- ### Gegeben: * Punkt $P = (x_0, y_0)$ * Strecke mit den Endpunkten $A = (x_1, y_1)$, $B = (x_2, y_2)$ --- ### Schritt-für-Schritt-Lösung: 1. **Vektorbildung**: * $\vec{AP} = (x_0 - x_1, y_0 - y_1)$ * $\vec{AB} = (x_2 - x_1, y_2 - y_1)$ 2. **Skalare Projektion von $\vec{AP}$ auf $\vec{AB}$**: $$ t = \frac{\vec{AP} \cdot \vec{AB}}{|\vec{AB}|^2} $$ 3. **Fallunterscheidung**: * Wenn $t < 0$: nächstgelegener Punkt ist $A$ * Wenn $t > 1$: nächstgelegener Punkt ist $B$ * Wenn $0 \leq t \leq 1$: Projektion fällt auf die Strecke, d.h. Punkt $Q = A + t \cdot \vec{AB}$ 4. **Abstandsberechnung**: * Falls $t < 0$ oder $t > 1$: Abstand = $|P - A|$ bzw. $|P - B|$ * Sonst: Abstand = $|P - Q|$ --- ### Beispiel in Formel: $$ \text{Abstand} = \begin{cases} \sqrt{(x_0 - x_1)^2 + (y_0 - y_1)^2}, & \text{wenn } t < 0 \\ \sqrt{(x_0 - x_2)^2 + (y_0 - y_2)^2}, & \text{wenn } t > 1 \\ \sqrt{(x_0 - x_q)^2 + (y_0 - y_q)^2}, & \text{sonst} \end{cases} $$ wobei: $$ x_q = x_1 + t \cdot (x_2 - x_1), \quad y_q = y_1 + t \cdot (y_2 - y_1) $$