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 <cstdlib>
13
14#include <iostream>
15#include "TROOT.h"
16#include "TBuffer.h"
17#include "TEllipse.h"
18#include "TVirtualPad.h"
19#include "TVirtualPadPainter.h"
20#include "TMath.h"
21#include "TPoint.h"
22#include "TVirtualX.h"
23
24
25constexpr Double_t kPI = TMath::Pi();
26
27
28/** \class TEllipse
29\ingroup BasicGraphics
30
31Draw Ellipses.
32
33The ellipse can be truncated and rotated. It is defined by its center `(x1,y1)`
34and two radius `r1` and `r2`.
35
36A minimum and maximum angle may be specified `(phimin, phimax)`.
37The ellipse may be rotated with an angle `theta`. All these
38angles are in degrees.
39The attributes of the outline line are given via `TAttLine`.
40The attributes of the fill area are given via `TAttFill`.
41The picture below illustrates different types of ellipses.
42
43When an ellipse sector only is drawn, the lines connecting the center
44of the ellipse to the edges are drawn by default. One can specify
45the drawing option "only" to not draw these lines or alternatively
46call the function `SetNoEdges()`. To remove completely the ellipse
47outline it is enough to specify 0 as line style.
48
49Begin_Macro(source)
50../../../tutorials/visualisation/graphics/ellipse.C
51End_Macro
52*/
53
54////////////////////////////////////////////////////////////////////////////////
55/// Ellipse default constructor.
56
58{
59 fX1 = 0;
60 fY1 = 0;
61 fR1 = 1;
62 fR2 = 1;
63 fPhimin = 0;
64 fPhimax = 360;
65 fTheta = 0;
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Ellipse normal constructor.
70
72 :TObject(), TAttLine(), TAttFill(0,1001)
73{
74 fX1 = x1;
75 fY1 = y1;
76 fR1 = r1;
77 fR2 = r2;
80 fTheta = theta;
81 if (r2 <= 0) fR2 = fR1;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Ellipse default destructor.
86
90
91////////////////////////////////////////////////////////////////////////////////
92/// Copy constructor.
93
95{
96 fX1 = 0;
97 fY1 = 0;
98 fR1 = 1;
99 fR2 = 1;
100 fPhimin = 0;
101 fPhimax = 360;
102 fTheta = 0;
103
104 ellipse.TEllipse::Copy(*this);
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Copy this ellipse to ellipse.
109
110void TEllipse::Copy(TObject &obj) const
111{
112 TObject::Copy(obj);
113 TAttLine::Copy(((TEllipse&)obj));
114 TAttFill::Copy(((TEllipse&)obj));
115 ((TEllipse&)obj).fX1 = fX1;
116 ((TEllipse&)obj).fY1 = fY1;
117 ((TEllipse&)obj).fR1 = fR1;
118 ((TEllipse&)obj).fR2 = fR2;
119 ((TEllipse&)obj).fPhimin = fPhimin;
120 ((TEllipse&)obj).fPhimax = fPhimax;
121 ((TEllipse&)obj).fTheta = fTheta;
122}
123
124////////////////////////////////////////////////////////////////////////////////
125/// Compute distance from point px,py to an ellipse.
126///
127/// Compute the closest distance of approach from point px,py to this
128/// ellipse. The distance is computed in pixels units.
129///
130/// In case of a filled ellipse the distance returned is 0 if the point
131/// (px,py) is inside the ellipse, and is huge if the point is outside.
132
134{
135 if (!gPad) return 9999;
136 Double_t x = gPad->PadtoX(gPad->AbsPixeltoX(px));
137 Double_t y = gPad->PadtoY(gPad->AbsPixeltoY(py));
138
139 Double_t dxnr = x - fX1;
140 Double_t dynr = y - fY1;
141
142 Double_t ct = TMath::Cos(kPI*GetTheta()/180.0);
143 Double_t st = TMath::Sin(kPI*GetTheta()/180.0);
144
145 Double_t dx = dxnr*ct + dynr*st;
146 Double_t dy = -dxnr*st + dynr*ct;
147
148 Double_t r1 = fR1;
149 Double_t r2 = fR2;
150
151 if (dx == 0 || r1 == 0 || r2 == 0) return 9999;
153
154 Double_t tana = dy/dx;
155 tana *= tana;
156 Double_t distr = TMath::Sqrt((1+tana)/(1.0/(r1*r1) + tana/(r2*r2)));
157 Int_t dist = 9999;
158 if (GetFillColor() && GetFillStyle()) {
159 if (distr > distp) dist = 0;
160 } else {
161 if (TMath::Abs(distr-distp)/(r1+r2) < 0.01) dist = 0;
162 }
163 return dist;
164}
165
166////////////////////////////////////////////////////////////////////////////////
167/// Draw this ellipse with its current attributes.
168
173
174////////////////////////////////////////////////////////////////////////////////
175/// Draw this ellipse with new coordinates.
176
187
188////////////////////////////////////////////////////////////////////////////////
189/// Execute action corresponding to one event.
190///
191/// This member function is called when a line is clicked with the locator
192///
193/// If Left button clicked on one of the line end points, this point
194/// follows the cursor until button is released.
195///
196/// if Middle button clicked, the line is moved parallel to itself
197/// until the button is released.
198///
199/// NOTE that support for log scale is not implemented
200
202{
203 if (!gPad || !gPad->IsEditable()) return;
204
205 auto &parent = *gPad;
206
207 constexpr Int_t kMaxDiff = 10;
208
209 static enum { pNone, pTop, pL, pR, pBot, pINSIDE } mode = pNone;
210 static Int_t sdx = 0, sdy = 0;
211 static Double_t oldX1, oldY1, oldR1, oldR2;
212 static Bool_t first_move = kTRUE;
213
214 auto paint_hollow = [this,&parent]() {
215 auto pp = parent.GetPainter();
216 pp->SetAttLine(*this);
217 std::vector<Double_t> x, y;
218 FillPoints(parent, x, y, GetX1(), GetY1(), GetR1(), GetR2(), GetPhimin(), GetPhimax(), GetTheta());
219 pp->DrawPolyLine(x.size(), x.data(), y.data());
220 pp->SetAttMarker({GetLineColor(), 25, 2});
221 Double_t xm[4] = { GetX1(), GetX1(), GetX1() - GetR1(), GetX1() + GetR1() };
222 Double_t ym[4] = { GetY1() + GetR2(), GetY1() - GetR2(), GetY1(), GetY1() };
223 for (Int_t i = 0; i < 4; ++i) {
224 xm[i] = parent.XtoPad(xm[i]);
225 ym[i] = parent.YtoPad(ym[i]);
226 }
227 pp->DrawPolyMarker(4, xm, ym);
228 };
229
230 auto changeX = [this](Int_t px1, Int_t px2) {
231 auto x1 = GetXCoord(px1, kFALSE, kTRUE);
232 auto x2 = GetXCoord(px2, kFALSE, kTRUE);
233 SetX1((x1 + x2) * 0.5);
234 SetR1(TMath::Abs((x2 - x1) * 0.5));
235 if (x2 < x1)
236 mode = (mode == pL) ? pR : pL;
237 };
238
239 auto changeY = [this](Int_t py1, Int_t py2) {
240 auto y1 = GetYCoord(py1, kFALSE, kTRUE);
241 auto y2 = GetYCoord(py2, kFALSE, kTRUE);
242 SetY1((y1 + y2) * 0.5);
243 SetR2(TMath::Abs((y1 - y2) * 0.5));
244 if (y1 < y2)
245 mode = (mode == pTop) ? pBot : pTop;
246 };
247
248 Bool_t opaque = parent.OpaqueMoving();
249 Int_t px1 = parent.XtoAbsPixel(parent.XtoPad(GetX1()));
250 Int_t py1 = parent.YtoAbsPixel(parent.YtoPad(GetY1()));
251 Int_t pLx = parent.XtoAbsPixel(parent.XtoPad(GetX1() - GetR1()));
252 Int_t pRx = parent.XtoAbsPixel(parent.XtoPad(GetX1() + GetR1()));
253 Int_t pBy = parent.YtoAbsPixel(parent.YtoPad(GetY1() - GetR2()));
254 Int_t pTy = parent.YtoAbsPixel(parent.YtoPad(GetY1() + GetR2()));
255
256 switch (event) {
257
258 case kArrowKeyPress:
259 case kButton1Down:
260 oldX1 = GetX1();
261 oldY1 = GetY1();
262 oldR1 = GetR1();
263 oldR2 = GetR2();
264
265 sdx = px1 - px;
266 sdy = py1 - py;
267
268 // No break !!!
269
270 case kMouseMotion: {
271 mode = pNone;
272 if ((TMath::Abs(px - px1) < kMaxDiff) && (TMath::Abs(py - pTy) < kMaxDiff)) {
273 mode = pTop; // top edge
274 parent.SetCursor(kTopSide);
275 } else if ((TMath::Abs(px - px1) < kMaxDiff) && (TMath::Abs(py - pBy) < kMaxDiff)) {
276 mode = pBot; // bottom edge
277 parent.SetCursor(kBottomSide);
278 } else if ((TMath::Abs(py - py1) < kMaxDiff) && (TMath::Abs(px - pLx) < kMaxDiff)) {
279 mode = pL; // left edge
280 parent.SetCursor(kLeftSide);
281 } else if ((TMath::Abs(py - py1) < kMaxDiff) && (TMath::Abs(px - pRx) < kMaxDiff)) {
282 mode = pR; // right edge
283 parent.SetCursor(kRightSide);
284 } else {
285 mode = pINSIDE;
286 parent.SetCursor(kMove);
287 }
289 break;
290 }
291
292 case kArrowKeyRelease:
293 case kButton1Motion: {
294 if (mode == pNone)
295 break;
296 if (!opaque && !first_move)
297 paint_hollow();
298 char guide = 'i';
299 switch (mode) {
300 case pNone:
301 break;
302 case pL:
303 changeX(px, pRx);
304 guide = 'l';
305 break;
306 case pR:
307 changeX(pLx, px);
308 guide = 'r';
309 break;
310 case pTop:
311 changeY(py, pBy);
312 guide = 't';
313 break;
314 case pBot:
315 changeY(pTy, py);
316 guide = 'b';
317 break;
318 case pINSIDE:
319 SetX1(GetXCoord(px + sdx, kFALSE, kTRUE));
320 SetY1(GetYCoord(py + sdy, kFALSE, kTRUE));
321 guide = 'i';
322 break;
323 }
325 if (opaque) {
326 parent.ShowGuidelines(this, event, guide, true);
327 parent.ModifiedUpdate();
328 } else
329 paint_hollow();
330 break;
331 }
332
333 case kButton1Up:
334 if (gROOT->IsEscaped()) {
335 gROOT->SetEscape(kFALSE);
336 if (opaque) {
337 parent.ShowGuidelines(this, event);
338 SetX1(oldX1);
339 SetY1(oldY1);
340 SetR1(oldR1);
341 SetR2(oldR2);
342 parent.ModifiedUpdate();
343 }
344 break;
345 }
346
347 if (opaque)
348 parent.ShowGuidelines(this, event);
349 else
350 parent.Modified(kTRUE);
351 mode = pNone;
352 }
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Return 1 if the point (x,y) is inside the polygon defined by
357/// the ellipse 0 otherwise.
358/// Author: Ole Hansen (ole@jlab.org)
360{
361 x -= fX1;
362 y -= fY1;
364 Double_t st = TMath::Sin(th);
365 Double_t ct = TMath::Cos(th);
366 Double_t xx = ct * x + st * y;
367 Double_t yy = -st * x + ct * y;
368
369 if (TMath::Abs(xx) > fR1 || TMath::Abs(yy) > fR2)
370 return 0;
371 Double_t xn = xx / fR1;
372 Double_t yn = yy / fR2;
373 if (xn * xn + yn * yn > 1.)
374 return 0;
375 if (fPhimax - fPhimin >= 360.)
376 return 1;
377 Double_t phimin = std::fmod(fPhimin, 360.);
378 Double_t phimax = std::fmod(fPhimax, 360.);
381 return 0;
382
383 return 1;
384}
385
386
387////////////////////////////////////////////////////////////////////////////////
388/// List this ellipse with its attributes.
389
391{
393 printf("%s: X1= %f Y1=%f R1=%f R2=%f\n",GetName(),fX1,fY1,fR1,fR2);
394}
395
396////////////////////////////////////////////////////////////////////////////////
397/// Paint this ellipse with its current attributes.
398
403
404////////////////////////////////////////////////////////////////////////////////
405/// Fill points which can be used for the painting
406/// Return true if full 360 ellipse is created
407
408Bool_t TEllipse::FillPoints(TVirtualPad &pad, std::vector<Double_t> &x, std::vector<Double_t> &y,
410{
411 const Int_t np = 200;
412
415
416 //set number of points approximatively proportional to the ellipse circumference
417 Double_t circ = kPI*(r1+r2)*(phi2-phi1)/360;
418 Int_t n = (Int_t)(np*circ/((pad.GetX2() - pad.GetX1())+(pad.GetY2()-pad.GetY1())));
419 Bool_t full_circle = phi2-phi1 >= 360;
420 n = TMath::Min(np, TMath::Max(n, (Int_t) (full_circle ? 36 : 8)));
421
422 x.resize(n + (full_circle ? 1 : 3));
423 y.resize(n + (full_circle ? 1 : 3));
424
425 Double_t dphi = (phi2-phi1)*kPI/(180*n);
426 Double_t ct = TMath::Cos(kPI*theta/180);
427 Double_t st = TMath::Sin(kPI*theta/180);
428 for (Int_t i = 0; i <= n; i++) {
429 Double_t angle = phi1*kPI/180 + i*dphi;
432 x[i] = pad.XtoPad(x1 + dx*ct - dy*st);
433 y[i] = pad.YtoPad(y1 + dx*st + dy*ct);
434 }
435 if (!full_circle) {
436 x[n+1] = pad.XtoPad(x1);
437 y[n+1] = pad.YtoPad(y1);
438 x[n+2] = x[0];
439 y[n+2] = y[0];
440 }
441
442 return full_circle;
443}
444
445
446////////////////////////////////////////////////////////////////////////////////
447/// Draw this ellipse with new coordinates.
448
452{
453 if (!gPad) return;
454
455 std::vector<Double_t> x, y;
456 Bool_t full_circle = FillPoints(*gPad, x, y, x1, y1, r1, r2, phimin, phimax, theta);
457
458 TAttFill::ModifyOn(*gPad); //Change fill attributes only if necessary
459 TAttLine::ModifyOn(*gPad); //Change line attributes only if necessary
460
461 if (GetFillStyle() > 0)
462 gPad->PaintFillArea(x.size() - 1, x.data(), y.data());
463
464 if (GetLineStyle() > 0) {
465 TString opt = option;
466 opt.ToLower();
467 Bool_t less_points = !full_circle && (TestBit(kNoEdges) || opt.Contains("only"));
468 gPad->PaintPolyLine(x.size() - (less_points ? 2 : 0), x.data(), y.data());
469 }
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Dump this ellipse with its attributes.
474
476{
477 printf("Ellipse: X1=%f Y1=%f R1=%f R2=%f",fX1,fY1,fR1,fR2);
478 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
479 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
480 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
481 printf("\n");
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Save primitive as a C++ statement(s) on output stream out
486
487void TEllipse::SavePrimitive(std::ostream &out, Option_t *option)
488{
490 out, Class(), "ellipse",
491 TString::Format("%g, %g, %g, %g, %g, %g, %g", fX1, fY1, fR1, fR2, fPhimin, fPhimax, fTheta));
492
493 SaveFillAttributes(out, "ellipse", 0, 1001);
494 SaveLineAttributes(out, "ellipse", 1, 1, 1);
495
496 if (GetNoEdges())
497 out << " ellipse->SetNoEdges();\n";
498
499 SavePrimitiveDraw(out, "ellipse", option);
500}
501
502////////////////////////////////////////////////////////////////////////////////
503/// Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
504
506{
507 return TestBit(kNoEdges) ? kTRUE : kFALSE;
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// if noEdges = kTRUE the lines connecting the center to the edges
512/// will not be drawn.
513/// default is to draw the edges.
514
520
521////////////////////////////////////////////////////////////////////////////////
522/// Stream an object of class TEllipse.
523
525{
526 if (R__b.IsReading()) {
528 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
529 if (R__v > 1) {
530 R__b.ReadClassBuffer(TEllipse::Class(), this, R__v, R__s, R__c);
531 return;
532 }
533 //====process old versions before automatic schema evolution
537 Float_t x1,y1,r1,r2,phimin,phimax,theta;
538 R__b >> x1; fX1 = x1;
539 R__b >> y1; fY1 = y1;
540 R__b >> r1; fR1 = r1;
541 R__b >> r2; fR2 = r2;
544 R__b >> theta; fTheta = theta;
545 R__b.CheckByteCount(R__s, R__c, TEllipse::IsA());
546 //====end of old versions
547
548 } else {
549 R__b.WriteClassBuffer(TEllipse::Class(),this);
550 }
551}
552
553////////////////////////////////////////////////////////////////////////////////
554/// Return the bounding Box of the Ellipse, currently not taking into
555/// account the rotating angle.
556
558{
559 Rectangle_t BBox{0, 0, 0, 0};
560 if (gPad) {
561 BBox.fX = gPad->XtoPixel(fX1 - fR1);
562 BBox.fY = gPad->YtoPixel(fY1 + fR2);
563 BBox.fWidth = gPad->XtoPixel(fX1 + fR1) - gPad->XtoPixel(fX1 - fR1);
564 BBox.fHeight = gPad->YtoPixel(fY1 - fR2) - gPad->YtoPixel(fY1 + fR2);
565 }
566 return BBox;
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Return the center of the Ellipse as TPoint in pixels
571
573{
574 TPoint p(0, 0);
575 if (gPad) {
576 p.SetX(gPad->XtoPixel(fX1));
577 p.SetY(gPad->YtoPixel(fY1));
578 }
579 return p;
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Set X coordinate of the center of the Ellipse
584
586{
587 SetX1(GetXCoord(x));
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Set Y coordinate of the center of the Ellipse
592
594{
595 SetY1(GetYCoord(y));
596}
597
598////////////////////////////////////////////////////////////////////////////////
599/// Set left hand side of BoundingBox to a value
600/// (resize in x direction on left)
601
603{
605 if (x1 > fX1+fR1) return;
606
607 SetR1((fX1+fR1-x1)*0.5);
608 SetX1(x1 + fR1);
609}
610
611////////////////////////////////////////////////////////////////////////////////
612/// Set right hand side of BoundingBox to a value
613/// (resize in x direction on right)
614
616{
618 if (x2 < fX1-fR1) return;
619
620 SetR1((x2-fX1+fR1)*0.5);
621 SetX1(x2 - fR1);
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Set top of BoundingBox to a value (resize in y direction on top)
626
628{
630 if (y1 < fY1-fR2) return;
631
632 SetR2((y1-fY1+fR2)*0.5);
633 SetY1(y1 - fR2);
634}
635
636////////////////////////////////////////////////////////////////////////////////
637/// Set bottom of BoundingBox to a value
638/// (resize in y direction on bottom)
639
641{
643 if (y2 > fY1+fR2) return;
644
645 SetR2((fY1+fR2-y2)*0.5);
646 SetY1(y2 + fR2);
647}
@ 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
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
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:25
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:390
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:449
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Ellipse.
Definition TEllipse.cxx:593
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:201
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TEllipse.cxx:627
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:602
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:640
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:133
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:615
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition TEllipse.cxx:505
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
Definition TEllipse.cxx:169
Rectangle_t GetBBox() override
Return the bounding Box of the Ellipse, currently not taking into account the rotating angle.
Definition TEllipse.cxx:557
void Paint(Option_t *option="") override
Paint this ellipse with its current attributes.
Definition TEllipse.cxx:399
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:359
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Ellipse.
Definition TEllipse.cxx:585
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:408
virtual void SetY1(Double_t y1)
Definition TEllipse.h:73
~TEllipse() override
Ellipse default destructor.
Definition TEllipse.cxx:87
Double_t fR2
second radius
Definition TEllipse.h:30
void Streamer(TBuffer &) override
Stream an object of class TEllipse.
Definition TEllipse.cxx:524
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:515
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Definition TEllipse.cxx:110
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:572
TEllipse()
Ellipse default constructor.
Definition TEllipse.cxx:57
Double_t fR1
first radius
Definition TEllipse.h:29
static TClass * Class()
@ kNoEdges
Definition TEllipse.h:41
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:177
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:475
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TEllipse.cxx:487
Mother of all ROOT objects.
Definition TObject.h:42
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:462
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:997
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:204
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:888
virtual void Copy(TObject &object) const
Copy this to obj.
Definition TObject.cxx:159
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:845
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:777
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:3052
Basic string class.
Definition TString.h:138
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:2385
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:641
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:657
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:673
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:605
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:599
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