80 if (r2 <= 0) fR2 = fR1;
103 ellipse.TEllipse::Copy(*
this);
134 if (!
gPad)
return 9999;
150 if (dx == 0 || r1 == 0 || r2 == 0)
return 9999;
158 if (distr > distp)
dist = 0;
208 static Int_t px1,py1,npe,r1,r2,sav1,sav2;
209 const Int_t kMinSize = 25;
211 static Bool_t pTop, pL, pR, pBot, pINSIDE;
212 static Int_t pTx,pTy,pLx,pLy,pRx,pRy,pBx,pBy;
214 static Int_t pxold, pyold;
215 static Int_t sig,impair;
217 static Double_t oldX1, oldY1, oldR1, oldR2;
221 if (!
gPad->IsEditable())
return;
238 x[i] =
gPad->XtoAbsPixel(
fX1 + dx*ct - dy*st);
239 y[i] =
gPad->YtoAbsPixel(
fY1 + dx*st + dy*ct);
266 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
267 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
268 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
269 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
270 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
271 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
272 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
273 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
274 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
275 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
276 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
277 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
278 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
279 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
280 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
281 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
284 sdx = this->
GetX1()-
gPad->AbsPixeltoX(px);
285 sdy = this->
GetY1()-
gPad->AbsPixeltoY(py);
298 pTop = pL = pR = pBot = pINSIDE =
kFALSE;
323 pxold = px; pyold = py;
331 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
332 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
333 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
334 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
335 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
336 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
337 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
338 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
339 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
340 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
341 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
342 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
343 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
344 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
345 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
346 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
347 for (i=0;i<npe;i++)
gVirtualX->DrawLine(
x[i],
y[i],
x[i+1],
y[i+1]);
352 py1 += (py - pyold)/2;
353 r2 -= (py - pyold)/2;
355 if (py-pyold>0) sig=+1;
357 if (impair==2) { impair = 0; py1 += sig; r2 -= sig;}
358 if (py1 > pBy-kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
363 py1 += (py - pyold)/2;
364 r2 += (py - pyold)/2;
366 if (py-pyold>0) sig=+1;
368 if (impair==2) { impair = 0; py1 += sig; r2 += sig;}
369 if (py1 < pTy+kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
374 px1 += (px - pxold)/2;
375 r1 -= (px - pxold)/2;
377 if (px-pxold>0) sig=+1;
379 if (impair==2) { impair = 0; px1 += sig; r1 -= sig;}
380 if (px1 > pRx-kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
385 px1 += (px - pxold)/2;
386 r1 += (px - pxold)/2;
388 if (px-pxold>0) sig=+1;
390 if (impair==2) { impair = 0; px1 += sig; r1 += sig;}
391 if (px1 < pLx+kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
393 if (pTop || pBot || pL || pR) {
402 x[i] = px1 +
Int_t(dx*ct - dy*st);
403 y[i] = py1 +
Int_t(dx*st + dy*ct);
427 if (pTop)
gPad->ShowGuidelines(
this, event,
't',
true);
428 if (pBot)
gPad->ShowGuidelines(
this, event,
'b',
true);
429 if (pL)
gPad->ShowGuidelines(
this, event,
'l',
true);
430 if (pR)
gPad->ShowGuidelines(
this, event,
'r',
true);
437 dpx = px-pxold; dpy = py-pyold;
438 px1 += dpx; py1 += dpy;
439 for (i=0;i<=npe;i++) {
x[i] += dpx;
y[i] += dpy;}
440 for (i=0;i<npe;i++)
gVirtualX->DrawLine(
x[i],
y[i],
x[i+1],
y[i+1]);
445 gPad->ShowGuidelines(
this, event,
'i',
true);
457 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
458 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
459 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
460 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
461 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
462 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
463 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
464 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
465 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
466 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
467 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
468 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
469 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
470 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
471 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
472 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
479 if (
gROOT->IsEscaped()) {
482 gPad->ShowGuidelines(
this, event);
494 gPad->ShowGuidelines(
this, event);
498 fBy =
gPad->AbsPixeltoY(py1+r2);
499 fTy =
gPad->AbsPixeltoY(py1-r2);
500 fLx =
gPad->AbsPixeltoX(px1+r1);
501 fRx =
gPad->AbsPixeltoX(px1-r1);
528 if (xn * xn + yn * yn > 1.)
535 if (phi < phimin || phi > phimax)
567 const Int_t np = 200;
584 for (
Int_t i=0;i<=
n;i++) {
588 x[i] =
gPad->XtoPad(x1 + dx*ct - dy*st);
589 y[i] =
gPad->YtoPad(y1 + dx*st + dy*ct);
591 TString opt = option;
593 if (phi2-phi1 >= 360 ) {
597 x[
n+1] =
gPad->XtoPad(x1);
598 y[
n+1] =
gPad->YtoPad(y1);
604 else gPad->PaintPolyLine(
n+3,
x,
y);
614 printf(
"Ellipse: X1=%f Y1=%f R1=%f R2=%f",
fX1,
fY1,
fR1,
fR2);
627 out,
Class(),
"ellipse",
628 TString::Format(
"%g, %g, %g, %g, %g, %g, %g",
fX1,
fY1,
fR1,
fR2,
fPhimin,
fPhimax,
fTheta));
634 out <<
" ellipse->SetNoEdges();\n";
674 Float_t x1,y1,r1,r2,phimin,phimax,theta;
675 R__b >> x1;
fX1 = x1;
676 R__b >> y1;
fY1 = y1;
677 R__b >> r1;
fR1 = r1;
678 R__b >> r2;
fR2 = r2;
679 R__b >> phimin;
fPhimin = phimin;
680 R__b >> phimax;
fPhimax = phimax;
681 R__b >> theta;
fTheta = theta;
696 Rectangle_t BBox{0, 0, 0, 0};
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
Abstract base class for elements drawn in the editor.
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
void Copy(TAttFill &attfill) const
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
virtual Style_t GetLineStyle() const
Return the line style.
void Copy(TAttLine &attline) const
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClass * IsA() const override
virtual void SetR1(Double_t r1)
void ls(Option_t *option="") const override
The ls function lists the contents of a class on stdout.
virtual void SetX1(Double_t x1)
void SetBBoxCenterY(const Int_t y) override
Double_t GetTheta() const
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
void SetBBoxY1(const Int_t y) override
void SetBBoxX1(const Int_t x) override
void SetBBoxY2(const Int_t y) override
Double_t fPhimax
Maximum angle (degrees).
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
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="")
Double_t fX1
X coordinate of centre.
void SetBBoxX2(const Int_t x) override
Bool_t GetNoEdges() const
void Draw(Option_t *option="") override
Default Draw method for all objects.
Rectangle_t GetBBox() override
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
Double_t fY1
Y coordinate of centre.
Double_t fTheta
Rotation angle (degrees).
void SetBBoxCenter(const TPoint &p) override
Int_t IsInside(Double_t x, Double_t y) const
void SetBBoxCenterX(const Int_t x) override
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="")
virtual void SetY1(Double_t y1)
Double_t fR2
second radius
void Streamer(TBuffer &) override
Stream an object of class TObject.
void Copy(TObject &ellipse) const override
Copy this to obj.
Double_t fPhimin
Minimum angle (degrees).
virtual void SetNoEdges(Bool_t noEdges=kTRUE)
TPoint GetBBoxCenter() override
virtual void SetR2(Double_t r2)
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Mother of all ROOT objects.
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Copy(TObject &object) const
Copy this to obj.
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.
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".
@ kCanDelete
if object in a list can be deleted
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
void ToLower()
Change string to lower-case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
double dist(Rotation3D const &r1, Rotation3D const &r2)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Rectangle structure (maps to the X11 XRectangle structure).