Thursday, January 1, 2009

Trajectory

To make the trajectory a missle would follow (assuming no wind resistance), enter:


to fire :a :v
make "s Distance [0 0] make "t 0 make "h 0 make "l 0 make "q 0
until [ycor<0]>.001 ift [seth (arctan ycor-:l xcor-:h)]
end


Where "a" is the angle it launches at and "v" is the starting velocity. You can shoot your missle from anywhere, as long as it starts on the x-axis. The missle will also point in the direction it is shooting. I used the formulas for trajectory:

velocity times the amount of time which has passed times the sine of the the starter angle will equal the current distance forward. The velocity times the time times the cosine of the starting angle, all subtracted by time squared times gravity (which is 4.905 meters per second) will give you the current height.
I recomend putting :v at a maximum of 100, and :a at whatever you like. Negative angles are angles which point to the left instead of to the right.

No comments: