Posted May 19, 201213 yr This is more of a math question than a modding question. It is for my ICBM mod and I can't really figure it out. I am given point A and B. A missile is to be shot from point A to B. What would the trajectory (rotationPitch) of the missile be in angles? Also, what direction (rotationYaw) will the missile shoot in angles? I tried using Tangent but it didn't really work properly. I looked at the EntityArrow class as a reference but they already had the rotationYaw and rotationPitch as known variables (they get the variables from the entity player's rotation). LaunchYaw will be the direction of the missile the missile being shot. LaunchPitch will be the trajectory of the missile. this.setLocationAndAngles(position.x, position.y, position.z, launchYaw, launchPitch); I am guessing the solution would be related to sine cosine, tangent functions. Since I know the two points, I know the distance between the two points. http://calclavia.com/uploads/banner.png[/img]
May 19, 201213 yr having done some quick research anything luanched into suborbit is at roughly a 78 degree angle, looking at some pictures of test missle impacts the return angle is about 45 degrees-90 degrees suborbit is about 160–2,000 km (100–1,240 miles) above the Earth's surface the entre speed and reentry speed is about 7 km/s(entry) 4km/s (reentry) hope this helps
May 19, 201213 yr Author having done some quick research anything luanched into suborbit is at roughly a 78 degree angle, looking at some pictures of test missle impacts the return angle is about 45 degrees-90 degrees suborbit is about 160–2,000 km (100–1,240 miles) above the Earth's surface the entre speed and reentry speed is about 7 km/s(entry) 4km/s (reentry) hope this helps Sorry but that's not what I was looking for. I posted a image of what I'm trying to get above. http://calclavia.com/uploads/banner.png[/img]
May 19, 201213 yr You want the bearing of the rocket? If so, that's equivalent to tan-1(distance between source and where you put the angle 0 text on that image/distance between target and source). See this image: Point B is your destination, point A is your source and point C is required to work out the length of line b, which goes into the tan function.
May 19, 201213 yr Author You want the bearing of the rocket? If so, that's equivalent to tan-1(distance between source and where you put the angle 0 text on that image/distance between target and source). See this image: Point B is your destination, point A is your source and point C is required to work out the length of line b, which goes into the tan function. Yes, I want to find the bearing of the rocket. Good solution, but I do not know the point C and also the line B. How would I calculate to find that? Point C is required in order for me to use tangent. http://calclavia.com/uploads/banner.png[/img]
May 19, 201213 yr Point C is simply the point where your lines intersect at right angles on the 0-degree line. Therefore point C has the same X value as A and same Y as B. For an example calculation, let point A be of co-ordinate (1,2) and point B be co-ordinate (4,5) This means point C has co-ordinates (1,5). Next, we get line b and c. b=sqrt((4-1)^2+(5-2)^2)=4.24264069 c=sqrt((1-1)^2+(5-2)^2)=3 . Next, we plug this into Tan^-1 to get Angle=Tan^-1(3/4.24264069)=35.26 degrees, or 0.6154797 radians.
May 19, 201213 yr Author This is all GCSE-level trigononmetry, BTW. Sorry, but I am only in junior high school. If I am not as good as you in math, I will not be surprised. But anyway, thanks for the reply. I feel stupid I didn't thought of that solution. I was trying to think too hard when it's something really simple. Thanks. http://calclavia.com/uploads/banner.png[/img]
May 19, 201213 yr This is all GCSE-level trigononmetry, BTW. Sorry, I just got in high school. You'll be a couple steps ahead then
May 19, 201213 yr This is all GCSE-level trigononmetry, BTW. Sorry, I just got in high school. You'll be a couple steps ahead then I would argue that you can't really make assumptions based on age/education. In my high school you learn basic trig in geometry, and then real trig is entirely optional. I accidentally the everything then NullPointerException.
May 19, 201213 yr This is all GCSE-level trigononmetry, BTW. Sorry, I just got in high school. You'll be a couple steps ahead then I would argue that you can't really make assumptions based on age/education. In my high school you learn basic trig in geometry, and then real trig is entirely optional. No assumptions were made. What are you on about? SoHCaHToA *is* basic trig...
May 20, 201213 yr This is all GCSE-level trigononmetry, BTW. Sorry, but I am only in junior high school. If I am not as good as you in math, I will not be surprised. But anyway, thanks for the reply. I feel stupid I didn't thought of that solution. I was trying to think too hard when it's something really simple. Thanks. Wow... Glad to find a kindred spirit! So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
May 20, 201213 yr This is all GCSE-level trigononmetry, BTW. Sorry, but I am only in junior high school. If I am not as good as you in math, I will not be surprised. But anyway, thanks for the reply. I feel stupid I didn't thought of that solution. I was trying to think too hard when it's something really simple. Thanks. Wow... Glad to find a kindred spirit! You need to take gravity into account here. A missile usually goes into suborbit, but if you are just firing it over a *short* distance, then you should be able to make a parabolic path... I have no idea how to do it (Algebra II is not helping here), but google knows... So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
May 20, 201213 yr Author I figured out a solution for my problem but the result is completely different from this. I simply used the atan2() java function to get the radians and convert it into a angle. http://calclavia.com/uploads/banner.png[/img]
May 20, 201213 yr I figured out a solution for my problem but the result is completely different from this. I simply used the atan2() java function to get the radians and convert it into a angle. That works! Glad you solved your problem! So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
May 20, 201213 yr I figured out a solution for my problem but the result is completely different from this. I simply used the atan2() java function to get the radians and convert it into a angle. The answer is not completely different. atan = tan^-1
May 21, 201213 yr Author I haven't learn this in school yet. But can you please tell me the difference between atan and atan2 functions in Java? Atan2 seems to work an atan does not work. http://calclavia.com/uploads/banner.png[/img]
May 21, 201213 yr I haven't learn this in school yet. But can you please tell me the difference between atan and atan2 functions in Java? Atan2 seems to work an atan does not work. Just play around with the console. The atan function may be using radians as it's primary in/out, so a value above 2pi may not work or be wonked out. So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
May 21, 201213 yr I haven't learn this in school yet. But can you please tell me the difference between atan and atan2 functions in Java? Atan2 seems to work an atan does not work. Just play around with the console. The atan function may be using radians as it's primary in/out, so a value above 2pi may not work or be wonked out. This, but also see http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#atan2%28double,%20double%29
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.