Path: utzoo!attcan!uunet!nih-csl!lhc!mimsy!haven!uflorida!rex!wuarchive!usc!rutgers!rochester!pt.cs.cmu.edu!sei!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.sys.mac.games Subject: Re: Hex distances Message-ID: <9593@fy.sei.cmu.edu> Date: 19 Nov 90 13:05:40 GMT References: <1990Nov17.111429.6250@wuarchive.wustl.edu> Reply-To: firth@sei.cmu.edu (Robert Firth) Organization: Software Engineering Institute, Pittsburgh, PA Lines: 25 Distances on hexagonal tesselations. Let the distance between the centre of a hex and the centre of an adjacent hex be 1. Consider the hexes to be laid out in successive horizontal rows, so each successive row is displaced a half unit. Let the coordinate axes be horizontal and upward right sloping diagonal. These coordinate axes are at an angle of pi/3, or 60 degrees. Given two hexes whose coordinates differ by H (horizontal) and D (diagonal), then we have: delta_x = H + D cos pi/3 = H + D/2 delta_y = D sin pi/3 = D sqrt(3)/2 Hence the total distance is given by dist = sqrt(delta_x^2 + delta_y^2) which simplifies to dist = sqrt(H^2 + D^2 + HD) Hope that helps.