Calculating points in 3D

Tips, tactics, and general discussion for Evochron Legacy.
Frozen Eagle
Ensign
Ensign
Posts: 12
Joined: Sat Feb 18, 2012 3:07 am

Calculating points in 3D

Post by Frozen Eagle »

I am trying to make a Java program that will calculate points so that I can jump right above cities but I am having problems with the calculation of the pitch/heading.

Basically what I am doing is jumps at 0 pitch/heading at a point (0, 0, -x) from a planet to determine how far away you need to be so that you don't burn up, and then using the center of the planet to the city and extending that line so that I don't burn up. My only problem is not always approximating the pitch/heading correctly because I am trying to get as close as possible without burning up.

Code I have so far is in the attachment.


[file]565[/file]
Image
User avatar
DaveK
Global Moderator
Global Moderator
Posts: 4161
Joined: Mon Apr 19, 2010 9:04 pm
Location: Leeds UK

Calculating points in 3D

Post by DaveK »

sounds like another cool tool! :)

At the moment I set the destination to be "above" the city and about 7mm away from the planet (as seen in the NavMap) and switch to side views and move the destination point so it is above the city in the side view as well and then switch back and jump

It works, but I really like the idea of computer assistance - slicker and quicker (and certainly cooler!) :D
Callsign: Incoming
Image
Life is like a sewer... what you get out of it depends on what you put into it. - Bob Newhart
Hell is being in a pure platinum asteroid field... with a diamond mining beam
ImageImage
Dhuran
Ensign
Ensign
Posts: 20
Joined: Fri Feb 03, 2012 7:30 am

Calculating points in 3D

Post by Dhuran »

You might be able to get away with direction cosines using the difference between your ship orientation and the direction vector to the point you wish to travel to.

http://en.wikipedia.org/wiki/Direction_cosine

It looks like you are calculating most of the parameters you'll need since you're starting your ship from a 0 pitch 0 heading orientation.

You'll basically take the arc cosine for each vector component (like x2-x1) divided by the total vector length to get each respective angle.

If your ship isn't starting from a 0,0,0 angle orientation you'll have to use Euler Angles.