Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3219)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3220)
@@ -12,9 +12,7 @@
 
    * mgui/MHexagon.cc
-     - fixed comment in DistanceToPrimitive(Float_t px, Float_t py)
-       The pixel "radius" here used is that of the "outer" circle, not
-       of the inner one as previously stated. Added FIXME comment to
-       implement better calculation in the future.
-
+     - DistanceToPrimitive(Float_t px, Float_t py) Changed check of
+       whether px,py is inside the pixel or not. Previous algorithm 
+       was just an approximation.
 
  2004/01/17: Raquel de los Reyes
Index: trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 3219)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 3220)
@@ -154,5 +154,5 @@
 // ------------------------------------------------------------------------
 //
-// compute the distance of a point (px,py) to the Hexagon in world
+// compute the distance of a point (px,py) to the Hexagon center in world
 // coordinates. Return -1 if inside.
 //
@@ -164,4 +164,30 @@
     const Double_t dx = px-fX;
     const Double_t dy = py-fY;
+    const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy);
+
+    if (TMath::Abs(dx) > fD/2.)
+      return disthex;
+
+    const Double_t dx2 = dx*0.5 + dy*0.866025403784438597;
+
+    if  (TMath::Abs(dx2) > fD/2.)
+      return disthex;
+
+    const Double_t dx3 = dx*0.5 - dy*0.866025403784438597;
+
+    if  (TMath::Abs(dx3) > fD/2.)
+      return disthex;
+
+    return -1;
+}
+
+/*
+Float_t MHexagon::DistanceToPrimitive(Float_t px, Float_t py)
+{
+    //
+    //  compute the distance of the Point to the center of the Hexagon
+    //
+    const Double_t dx = px-fX;
+    const Double_t dy = py-fY;
 
     const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy);
@@ -177,4 +203,5 @@
     //
 }
+*/
 
 // ------------------------------------------------------------------------
