RE: elipse

From: Fine, Valeri <fine_at_bnl.gov>
Date: Sat, 2 Sep 2006 14:41:32 -0400


Hello Nasim,  

> I know the cordinates of four different arbitary points of the elipse
 

  This does allow you to calculate any ellipse parameter yourself  

> and o the angle of the semi-major axis with respect to the x axis.
> is that any way to draw such an elipse in root.
 

I am afraid ROOT has no direct method to provide the arbitrary 2D coordinate transformation the kind of thing one needs to rotate the 2D figures.  

There are two solutions:  

  1. Do things yourself, namely
      1.1.  Calculate the several ellipse points 
               (enough to make the polylyne  looks smooth, see p 1.3. below)
              using the ellipse formula
      1.2.  Apply the rotation matrix to get it the way you want
      1.3.  Create TPolyLine object http://root.cern.ch/root/htmldoc/TPolyLine.html 
      1.4.  Draw that object
 
  2. Take advantage of ROOT/ Qt layer. This way you can use Qt classes and API within your ROOT application. 
      This means you can use the class QPainter and its methods:
                 http://doc.trolltech.com/3.3/qpainter.html#rotate
                 http://doc.trolltech.com/3.3/qpainter.html#drawEllipse
 

See: ftp://root.cern.ch/root/doc/chapter27.pdf for details and http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html for the list of Qt classes available from the ROOT Cint command prompt. (Bear in mind that all Qt classes are available from the compiled code). Let me know whether you need a working Qt/Root example. I could make it available by Monday  

 Hope this helps.  

               Valeri

Many Thanks,
Nasim

--
Received on Sat Sep 02 2006 - 20:42:14 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET