FACT++  1.0
void MGImage::DrawCircle ( UChar_t *  buf,
int  w,
int  h,
Float_t  x,
Float_t  y,
Float_t  r,
UChar_t  col 
)
static

Definition at line 350 of file MGImage.cc.

References i.

Referenced by DisableSyncMode(), and FilterLed::DrawCircle().

351 {
352  const Int_t n = TMath::Nint(sqrt(2.)*r*TMath::Pi()/2);
353  for (int i=0; i<n-1; i++)
354  {
355  const Double_t angle = TMath::TwoPi()*i/n;
356 
357  const Double_t dx = r*cos(angle);
358  const Double_t dy = r*sin(angle);
359 
360  const Int_t x1 = TMath::Nint(x+dx);
361  const Int_t x2 = TMath::Nint(x-dx);
362 
363  const Int_t y1 = TMath::Nint(y+dy);
364  if (y1>=0 && y1<h)
365  {
366  if (x1>=0 && x1<w)
367  buf[x1+y1*w] = col;
368 
369  if (x2>=0 && x2<w)
370  buf[x2+y1*w] = col;
371  }
372 
373  const Int_t y2 = TMath::Nint(y-dy);
374  if (y2>=0 && y2<h)
375  {
376  if (x1>=0 && x1<w)
377  buf[x1+y2*w] = col;
378 
379  if (x2>=0 && x2<w)
380  buf[x2+y2*w] = col;
381  }
382  }
383 }
int i
Definition: db_dim_client.c:21

+ Here is the caller graph for this function: