- #1
FranBoltzmann
- 1
- 0
Im new to the forum, so I didnt know where to post this.
(x is cross-product, . is dot-product and * is multiplication)
Consider point P with linear velocity Pv.
Consider points A and B that define the edge AB of a square with C as center.
Consider that C has linear velocity Cv and angular velocity Cw.
Av = Cv + Cw x (A-C)
Bv = Cv + Cw x (B-C)
(Considering this is 2D, you can see Cw as (0,0,angle) and all linear velocities as (Vx,Vy,0) )
Now, let's add time as a variable.
P(t) = P(0) + Pv*t
A(t) = A(0) + Av*t
B(t) = B(0) + Bv*t
(consider velocities to be constant)
Now the fun begins:
A(t) + k*[ B(t) - A(t) ] is a point along the edge AB where 0 ≤ k ≤ 1
Which means:
A(0) + Av*t + k*[ B(0) + Bv*t - A(0) - Av*t ]
So far so good, but what happens if we want to know when P(t) intersects AB(t)?
P(0) + Pv*t = A(0) + Av*t + k*[ B(0) + Bv*t - A(0) - Av*t ]
or
A(0) + k*B(0) - k*A(0) - P(0) = t
(Pv - Av - k*Bv + k*Av)
or
P(0) + Pv*t - A(0) - Av*t = k
B(0) + Bv*t - A(0) - Av*t
Finally, I should state that all variables are known except k and t.
The objective is to know t and k that satisfy the equation BUT then discard any pair (t,k) where k doesn't satisfy 0 ≤ k ≤ 1.
Can anyone help me find a solution or better way to solve this problem? Or is this impossible?
Thanks in advance!
(x is cross-product, . is dot-product and * is multiplication)
Consider point P with linear velocity Pv.
Consider points A and B that define the edge AB of a square with C as center.
Consider that C has linear velocity Cv and angular velocity Cw.
Av = Cv + Cw x (A-C)
Bv = Cv + Cw x (B-C)
(Considering this is 2D, you can see Cw as (0,0,angle) and all linear velocities as (Vx,Vy,0) )
Now, let's add time as a variable.
P(t) = P(0) + Pv*t
A(t) = A(0) + Av*t
B(t) = B(0) + Bv*t
(consider velocities to be constant)
Now the fun begins:
A(t) + k*[ B(t) - A(t) ] is a point along the edge AB where 0 ≤ k ≤ 1
Which means:
A(0) + Av*t + k*[ B(0) + Bv*t - A(0) - Av*t ]
So far so good, but what happens if we want to know when P(t) intersects AB(t)?
P(0) + Pv*t = A(0) + Av*t + k*[ B(0) + Bv*t - A(0) - Av*t ]
or
A(0) + k*B(0) - k*A(0) - P(0) = t
(Pv - Av - k*Bv + k*Av)
or
P(0) + Pv*t - A(0) - Av*t = k
B(0) + Bv*t - A(0) - Av*t
Finally, I should state that all variables are known except k and t.
The objective is to know t and k that satisfy the equation BUT then discard any pair (t,k) where k doesn't satisfy 0 ≤ k ≤ 1.
Can anyone help me find a solution or better way to solve this problem? Or is this impossible?
Thanks in advance!