Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEllipse.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 16/10/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TEllipse.h"
13
14#include <cstdlib>
15#include <iostream>
16
17#include "TROOT.h"
18#include "TBuffer.h"
19#include "TAttMarker.h"
20#include "TVirtualPad.h"
21#include "TBoxInteractive.h"
22#include "TMath.h"
23#include "TPoint.h"
24
25
26constexpr Double_t kPI = TMath::Pi();
27
28
29/** \class TEllipse
30\ingroup BasicGraphics
31
32Draw Ellipses.
33
34The ellipse can be truncated and rotated. It is defined by its center `(x1,y1)`
35and two radius `r1` and `r2`.
36
37A minimum and maximum angle may be specified `(phimin, phimax)`.
38The ellipse may be rotated with an angle `theta`. All these
39angles are in degrees.
40The attributes of the outline line are given via `TAttLine`.
41The attributes of the fill area are given via `TAttFill`.
42The picture below illustrates different types of ellipses.
43
44When an ellipse sector only is drawn, the lines connecting the center
45of the ellipse to the edges are drawn by default. One can specify
46the drawing option "only" to not draw these lines or alternatively
47call the function `SetNoEdges()`. To remove completely the ellipse
48outline it is enough to specify 0 as line style.
49
50Begin_Macro(source)
51../../../tutorials/visualisation/graphics/ellipse.C
52End_Macro
53*/
54
55////////////////////////////////////////////////////////////////////////////////
56/// Ellipse default constructor.
57
59{
60 fX1 = 0;
61 fY1 = 0;
62 fR1 = 1;
63 fR2 = 1;
64 fPhimin = 0;
65 fPhimax = 360;
66 fTheta = 0;
67}
68
69////////////////////////////////////////////////////////////////////////////////
70/// Ellipse normal constructor.
71
73 :TObject(), TAttLine(), TAttFill(0,1001)
74{
75 fX1 = x1;
76 fY1 = y1;
77 fR1 = r1;
78 fR2 = r2;
81 fTheta = theta;
82 if (r2 <= 0) fR2 = fR1;
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Ellipse default destructor.
87
91
92////////////////////////////////////////////////////////////////////////////////
93/// Copy constructor.
94
96{
97 fX1 = 0;
98 fY1 = 0;
99 fR1 = 1;
100 fR2 = 1;
101 fPhimin = 0;
102 fPhimax = 360;
103 fTheta = 0;
104
105 ellipse.TEllipse::Copy(*this);
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Copy this ellipse to ellipse.
110
111void TEllipse::Copy(TObject &obj) const
112{
113 TObject::Copy(obj);
114 TAttLine::Copy(((TEllipse&)obj));
115 TAttFill::Copy(((TEllipse&)obj));
116 ((TEllipse&)obj).fX1 = fX1;
117 ((TEllipse&)obj).fY1 = fY1;
118 ((TEllipse&)obj).fR1 = fR1;
119 ((TEllipse&)obj).fR2 = fR2;
120 ((TEllipse&)obj).fPhimin = fPhimin;
121 ((TEllipse&)obj).fPhimax = fPhimax;
122 ((TEllipse&)obj).fTheta = fTheta;
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Compute distance from point px,py to an ellipse.
127///
128/// Compute the closest distance of approach from point px,py to this
129/// ellipse. The distance is computed in pixels units.
130///
131/// In case of a filled ellipse the distance returned is 0 if the point
132/// (px,py) is inside the ellipse, and is huge if the point is outside.
133
135{
136 if (!gPad) return 9999;
137 Double_t x = gPad->PadtoX(gPad->AbsPixeltoX(px));
138 Double_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
139
140 Double_t dxnr = x - fX1;
141 Double_t dynr = y - fY1;
142
143 Double_t ct = TMath::Cos(kPI*GetTheta()/180.0);
144 Double_t st = TMath::Sin(kPI*GetTheta()/180.0);
145
146 Double_t dx = dxnr*ct + dynr*st;
147 Double_t dy = -dxnr*st + dynr*ct;
148
149 Double_t r1 = fR1;
150 Double_t r2 = fR2;
151
152 if (dx == 0 || r1 == 0 || r2 == 0) return 9999;
154
155 Double_t tana = dy/dx;
156 tana *= tana;
157 Double_t distr = TMath::Sqrt((1+tana)/(1.0/(r1*r1) + tana/(r2*r2)));
158 Int_t dist = 9999;
159 if (GetFillColor() && GetFillStyle()) {
160 if (distr > distp) dist = 0;
161 } else {
162 if (TMath::Abs(distr-distp)/(r1+r2) < 0.01) dist = 0;
163 }
164 return dist;
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Draw this ellipse with its current attributes.
169
174
175////////////////////////////////////////////////////////////////////////////////
176/// Draw this ellipse with new coordinates.
177
188
189
191 public:
193 : TBoxInteractive(kFALSE, e->GetX1() - e->GetR1(), e->GetY1() - e->GetR2(), e->GetX1() + e->GetR1(),
194 e->GetY1() + e->GetR2())
195 {
196 }
197
198 void PaintOutline(TVirtualPad &parent) override
199 {
200 auto e = static_cast<TEllipse *> (GetObject());
201
202 std::vector<Double_t> x, y;
203 Bool_t fullcircle = e->FillPoints(parent, x, y, (newX1 + newX2) / 2, (newY1 + newY2) / 2, (newX2 - newX1) / 2, (newY2 - newY1) / 2, e->GetPhimin(), e->GetPhimax(), e->GetTheta());
204
205 // "i" is interactive painting, "diamond" is id
206 parent.PaintPolyLine(x.size(), x.data(), y.data(), "iellipse");
207
208 if(!fullcircle || e->GetTheta())
209 PaintDiamondCorners(parent, "ellipse");
210 }
211
213 {
214 e->SetX1(usenew ? (newX1 + newX2) / 2 : (oldX1 + oldX2) / 2);
215 e->SetR1(usenew ? (newX2 - newX1) / 2 : (oldX2 - oldX1) / 2);
216 e->SetY1(usenew ? (newY1 + newY2) / 2 : (oldY1 + oldY2) / 2);
217 e->SetR2(usenew ? (newY2 - newY1) / 2 : (oldY2 - oldY1) / 2);
218 }
219};
220
221
222////////////////////////////////////////////////////////////////////////////////
223/// Execute action corresponding to one event.
224///
225/// This member function is called when a line is clicked with the locator
226///
227/// If Left button clicked on one of the line end points, this point
228/// follows the cursor until button is released.
229///
230/// if Middle button clicked, the line is moved parallel to itself
231/// until the button is released.
232///
233/// NOTE that support for log scale is not implemented
234
236{
237 if (!gPad || !gPad->IsEditable())
238 return;
239
240 auto &parent = *gPad;
241
242 auto inter = dynamic_cast<TEllipseInteractive *>(parent.Interactive(this));
243
244 switch (event) {
245
246 case kArrowKeyPress:
247 case kButton1Down:
248 inter = new TEllipseInteractive(this);
249 parent.Interactive(this, inter);
250 // No break !!!
251
252 case kMouseMotion: {
253 TEllipseInteractive dummy(this);
254 if (!inter) inter = &dummy;
255 inter->CalcPixelCoord(parent, dummy.oldX1, dummy.oldY1, dummy.oldX2, dummy.oldY2);
256
257 if (!inter->SelectDiamondCorner(px, py, kFALSE)) {
258 // refuse interactive changes
259 parent.Interactive();
260 } else {
261 inter->SetCursor(parent, event == kButton1Down);
262 }
263 break;
264 }
265
266 case kArrowKeyRelease:
267 case kButton1Motion:
268 if (!inter)
269 return;
270
271 if (!inter->ProcessMouseMove(parent, px, py))
272 return;
273
274 inter->ApplyChanges(parent);
275
276 if (inter->IsOpaque(parent)) {
277 inter->Apply(this);
278 parent.ShowGuidelines(this, event, inter->GetGuideChar(), true);
279 parent.Modified(kTRUE);
280 }
281
282 break;
283
284 case kButton1Up:
285 if (inter && inter->IsOpaque(parent))
286 parent.ShowGuidelines(this, event);
287
288 if (gROOT->IsEscaped()) {
289 gROOT->SetEscape(kFALSE);
290 if (inter && inter->IsOpaque(parent)) {
291 inter->Apply(this, kFALSE);
292 }
293 } else if (inter && !inter->IsOpaque(parent)) {
294 inter->Apply(this);
295 }
296
297 parent.Modified();
298 parent.Interactive(); // delete interactive object
299 break;
300 }
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Return 1 if the point (x,y) is inside the polygon defined by
305/// the ellipse 0 otherwise.
306/// Author: Ole Hansen (ole@jlab.org)
308{
309 x -= fX1;
310 y -= fY1;
314 Double_t xx = ct * x + st * y;
315 Double_t yy = -st * x + ct * y;
316
317 if (TMath::Abs(xx) > fR1 || TMath::Abs(yy) > fR2)
318 return 0;
319 Double_t xn = xx / fR1;
320 Double_t yn = yy / fR2;
321 if (xn * xn + yn * yn > 1.)
322 return 0;
323 if (fPhimax - fPhimin >= 360.)
324 return 1;
325 Double_t phimin = std::fmod(fPhimin, 360.);
326 Double_t phimax = std::fmod(fPhimax, 360.);
329 return 0;
330
331 return 1;
332}
333
334
335////////////////////////////////////////////////////////////////////////////////
336/// List this ellipse with its attributes.
337
339{
341 printf("%s: X1= %f Y1=%f R1=%f R2=%f\n",GetName(),fX1,fY1,fR1,fR2);
342}
343
344////////////////////////////////////////////////////////////////////////////////
345/// Paint this ellipse with its current attributes.
346
351
352////////////////////////////////////////////////////////////////////////////////
353/// Fill points which can be used for the painting
354/// Return true if full 360 ellipse is created
355
356Bool_t TEllipse::FillPoints(TVirtualPad &pad, std::vector<Double_t> &x, std::vector<Double_t> &y,
358{
359 const Int_t np = 200;
360
363
364 //set number of points approximatively proportional to the ellipse circumference
365 Double_t circ = kPI*(r1+r2)*(phi2-phi1)/360;
366 Int_t n = (Int_t)(np*circ/((pad.GetX2() - pad.GetX1())+(pad.GetY2()-pad.GetY1())));
367 Bool_t full_circle = phi2-phi1 >= 360;
368 n = TMath::Min(np, TMath::Max(n, (Int_t) (full_circle ? 36 : 8)));
369
370 x.resize(n + (full_circle ? 1 : 3));
371 y.resize(n + (full_circle ? 1 : 3));
372
373 Double_t dphi = (phi2-phi1)*kPI/(180*n);
374 Double_t ct = TMath::Cos(kPI*theta/180);
375 Double_t st = TMath::Sin(kPI*theta/180);
376 for (Int_t i = 0; i <= n; i++) {
377 Double_t angle = phi1*kPI/180 + i*dphi;
380 x[i] = pad.XtoPad(x1 + dx*ct - dy*st);
381 y[i] = pad.YtoPad(y1 + dx*st + dy*ct);
382 }
383 if (!full_circle) {
384 x[n+1] = pad.XtoPad(x1);
385 y[n+1] = pad.YtoPad(y1);
386 x[n+2] = x[0];
387 y[n+2] = y[0];
388 }
389
390 return full_circle;
391}
392
393
394////////////////////////////////////////////////////////////////////////////////
395/// Draw this ellipse with new coordinates.
396
400{
401 if (!gPad) return;
402
403 std::vector<Double_t> x, y;
404 Bool_t full_circle = FillPoints(*gPad, x, y, x1, y1, r1, r2, phimin, phimax, theta);
405
406 TAttFill::ModifyOn(*gPad); //Change fill attributes only if necessary
407 TAttLine::ModifyOn(*gPad); //Change line attributes only if necessary
408
409 if (GetFillStyle() > 0)
410 gPad->PaintFillArea(x.size() - 1, x.data(), y.data());
411
412 if (GetLineStyle() > 0) {
413 TString opt = option;
414 opt.ToLower();
415 Bool_t less_points = !full_circle && (TestBit(kNoEdges) || opt.Contains("only"));
416 gPad->PaintPolyLine(x.size() - (less_points ? 2 : 0), x.data(), y.data());
417 }
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// Dump this ellipse with its attributes.
422
424{
425 printf("Ellipse: X1=%f Y1=%f R1=%f R2=%f",fX1,fY1,fR1,fR2);
426 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
427 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
428 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
429 printf("\n");
430}
431
432////////////////////////////////////////////////////////////////////////////////
433/// Save primitive as a C++ statement(s) on output stream out
434
435void TEllipse::SavePrimitive(std::ostream &out, Option_t *option)
436{
438 out, Class(), "ellipse",
439 TString::Format("%g, %g, %g, %g, %g, %g, %g", fX1, fY1, fR1, fR2, fPhimin, fPhimax, fTheta));
440
441 SaveFillAttributes(out, "ellipse", 0, 1001);
442 SaveLineAttributes(out, "ellipse", 1, 1, 1);
443
444 if (GetNoEdges())
445 out << " ellipse->SetNoEdges();\n";
446
447 SavePrimitiveDraw(out, "ellipse", option);
448}
449
450////////////////////////////////////////////////////////////////////////////////
451/// Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
452
454{
455 return TestBit(kNoEdges) ? kTRUE : kFALSE;
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// if noEdges = kTRUE the lines connecting the center to the edges
460/// will not be drawn.
461/// default is to draw the edges.
462
468
469////////////////////////////////////////////////////////////////////////////////
470/// Stream an object of class TEllipse.
471
473{
474 if (R__b.IsReading()) {
476 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
477 if (R__v > 1) {
478 R__b.ReadClassBuffer(TEllipse::Class(), this, R__v, R__s, R__c);
479 return;
480 }
481 //====process old versions before automatic schema evolution
485 Float_t x1,y1,r1,r2,phimin,phimax,theta;
486 R__b >> x1; fX1 = x1;
487 R__b >> y1; fY1 = y1;
488 R__b >> r1; fR1 = r1;
489 R__b >> r2; fR2 = r2;
492 R__b >> theta; fTheta = theta;
493 R__b.CheckByteCount(R__s, R__c, TEllipse::IsA());
494 //====end of old versions
495
496 } else {
497 R__b.WriteClassBuffer(TEllipse::Class(),this);
498 }
499}
500
501////////////////////////////////////////////////////////////////////////////////
502/// Return the bounding Box of the Ellipse, currently not taking into
503/// account the rotating angle.
504
506{
507 Rectangle_t BBox{0, 0, 0, 0};
508 if (gPad) {
509 BBox.fX = gPad->XtoPixel(fX1 - fR1);
510 BBox.fY = gPad->YtoPixel(fY1 + fR2);
511 BBox.fWidth = gPad->XtoPixel(fX1 + fR1) - gPad->XtoPixel(fX1 - fR1);
512 BBox.fHeight = gPad->YtoPixel(fY1 - fR2) - gPad->YtoPixel(fY1 + fR2);
513 }
514 return BBox;
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// Return the center of the Ellipse as TPoint in pixels
519
521{
522 TPoint p(0, 0);
523 if (gPad) {
524 p.SetX(gPad->XtoPixel(fX1));
525 p.SetY(gPad->YtoPixel(fY1));
526 }
527 return p;
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Set X coordinate of the center of the Ellipse
532
534{
535 SetX1(GetXCoord(x));
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Set Y coordinate of the center of the Ellipse
540
542{
543 SetY1(GetYCoord(y));
544}
545
546////////////////////////////////////////////////////////////////////////////////
547/// Set left hand side of BoundingBox to a value
548/// (resize in x direction on left)
549
551{
553 if (x1 > fX1+fR1) return;
554
555 SetR1((fX1+fR1-x1)*0.5);
556 SetX1(x1 + fR1);
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Set right hand side of BoundingBox to a value
561/// (resize in x direction on right)
562
564{
566 if (x2 < fX1-fR1) return;
567
568 SetR1((x2-fX1+fR1)*0.5);
569 SetX1(x2 - fR1);
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Set top of BoundingBox to a value (resize in y direction on top)
574
576{
578 if (y1 < fY1-fR2) return;
579
580 SetR2((y1-fY1+fR2)*0.5);
581 SetY1(y1 - fR2);
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// Set bottom of BoundingBox to a value
586/// (resize in y direction on bottom)
587
589{
591 if (y2 > fY1+fR2) return;
592
593 SetR2((fY1+fR2-y2)*0.5);
594 SetY1(y2 + fR2);
595}
@ kMouseMotion
Definition Buttons.h:23
@ kArrowKeyRelease
Definition Buttons.h:21
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kArrowKeyPress
Definition Buttons.h:21
@ kButton1Down
Definition Buttons.h:17
#define e(i)
Definition RSha256.hxx:103
cudaEvent_t event
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Version_t
Class version identifier (short)
Definition RtypesCore.h:80
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
constexpr Double_t kPI
Definition TEllipse.cxx:26
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:417
#define gPad
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
Double_t GetYCoord(const Int_t y, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Can return ndc or normal values Also one can specify to use absolute coordinates for input parameter ...
Double_t GetXCoord(const Int_t x, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Return user X coordinate for pixel X value Can return ndc or normal values Also one can specify to us...
Fill Area Attributes class.
Definition TAttFill.h:21
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:32
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition TAttFill.cxx:203
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition TAttFill.h:33
virtual void ModifyOn(TVirtualPad &pad)
Change current fill area attributes on speicifed pad.
Definition TAttFill.cxx:221
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition TAttFill.cxx:240
Line Attributes class.
Definition TAttLine.h:21
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:36
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
virtual void ModifyOn(TVirtualPad &pad)
Change current line attributes on specified pad.
Definition TAttLine.cxx:255
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:37
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition TAttLine.cxx:176
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition TAttLine.cxx:289
void PaintDiamondCorners(TVirtualPad &parent, const char *id="diamond")
Paint diamond corners outline.
Buffer base class used for serializing objects.
Definition TBuffer.h:43
void PaintOutline(TVirtualPad &parent) override
Paint object outline.
Definition TEllipse.cxx:198
TEllipseInteractive(TEllipse *e)
Definition TEllipse.cxx:192
void Apply(TEllipse *e, Bool_t usenew=kTRUE)
Definition TEllipse.cxx:212
Draw Ellipses.
Definition TEllipse.h:25
TClass * IsA() const override
Definition TEllipse.h:86
virtual void SetR1(Double_t r1)
Definition TEllipse.h:72
void ls(Option_t *option="") const override
List this ellipse with its attributes.
Definition TEllipse.cxx:338
friend class TEllipseInteractive
Definition TEllipse.h:27
virtual void SetX1(Double_t x1)
Definition TEllipse.h:75
virtual 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.
Definition TEllipse.cxx:397
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Ellipse.
Definition TEllipse.cxx:541
Double_t GetTheta() const
Definition TEllipse.h:62
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TEllipse.cxx:235
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TEllipse.cxx:575
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition TEllipse.cxx:550
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition TEllipse.cxx:588
@ kNoEdges
Definition TEllipse.h:44
Double_t fPhimax
Maximum angle (degrees)
Definition TEllipse.h:35
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an ellipse.
Definition TEllipse.cxx:134
Double_t fX1
X coordinate of centre.
Definition TEllipse.h:30
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition TEllipse.cxx:563
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition TEllipse.cxx:453
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
Definition TEllipse.cxx:170
Rectangle_t GetBBox() override
Return the bounding Box of the Ellipse, currently not taking into account the rotating angle.
Definition TEllipse.cxx:505
void Paint(Option_t *option="") override
Paint this ellipse with its current attributes.
Definition TEllipse.cxx:347
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:31
Double_t fTheta
Rotation angle (degrees)
Definition TEllipse.h:36
Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside the polygon defined by the ellipse 0 otherwise.
Definition TEllipse.cxx:307
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Ellipse.
Definition TEllipse.cxx:533
Bool_t FillPoints(TVirtualPad &pad, std::vector< Double_t > &x, std::vector< Double_t > &y, Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta)
Fill points which can be used for the painting Return true if full 360 ellipse is created.
Definition TEllipse.cxx:356
virtual void SetY1(Double_t y1)
Definition TEllipse.h:76
~TEllipse() override
Ellipse default destructor.
Definition TEllipse.cxx:88
Double_t fR2
second radius
Definition TEllipse.h:33
void Streamer(TBuffer &) override
Stream an object of class TEllipse.
Definition TEllipse.cxx:472
virtual void SetNoEdges(Bool_t noEdges=kTRUE)
if noEdges = kTRUE the lines connecting the center to the edges will not be drawn.
Definition TEllipse.cxx:463
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Definition TEllipse.cxx:111
Double_t fPhimin
Minimum angle (degrees)
Definition TEllipse.h:34
TPoint GetBBoxCenter() override
Return the center of the Ellipse as TPoint in pixels.
Definition TEllipse.cxx:520
TEllipse()
Ellipse default constructor.
Definition TEllipse.cxx:58
Double_t fR1
first radius
Definition TEllipse.h:32
static TClass * Class()
virtual TEllipse * 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.
Definition TEllipse.cxx:178
virtual void SetR2(Double_t r2)
Definition TEllipse.h:73
void Print(Option_t *option="") const override
Dump this ellipse with its attributes.
Definition TEllipse.cxx:423
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TEllipse.cxx:435
Mother of all ROOT objects.
Definition TObject.h:42
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:461
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
Definition TObject.cxx:995
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:203
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:886
virtual void Copy(TObject &object) const
Copy this to obj.
Definition TObject.cxx:158
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
Definition TObject.cxx:844
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:776
void ResetBit(UInt_t f)
Definition TObject.h:203
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:71
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition TROOT.cxx:3067
Basic string class.
Definition TString.h:137
void ToLower()
Change string to lower-case.
Definition TString.cxx:1190
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2460
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
TObject * GetObject() const
Definition TVirtualPad.h:82
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual void PaintPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="")=0
virtual Double_t GetTheta() const =0
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition TMath.h:659
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:675
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:607
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:601
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition TMath.h:75
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
Rectangle structure (maps to the X11 XRectangle structure)
Definition GuiTypes.h:362
Short_t fX
Definition GuiTypes.h:363