Grid references and distance.

DontTouchTheClock
New member
 
Posts: 7
Joined: Sun Apr 17, 2016 17:53

Grid references and distance.

by DontTouchTheClock » Mon Apr 18, 2016 17:51

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 lurk, I learn, I lack.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Grid references and distance.

by Krock » Tue Apr 19, 2016 11:24

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.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Grid references and distance.

by azekill_DIABLO » Tue Apr 19, 2016 16:54

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*
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Grid references and distance.

by sofar » Tue Apr 19, 2016 18:11

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).
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Grid references and distance.

by sofar » Tue Apr 19, 2016 18:31

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.
 

DontTouchTheClock
New member
 
Posts: 7
Joined: Sun Apr 17, 2016 17:53

Re: Grid references and distance.

by DontTouchTheClock » Tue Apr 19, 2016 20:38

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.
I lurk, I learn, I lack.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron