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 "TVirtualPadPainter.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////////////////////////////////////////////////////////////////////////////////
190/// Execute action corresponding to one event.
191///
192/// This member function is called when a line is clicked with the locator
193///
194/// If Left button clicked on one of the line end points, this point
195/// follows the cursor until button is released.
196///
197/// if Middle button clicked, the line is moved parallel to itself
198/// until the button is released.
199///
200/// NOTE that support for log scale is not implemented
201
203{
204 if (!gPad || !gPad->IsEditable()) return;
205
206 auto &parent = *gPad;
207
208 constexpr Int_t kMaxDiff = 10;
209
210 static enum { pNone, pTop, pL, pR, pBot, pINSIDE } mode = pNone;
211 static Int_t sdx = 0, sdy = 0;
212 static Double_t oldX1, oldY1, oldR1, oldR2;
213 static Bool_t first_move = kTRUE;
214
215 auto paint_hollow = [this,&parent]() {
216 auto pp = parent.GetPainter();
217 pp->SetAttLine(*this);
218 std::vector<Double_t> x, y;
219 FillPoints(parent, x, y, GetX1(), GetY1(), GetR1(), GetR2(), GetPhimin(), GetPhimax(), GetTheta());
220 pp->DrawPolyLine(x.size(), x.data(), y.data());
221 pp->SetAttMarker({GetLineColor(), 25, 2});
222 Double_t xm[4] = { GetX1(), GetX1(), GetX1() - GetR1(), GetX1() + GetR1() };
223 Double_t ym[4] = { GetY1() + GetR2(), GetY1() - GetR2(), GetY1(), GetY1() };
224 for (Int_t i = 0; i < 4; ++i) {
225 xm[i] = parent.XtoPad(xm[i]);
226 ym[i] = parent.YtoPad(ym[i]);
227 }
228 pp->DrawPolyMarker(4, xm, ym);
229 };
230
231 auto changeX = [this](Int_t px1, Int_t px2) {
232 auto x1 = GetXCoord(px1, kFALSE, kTRUE);
233 auto x2 = GetXCoord(px2, kFALSE, kTRUE);
234 SetX1((x1 + x2) * 0.5);
235 SetR1(TMath::Abs((x2 - x1) * 0.5));
236 if (x2 < x1)
237 mode = (mode == pL) ? pR : pL;
238 };
239
240 auto changeY = [this](Int_t py1, Int_t py2) {
241 auto y1 = GetYCoord(py1, kFALSE, kTRUE);
242 auto y2 = GetYCoord(py2, kFALSE, kTRUE);
243 SetY1((y1 + y2) * 0.5);
244 SetR2(TMath::Abs((y1 - y2) * 0.5));
245 if (y1 < y2)
246 mode = (mode == pTop) ? pBot : pTop;
247 };
248
249 Bool_t opaque = parent.OpaqueMoving();
250 Int_t px1 = parent.XtoAbsPixel(parent.XtoPad(GetX1()));
251 Int_t py1 = parent.YtoAbsPixel(parent.YtoPad(GetY1()));
252 Int_t pLx = parent.XtoAbsPixel(parent.XtoPad(GetX1() - GetR1()));
253 Int_t pRx = parent.XtoAbsPixel(parent.XtoPad(GetX1() + GetR1()));
254 Int_t pBy = parent.YtoAbsPixel(parent.YtoPad(GetY1() - GetR2()));
255 Int_t pTy = parent.YtoAbsPixel(parent.YtoPad(GetY1() + GetR2()));
256
257 switch (event) {
258
259 case kArrowKeyPress:
260 case kButton1Down:
261 oldX1 = GetX1();
262 oldY1 = GetY1();
263 oldR1 = GetR1();
264 oldR2 = GetR2();
265
266 sdx = px1 - px;
267 sdy = py1 - py;
268
269 // No break !!!
270
271 case kMouseMotion: {
272 mode = pNone;
273 if ((TMath::Abs(px - px1) < kMaxDiff) && (TMath::Abs(py - pTy) < kMaxDiff)) {
274 mode = pTop; // top edge
275 parent.SetCursor(kTopSide);
276 } else if ((TMath::Abs(px - px1) < kMaxDiff) && (TMath::Abs(py - pBy) < kMaxDiff)) {
277 mode = pBot; // bottom edge
278 parent.SetCursor(kBottomSide);
279 } else if ((TMath::Abs(py - py1) < kMaxDiff) && (TMath::Abs(px - pLx) < kMaxDiff)) {
280 mode = pL; // left edge
281 parent.SetCursor(kLeftSide);
282 } else if ((TMath::Abs(py - py1) < kMaxDiff) && (TMath::Abs(px - pRx) < kMaxDiff)) {
283 mode = pR; // right edge
284 parent.SetCursor(kRightSide);
285 } else {
286 mode = pINSIDE;
287 parent.SetCursor(kMove);
288 }
290 break;
291 }
292
293 case kArrowKeyRelease:
294 case kButton1Motion: {
295 if (mode == pNone)
296 break;
297 if (!opaque && !first_move)
298 paint_hollow();
299 char guide = 'i';
300 switch (mode) {
301 case pNone:
302 break;
303 case pL:
304 changeX(px, pRx);
305 guide = 'l';
306 break;
307 case pR:
308 changeX(pLx, px);
309 guide = 'r';
310 break;
311 case pTop:
312 changeY(py, pBy);
313 guide = 't';
314 break;
315 case pBot:
316 changeY(pTy, py);
317 guide = 'b';
318 break;
319 case pINSIDE:
320 SetX1(GetXCoord(px + sdx, kFALSE, kTRUE));
321 SetY1(GetYCoord(py + sdy, kFALSE, kTRUE));
322 guide = 'i';
323 break;
324 }
326 if (opaque) {
327 parent.ShowGuidelines(this, event, guide, true);
328 parent.ModifiedUpdate();
329 } else
330 paint_hollow();
331 break;
332 }
333
334 case kButton1Up:
335 if (gROOT->IsEscaped()) {
336 gROOT->SetEscape(kFALSE);
337 if (opaque) {
338 parent.ShowGuidelines(this, event);
339 SetX1(oldX1);
340 SetY1(oldY1);
341 SetR1(oldR1);
342 SetR2(oldR2);
343 parent.ModifiedUpdate();
344 }
345 break;
346 }
347
348 if (opaque)
349 parent.ShowGuidelines(this, event);
350 else
351 parent.Modified(kTRUE);
352 mode = pNone;
353 }
354}
355
356////////////////////////////////////////////////////////////////////////////////
357/// Return 1 if the point (x,y) is inside the polygon defined by
358/// the ellipse 0 otherwise.
359/// Author: Ole Hansen (ole@jlab.org)
361{
362 x -= fX1;
363 y -= fY1;
367 Double_t xx = ct * x + st * y;
368 Double_t yy = -st * x + ct * y;
369
370 if (TMath::Abs(xx) > fR1 || TMath::Abs(yy) > fR2)
371 return 0;
372 Double_t xn = xx / fR1;
373 Double_t yn = yy / fR2;
374 if (xn * xn + yn * yn > 1.)
375 return 0;
376 if (fPhimax - fPhimin >= 360.)
377 return 1;
378 Double_t phimin = std::fmod(fPhimin, 360.);
379 Double_t phimax = std::fmod(fPhimax, 360.);
382 return 0;
383
384 return 1;
385}
386
387
388////////////////////////////////////////////////////////////////////////////////
389/// List this ellipse with its attributes.
390
392{
394 printf("%s: X1= %f Y1=%f R1=%f R2=%f\n",GetName(),fX1,fY1,fR1,fR2);
395}
396
397////////////////////////////////////////////////////////////////////////////////
398/// Paint this ellipse with its current attributes.
399
404
405////////////////////////////////////////////////////////////////////////////////
406/// Fill points which can be used for the painting
407/// Return true if full 360 ellipse is created
408
409Bool_t TEllipse::FillPoints(TVirtualPad &pad, std::vector<Double_t> &x, std::vector<Double_t> &y,
411{
412 const Int_t np = 200;
413
416
417 //set number of points approximatively proportional to the ellipse circumference
418 Double_t circ = kPI*(r1+r2)*(phi2-phi1)/360;
419 Int_t n = (Int_t)(np*circ/((pad.GetX2() - pad.GetX1())+(pad.GetY2()-pad.GetY1())));
420 Bool_t full_circle = phi2-phi1 >= 360;
421 n = TMath::Min(np, TMath::Max(n, (Int_t) (full_circle ? 36 : 8)));
422
423 x.resize(n + (full_circle ? 1 : 3));
424 y.resize(n + (full_circle ? 1 : 3));
425
426 Double_t dphi = (phi2-phi1)*kPI/(180*n);
427 Double_t ct = TMath::Cos(kPI*theta/180);
428 Double_t st = TMath::Sin(kPI*theta/180);
429 for (Int_t i = 0; i <= n; i++) {
430 Double_t angle = phi1*kPI/180 + i*dphi;
433 x[i] = pad.XtoPad(x1 + dx*ct - dy*st);
434 y[i] = pad.YtoPad(y1 + dx*st + dy*ct);
435 }
436 if (!full_circle) {
437 x[n+1] = pad.XtoPad(x1);
438 y[n+1] = pad.YtoPad(y1);
439 x[n+2] = x[0];
440 y[n+2] = y[0];
441 }
442
443 return full_circle;
444}
445
446
447////////////////////////////////////////////////////////////////////////////////
448/// Draw this ellipse with new coordinates.
449
453{
454 if (!gPad) return;
455
456 std::vector<Double_t> x, y;
457 Bool_t full_circle = FillPoints(*gPad, x, y, x1, y1, r1, r2, phimin, phimax, theta);
458
459 TAttFill::ModifyOn(*gPad); //Change fill attributes only if necessary
460 TAttLine::ModifyOn(*gPad); //Change line attributes only if necessary
461
462 if (GetFillStyle() > 0)
463 gPad->PaintFillArea(x.size() - 1, x.data(), y.data());
464
465 if (GetLineStyle() > 0) {
466 TString opt = option;
467 opt.ToLower();
468 Bool_t less_points = !full_circle && (TestBit(kNoEdges) || opt.Contains("only"));
469 gPad->PaintPolyLine(x.size() - (less_points ? 2 : 0), x.data(), y.data());
470 }
471}
472
473////////////////////////////////////////////////////////////////////////////////
474/// Dump this ellipse with its attributes.
475
477{
478 printf("Ellipse: X1=%f Y1=%f R1=%f R2=%f",fX1,fY1,fR1,fR2);
479 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
480 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
481 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
482 printf("\n");
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Save primitive as a C++ statement(s) on output stream out
487
488void TEllipse::SavePrimitive(std::ostream &out, Option_t *option)
489{
491 out, Class(), "ellipse",
492 TString::Format("%g, %g, %g, %g, %g, %g, %g", fX1, fY1, fR1, fR2, fPhimin, fPhimax, fTheta));
493
494 SaveFillAttributes(out, "ellipse", 0, 1001);
495 SaveLineAttributes(out, "ellipse", 1, 1, 1);
496
497 if (GetNoEdges())
498 out << " ellipse->SetNoEdges();\n";
499
500 SavePrimitiveDraw(out, "ellipse", option);
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
505
507{
508 return TestBit(kNoEdges) ? kTRUE : kFALSE;
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// if noEdges = kTRUE the lines connecting the center to the edges
513/// will not be drawn.
514/// default is to draw the edges.
515
521
522////////////////////////////////////////////////////////////////////////////////
523/// Stream an object of class TEllipse.
524
526{
527 if (R__b.IsReading()) {
529 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
530 if (R__v > 1) {
531 R__b.ReadClassBuffer(TEllipse::Class(), this, R__v, R__s, R__c);
532 return;
533 }
534 //====process old versions before automatic schema evolution
538 Float_t x1,y1,r1,r2,phimin,phimax,theta;
539 R__b >> x1; fX1 = x1;
540 R__b >> y1; fY1 = y1;
541 R__b >> r1; fR1 = r1;
542 R__b >> r2; fR2 = r2;
545 R__b >> theta; fTheta = theta;
546 R__b.CheckByteCount(R__s, R__c, TEllipse::IsA());
547 //====end of old versions
548
549 } else {
550 R__b.WriteClassBuffer(TEllipse::Class(),this);
551 }
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Return the bounding Box of the Ellipse, currently not taking into
556/// account the rotating angle.
557
559{
560 Rectangle_t BBox{0, 0, 0, 0};
561 if (gPad) {
562 BBox.fX = gPad->XtoPixel(fX1 - fR1);
563 BBox.fY = gPad->YtoPixel(fY1 + fR2);
564 BBox.fWidth = gPad->XtoPixel(fX1 + fR1) - gPad->XtoPixel(fX1 - fR1);
565 BBox.fHeight = gPad->YtoPixel(fY1 - fR2) - gPad->YtoPixel(fY1 + fR2);
566 }
567 return BBox;
568}
569
570////////////////////////////////////////////////////////////////////////////////
571/// Return the center of the Ellipse as TPoint in pixels
572
574{
575 TPoint p(0, 0);
576 if (gPad) {
577 p.SetX(gPad->XtoPixel(fX1));
578 p.SetY(gPad->YtoPixel(fY1));
579 }
580 return p;
581}
582
583////////////////////////////////////////////////////////////////////////////////
584/// Set X coordinate of the center of the Ellipse
585
587{
588 SetX1(GetXCoord(x));
589}
590
591////////////////////////////////////////////////////////////////////////////////
592/// Set Y coordinate of the center of the Ellipse
593
595{
596 SetY1(GetYCoord(y));
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Set left hand side of BoundingBox to a value
601/// (resize in x direction on left)
602
604{
606 if (x1 > fX1+fR1) return;
607
608 SetR1((fX1+fR1-x1)*0.5);
609 SetX1(x1 + fR1);
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Set right hand side of BoundingBox to a value
614/// (resize in x direction on right)
615
617{
619 if (x2 < fX1-fR1) return;
620
621 SetR1((x2-fX1+fR1)*0.5);
622 SetX1(x2 - fR1);
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Set top of BoundingBox to a value (resize in y direction on top)
627
629{
631 if (y1 < fY1-fR2) return;
632
633 SetR2((y1-fY1+fR2)*0.5);
634 SetY1(y1 - fR2);
635}
636
637////////////////////////////////////////////////////////////////////////////////
638/// Set bottom of BoundingBox to a value
639/// (resize in y direction on bottom)
640
642{
644 if (y2 > fY1+fR2) return;
645
646 SetR2((fY1+fR2-y2)*0.5);
647 SetY1(y2 + fR2);
648}
@ 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
@ kRightSide
Definition GuiTypes.h:374
@ kBottomSide
Definition GuiTypes.h:374
@ kTopSide
Definition GuiTypes.h:374
@ kLeftSide
Definition GuiTypes.h:374
@ kMove
Definition GuiTypes.h:375
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 mode
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
Buffer base class used for serializing objects.
Definition TBuffer.h:43
Draw Ellipses.
Definition TEllipse.h:24
TClass * IsA() const override
Definition TEllipse.h:83
virtual void SetR1(Double_t r1)
Definition TEllipse.h:69
void ls(Option_t *option="") const override
List this ellipse with its attributes.
Definition TEllipse.cxx:391
virtual void SetX1(Double_t x1)
Definition TEllipse.h:72
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:450
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Ellipse.
Definition TEllipse.cxx:594
Double_t GetTheta() const
Definition TEllipse.h:59
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TEllipse.cxx:202
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TEllipse.cxx:628
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:603
Double_t GetPhimax() const
Definition TEllipse.h:58
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition TEllipse.cxx:641
@ kNoEdges
Definition TEllipse.h:41
Double_t GetX1() const
Definition TEllipse.h:53
Double_t fPhimax
Maximum angle (degrees)
Definition TEllipse.h:32
Double_t GetPhimin() const
Definition TEllipse.h:57
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:27
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:616
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition TEllipse.cxx:506
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:558
void Paint(Option_t *option="") override
Paint this ellipse with its current attributes.
Definition TEllipse.cxx:400
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:28
Double_t fTheta
Rotation angle (degrees)
Definition TEllipse.h:33
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:360
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Ellipse.
Definition TEllipse.cxx:586
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:409
virtual void SetY1(Double_t y1)
Definition TEllipse.h:73
~TEllipse() override
Ellipse default destructor.
Definition TEllipse.cxx:88
Double_t fR2
second radius
Definition TEllipse.h:30
void Streamer(TBuffer &) override
Stream an object of class TEllipse.
Definition TEllipse.cxx:525
Double_t GetR2() const
Definition TEllipse.h:56
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:516
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Definition TEllipse.cxx:111
Double_t GetR1() const
Definition TEllipse.h:55
Double_t fPhimin
Minimum angle (degrees)
Definition TEllipse.h:31
Double_t GetY1() const
Definition TEllipse.h:54
TPoint GetBBoxCenter() override
Return the center of the Ellipse as TPoint in pixels.
Definition TEllipse.cxx:573
TEllipse()
Ellipse default constructor.
Definition TEllipse.cxx:58
Double_t fR1
first radius
Definition TEllipse.h:29
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:70
void Print(Option_t *option="") const override
Dump this ellipse with its attributes.
Definition TEllipse.cxx:476
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TEllipse.cxx:488
Mother of all ROOT objects.
Definition TObject.h:42
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:460
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:994
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:202
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:885
virtual void Copy(TObject &object) const
Copy this to obj.
Definition TObject.cxx:157
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:843
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:775
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:1189
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:2459
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
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