Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TCurlyArc.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Otto Schaile 20/11/99
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/** \class TCurlyArc
13\ingroup BasicGraphics
14
15Implements curly or wavy arcs used to draw Feynman diagrams.
16
17Amplitudes and wavelengths may be specified in the constructors,
18via commands or interactively from popup menus.
19The class make use of TCurlyLine by inheritance, ExecuteEvent methods
20are highly inspired from the methods used in TPolyLine and TArc.
21The picture below has been generated by the tutorial feynman.
22
23Begin_Macro(source)
24../../../tutorials/visualisation/graphics/feynman.C
25End_Macro
26*/
27
28#include <iostream>
29#include "TCurlyArc.h"
30#include "TROOT.h"
31#include "TVirtualPad.h"
32#include "TVirtualX.h"
33#include "TMath.h"
34#include "TPoint.h"
35
39
40
41////////////////////////////////////////////////////////////////////////////////
42/// Default constructor
43
45{
46 fR1 = 0.;
47 fPhimin = 0.;
48 fPhimax = 0.;
49 fTheta = 0.;
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Create a new TCurlyArc with center (x1, y1) and radius rad.
54/// The wavelength and amplitude are given in percent of the line length
55/// phimin and phimax are given in degrees.
56
58 Double_t rad, Double_t phimin, Double_t phimax,
59 Double_t wl, Double_t amp)
60 : fR1(rad), fPhimin(phimin),fPhimax(phimax)
61{
62 fX1 = x1;
63 fY1 = y1;
64 fIsCurly = fgDefaultIsCurly;
65 fAmplitude = amp;
66 fWaveLength = wl;
67 fTheta = 0;
68 Build();
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Create a curly (Gluon) or wavy (Gamma) arc.
73
75{
76 Double_t pixeltoX = 1;
77 Double_t pixeltoY = 1;
78 Double_t rPix = fR1;
79 if (gPad) {
80 Double_t ww = (Double_t)gPad->GetWw();
81 Double_t wh = (Double_t)gPad->GetWh();
82 Double_t pxrange = gPad->GetAbsWNDC()*ww;
83 Double_t pyrange = - gPad->GetAbsHNDC()*wh;
84 Double_t xrange = gPad->GetX2() - gPad->GetX1();
85 Double_t yrange = gPad->GetY2() - gPad->GetY1();
86 pixeltoX = xrange / pxrange;
87 pixeltoY = yrange/pyrange;
88 rPix = fR1 / pixeltoX;
89 }
90 Double_t dang = fPhimax - fPhimin;
91 if (dang < 0) dang += 360;
92 Double_t length = TMath::Pi() * fR1 * dang/180;
93 Double_t x1sav = fX1;
94 Double_t y1sav = fY1;
95 fX1 = fY1 = 0;
96 fX2 = length;
97 fY2 = 0;
99 fX1 = x1sav;
100 fY1 = y1sav;
101 Double_t *xv= GetX();
102 Double_t *yv= GetY();
103 Double_t xx, yy, angle;
104 for(Int_t i = 0; i < fNsteps; i++){
105 angle = xv[i] / rPix + fPhimin * TMath::Pi()/180;
106 xx = (yv[i] + rPix) * cos(angle);
107 yy = (yv[i] + rPix) * sin(angle);
108 xx *= pixeltoX;
109 yy *= TMath::Abs(pixeltoY);
110 xv[i] = xx + fX1;
111 yv[i] = yy + fY1;
112 }
113 if (gPad) gPad->Modified();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Compute distance from point px,py to an arc.
118///
119/// Compute the closest distance of approach from point px,py to this arc.
120/// The distance is computed in pixels units.
121
123{
124 if (!gPad) return 9999;
125 // Compute distance of point to center of arc
126 Int_t pxc = gPad->XtoAbsPixel(fX1);
127 Int_t pyc = gPad->YtoAbsPixel(fY1);
128 Double_t dist = TMath::Sqrt(Long64_t(pxc-px)*(pxc-px)+Long64_t(pyc-py)*(pyc-py));
129 Double_t cosa = (px - pxc)/dist;
130 Double_t sina = (pyc - py)/dist;
131 Double_t phi = TMath::ATan2(sina,cosa);
132 if (phi < 0) phi += 2 * TMath::Pi();
133 phi = phi * 180 / TMath::Pi();
134 if (fPhimax > fPhimin){
135 if (phi < fPhimin || phi > fPhimax) return 9999;
136 } else {
137 if (phi > fPhimin && phi < fPhimax) return 9999;
138 }
139 Int_t pxr = gPad->XtoPixel(fR1)- gPad->XtoPixel(0);
140 Double_t distr = TMath::Abs(dist-pxr);
141 return Int_t(distr);
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// Execute action corresponding to one event.
146///
147/// This member function is called when a TCurlyArc is clicked with the locator
148///
149/// If Left button clicked on one of the line end points, this point
150/// follows the cursor until button is released.
151///
152/// if Middle button clicked, the line is moved parallel to itself
153/// until the button is released.
154
155void TCurlyArc::ExecuteEvent(Int_t event, Int_t px, Int_t py)
156{
157 if (!gPad) return;
158
159 Int_t kMaxDiff = 10;
160 const Int_t np = 10;
161 const Double_t pi = TMath::Pi();
162 static Int_t x[np+3], y[np+3];
163 static Int_t px1,py1,npe,r1;
164 static Int_t pxold, pyold;
165 Int_t i, dpx, dpy;
167 Double_t phi0;
168 static Bool_t pTop, pL, pR, pBot, pINSIDE;
169 static Int_t pTx,pTy,pLx,pLy,pRx,pRy,pBx,pBy;
170
171 Bool_t opaque = gPad->OpaqueMoving();
172
173 switch (event) {
174
175 case kArrowKeyPress:
176 case kButton1Down:
177 if (!opaque) {
178 gVirtualX->SetLineColor(-1);
180 dphi = (fPhimax-fPhimin) * pi / 180;
181 if (dphi<0) dphi += 2 * pi;
182 dphi /= np;
183 phi0 = fPhimin * pi / 180;
184 for (i=0;i<=np;i++) {
185 angle = Double_t(i)*dphi + phi0;
188 Int_t rpixY = gPad->XtoAbsPixel(dy) - gPad->XtoAbsPixel(0);
189 x[i] = gPad->XtoAbsPixel(fX1 + dx);
190 y[i] = gPad->YtoAbsPixel(fY1) + rpixY;
191 }
192 if (fPhimax-fPhimin >= 360 ) {
193 x[np+1] = x[0];
194 y[np+1] = y[0];
195 npe = np;
196 } else {
197 x[np+1] = gPad->XtoAbsPixel(fX1);
198 y[np+1] = gPad->YtoAbsPixel(fY1);
199 x[np+2] = x[0];
200 y[np+2] = y[0];
201 npe = np + 2;
202 }
203 }
204 px1 = gPad->XtoAbsPixel(fX1);
205 py1 = gPad->YtoAbsPixel(fY1);
206 pTx = pBx = px1;
207 pLy = pRy = py1;
208 pLx = gPad->XtoAbsPixel(-fR1+fX1);
209 pRx = gPad->XtoAbsPixel( fR1+fX1);
210 r1 = TMath::Abs(pLx-pRx)/2;
211 // a circle in pixels, radius measured along X
212 pTy = gPad->YtoAbsPixel(fY1) + r1;
213 pBy = gPad->YtoAbsPixel(fY1) - r1;
214
215 if (!opaque) {
216 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
217 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
218 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
219 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
220 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
221 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
222 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
223 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
224 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
225 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
226 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
227 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
228 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
229 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
230 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
231 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
232 }
233 // No break !!!
234
235 case kMouseMotion:
236 px1 = gPad->XtoAbsPixel(fX1);
237 py1 = gPad->YtoAbsPixel(fY1);
238 pTx = pBx = px1;
239 pLy = pRy = py1;
240 pLx = gPad->XtoAbsPixel(-fR1+fX1);
241 pRx = gPad->XtoAbsPixel( fR1+fX1);
242
243 pTy = gPad->YtoAbsPixel(fY1) + TMath::Abs(pLx-pRx)/2;
244 pBy = gPad->YtoAbsPixel(fY1) - TMath::Abs(pLx-pRx)/2;
245
246 pTop = pL = pR = pBot = pINSIDE = kFALSE;
247 if ((TMath::Abs(px - pTx) < kMaxDiff) &&
248 (TMath::Abs(py - pTy) < kMaxDiff)) { // top edge
249 pTop = kTRUE;
250 gPad->SetCursor(kTopSide);
251 }
252 else
253 if ((TMath::Abs(px - pBx) < kMaxDiff) &&
254 (TMath::Abs(py - pBy) < kMaxDiff)) { // bottom edge
255 pBot = kTRUE;
256 gPad->SetCursor(kBottomSide);
257 }
258 else
259 if ((TMath::Abs(py - pLy) < kMaxDiff) &&
260 (TMath::Abs(px - pLx) < kMaxDiff)) { // left edge
261 pL = kTRUE;
262 gPad->SetCursor(kLeftSide);
263 }
264 else
265 if ((TMath::Abs(py - pRy) < kMaxDiff) &&
266 (TMath::Abs(px - pRx) < kMaxDiff)) { // right edge
267 pR = kTRUE;
268 gPad->SetCursor(kRightSide);
269 }
270 else {pINSIDE= kTRUE; gPad->SetCursor(kMove); }
271 pxold = px; pyold = py;
272
273 break;
274
275 case kArrowKeyRelease:
276 case kButton1Motion:
277 if (!opaque) {
278 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
279 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
280 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
281 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
282 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
283 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
284 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
285 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
286 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
287 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
288 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
289 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
290 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
291 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
292 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
293 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
294 for (i=0;i<npe;i++) gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
295 }
296 if (pTop) {
297 r1 += (py - pyold);
298 }
299 if (pBot) {
300 r1 -= (py - pyold);
301 }
302 if (pL) {
303 r1 -= (px - pxold);
304 }
305 if (pR) {
306 r1 += (px - pxold);
307 }
308 if (pTop || pBot || pL || pR) {
309 if (!opaque) {
310 gVirtualX->SetLineColor(-1);
312 dphi = (fPhimax-fPhimin) * pi / 180;
313 if (dphi<0) dphi += 2 * pi;
314 dphi /= np;
315 phi0 = fPhimin * pi / 180;
316 Double_t ur1 = r1;
317 Int_t pX1 = gPad->XtoAbsPixel(fX1);
318 Int_t pY1 = gPad->YtoAbsPixel(fY1);
319 for (i=0;i<=np;i++) {
320 angle = Double_t(i)*dphi + phi0;
321 dx = ur1 * TMath::Cos(angle);
322 dy = ur1 * TMath::Sin(angle);
323 x[i] = pX1 + (Int_t)dx;
324 y[i] = pY1 + (Int_t)dy;
325 }
326 if (fPhimax-fPhimin >= 360 ) {
327 x[np+1] = x[0];
328 y[np+1] = y[0];
329 npe = np;
330 } else {
331 x[np+1] = pX1;
332 y[np+1] = pY1;
333 x[np+2] = x[0];
334 y[np+2] = y[0];
335 npe = np + 2;
336 }
337 for (i=0;i<npe;i++) {
338 gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
339 }
340 }
341 else {
342 this->SetStartPoint(gPad->AbsPixeltoX(px1), gPad->AbsPixeltoY(py1));
343 this->SetRadius(TMath::Abs(gPad->AbsPixeltoX(px1-r1)-gPad->AbsPixeltoX(px1+r1))/2);
344 if (pTop) gPad->ShowGuidelines(this, event, 't', true);
345 if (pBot) gPad->ShowGuidelines(this, event, 'b', true);
346 if (pL) gPad->ShowGuidelines(this, event, 'l', true);
347 if (pR) gPad->ShowGuidelines(this, event, 'r', true);
348 gPad->Modified(kTRUE);
349 gPad->Update();
350 }
351 }
352 if (pINSIDE) {
353 dpx = px-pxold; dpy = py-pyold;
354 px1 += dpx; py1 += dpy;
355 if (!opaque) {
356 for (i=0;i<=npe;i++) { x[i] += dpx; y[i] += dpy;}
357 for (i=0;i<npe;i++) gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
358 } else {
359 this->SetStartPoint(gPad->AbsPixeltoX(px1), gPad->AbsPixeltoY(py1));
360 gPad->ShowGuidelines(this, event, 'i', true);
361 gPad->Modified(kTRUE);
362 gPad->Update();
363 }
364 }
365 pTx = pBx = px1;
366 pRx = px1+r1;
367 pLx = px1-r1;
368 pRy = pLy = py1;
369 pTy = py1-r1;
370 pBy = py1+r1;
371 if (!opaque) {
372 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
373 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
374 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
375 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
376 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
377 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
378 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
379 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
380 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
381 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
382 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
383 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
384 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
385 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
386 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
387 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
388 }
389 pxold = px;
390 pyold = py;
391 break;
392
393 case kButton1Up:
394 if (opaque) {
395 gPad->ShowGuidelines(this, event);
396 } else {
397 fX1 = gPad->AbsPixeltoX(px1);
398 fY1 = gPad->AbsPixeltoY(py1);
399 rLx = gPad->AbsPixeltoX(px1+r1);
400 rRx = gPad->AbsPixeltoX(px1-r1);
401 fR1 = TMath::Abs(rRx-rLx)/2;
402 }
403 Build();
404 gPad->Modified(kTRUE);
405 if (!opaque) gVirtualX->SetLineColor(-1);
406 }
407}
408
409////////////////////////////////////////////////////////////////////////////////
410/// Save primitive as a C++ statement(s) on output stream out
411
412void TCurlyArc::SavePrimitive(std::ostream &out, Option_t *option)
413{
415 out, Class(), "curlyarc",
416 TString::Format("%g, %g, %g, %g, %g, %g, %g", fX1, fY1, fR1, fPhimin, fPhimax, fWaveLength, fAmplitude));
417
418 SaveLineAttributes(out, "curlyarc", 1, 1, 1);
419 if (!fIsCurly)
420 out << " curlyarc->SetWavy();\n";
421
422 SavePrimitiveDraw(out, "curlyarc", option);
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Set Curly Arc center.
427
429{
430 fX1 = x;
431 fY1 = y;
432 Build();
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Set Curly Arc radius.
437
439{
440 fR1 = x;
441 Build();
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Set Curly Arc minimum Phi.
446
448{
449 fPhimin = x;
450 Build();
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Set Curly Arc maximum Phi.
455
457{
458 fPhimax = x;
459 Build();
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// Set default wave length.
464
466{
467 fgDefaultWaveLength = WaveLength;
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Set default wave amplitude.
472
474{
475 fgDefaultAmplitude = Amplitude ;
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Set default "IsCurly".
480
482{
483 fgDefaultIsCurly = IsCurly;
484}
485
486////////////////////////////////////////////////////////////////////////////////
487/// Get default wave length.
488
490{
491 return fgDefaultWaveLength;
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Get default wave amplitude.
496
498{
499 return fgDefaultAmplitude;
500}
501
502////////////////////////////////////////////////////////////////////////////////
503/// Get default "IsCurly".
504
506{
507 return fgDefaultIsCurly;
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Return the bounding Box of the Line
512
514{
515 Rectangle_t BBox{0, 0, 0, 0};
516 if (gPad) {
517 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2() - gPad->GetY1()) / TMath::Abs(gPad->GetX2() - gPad->GetX1());
518 BBox.fX = gPad->XtoPixel(fX1 - fR1);
519 BBox.fY = gPad->YtoPixel(fY1 + R2);
520 BBox.fWidth = gPad->XtoPixel(fX1 + fR1) - gPad->XtoPixel(fX1 - fR1);
521 BBox.fHeight = gPad->YtoPixel(fY1 - R2) - gPad->YtoPixel(fY1 + R2);
522 }
523 return BBox;
524}
525
526////////////////////////////////////////////////////////////////////////////////
527/// Return the center of the BoundingBox as TPoint in pixels
528
530{
531 TPoint p(0,0);
532 if (gPad) {
533 p.SetX(gPad->XtoPixel(fX1));
534 p.SetY(gPad->YtoPixel(fY1));
535 }
536 return p;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Set center of the BoundingBox
541
542void TCurlyArc::SetBBoxCenter(const TPoint &p)
543{
544 if (!gPad) return;
545 fX1 = gPad->PixeltoX(p.GetX());
546 fY1 = gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0));
547 Build();
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Set X coordinate of the center of the BoundingBox
552
554{
555 if (!gPad) return;
556 fX1 = gPad->PixeltoX(x);
557 Build();
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Set Y coordinate of the center of the BoundingBox
562
564{
565 if (!gPad) return;
566 fY1 = gPad->PixeltoY(y-gPad->VtoPixel(0));
567 Build();
568}
569
570////////////////////////////////////////////////////////////////////////////////
571/// Set left hand side of BoundingBox to a value
572/// (resize in x direction on left)
573
574void TCurlyArc::SetBBoxX1(const Int_t x)
575{
576 if (!gPad) return;
577 Double_t x1 = gPad->PixeltoX(x);
578 if (x1>fX1+fR1) return;
579
580 fR1 = (fX1+fR1-x1)*0.5;
581 fX1 = x1 + fR1;
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// Set right hand side of BoundingBox to a value
586/// (resize in x direction on right)
587
588void TCurlyArc::SetBBoxX2(const Int_t x)
589{
590 if (!gPad) return;
591 Double_t x2 = gPad->PixeltoX(x);
592 if (x2<fX1-fR1) return;
593
594 fR1 = (x2-fX1+fR1)*0.5;
595 fX1 = x2-fR1;
596}
597
598////////////////////////////////////////////////////////////////////////////////
599/// Set top of BoundingBox to a value (resize in y direction on top)
600
601void TCurlyArc::SetBBoxY1(const Int_t y)
602{
603 if (!gPad) return;
604 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1());
605
606 Double_t y1 = gPad->PixeltoY(y-gPad->VtoPixel(0));
607 if (y1<fY1-R2) return;
608
609 fR1 = (y1-fY1+R2)*0.5 / (TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1()));
610 fY1 = y1-R2;
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Set bottom of BoundingBox to a value
615/// (resize in y direction on bottom)
616
617void TCurlyArc::SetBBoxY2(const Int_t y)
618{
619 if (!gPad) return;
620 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1());
621
622 Double_t y2 = gPad->PixeltoY(y-gPad->VtoPixel(0));
623
624 if (y2>fY1+R2) return;
625
626 fR1 = (fY1+R2-y2)*0.5 / (TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1()));
627 fY1 = y2+R2;
628}
@ 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
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define gPad
#define gVirtualX
Definition TVirtualX.h:375
virtual void Modify()
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Rectangle_t GetBBox() override
static void SetDefaultIsCurly(Bool_t IsCurly)
static Double_t GetDefaultWaveLength()
static Bool_t GetDefaultIsCurly()
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
void SetBBoxX1(const Int_t x) override
virtual void SetPhimax(Double_t phimax)
void Build() override
virtual void SetRadius(Double_t radius)
Double_t fTheta
used internally
Definition TCurlyArc.h:22
static TClass * Class()
Double_t fPhimax
end phi (degrees)
Definition TCurlyArc.h:21
void SetBBoxY2(const Int_t y) override
virtual void SetCenter(Double_t x1, Double_t y1)
void SetBBoxX2(const Int_t x) override
static Double_t fgDefaultWaveLength
default wavelength
Definition TCurlyArc.h:24
virtual void SetPhimin(Double_t phimin)
Double_t fPhimin
start phi (degrees)
Definition TCurlyArc.h:20
Double_t fR1
Radius of arc.
Definition TCurlyArc.h:19
static Double_t fgDefaultAmplitude
default amplitude
Definition TCurlyArc.h:25
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
TPoint GetBBoxCenter() override
static Bool_t fgDefaultIsCurly
default curly type
Definition TCurlyArc.h:26
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a primitive as a C++ statement(s) on output stream "out".
static Double_t GetDefaultAmplitude()
void SetBBoxCenter(const TPoint &p) override
void SetBBoxCenterY(const Int_t y) override
void SetBBoxY1(const Int_t y) override
static void SetDefaultAmplitude(Double_t Amplitude)
static void SetDefaultWaveLength(Double_t WaveLength)
void SetBBoxCenterX(const Int_t x) override
Double_t fY1
start y, center for arc
Definition TCurlyLine.h:23
Double_t fWaveLength
wavelength of sinusoid in percent of pad height
Definition TCurlyLine.h:26
Double_t fAmplitude
amplitude of sinusoid in percent of pad height
Definition TCurlyLine.h:27
Int_t fNsteps
used internally (controls precision)
Definition TCurlyLine.h:28
virtual void Build()
Double_t fY2
end y
Definition TCurlyLine.h:25
Double_t fX1
start x, center for arc
Definition TCurlyLine.h:22
Double_t fX2
end x
Definition TCurlyLine.h:24
virtual void SetStartPoint(Double_t x1, Double_t y1)
Bool_t fIsCurly
true: Gluon, false: Gamma
Definition TCurlyLine.h:29
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
SCoord_t GetY() const
Definition TPoint.h:47
SCoord_t GetX() const
Definition TPoint.h:46
Double_t * GetX() const
Definition TPolyLine.h:54
Double_t * GetY() const
Definition TPolyLine.h:55
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
RVec< PromoteType< T > > cos(const RVec< T > &v)
Definition RVec.hxx:1848
RVec< PromoteType< T > > sin(const RVec< T > &v)
Definition RVec.hxx:1847
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
double dist(Rotation3D const &r1, Rotation3D const &r2)
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
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
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
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
BVH_ALWAYS_INLINE T length(const Vec< T, N > &v)
Definition vec.h:122
#define R2(v, w, x, y, z, i)
Definition sha1.inl:137
Rectangle structure (maps to the X11 XRectangle structure).
Definition GuiTypes.h:362
Short_t fX
Definition GuiTypes.h:363
UShort_t fHeight
Definition GuiTypes.h:364
Short_t fY
Definition GuiTypes.h:363
UShort_t fWidth
Definition GuiTypes.h:364