Zeit berechnen, wenn eine sich bewegende Kugel mit einer sich bewegenden Linie / einem sich bewegenden Polygon (2D) kollidiert
Ich habe ein Polygon und darin ist eine sich bewegende Kugel. Der Ball sollte zurückspringen, wenn er an eine Grenze stößt.
Meine aktuelle 'Lösung': Ich teile das Polygon in Linien auf und berechne, wann der Ball auf die Bewegungslinie trifft
alle Variablen:
a = length of a
b = length of b
c = length of c
ax = x position of A
ay = y position of A
bx = x position of B
by = y position of B
cx = x position of C
cy = y position of C
vax = speed of A on the x-axis
vay = speed of A on the y-axis
vbx = speed of B on the x-axis
vby = speed of B on the y-axis
vcx = speed of C on the x-axis
vcy = speed of C on the y-axis
h = height (equals r, because it collides when h is r)
r = radius
t = time (one time unit equals 1 frame. not relevant)
axc = x positon of A at the collision
ayc = y positon of A at the collision
bxc = x positon of B at the collision
byc = y positon of B at the collision
cxc = x positon of C at the collision
cyc = y positon of C at the collision
Berechnen Sie die Kollisionsposition aller Punkte:
axc:=ax+vax*t
ayc:=ay+vay*t
bxc:=bx+vbx*t
byc:=by+vby*t
cyc:=cy+vcy*t
cxc:=cx+vcx*t
Berechnen Sie die Länge aller Scheitelpunkte
a:=√((axc-cxc)^(2)+(ayc-cyc)^(2))
b:=√((bxc-cxc)^(2)+(byc-cyc)^(2))
c:=√((axc-bxc)^(2)+(ayc-byc)^(2))
Calculate h
h=((√(2*(a^(2)*b^(2)+b^(2)*a^(2)+c^(2)*a^(2))-(a^(4)+b^(4)+c^(4))))/(2*c))
Solve für t
solve(h=((√(2*(a^(2)*b^(2)+b^(2)*a^(2)+c^(2)*a^(2))-(a^(4)+b^(4)+c^(4))))/(2*c)), t)
BUUUUUT: Mein Rechner (Ti-Nspire CX CAS) stürzt ab. Und Microsoft Mathematics dauert zu lange (ich rechne gerade ... für 1 Stunde und immer noch nichts ...)
So ... HILFE!
(Hinterfragen Sie nicht meine Malfertigkeiten)