There may not be a closed form solution, as you will have to find all paths and then select the shortest one.
Actually, it _doesn't_ work, because canonically, 0101 to 0810 should come
out to J-13 (counting hexes). I thought that perhaps using that formula and
rounding up would be OK, and it probably is for J-3 or less, but I'd really
like one that works and gives canonical answers for _any_ distance. For
Reasons.
On Fri, 27 Mar 2020 19:12:40 -0700, Vareck Bostrom <xxxxxx@gmail.com>
wrote:
>Here's a verification of sorts: https://i.imgur.com/hke5AEm.png
>hexes are drawn with the centers translated per the toMap[] method and then
>range rings independently drawn at 1 parsec radii (with the first at 0.5
>parsec to show that the distance between the centerpoint of the hex and the
>edge of the hex is half a parsec). Between 1,1 and 8,10 you can see it's a
>bit under 10.5 parsec.
>
>On Fri, Mar 27, 2020 at 6:41 PM Vareck Bostrom <xxxxxx@gmail.com> wrote:
>
>> I may have derived this from the travellermap API document or come up with
>> it myself, I don't remember now, but it works.
>>
>> I have a mathematica method toMap[] which will take a vector of the x and
>> y hex number and return a map-space value:
>> toMap[vec_] := Module[{ix, iy, x, y},
>> ix = vec[[1]] - 0.5;
>> iy = If[ EvenQ[ vec[[1]] ], vec[[2]] - 0.5, vec[[2]] ];
>> x = ix Cos[\[Pi] 6^-1];
>> y = -iy;
>> {x, y}
>> ];
>>
>> then just take the regular euclidean distance between them, e.g.,
>> In[972]:= EuclideanDistance[ toMap[{01,01}], toMap[{08,10}] ]
>> Out[972]= 10.4403
>>
>> Asking mathematica for a general solution gives:
>> In[973]:= EuclideanDistance[ toMap[{ax,ay}], toMap[{bx,by}] ]
>> Out[973]= Sqrt[Abs[1/2 Sqrt[3] (-0.5+ax)-1/2 Sqrt[3]
>> (-0.5+bx)]^2+Abs[-ay+by]^2]
>> where ax, ay are the hex coordinates of the first hex and bx, by are the
>> coordinates of the second
>>
>>
>> On Fri, Mar 27, 2020 at 3:33 PM Jeff Zeitlin <
>> xxxxxx@freelancetraveller.com> wrote:
>>
>>> Given a standard Traveller subsector, with coordinates 0101 to 0810,
>>> alternate columns staggered, what's the formula/algorithm to calculate the
>>> jump distance between two hexes?
>>>
>>> ®Traveller is a registered trademark of
>>> Far Future Enterprises, 1977-2020. Use of
>>> the trademark in this notice and in the
>>> referenced materials is not intended to
>>> infringe or devalue the trademark.
>>>
>>> --
>>> Jeff Zeitlin, Editor
>>> Freelance Traveller
>>> The Electronic Fan-Supported Traveller® Resource
>>> xxxxxx@freelancetraveller.com
>>> http://www.freelancetraveller.com
>>>
>>> Freelance Traveller extends its thanks to the following
>>> enterprises for hosting services:
>>>
>>> onCloud/CyberWeb Enterprises (http://www.oncloud.io)
>>> The Traveller Downport (http://www.downport.com)
>>> -----
>>> The Traveller Mailing List
>>> Archives at http://archives.simplelists.com/tml
>>> Report problems to xxxxxx@simplelists.com
>>> To unsubscribe from this list please go to
>>> http://archives.simplelists.com
>>
>>
>-----
>The Traveller Mailing List
>Archives at http://archives.simplelists.com/tml
>Report problems to xxxxxx@simplelists.com
>To unsubscribe from this list please go to
>http://archives.simplelists.com
®Traveller is a registered trademark of
Far Future Enterprises, 1977-2020. Use of
the trademark in this notice and in the
referenced materials is not intended to
infringe or devalue the trademark.
--
Jeff Zeitlin, Editor
Freelance Traveller
The Electronic Fan-Supported Traveller® Resource
xxxxxx@freelancetraveller.com
http://www.freelancetraveller.com
Freelance Traveller extends its thanks to the following
enterprises for hosting services:
onCloud/CyberWeb Enterprises (http://www.oncloud.io)
The Traveller Downport (http://www.downport.com)
-----
The Traveller Mailing List
Archives at http://archives.simplelists.com/tml
Report problems to xxxxxx@simplelists.com
To unsubscribe from this list please go to
http://www.simplelists.com/confirm.php?u=wkJZDVdDoS21PvuTrsXSMsmho7pwDsoN