Termumformung der Vektorrechnung

Neue Frage »

azmah Auf diesen Beitrag antworten »
Termumformung der Vektorrechnung
Meine Frage:
Hallo,
ich habe eine Berechnung für einen Algorithmus, den ich programmiere. Dabei nutze ich die Vektorrechnung um die Schnittpunkte von Geraden zu berechnen. Leider stimmt mein Rechenanfang anscheinend noch nicht.

Es wäre cool, wenn jemand da mal gegenrechnen würde, da faktor1 und faktor2 bei mir sehr groß werden also zb faktor1 = 1481266 und dadurch die Prüfungen, wie die beiden Geraden liegen, natürlich fehlschlagen.

Meine Ideen:

// "x" von y = ax+b

float faktor1;
float faktor2;

/*

g = punkt1 + (punkt2-punkt1) * faktor1

h = punkt3 + (punkt4-punkt3) * faktor2

/// ------------------------------------------------------------------------------------------------------------------------

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

/// ------------------------------------------------------------------------------------------------------------------------

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)

/// ------------------------------------------------------------------------------------------------------------------------

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

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

f1 einsetzen: 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 )
| * (p2.x-p1.x)

(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)

umformen: (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)
| f auf eine Seite bringen

(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 )
| f 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 ) ) | / ( ( p4.y - p3.y )* ( p2.x-p1.x) - (p4.x - p3.x ) * (p2.y - p1.y ) )

faktor2 = ( (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 ) )

*/

faktor2 = (punkt1.Y - punkt3.Y) * (punkt2.X - punkt1.X) + ((punkt3.X - punkt1.X) * (punkt2.Y - punkt1.Y)) / ((punkt4.Y - punkt3.Y) * (punkt2.X - punkt1.X) - (punkt4.X - punkt3.X) * (punkt2.Y - punkt1.Y));
faktor1 = (punkt3.X + (punkt4.X - punkt3.X) * faktor2 - punkt1.X) / (punkt2.X - punkt1.X);
adiutor62 Auf diesen Beitrag antworten »
RE: Termumformung der Vektorrechnung
Doppelpost:
http://www.mathelounge.de/352754/komplexe-termumformung
riwe Auf diesen Beitrag antworten »
RE: Termumformung der Vektorrechnung
wozu in die Ferne schweifen Augenzwinkern
Neue Frage »
Antworten »



Verwandte Themen

Die Beliebtesten »
Die Größten »
Die Neuesten »