ROOT » GRAF2D » GRAF » TEllipse

class TEllipse: public TObject, public TAttLine, public TAttFill, public TAttBBox2D


TEllipse : to draw ellipses

The ellipse can be truncated and rotated. It is defined by its center (x1,y1) and two radius r1 and r2. A minimum and maximum angle may be specified (phimin, phimax). The ellipse may be rotated with an angle theta. All these angles are in degrees. The attributes of the outline line are given via TAttLine. The attributes of the fill area are given via TAttFill. The picture below illustrates different types of ellipses.

When an ellipse sector only is drawn, the lines connecting the center of the ellipse to the edges are drawn by default. One can specify the drawing option "only" to not draw these lines or alternatively call the function SetNoEdges(). To remove completely the ellipse outline it is enough to specify 0 as line style.

output of html602/MACRO_TEllipse_1.gif
//Draw ellipses
//Author: Rene Brun
{
   c1 = new TCanvas("c1");
   c1->Range(0,0,1,1);
   TPaveLabel pel(0.1,0.8,0.9,0.95,"Examples of Ellipses");
   pel.SetFillColor(42);
   pel.Draw();
   TEllipse el1(0.25,0.25,.1,.2);
   el1.Draw();
   TEllipse el2(0.25,0.6,.2,.1);
   el2.SetFillColor(6);
   el2.SetFillStyle(3008);
   el2.Draw();
   TEllipse el3(0.75,0.6,.2,.1,45,315);
   el3.SetFillColor(2);
   el3.SetFillStyle(1001);
   el3.SetLineColor(4);
   el3.Draw();
   TEllipse el4(0.75,0.25,.2,.15,45,315,62);
   el4.SetFillColor(5);
   el4.SetFillStyle(1001);
   el4.SetLineColor(4);
   el4.SetLineWidth(6);
   el4.Draw();
   return c1;
}
 

Function Members (Methods)

public:
virtual~TEllipse()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidCopy(TObject& ellipse) const
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidDrawEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t* option = "")
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Rectangle_tGetBBox()
virtual TPointGetBBoxCenter()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual const char*TObject::GetName() const
Bool_tGetNoEdges() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Double_tGetPhimax() const
Double_tGetPhimin() const
Double_tGetR1() const
Double_tGetR2() const
Double_tGetTheta() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Double_tGetX1() const
Double_tGetY1() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TEllipse&operator=(const TEllipse&)
virtual voidPaint(Option_t* option = "")
virtual voidPaintEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidSetBBoxCenter(const TPoint& p)
virtual voidSetBBoxCenterX(const Int_t x)
virtual voidSetBBoxCenterY(const Int_t y)
virtual voidSetBBoxX1(const Int_t x)
virtual voidSetBBoxX2(const Int_t x)
virtual voidSetBBoxY1(const Int_t y)
virtual voidSetBBoxY2(const Int_t y)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidTAttLine::SetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidSetNoEdges(Bool_t noEdges = kTRUE)TOGGLE GETTER
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPhimax(Double_t phi = 360)MENU
virtual voidSetPhimin(Double_t phi = 0)MENU
virtual voidSetR1(Double_t r1)MENU
virtual voidSetR2(Double_t r2)MENU
virtual voidSetTheta(Double_t theta = 0)MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetX1(Double_t x1)MENU
virtual voidSetY1(Double_t y1)MENU
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TEllipse()
TEllipse(const TEllipse& ellipse)
TEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2 = 0, Double_t phimin = 0, Double_t phimax = 360, Double_t theta = 0)
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TEllipse::(anonymous)kNoEdges
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Double_tfPhimaxMaximum angle (degrees)
Double_tfPhiminMinimum angle (degrees)
Double_tfR1first radius
Double_tfR2second radius
Double_tfThetaRotation angle (degrees)
Double_tfX1X coordinate of centre
Double_tfY1Y coordinate of centre

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TEllipse()
 Ellipse default constructor.
TEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2 = 0, Double_t phimin = 0, Double_t phimax = 360, Double_t theta = 0)
 Ellipse normal constructor.
~TEllipse()
 Ellipse default destructor.
TEllipse(const TEllipse& ellipse)
 Copy constructor.
void Copy(TObject& ellipse) const
 Copy this ellipse to ellipse.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute distance from point px,py to an ellipse.

 Compute the closest distance of approach from point px,py to this
 ellipse. The distance is computed in pixels units.

 In case of a filled ellipse the distance returned is 0 if the point
 (px,py) is inside the ellipse, and is huge if the point is outside.
void Draw(Option_t* option = "")
 Draw this ellipse with its current attributes.
void DrawEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t* option = "")
 Draw this ellipse with new coordinates.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute action corresponding to one event.

  This member function is called when a line is clicked with the locator

  If Left button clicked on one of the line end points, this point
     follows the cursor until button is released.

  if Middle button clicked, the line is moved parallel to itself
     until the button is released.

  NOTE that support for log scale is not implemented
void ls(Option_t* option = "") const
 List this ellipse with its attributes.
void Paint(Option_t* option = "")
 Paint this ellipse with its current attributes.
void PaintEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t* option = "")
 Draw this ellipse with new coordinates.
void Print(Option_t* option = "") const
 Dump this ellipse with its attributes.
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out
Bool_t GetNoEdges() const
 Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
void SetNoEdges(Bool_t noEdges = kTRUE)
 if  noEdges = kTRUE the lines connecting the center to the edges
 will not be drawn.
 default is to draw the edges.
void Streamer(TBuffer& )
 Stream an object of class TEllipse.
Rectangle_t GetBBox()
 Return the bounding Box of the Ellipse, currently not taking into
 account the rotating angle.
TPoint GetBBoxCenter()
 Return the center of the Ellipse as TPoint in pixels
void SetBBoxCenter(const TPoint& p)
 Set center of the Ellipse
void SetBBoxCenterX(const Int_t x)
 Set X coordinate of the center of the Ellipse
void SetBBoxCenterY(const Int_t y)
 Set Y coordinate of the center of the Ellipse
void SetBBoxX1(const Int_t x)
 Set lefthandside of BoundingBox to a value
 (resize in x direction on left)
void SetBBoxX2(const Int_t x)
 Set righthandside of BoundingBox to a value
 (resize in x direction on right)
void SetBBoxY1(const Int_t y)
 Set top of BoundingBox to a value (resize in y direction on top)
void SetBBoxY2(const Int_t y)
 Set bottom of BoundingBox to a value
 (resize in y direction on bottom)
Double_t GetX1() const
{return fX1;}
Double_t GetY1() const
{return fY1;}
Double_t GetR1() const
{return fR1;}
Double_t GetR2() const
{return fR2;}
Double_t GetPhimin() const
{return fPhimin;}
Double_t GetPhimax() const
{return fPhimax;}
Double_t GetTheta() const
{return fTheta;}
void SetPhimin(Double_t phi = 0)
{fPhimin=phi;}
void SetPhimax(Double_t phi = 360)
{fPhimax=phi;}
void SetR1(Double_t r1)
{fR1=r1;}
void SetR2(Double_t r2)
{fR2=r2;}
void SetTheta(Double_t theta = 0)
{fTheta=theta;}
void SetX1(Double_t x1)
{fX1=x1;}
void SetY1(Double_t y1)
{fY1=y1;}