Ignore:
Timestamp:
02/17/04 20:10:59 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.