|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#13
|
|||||
|
|||||
|
Ah, I love the lunch break. If this is correct, which I'm pretty sure it is, I'm proud to say I did it myself. if it's not, then you get what you paid for.
Given: X (desired position in horizontal direction), Y (desired position in vertical direction) Vo (firing velocity) Find: Launch Angle, A Starting with your two basic projectile motion equations: X = Vo * cos(A) * t Y = Vo * sin(A) * t - 1/2 * g * t^2 First, solve for t to eliminate it from the equation. t = x / (Vo * cos(A) ) Substituting: y = (x * Vo * sin(A)) / (Vo * cos(A)) - (g * x^2)/(2 * Vo^2 * cos^2(A)) Trig Identity: tan(A) = sin(A) / cos(A) y = (x * tan(A) ) - (g * x^2) / (2 * Vo^2 * cos^2(A)) (x * tan(A) - y ) * (2 * Vo^2 * cos^2(A)) = g * x^2 (2 * Vo^2 * x * sin(A) * cos(A)) - (2 * Vo^2 * cos^2(A) * y) = g * x^2 Simplify some more: (2 * x * sin(A) * cos(A)) - (2 * cos^2(A) * y) = (g * x^2) / (Vo^2) Fancy Trig: (x * sin(2A)) - (2 * cos^2(A) * y) = (g * x^2) / (Vo^2) Little More Fancy Trig: (x * sin(2A)) + (-y)(1+cos(2A)) = (g * x^2) / (Vo^2) Not So Fancy Math: (x * sin(2A)) + (-y * cos(2A)) = (((g * x^2) / (Vo^2)) +y) Pretty Fancy Trig Identity: (if there's a mistake, it's bad application here!) a * sin(A) + b * cos (A) = sqrt(A^2 + B^2) * sin(A + T) Where T: arctan(b/a) if a>=0; pi + arctan(b/a) if a<0 I simplified this with the common(?) matlab function atan2 which is a 'smart' arc tan function that takes the sign of the x and y components into account when returning an angle. Note, however, that since A in our case is X, it should never be negative, assuming you're aiming in front of you... Using Pretty Fancy Trig Identity Above: sqrt(x^2 + y^2) * sin(2A + atan2(-y/x)) = (((g * x^2) / (Vo^2)) +y) Finally, when you put this in terms of A: A = 1/2 * (asin( (((g * x^2) / (Vo^2)) +y) / sqrt(x^2 + y^2) ) - atan2(-y/x)) The reason I feel pretty comfortable about this, because when you set Y=0, you get your basic range equation: 2A = asin(g * X / Vo^2)) That's that! Sources: http://en.wikipedia.org/wiki/Trigonometric_identity http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html Matt |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Viewing Angle of Camera | Joe Johnson | Technical Discussion | 10 | 14-01-2005 14:11 |
| Calc. Triangle Angle or Side Based on Ellipses? | indieFan | Math and Science | 1 | 07-06-2004 21:25 |
| Serious VCU Fire | Joe Matt | Chit-Chat | 3 | 26-03-2004 19:04 |
| PBASIC ARCTAN function | Greg Ross | Programming | 14 | 11-05-2003 12:28 |
| 45 degree PVC angle fittings: which? | archiver | 2001 | 2 | 23-06-2002 22:53 |