Changeset 3220


Ignore:
Timestamp:
02/17/04 20:10:59 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3219 r3220  
    1212
    1313   * mgui/MHexagon.cc
    14      - fixed comment in DistanceToPrimitive(Float_t px, Float_t py)
    15        The pixel "radius" here used is that of the "outer" circle, not
    16        of the inner one as previously stated. Added FIXME comment to
    17        implement better calculation in the future.
    18 
     14     - DistanceToPrimitive(Float_t px, Float_t py) Changed check of
     15       whether px,py is inside the pixel or not. Previous algorithm
     16       was just an approximation.
    1917
    2018 2004/01/17: Raquel de los Reyes
  • trunk/MagicSoft/Mars/mgui/MHexagon.cc

    r3219 r3220  
    154154// ------------------------------------------------------------------------
    155155//
    156 // compute the distance of a point (px,py) to the Hexagon in world
     156// compute the distance of a point (px,py) to the Hexagon center in world
    157157// coordinates. Return -1 if inside.
    158158//
     
    164164    const Double_t dx = px-fX;
    165165    const Double_t dy = py-fY;
     166    const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy);
     167
     168    if (TMath::Abs(dx) > fD/2.)
     169      return disthex;
     170
     171    const Double_t dx2 = dx*0.5 + dy*0.866025403784438597;
     172
     173    if  (TMath::Abs(dx2) > fD/2.)
     174      return disthex;
     175
     176    const Double_t dx3 = dx*0.5 - dy*0.866025403784438597;
     177
     178    if  (TMath::Abs(dx3) > fD/2.)
     179      return disthex;
     180
     181    return -1;
     182}
     183
     184/*
     185Float_t MHexagon::DistanceToPrimitive(Float_t px, Float_t py)
     186{
     187    //
     188    //  compute the distance of the Point to the center of the Hexagon
     189    //
     190    const Double_t dx = px-fX;
     191    const Double_t dy = py-fY;
    166192
    167193    const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy);
     
    177203    //
    178204}
     205*/
    179206
    180207// ------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.