<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Have you considered an arithmetic or algorithmic solution, using only
the coordinates of the mouse click and what you know about hexagonal
grid?<br>
<br>
The input to your function would be the X and Y coordinates on your
canvas where the mouse was clicked. The output of your function would
be some kind of identifier for the clicked hexagon, such as an object,
array index, or hexagonal-coordinates.<br>
<br>
By sketching this out on paper, I think you will see how you can at
least narrow down the selected hexagon to only a few. Once you have
that coarse mapping between the coordinates, trigonometry or arithmetic
will tell you to which side of a diagonal line a point falls...<br>
<br>
<br>
deepankar wrote at 09/20/2008 11:23 AM:
<blockquote cite="mid:EFFF03A66FE14D3EAA26EB7BD69240E2@serv" type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.6001.18099" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">I draw a tiled array of hexagons on
a canvas using paths. Now I would like to detect which hexagon is
beeing clicked on.</font></div>
</blockquote>
<font size="2"><font face="Arial"><br>
<br>
</font></font>
<div class="moz-signature">-- <br>
<a class="moz-txt-link-freetext" href="http://www.neilvandyke.org/">http://www.neilvandyke.org/</a>
</div>
</body>
</html>