I am working on javascript code where I need to find out distance on the basis of Angle, Initial Height, Velocity, Maximum Range.
Example: If an object shoots from the ground (where height = 0) at the angle 45 degree and with the velocity of 3000. The Object drops at distance 1500 meter far from the point where it was thrown.
What will be the distance from the shooting point to dropping point on the ground, if the object shoots from same height and velocity but at the angle of 60 degree.
Initial Height => h = 0
Angle => a = 45 degree
Velocity => v = 3000
Max Range => m = 1500 meter
var h = 0;
var a = 45;
var v = 3000;
var m = 1500;
var d = null; //need to calculate this
// Range calculation formula is: d = V₀² * sin(2 * α) / g
d = v * v * Math.sin(2 * a) / 9.8;
I am getting Range from above formula but that's not on the basis of given maximum range.
The function Math.sin
expects that the angle is given in radian. Given an angle α
in degree, you can compute the angle in radian by α * (π/180)
. Thus, your computation needs to be performed as follows.
d = v * v * Math.sin(2 * a * Math.PI / 180) / 9.8;
Note, your maximum range is actually ≈920000 m. Your initial velocity is 10800 km/h (or 6710 mph), which is 10 times as fast as a commercial air plane.