6
votes

I'm trying to figure out some calculations using arcs in 3d space but am a bit lost. Lets say that I want to animate an arc in 3d space to connect 2 x,y,z coordinates (both coordinates have a z value of 0, and are just points on a plane). I'm controlling the arc by sending it a starting x,y,z position, a rotation, a velocity, and a gravity value. If I know both the x,y,z coordinates that need to be connected, is there a way to calculate what the necessary rotation, velocity, and gravity values to connect it from the starting x,y,z coordinate to the ending one?

Thanks.

EDIT: Thanks tom10. To clarify, I'm making "arcs" by creating a parabola with particles. I'm trying to figure out how to ( by starting a parabola formed by a series particles with an beginning x,y,z,velocity,rotation,and gravity) determine where it will in end(the last x,y,z coordinates). So if it if these are the two coordinates that need to be connected:

x1=240;
y1=140;
z1=0;

x2=300;
y2=200;
z2=0;

how can the rotation, velocity, and gravity of this parabola be calculated using only these variables start the formation of the parabola:

x1=240;
y1=140;
z1=0;
rotation;
velocity;
gravity;

I am trying to keep the angle a constant value.

2
Sounds like a physics problem having nothing to do with programming. Also, btw, by "arc" it's generally meant a portion of a circle, but frictionless trajectories with gravity generally give parabolas. Which are you looking for? So my suggestion is to clarify the question a bit and connect to programming. - tom10
Given two points on a plane, an infinite number of arcs will intersect the two points. There are two for every circle on the plane with a diameter greater than or equal to the distance between the points, and you can rotate each of those circles to any angle about a line through the two points. - Jerry Coffin
Is your gravitation along y or z axis? If it is y, then z can be completely ignored. - msell
@msell, my gravitational force is currently being applied to my x and y coordinates. - minimalpop
If gravity is acting on x and y then z will always be zero. I thought your x and y were position on the ground and z was altitude, which makes much more sense - especially with the 3d tag for this question. - phkahler

2 Answers

6
votes

This link describes the ballistic trajectory to "hit a target at range x and altitude y when fired from (0,0) and with initial velocity v the required angle(s) of launch θ", which is what you want, right? To get your variables into the right form, set the rotation angle (in the x-y plane) so you're pointing in the right direction, that is atan(y/x), and from then on out, to match the usual terminology for 2D problem, rewrite your z to y, and the horizontal distance to the target (which is sqrt(xx + yy)) as x, and then you can directly use the formula in link.

-1
votes

Do the same as you'd do in 2D. You just have to convert your figures to an affine space by rotating the axis, so one of them becomes zero; then solve and undo the rotation.