Page 1 of 1

Grid references and distance.

PostPosted: Mon Apr 18, 2016 17:51
by DontTouchTheClock
If anyone has watched Star-Trek, they may know of the bearing system used. IF not:
Azimuth is for "horizontal bearing" (x,z)
Elevation is for "vertical bearing" (y)
Thus if a player is at (7,8,9) and heads for a (45*,45*) bearing for 1.414, they will reach (8,9,10).

My question is this, if I am at (9,6,5) how would I get to (3,3,3)?

Also, how would I find the result location from Azimuth, Elevation and Distance?

Re: Grid references and distance.

PostPosted: Tue Apr 19, 2016 11:24
by Krock
To your first question:
This can be solved with circle functions. You have a coordinate delta X of 9 - 3 = 6 and Z of 5 - 3 = 2.
arctan(6 / 2) = 71.56° horizontal with a length of -sqrt(6^2 + 2^2) = -6.324 (either this negative or the arc + 180 for the opposite direction)
When you travel this previously calculated distance you also move along the Y axis by 6 - 3 = 3
arctan(3 / 6.324) = 25.68° vertical with a total travelled length of -sqrt(3^2 + 6.324^2) = -7

Please correct me if this is a complete bullshit. I actually never calculated arcs in the three dimensional rooms.

Re: Grid references and distance.

PostPosted: Tue Apr 19, 2016 16:54
by azekill_DIABLO
Krock wrote:To your first question:
This can be solved with circle functions. You have a coordinate delta X of 9 - 3 = 6 and Z of 5 - 3 = 2.
arctan(6 / 2) = 71.56° horizontal with a length of -sqrt(6^2 + 2^2) = -6.324 (either this negative or the arc + 180 for the opposite direction)
When you travel this previously calculated distance you also move along the Y axis by 6 - 3 = 3
arctan(3 / 6.324) = 25.68° vertical with a total travelled length of -sqrt(3^2 + 6.324^2) = -7

Please correct me if this is a complete bullshit. I actually never calculated arcs in the three dimensional rooms.


*brain cooking*

Re: Grid references and distance.

PostPosted: Tue Apr 19, 2016 18:11
by sofar
Thus if a player is at (7,8,9) and heads for a (45*,45*) bearing for 1.414, they will reach (8,9,10).


This is incorrect. You will not reach (8,9,10) with that angle. You will need to head at an angle of (45, 35.264) to reach (8,9,10).

You can visualize this by first heading (0,45) which reaches (8,9,9), and if you head (90,45) you will reach (7,9,10). Now draw a sphere centered at (7,8,9) and intersect it with the (1,1,1) cube that is between (7,8,9) and (8,9,10), and you'll see that at the top surface of the cube, the sphere and the cube do not intersect at (8,9,10).

Re: Grid references and distance.

PostPosted: Tue Apr 19, 2016 18:31
by sofar
DontTouchTheClock wrote:If anyone has watched Star-Trek, they may know of the bearing system used. IF not:
Azimuth is for "horizontal bearing" (x,z)
Elevation is for "vertical bearing" (y)
Thus if a player is at (7,8,9) and heads for a (45*,45*) bearing for 1.414, they will reach (8,9,10).

My question is this, if I am at (9,6,5) how would I get to (3,3,3)?

Also, how would I find the result location from Azimuth, Elevation and Distance?


I like to break these type of problems down into simple geometry.

cos a = opposite / hypotenuse
sin a = adjacent / hypotenuse
tan a = opposite / adjacent

for the length of the opposite I usually pick the vertical: 6 - 3 = -3

to get the length of the horizontal we use pythagoras: sqrt((9 - 3)^2 + (5 - 3)^2) = sqrt(40) = 6.325

now we can establish the vertical bearing angle: tan V = -3 / 6.325 -> V = -129.4 (which is the inverse direction of 39 degrees up/right, so it's down and left)

The horizontal angle is a bit easier, since the sides length doesn't require two steps to calculate.

The horizontal sides are (9-3) and (5-3) long. So the vector is -6, 0, -2. tan V = -2 / -6 -> V = 18.43.

Of course we're in the 3rd quadrant so the actual heading is 180+18.43 = 198.43.

DISCLAIMER: this was entirely off the top off my head. May contain errors.

Re: Grid references and distance.

PostPosted: Tue Apr 19, 2016 20:38
by DontTouchTheClock
To make more sense, I will use some more terminology;
I was travelling in an increase of one cube. Lets say +X is the galactic "north". +Y is galactic "up". +Z is galactic "east".
So to travel one cube east and north, I travel for 45°, as you have stated.
This is a calculation of Z to X, relevance of galactic north to Azimuth.
From my origin (7,8,9) it will move me to (8, 8, 10).

Now since there is no need to calculate what plane Y corresponds with, since elevation is a pure calculation of Y from X. Thus like the first example, we can ignore the unneeded coordinate[Z] and arrive at 45°. (8, 9, 9)

I am not saying I am going to be right, I am stating how-much of a simpleton I can be. The most training I have this subject is some map-reading and the use of a compass, thus I did this without a calculator.