0 Daumen
320 Aufrufe

Ich habe 2 Geraden

g = punkt1 + (punkt2-punkt1) * faktor1

h = punkt3 + (punkt4-punkt3) * faktor2

und setze diese gleich. 

punkt1 + (punkt2-punkt1) * faktor1 = punkt3 + (punkt4-punkt3) * faktor2

Dabei entsteht die 1. Gleichung

punkt1.x + (punkt2.x-punkt1.x) * faktor1.x = punkt3.x + (punkt4.x-punkt3.x) * faktor2               | - punkt1.x 

(punkt2.x-punkt1.x) * faktor1.x = punkt3.x + (punkt4.x-punkt3.x) * faktor2 - punkt1.x                | / (punkt2.x-punkt1.x)

faktor1 = (punkt3.x + (punkt4.x-punkt3.x) * faktor2 - punkt1.x) / (punkt2.x-punkt1.x)

Diesen kann ich dann in die 2. Gleichung 

punkt1.y + (punkt2.y-punkt1.y) * faktor1 = punkt3.y + (punkt4.y-punkt3.y) * faktor2

einsetzen

punkt1.y + (punkt2.y-punkt1.y) * (punkt3.x + (punkt4.x-punkt3.x) * faktor2 - punkt1.x) / (punkt2.x-punkt1.x) = punkt3.y + (punkt4.y-punkt3.y) * faktor2

Aufgelöst werden muss nun nach faktor2 = ......

Ich komme mit den ganzen Klammern durcheinander, bzw. der Term wird riesig unüberschaubar :S

Avatar von

Hat zwar nichts mit deiner Frage zu tun, aber vielleicht hilft dir das TeX-Tool weiter: https://www.matheretter.de/rechner/latex .

(Damit kann man mathematische Formeln schreiben.)

3 Antworten

0 Daumen
Die Klammern werden zum Teil überflüssig, wenn man im konkreten Falle Zwischenergebnisse gleich ausrechnet. Dann würde zum Beispiel aus:

punkt1.x + (punkt2.x-punkt1.x) * faktor1 = punkt3.x + (punkt4.x-punkt3.x) * faktor2    

      3        +    (      5    -   3   )   ·     k            =     8        +   (   6       -        8        )  · m

oder 3 + 2k = 8 - 2m.

Da du das Ganze nur theoretisch und nicht konkret schilderst, kann ich nichts Genaueres schreiben.

Avatar von

Tut mir leid, das Ganze muss variabel bleiben da ich das Ganze programmiere und dieser Algorithmus für Polygone anwendbar sein soll. Deswegen muss ich die Werte beibehalten und an faktor2 rankommen :)

0 Daumen

vielleicht noch vor dem Einsetzen etwas umformen die 2. Gleichung

und bedenke p2.x-p1.x ungleich 0.

p1.y - p3.y  + f1 * (p2.y - p1.y ) = f2 * ( p4.y - p3.y )

dann einsetzen rot !

p1.y - p3.y  +( (p3.x-p1.x)+ f2(p4.x - p3.x )) / ( p2.x-p1.x)  * (p2.y - p1.y ) = f2 * ( p4.y - p3.y )

mit ( p2.x-p1.x) malnehmen gibt


(p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)+ f2(p4.x - p3.x ))  * (p2.y - p1.y ) = f2 * ( p4.y - p3.y )* ( p2.x-p1.x)

Die rote Klammer auflösen:


(p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)  * (p2.y - p1.y ) + f2(p4.x - p3.x ) * (p2.y - p1.y ) = f2 * ( p4.y - p3.y )* ( p2.x-p1.x)

Dann alles mit f2 auf eine Seite:


(p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)  * (p2.y - p1.y )= f2 * ( p4.y - p3.y )* ( p2.x-p1.x) -
  f2(p4.x - p3.x ) * (p2.y - p1.y )

rechts f2 ausklammern:

(p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)  * (p2.y - p1.y )= f2 * ( ( p4.y - p3.y )* ( p2.x-p1.x) -
  (p4.x - p3.x ) * (p2.y - p1.y )
)

und durch das blaue teilen  (wenn es nicht 0 ist )

f2 = ( (p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)  * (p2.y - p1.y ) )   /

                ( ( p4.y - p3.y )* ( p2.x-p1.x) -  (p4.x - p3.x ) * (p2.y - p1.y ) )




Avatar von 288 k 🚀

Vielen Dank für diese Lösung! 

Ich hoffe du hast nur 1 Klammer zu viel gesetzt, an dieser Stelle:

f2 = ( (p1.y - p3.y)* ( p2.x-p1.x)   +( (p3.x-p1.x)  * (p2.y - p1.y ) )   /

                ( ( p4.y - p3.y )* ( p2.x-p1.x) -  (p4.x - p3.x ) * (p2.y - p1.y ) )


Die allererste Klammer :) Oder ganz zum Schluss fehlt eine.

stimmt die allererste ist falsch.

Vielen Dank ! :) 

Jetzt habe ich einen anwendbaren Algorithmus zur Schnittpunktberechnung für ein Polygonrätsel

0 Daumen

Hi,
ich geh mal davon aus das Du versucht hast folgendes Problem zu beschreiben, wobei \( P_x \in \mathbb{R}^2 \) ist.
$$ P_1 + \alpha (P_2 - P_1) = P_3 + \beta (P_4 - P_3)  $$
Die Lösung ergibt sich wie folgt. Mit
$$ A = \begin{pmatrix}  x_2-x_1 & x_3-x_4 \\ y_2-y_1 & y_3-y_4 \end{pmatrix} $$
$$ z = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} $$ und
$$ b = \begin{pmatrix} x_3-x_1 \\ y_3-y_1 \end{pmatrix} $$
ergibt sich folgendes Gleichungssystem.
$$ A \cdot z = b $$
Daraus folgt
$$ \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \frac{1}{\det(A)} \begin{pmatrix}  y_3-y_4 & x_4-x_3 \\ y_1-y_2 & x_2-x_1 \end{pmatrix} \cdot \begin{pmatrix} x_3-x_1 \\ y_3-y_1 \end{pmatrix} $$ und
$$  \det(A) = (x_2-x_1)(y_3-y_4)-(x_3-x_4)(y_2-y_1) $$
Also
$$ \alpha = \frac{ (y_3-y_4)(x_3-x_1)+(x_4-x_3)(y_3-y_1) }{(x_2-x_1)(y_3-y_4)-(x_3-x_4)(y_2-y_1)} $$ und
$$ \beta =  \frac{ (y_1-y_2)(x_3-x_1)+(x_2-x_1)(y_3-y_1) }{(x_2-x_1)(y_3-y_4)-(x_3-x_4)(y_2-y_1)} $$

Avatar von 39 k

Ein anderes Problem?

Stell deine Frage

Willkommen bei der Mathelounge! Stell deine Frage einfach und kostenlos

x
Made by a lovely community