QB45 Forums
Party like you didn't do in 1999.

Programming Talk - View Post
Anything related to programming under the sun

Glenn
NORMAL

Posts: 37
That's not merely trigonometry. It's a branch of physics...
Posted by Glenn, on Aug 28th, 2005
known as "kinematics." Assuming I didn't screw something up, and that your point at distance x is at the same vertical position as the launch position, your launch angle (above the horizontal plane) is

ANGLE = ARCSIN(g * x / v^2) / 2,

where v is the launch speed and g is the acceleration of gravity. (At the earth's surface, if v is in meters/second, g = 9.81 m/s^2.)

Well, maybe I should anticipate your finding out that QB doesn't have an ARCSIN function. You can work things around and use QB's ATN (ARCTAN)function. (*This* is trigonometry. :) ) Calculate the number

N = g * x / v^2

(By definition, N is the sine of an angle. We are going to find the tangent of that angle and then use ATN.) Your angle is then

ANGLE = ATN(N/SQR(1 - N^2)) / 2.

Note that, for any given v, there will be two launch angles that cause your projectile to reach the ground (or whatever the initial vertical displacement was) at horizontal distance x. One is the angle as calculated above. The other is PI/2 - ANGLE.

Back to Programming Talk


Windows should be defenestrated.
Replies:
There are no replies to this message

Post a reply:







All content copyrighted 2004, All rights reserved.