Bug in TArc/TEllipse

From: Mathieu de Naurois (denauroi@polhp1.in2p3.fr)
Date: Thu Sep 03 1998 - 16:04:48 MEST


Hello Rooters,


If you create a Arc with:

TArc *Arc = new TArc (0,0,1,90,180);
Arc->Draw();

you should obtain a quarter of circle in the upper-left corner of the
picture, but you obtain it on the upper-RIGHT corner.

It seems to me that this bug is in the function TEllipse::PaintEllipse:

the rotation angle theta is taken into account, but not the first angle
phimin:

void TEllipse::PaintEllipse(Float_t, Float_t, Float_t, Float_t, Float_t
phimin,Float_t phimax, Float_t theta)
{
//*-*-*-*-*-*-*-*-*-*-*Draw this ellipse with new
coordinates*-*-*-*-*-*-*-*-*
//*-*                  ======================================

   const Int_t np = 40;
   const Float_t PI = 3.141592;
   static Float_t x[np+2], y[np+2];
   TAttLine::Modify();  //Change line attributes only if necessary
   TAttFill::Modify();  //Change fill attributes only if necessary

   Float_t angle,dx,dy;
   Float_t dphi = (phimax-phimin)*PI/(180*np);
   Float_t ct   = TMath::Cos(PI*theta/180);
   Float_t st   = TMath::Sin(PI*theta/180);
   for (Int_t i=0;i<np;i++) {
      angle = Float_t(i)*dphi;

---------> I think, one must add 'phimin' to this 'angle'!

      dx    = fR1*TMath::Cos(angle);
      dy    = fR2*TMath::Sin(angle);
      x[i]  = fX1 + dx*ct - dy*st;
      y[i]  = fY1 + dx*st + dy*ct;
   }
   if (phimax-phimin >= 360 ) {
      x[np] = x[0];
      y[np] = y[0];
      if (GetFillColor()) gPad->PaintFillArea(np,x,y);
      if (GetLineStyle()) gPad->PaintPolyLine(np+1,x,y);
   } else {
      x[np]   = fX1;
      y[np]   = fY1;
      x[np+1] = x[0];
      y[np+1] = y[0];
      if (GetFillColor()) gPad->PaintFillArea(np+1,x,y);
      if (GetLineStyle()) gPad->PaintPolyLine(np+2,x,y);
   }
}

--------------------------------------------

A suggestion: Would it be possible to provide an option to draw only the
contour of the ellipse, without the lines joining the center?

  Thank you
--------------------------------------------

Mathieu de Naurois
LPNHE Ecole Polytechnique
denauroi@polhp1.inp3.fr



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET