79 if (
r2 <= 0) fR2 = fR1;
148 if (dx == 0 || r1 == 0 || r2 == 0)
return 9999;
156 if (distr > distp) dist = 0;
158 if (
TMath::Abs(distr-distp)/(r1+r2) < 0.01) dist = 0;
204 Double_t angle,dx,dy,dphi,ct,st,fTy,fBy,fLx,fRx;
205 static Int_t px1,py1,npe,
r1,
r2,sav1,sav2;
206 const Int_t kMinSize = 25;
208 static Bool_t pTop, pL, pR, pBot, pINSIDE;
209 static Int_t pTx,pTy,pLx,pLy,pRx,pRy,pBx,pBy;
211 static Int_t pxold, pyold;
212 static Int_t sig,impair;
214 static Double_t oldX1, oldY1, oldR1, oldR2;
218 if (!
gPad->IsEditable())
return;
235 x[i] =
gPad->XtoAbsPixel(
fX1 + dx*ct - dy*st);
236 y[i] =
gPad->YtoAbsPixel(
fY1 + dx*st + dy*ct);
243 x[np] =
gPad->XtoAbsPixel(
fX1);
244 y[np] =
gPad->YtoAbsPixel(
fY1);
263 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
264 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
265 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
266 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
267 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
268 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
269 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
270 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
271 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
272 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
273 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
274 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
275 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
276 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
277 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
278 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
281 sdx = this->
GetX1()-
gPad->AbsPixeltoX(px);
282 sdy = this->
GetY1()-
gPad->AbsPixeltoY(py);
295 pTop = pL = pR = pBot = pINSIDE =
kFALSE;
320 pxold = px; pyold = py;
328 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
329 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
330 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
331 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
332 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
333 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
334 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
335 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
336 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
337 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
338 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
339 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
340 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
341 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
342 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
343 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
344 for (i=0;i<npe;i++)
gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
349 py1 += (py - pyold)/2;
350 r2 -= (py - pyold)/2;
352 if (py-pyold>0) sig=+1;
354 if (impair==2) { impair = 0; py1 += sig; r2 -= sig;}
355 if (py1 > pBy-kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
360 py1 += (py - pyold)/2;
361 r2 += (py - pyold)/2;
363 if (py-pyold>0) sig=+1;
365 if (impair==2) { impair = 0; py1 += sig; r2 += sig;}
366 if (py1 < pTy+kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
371 px1 += (px - pxold)/2;
372 r1 -= (px - pxold)/2;
374 if (px-pxold>0) sig=+1;
376 if (impair==2) { impair = 0; px1 += sig; r1 -= sig;}
377 if (px1 > pRx-kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
382 px1 += (px - pxold)/2;
383 r1 += (px - pxold)/2;
385 if (px-pxold>0) sig=+1;
387 if (impair==2) { impair = 0; px1 += sig; r1 += sig;}
388 if (px1 < pLx+kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
390 if (pTop || pBot || pL || pR) {
399 x[i] = px1 +
Int_t(dx*ct - dy*st);
400 y[i] = py1 +
Int_t(dx*st + dy*ct);
416 gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
424 if (pTop)
gPad->ShowGuidelines(
this, event,
't',
true);
425 if (pBot)
gPad->ShowGuidelines(
this, event,
'b',
true);
426 if (pL)
gPad->ShowGuidelines(
this, event,
'l',
true);
427 if (pR)
gPad->ShowGuidelines(
this, event,
'r',
true);
434 dpx = px-pxold; dpy = py-pyold;
435 px1 += dpx; py1 += dpy;
436 for (i=0;i<=npe;i++) { x[i] += dpx; y[i] += dpy;}
437 for (i=0;i<npe;i++)
gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
442 gPad->ShowGuidelines(
this, event,
'i',
true);
454 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
455 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
456 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
457 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
458 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
459 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
460 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
461 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
462 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
463 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
464 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
465 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
466 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
467 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
468 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
469 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
476 if (
gROOT->IsEscaped()) {
490 gPad->ShowGuidelines(
this, event);
494 fBy =
gPad->AbsPixeltoY(py1+r2);
495 fTy =
gPad->AbsPixeltoY(py1-r2);
496 fLx =
gPad->AbsPixeltoX(px1+r1);
497 fRx =
gPad->AbsPixeltoX(px1-r1);
530 const Int_t np = 200;
547 for (
Int_t i=0;i<=
n;i++) {
551 x[i] =
gPad->XtoPad(
x1 + dx*ct - dy*st);
552 y[i] =
gPad->YtoPad(y1 + dx*st + dy*ct);
556 if (phi2-phi1 >= 360 ) {
561 y[
n+1] =
gPad->YtoPad(y1);
567 else gPad->PaintPolyLine(
n+3,
x,
y);
577 printf(
"Ellipse: X1=%f Y1=%f R1=%f R2=%f",
fX1,
fY1,
fR1,
fR2);
595 out<<
"ellipse = new TEllipse("<<
fX1<<
","<<
fY1<<
","<<
fR1<<
","<<
fR2 601 if (
GetNoEdges()) out<<
" ellipse->SetNoEdges();"<<std::endl;
603 out<<
" ellipse->Draw();"<<std::endl;
628 void TEllipse::Streamer(
TBuffer &R__b)
638 TObject::Streamer(R__b);
639 TAttLine::Streamer(R__b);
640 TAttFill::Streamer(R__b);
643 R__b >> y1;
fY1 = y1;
646 R__b >> phimin;
fPhimin = phimin;
647 R__b >> phimax;
fPhimax = phimax;
648 R__b >> theta;
fTheta = theta;
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
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.
virtual void DrawEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t *option="")
Draw this ellipse with new coordinates.
Double_t GetTheta() const
TAttLine()
AttLine default constructor.
Double_t fX1
X coordinate of centre.
Double_t fY1
Y coordinate of centre.
virtual void ls(Option_t *option="") const
List this ellipse with its attributes.
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the Ellipse.
Bool_t TestBit(UInt_t f) const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TEllipse()
Ellipse default constructor.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to an ellipse.
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void Modify()
Change current line attributes if necessary.
virtual void SetR1(Double_t r1)
virtual Width_t GetLineWidth() const
Return the line width.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
if object in a list can be deleted
virtual void Paint(Option_t *option="")
Paint this ellipse with its current attributes.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual Style_t GetLineStyle() const
Return the line style.
static const double x2[5]
Fill Area Attributes class.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual void Copy(TObject &object) const
Copy this to obj.
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.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
TObject()
TObject constructor.
virtual void SetNoEdges(Bool_t noEdges=kTRUE)
if noEdges = kTRUE the lines connecting the center to the edges will not be drawn.
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
Double_t fTheta
Rotation angle (degrees)
Double_t fPhimax
Maximum angle (degrees)
virtual void SetY1(Double_t y1)
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the Ellipse.
virtual void Print(Option_t *option="") const
Dump this ellipse with its attributes.
virtual void SetX1(Double_t x1)
unsigned int r1[N_CITIES]
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.
virtual void SetR2(Double_t r2)
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Double_t fR2
second radius
virtual Color_t GetLineColor() const
Return the line color.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual ~TEllipse()
Ellipse default destructor.
static const double x1[5]
virtual TPoint GetBBoxCenter()
Return the center of the Ellipse as TPoint in pixels.
virtual void SetBBoxCenter(const TPoint &p)
Set center of the Ellipse.
virtual Color_t GetFillColor() const
Return the fill area color.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Mother of all ROOT objects.
void Copy(TObject &ellipse) const
Copy this ellipse to ellipse.
TAttFill()
AttFill default constructor.
Abstract base class for elements drawn in the editor.
Short_t Max(Short_t a, Short_t b)
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
virtual Rectangle_t GetBBox()
Return the bounding Box of the Ellipse, currently not taking into account the rotating angle...
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
virtual Style_t GetFillStyle() const
Return the fill area style.
Double_t Sqrt(Double_t x)
virtual const char * GetName() const
Returns name of object.
Double_t fPhimin
Minimum angle (degrees)
unsigned int r2[N_CITIES]
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.