Distance Between Bases as the B29 Flies (Full Version)

All Forums >> [New Releases from Matrix Games] >> War in the Pacific: Admiral's Edition



Message


Uhionk -> Distance Between Bases as the B29 Flies (1/20/2016 5:08:05 PM)

Hi,

Does anyone happen to know how to calculate the distance between two bases based on the (x,y) location information?




Oberst_Klink -> RE: Distance Between Bases and the B29 Flies (1/20/2016 5:11:07 PM)

quote:

ORIGINAL: Uhionk

Hi,

Does anyone happen to know how to calculate the distance between two bases based on the (x,y) location information?

Always ask zee Oberst :)

http://www.calculatorsoup.com/calculators/geometry-plane/distance-two-points.php

Klink, Oberst




fcharton -> RE: Distance Between Bases and the B29 Flies (1/20/2016 5:28:53 PM)

If dx and dy are the horizontal and vertical distance, it should be something like

abs(dy)+max(0,abs(dx)-(abs(dy)+1)/2)

where abs is the absolute value, and rounding down any division result.

In your example, dx=164-29=135, dy=112-48=64, and the distance is 64+(135-64/2)=64+103=167

Francois





Uhionk -> RE: Distance Between Bases and the B29 Flies (1/20/2016 5:39:53 PM)

I did try looking at similar formula, but they don't seem to match.

Johnson Isle (164, 112)
Colombo (29, 48)

Formula Distance: 149
Actual: 167




Oberst_Klink -> RE: Distance Between Bases and the B29 Flies (1/20/2016 5:53:41 PM)


quote:

ORIGINAL: Uhionk

I did try looking at similar formula, but they don't seem to match.

Johnson Isle (164, 112)
Colombo (29, 48)

Formula Distance: 149
Actual: 167

francois got it...

no flaw in the formula i got though... just the distance calculation in an x/y coordinate system.

klink, oberst




Jorge_Stanbury -> RE: Distance Between Bases and the B29 Flies (1/20/2016 5:58:11 PM)

the way I do it is simply to setup an air squadron on any kind of mission, transport, bombing, recon etc.
then set destination on the target and it a message will appear that "X hexes is too far away"

of course that means that I need to have a squadron on the origin hex




Uhionk -> RE: Distance Between Bases and the B29 Flies (1/20/2016 6:18:30 PM)

Francois method worked with a slight clarification. The dx and dy are not the horizontal and vertical difference.

dx is the smaller of (Loc1x-Loc2x) or (Loc1y-Loc2y) as a positive integer
dy is the larger of the same

Jorge, no need to set a mission, simply clicking on base1 and mouseover base2 shows the distance.

Thanks everyone for the help.





Jorge_Stanbury -> RE: Distance Between Bases and the B29 Flies (1/20/2016 6:33:46 PM)

Funny I have been playing this since 2012... never realized how easy was to get ranges
thanks




witpqs -> RE: Distance Between Bases and the B29 Flies (1/20/2016 6:57:50 PM)


quote:

ORIGINAL: Jorge_Stanbury

Funny I have been playing this since 2012... never realized how easy was to get ranges
thanks

Yet another UI improvement that Michael added! [&o]




Lokasenna -> RE: Distance Between Bases and the B29 Flies (1/20/2016 8:03:43 PM)


quote:

ORIGINAL: Uhionk

Francois method worked with a slight clarification. The dx and dy are not the horizontal and vertical difference.

dx is the smaller of (Loc1x-Loc2x) or (Loc1y-Loc2y) as a positive integer
dy is the larger of the same

Jorge, no need to set a mission, simply clicking on base1 and mouseover base2 shows the distance.


Thanks everyone for the help.




This. Use this. It works for any selected hex to any other thing that you can mouse-over.

The x,y coordinate system distance-between function is fine and all... but does it actually apply to an x,y system that uses hexes? I haven't checked. I just use the mouse-over feature.




EricTaylor -> RE: Distance Between Bases and the B29 Flies (6/16/2020 10:17:19 AM)

Mathematically, if you want to determine the distance between two points on a coordinate plane, you use the distance formula. d = √(x2 - x1)^2 + (y2 - y1)^2. When you know the coordinates of the two points that you're trying to find the distance between, just substitute them into the equation.




Ian R -> RE: Distance Between Bases and the B29 Flies (6/16/2020 2:46:44 PM)


quote:

ORIGINAL: EricTaylor

Mathematically, if you want to determine the distance between two points on a coordinate plane, you use the distance formula. d = √(x2 - x1)^2 + (y2 - y1)^2. When you know the coordinates of the two points that you're trying to find the distance between, just substitute them into the equation.


Luckily, we have the mouse-over instead of ...is that Pythagoras?




geofflambert -> RE: Distance Between Bases and the B29 Flies (6/16/2020 3:36:36 PM)


quote:

ORIGINAL: Ian R


quote:

ORIGINAL: EricTaylor

Mathematically, if you want to determine the distance between two points on a coordinate plane, you use the distance formula. d = √(x2 - x1)^2 + (y2 - y1)^2. When you know the coordinates of the two points that you're trying to find the distance between, just substitute them into the equation.


Luckily, we have the mouse-over instead of ...is that Pythagoras?

Looks like lawyerese. divorce alimony = the difference between the total incomes of the first two exes minus the value of the last gift card (a square meal at Applebee's) you gave your future ex plus twice my fee why you ask? Why not?




alimentary -> RE: Distance Between Bases and the B29 Flies (6/16/2020 6:00:23 PM)

quote:

ORIGINAL: Ian R
quote:

ORIGINAL: EricTaylor
Mathematically, if you want to determine the distance between two points on a coordinate plane, you use the distance formula. d = √(x2 - x1)^2 + (y2 - y1)^2.

Luckily, we have the mouse-over instead of ...is that Pythagoras?

That is indeed the Pythagorean theorem. As Ian R tried to say, it applies if you have cartesian coordinates on a Euclidean plane.

The real pacific ocean is not a plane. AE pretends that it is. However, the really sticky bit is that AE is played on a hex grid. The coordinates look like they are Cartesian. But the AE space is not described by the Euclidean metric. It is more of a "taxicab metric" but adapted to a hex grid.

AE distances are the number of moves from hex to adjacent hex that it would take to get from hex A to hex B.

The hexes are lined up in horizontal rows. Each row has a Y coordinate. The rows are stacked with odd numbered rows half a hex farther east than even-numbered rows. This fact really throws a monkey wrench into everything unless you adopt a simple fix:

Before sticking your numbers into the formula, increment the X coordinate on all odd numbered rows by 0.5.

Now then, for generally north/south paths, the distance along the path is how many rows you've moved. Generally north/south paths are identified by the fact that the change in the X coordinate is less than or equal to half the change in Y coordinate:

So:

If |delta X| <= 0.5 * |delta Y| then distance = |delta Y|

For generally east-west paths, the distance along the path is the the change in X coordinate plus 1/2 of the change in Y coordinate.

If |delta X| >= 0.5 * |delta Y| then distance = |delta X| + 0.5 * |delta Y|

Round fractions down.

[On the diagonals where delta Y is half of delta X, both formulas naturally yield the same result]


Let's try this out on the Johnston Isle to Colombo run. (164,112) => (29,48).
Both of those are in even row numbers. So we have no X offset.
Delta X = 164 - 29 = 135
Delta Y = 112 - 48 = 64
Delta X is greater than half of Delta Y so this is a generally east-west path.
135 + 64/2 = 135 + 32 = 167

Bingo!




BBfanboy -> RE: Distance Between Bases and the B29 Flies (6/16/2020 6:28:47 PM)


quote:

ORIGINAL: Lokasenna


quote:

ORIGINAL: Uhionk

Francois method worked with a slight clarification. The dx and dy are not the horizontal and vertical difference.

dx is the smaller of (Loc1x-Loc2x) or (Loc1y-Loc2y) as a positive integer
dy is the larger of the same

Jorge, no need to set a mission, simply clicking on base1 and mouseover base2 shows the distance.


Thanks everyone for the help.




This. Use this. It works for any selected hex to any other thing that you can mouse-over.

The x,y coordinate system distance-between function is fine and all... but does it actually apply to an x,y system that uses hexes? I haven't checked. I just use the mouse-over feature.

That works "as-the-Nell-flys" but for ships you have to go around things sometimes. Just set a TF to go from origin to target hex and it will give the hex count for the actual navigation path in the endurance figures at the top left area of the TF screen.




RangerJoe -> RE: Distance Between Bases and the B29 Flies (6/16/2020 7:05:24 PM)


quote:

ORIGINAL: BBfanboy


quote:

ORIGINAL: Lokasenna


quote:

ORIGINAL: Uhionk

Francois method worked with a slight clarification. The dx and dy are not the horizontal and vertical difference.

dx is the smaller of (Loc1x-Loc2x) or (Loc1y-Loc2y) as a positive integer
dy is the larger of the same

Jorge, no need to set a mission, simply clicking on base1 and mouseover base2 shows the distance.


Thanks everyone for the help.




This. Use this. It works for any selected hex to any other thing that you can mouse-over.

The x,y coordinate system distance-between function is fine and all... but does it actually apply to an x,y system that uses hexes? I haven't checked. I just use the mouse-over feature.

That works "as-the-Nell-flys" but for ships you have to go around things sometimes. Just set a TF to go from origin to target hex and it will give the hex count for the actual navigation path in the endurance figures at the top left area of the TF screen.


Planes may also want to avoid places where there are fighters as well as radar coverage, not to mention the mark I eyeball. Then who wants to fly into a thunderstorms with tons of explosives?

Also, that formula only works if the starting point and the destination are at the same relative place in their respective hexes.




alimentary -> RE: Distance Between Bases and the B29 Flies (6/16/2020 7:25:55 PM)

quote:

ORIGINAL: RangerJoe
Planes may also want to avoid places where there are fighters as well as radar coverage, not to mention the mark I eyeball. Then who wants to fly into a thunderstorms with tons of explosives?

Also, that formula only works if the starting point and the destination are at the same relative place in their respective hexes.

In the abstraction that is AE, the notions of in-transit interception, radar coverage and thunderstorms are not contemplated. You only get detection and interception at the target hex. The transit is abstracted.

Nor are the locations of the target or of the origin airfield within their respective hexes tracked.




Chris21wen -> RE: Distance Between Bases and the B29 Flies (6/17/2020 6:41:25 AM)


quote:

ORIGINAL: Ian R


quote:

ORIGINAL: EricTaylor

Mathematically, if you want to determine the distance between two points on a coordinate plane, you use the distance formula. d = √(x2 - x1)^2 + (y2 - y1)^2. When you know the coordinates of the two points that you're trying to find the distance between, just substitute them into the equation.


Luckily, we have the mouse-over instead of ...is that Pythagoras?


Yes. I real life it's not a simple as that. It works for a flat, two dimentioanl map but not a spherical, three dimentianal one. E.g a globe. Don't ask me what the maths are for that though.




alimentary -> RE: Distance Between Bases and the B29 Flies (6/23/2020 4:27:24 PM)

quote:

ORIGINAL: Chris21wen
Yes. I real life it's not a simple as that. It works for a flat, two dimentioanl map but not a spherical, three dimentianal one. E.g a globe. Don't ask me what the maths are for that though.

If one assumes that the shape of the geoid is a perfect sphere then there is a simple technique that will suffice.

Start by thinking longitude, latitude and the radius of the earth as polar coordinates. Convert them to cartesian coordinates.

x = r * cos(latitude) * sin(longitude)
y = r * cos(latitude) * cos(longitude)
z = r * sin(latitude)

Now compute the straight line (as the tunnel burrows) distance (dt) from the one point to the other.

dt = sqrt( (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 )

Now understand that the distance as the tunnel burrows is a chord on a circular segment and the distance as the sea-skimmer skims (ds) is the length of the circular arc.

If we bisect that circular segment we get a right triangle A, B, C with A at one endpoint, B in the middle of the chord and C at the center of the earth. The angle at B is the right angle.

The sine of the angle at C is given by half the chord divided by the Earth's radius. So the full angle is given by

full angle = 2 * asin ( dt / 2r )

If we are working in radians we can read off the sea-skimming distance ds as:

ds = full angle * r

If we are working in degrees we will need to multiply by pi/180

ds = full angle * r * pi/180


If one were actually implementing such a formula there is some simplification that can be done. There is no point in multiplying by r to get the cartesian coordinates and then dividing the computed displacement by r to get the argument for the asin function.

Writing down a complete formula is then a simple but somewhat tedious exercise.




Ambassador -> RE: Distance Between Bases and the B29 Flies (6/23/2020 5:45:47 PM)


quote:

ORIGINAL: BBfanboy


quote:

ORIGINAL: Lokasenna


quote:

ORIGINAL: Uhionk

Francois method worked with a slight clarification. The dx and dy are not the horizontal and vertical difference.

dx is the smaller of (Loc1x-Loc2x) or (Loc1y-Loc2y) as a positive integer
dy is the larger of the same

Jorge, no need to set a mission, simply clicking on base1 and mouseover base2 shows the distance.


Thanks everyone for the help.




This. Use this. It works for any selected hex to any other thing that you can mouse-over.

The x,y coordinate system distance-between function is fine and all... but does it actually apply to an x,y system that uses hexes? I haven't checked. I just use the mouse-over feature.

That works "as-the-Nell-flys" but for ships you have to go around things sometimes. Just set a TF to go from origin to target hex and it will give the hex count for the actual navigation path in the endurance figures at the top left area of the TF screen.

You can also do it from anywhere, even without ships at the origin hex, by using a TF and using waypoints.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
5.671875