Ignore:
Timestamp:
06/28/06 13:49:23 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/catalog
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/catalog/StarCatalog.cc

    r4865 r7764  
    142142}
    143143
     144/*
    144145void StarCatalog::CalcStars(MStarList &list)
    145146{
    146147    // full FOV
    147     fBox=768;
    148     CalcStars(list, 0, 576, 0, 0);
    149 }
     148    fBox=768/2;
     149    CalcStars(list, 768/2, 576/2, 0, 0);
     150}
     151*/
    150152
    151153void StarCatalog::CalcStars(MStarList &list, int xc, int yc,
    152154                            int xo, int yo) const
    153155{
     156    // For an apropriate unit conversion to pixels [pix/rad]
     157    const Double_t scale = TMath::RadToDeg()*sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2);
     158
     159    // Offsets to shift [-n/2;n/2] to [0;n] and to
     160    // move the stars in the counterdirection of the LEDs
     161    const Float_t offx = 768/2 + xo;
     162    const Float_t offy = 576/2 + yo;
     163
     164    // Allow catalog stars to be a bit outside [0.2deg] of the
     165    // monitored window. To get the std behaviour set offset=0
     166    const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()*scale);
     167    const Int_t box    = fBox+offset;
    154168
    155169    // CalcStars flips the picture in X defaultwise now
    156     int x0 = (768-xc)-fBox;
    157     int x1 = (768-xc)+fBox;
    158     int y0 = yc-fBox;
    159     int y1 = yc+fBox;
    160 
    161     if (x0<0) x0=0;
    162     if (y0<0) y0=0;
    163     if (x1>fW) x1=fW;
    164     if (y1>fH) y1=fH;
     170    // This defined the box in which stars are really returned
     171    int x0 = (768-xc)-box;
     172    int x1 = (768-xc)+box;
     173    int y0 = yc-box;
     174    int y1 = yc+box;
     175
     176    if (x0<  -offset) x0=  -offset;
     177    if (y0<  -offset) y0=  -offset;
     178    if (x1>fW+offset) x1=fW+offset;
     179    if (y1>fH+offset) y1=fH+offset;
    165180
    166181    // Align stars into telescope system
     
    171186    align.RotateZ(TMath::Pi()/2);
    172187
    173     // For an apropriate unit conversion to pixels
    174     const Double_t scale = TMath::RadToDeg()*sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2);
    175 
    176188    // Get List of stars from catalog
    177189    TIter Next(fAstro->GetList());
     
    213225
    214226        // Rotate by the rotation angle of the video camera
    215         Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle;
    216         Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle;
    217 
    218         if (xx<(x0-768/2) || xx >=(x1-768/2)
    219             || yy<(y0-(576/2+yo)) || yy>=(y1-(576/2+yo)))
     227        // and add the offsets on both axis
     228        Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle  +  offx;
     229        Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle  +  offy;
     230
     231        // Check if the resulting star is in the
     232        // search box for the real stars
     233        if (rx<x0 || rx>=x1 || ry<y0 || ry>=y1)
    220234            continue;
    221235
    222236        // Store pixel coordinates of star in list
    223         list.Add(xx+768/2+xo, yy+576/2+yo, -2.5*log10(mag));
    224 
     237        list.Add(rx, ry, -2.5*log10(mag));
    225238    }
    226239}
  • trunk/MagicSoft/Cosy/catalog/StarCatalog.h

    r6867 r7764  
    7676    }
    7777
     78    //void   CalcStars(MStarList &list);
    7879    void   CalcStars(MStarList &list, int xc, int yc, int xo, int yo) const;
    79     void   CalcStars(MStarList &list);
    8080    static void DrawStars(MStarList &list, byte *img);
    8181
Note: See TracChangeset for help on using the changeset viewer.