is this on the right track ?
((gd/v*cos(a)) - v*sin(a))^2 = v^2*sin(a)^2 + 2gy
A = gd/v*cos(a)
B = v*sin(a)
(A - B)(A - B)
= A^2 - AB - AB + B^2
= A^2 - 2AB + B^2
(gd/v*cos(a))^2 - 2*(gd/v*cos(a))*(v*sin(a)) + (v*sin(a))^2 = v^2*sin(a)^2 + 2*g*y
=> (gd)^2/(v*cos(a))^2 -...
given this formula for the range of a projectile when the initial height (y) is not zero:
d = (v * cos(a) / g) * (v * sin(a) + sqrt((v * sin(a))2 + 2 * g * y)
in a project I'm working on i need to compute 'v' given 'd', 'a', 'y' and 'g', so i would like to rewrite this equation in terms of 'v'...
i suppose i could also just do sin-1(Z) on the input for pitch to get theta now that i think about it..oh well. i agree it's more complex than it should be. in any case i think I'm all good now..
thanks @pmsrw3. to clarify i don't actually have theta when i calculate the launch direction, as i noted that comes from an external input as a number between 0 (no pitch) and 1 (straight up). so my givens are that and a target pos that is somewhere in front of me in the world.
i will try...
i have a target in the world somewhere in front of me. i begin by calculating a displacement vector in the XY plane (Z is up) between the position i am going to fire from and the target:
fireToTargetXY = (target_pos - fire_pos);
fireToTargetXY.Z = 0.0; // i don't really need to do this because...
ah. so i have an initial launch direction that i start with (i.e. theta is known).
well, more specifically, i have a unit vector that i start with. given that Z is up, i do this to calculate theta (pseudo code):
up_vector = vector(0,0,1);
Theta = acos(1.0 - (launch_direction dot up_vector))...
@pmsrw3: the initial velocity is being calculated as:
v = sqrt((d * g) / sin (2 * theta))
as i simply solved for v in the initial equation. is that not correct ?
@robphy: sorry, i failed to mention that Z is "up" in my 3D world, so Z is the vertical component, X and Y are horizontal...
actually, using smaller timestep increments doesn't seem to bring me closer to the target..
is d = (v2 / g) * sin(2 * theta) not what i want to be using here ?
hi there,
i'm programming a simulation of a projectile that has a known target off in the distance somewhere in my 3D world, i also know the angle at which i will be firing the projectile. i am firing the projectile on flat ground (so the start and end y-coordinates are the same).
i'm...
ok, so to summarize the results, the solution proposed by micromass worked (thanks!), but i had to negate the (xi',yi') result for any point (xi, yi) inside the larger rectangle that i transformed. i *think* this is because the coordinate system for the larger rectangle actually does have the...
that almost works :smile:
if Q in the larger rectangle is (-x,-y) however, it's coming out as (-x',-y'), which is outside the boundary of the smaller rectangle. though the values seem correct, they are just negated to the opposite (-x,-y) quadrant it looks like. maybe i set it up wrong, i...
isn't this a change of basis though? disregarding scale, i guess I'm not clear on how i could rotate the larger rectangle within the standard R2 space and end up with the coordinate system of the smaller rectangle (where positive Y is flipped to point down with positive X still pointing to the...