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/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
41
42////////////////////////////////////////////////////////////////////////////////
43/// Default constructor
44
46{
47 fR1 = 0.;
48 fPhimin = 0.;
49 fPhimax = 0.;
50 fTheta = 0.;
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Create a new TCurlyArc with center (x1, y1) and radius rad.
55/// The wavelength and amplitude are given in percent of the line length
56/// phimin and phimax are given in degrees.
57
59 Double_t rad, Double_t phimin, Double_t phimax,
60 Double_t wl, Double_t amp)
61 : fR1(rad), fPhimin(phimin),fPhimax(phimax)
62{
63 fX1 = x1;
64 fY1 = y1;
66 fAmplitude = amp;
67 fWaveLength = wl;
68 fTheta = 0;
69 Build();
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Create a curly (Gluon) or wavy (Gamma) arc.
74
76{
77 Double_t pixeltoX = 1;
78 Double_t pixeltoY = 1;
79 Double_t rPix = fR1;
80 if (gPad) {
81 Double_t ww = (Double_t)gPad->GetWw();
82 Double_t wh = (Double_t)gPad->GetWh();
83 Double_t pxrange = gPad->GetAbsWNDC()*ww;
84 Double_t pyrange = - gPad->GetAbsHNDC()*wh;
85 Double_t xrange = gPad->GetX2() - gPad->GetX1();
86 Double_t yrange = gPad->GetY2() - gPad->GetY1();
87 pixeltoX = xrange / pxrange;
88 pixeltoY = yrange/pyrange;
89 rPix = fR1 / pixeltoX;
90 }
91 Double_t dang = fPhimax - fPhimin;
92 if (dang < 0) dang += 360;
93 Double_t length = TMath::Pi() * fR1 * dang/180;
94 Double_t x1sav = fX1;
95 Double_t y1sav = fY1;
96 fX1 = fY1 = 0;
97 fX2 = length;
98 fY2 = 0;
100 fX1 = x1sav;
101 fY1 = y1sav;
102 Double_t *xv= GetX();
103 Double_t *yv= GetY();
104 Double_t xx, yy, angle;
105 for(Int_t i = 0; i < fNsteps; i++){
106 angle = xv[i] / rPix + fPhimin * TMath::Pi()/180;
107 xx = (yv[i] + rPix) * cos(angle);
108 yy = (yv[i] + rPix) * sin(angle);
109 xx *= pixeltoX;
110 yy *= TMath::Abs(pixeltoY);
111 xv[i] = xx + fX1;
112 yv[i] = yy + fY1;
113 }
114 if (gPad) gPad->Modified();
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Compute distance from point px,py to an arc.
119///
120/// Compute the closest distance of approach from point px,py to this arc.
121/// The distance is computed in pixels units.
122
124{
125 if (!gPad) return 9999;
126 // Compute distance of point to center of arc
127 Int_t pxc = gPad->XtoAbsPixel(fX1);
128 Int_t pyc = gPad->YtoAbsPixel(fY1);
129 Double_t dist = TMath::Sqrt(Double_t((pxc-px)*(pxc-px)+(pyc-py)*(pyc-py)));
130 Double_t cosa = (px - pxc)/dist;
131 Double_t sina = (pyc - py)/dist;
132 Double_t phi = TMath::ATan2(sina,cosa);
133 if (phi < 0) phi += 2 * TMath::Pi();
134 phi = phi * 180 / TMath::Pi();
135 if (fPhimax > fPhimin){
136 if (phi < fPhimin || phi > fPhimax) return 9999;
137 } else {
138 if (phi > fPhimin && phi < fPhimax) return 9999;
139 }
140 Int_t pxr = gPad->XtoPixel(fR1)- gPad->XtoPixel(0);
141 Double_t distr = TMath::Abs(dist-pxr);
142 return Int_t(distr);
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Execute action corresponding to one event.
147///
148/// This member function is called when a TCurlyArc is clicked with the locator
149///
150/// If Left button clicked on one of the line end points, this point
151/// follows the cursor until button is released.
152///
153/// if Middle button clicked, the line is moved parallel to itself
154/// until the button is released.
155
157{
158 if (!gPad) return;
159
160 Int_t kMaxDiff = 10;
161 const Int_t np = 10;
162 const Double_t pi = TMath::Pi();
163 static Int_t x[np+3], y[np+3];
164 static Int_t px1,py1,npe,r1;
165 static Int_t pxold, pyold;
166 Int_t i, dpx, dpy;
167 Double_t angle,dx,dy,dphi,rLx,rRx;
168 Double_t phi0;
169 static Bool_t pTop, pL, pR, pBot, pINSIDE;
170 static Int_t pTx,pTy,pLx,pLy,pRx,pRy,pBx,pBy;
171
172 Bool_t opaque = gPad->OpaqueMoving();
173
174 switch (event) {
175
176 case kArrowKeyPress:
177 case kButton1Down:
178 if (!opaque) {
179 gVirtualX->SetLineColor(-1);
181 dphi = (fPhimax-fPhimin) * pi / 180;
182 if (dphi<0) dphi += 2 * pi;
183 dphi /= np;
184 phi0 = fPhimin * pi / 180;
185 for (i=0;i<=np;i++) {
186 angle = Double_t(i)*dphi + phi0;
187 dx = fR1*TMath::Cos(angle);
188 dy = fR1*TMath::Sin(angle);
189 Int_t rpixY = gPad->XtoAbsPixel(dy) - gPad->XtoAbsPixel(0);
190 x[i] = gPad->XtoAbsPixel(fX1 + dx);
191 y[i] = gPad->YtoAbsPixel(fY1) + rpixY;
192 }
193 if (fPhimax-fPhimin >= 360 ) {
194 x[np+1] = x[0];
195 y[np+1] = y[0];
196 npe = np;
197 } else {
198 x[np+1] = gPad->XtoAbsPixel(fX1);
199 y[np+1] = gPad->YtoAbsPixel(fY1);
200 x[np+2] = x[0];
201 y[np+2] = y[0];
202 npe = np + 2;
203 }
204 }
205 px1 = gPad->XtoAbsPixel(fX1);
206 py1 = gPad->YtoAbsPixel(fY1);
207 pTx = pBx = px1;
208 pLy = pRy = py1;
209 pLx = gPad->XtoAbsPixel(-fR1+fX1);
210 pRx = gPad->XtoAbsPixel( fR1+fX1);
211 r1 = TMath::Abs(pLx-pRx)/2;
212 // a circle in pixels, radius measured along X
213 pTy = gPad->YtoAbsPixel(fY1) + r1;
214 pBy = gPad->YtoAbsPixel(fY1) - r1;
215
216 if (!opaque) {
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(pRx+4, py1-4, pRx+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(pLx+4, py1-4, pLx+4, py1+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, pBy-4, px1+4, pBy+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 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
233 }
234 // No break !!!
235
236 case kMouseMotion:
237 px1 = gPad->XtoAbsPixel(fX1);
238 py1 = gPad->YtoAbsPixel(fY1);
239 pTx = pBx = px1;
240 pLy = pRy = py1;
241 pLx = gPad->XtoAbsPixel(-fR1+fX1);
242 pRx = gPad->XtoAbsPixel( fR1+fX1);
243
244 pTy = gPad->YtoAbsPixel(fY1) + TMath::Abs(pLx-pRx)/2;
245 pBy = gPad->YtoAbsPixel(fY1) - TMath::Abs(pLx-pRx)/2;
246
247 pTop = pL = pR = pBot = pINSIDE = kFALSE;
248 if ((TMath::Abs(px - pTx) < kMaxDiff) &&
249 (TMath::Abs(py - pTy) < kMaxDiff)) { // top edge
250 pTop = kTRUE;
251 gPad->SetCursor(kTopSide);
252 }
253 else
254 if ((TMath::Abs(px - pBx) < kMaxDiff) &&
255 (TMath::Abs(py - pBy) < kMaxDiff)) { // bottom edge
256 pBot = kTRUE;
257 gPad->SetCursor(kBottomSide);
258 }
259 else
260 if ((TMath::Abs(py - pLy) < kMaxDiff) &&
261 (TMath::Abs(px - pLx) < kMaxDiff)) { // left edge
262 pL = kTRUE;
263 gPad->SetCursor(kLeftSide);
264 }
265 else
266 if ((TMath::Abs(py - pRy) < kMaxDiff) &&
267 (TMath::Abs(px - pRx) < kMaxDiff)) { // right edge
268 pR = kTRUE;
269 gPad->SetCursor(kRightSide);
270 }
271 else {pINSIDE= kTRUE; gPad->SetCursor(kMove); }
272 pxold = px; pyold = py;
273
274 break;
275
276 case kArrowKeyRelease:
277 case kButton1Motion:
278 if (!opaque) {
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(pRx+4, py1-4, pRx+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(pLx+4, py1-4, pLx+4, py1+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, pBy-4, px1+4, pBy+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 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
295 for (i=0;i<npe;i++) gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
296 }
297 if (pTop) {
298 r1 += (py - pyold);
299 }
300 if (pBot) {
301 r1 -= (py - pyold);
302 }
303 if (pL) {
304 r1 -= (px - pxold);
305 }
306 if (pR) {
307 r1 += (px - pxold);
308 }
309 if (pTop || pBot || pL || pR) {
310 if (!opaque) {
311 gVirtualX->SetLineColor(-1);
313 dphi = (fPhimax-fPhimin) * pi / 180;
314 if (dphi<0) dphi += 2 * pi;
315 dphi /= np;
316 phi0 = fPhimin * pi / 180;
317 Double_t ur1 = r1;
318 Int_t pX1 = gPad->XtoAbsPixel(fX1);
319 Int_t pY1 = gPad->YtoAbsPixel(fY1);
320 for (i=0;i<=np;i++) {
321 angle = Double_t(i)*dphi + phi0;
322 dx = ur1 * TMath::Cos(angle);
323 dy = ur1 * TMath::Sin(angle);
324 x[i] = pX1 + (Int_t)dx;
325 y[i] = pY1 + (Int_t)dy;
326 }
327 if (fPhimax-fPhimin >= 360 ) {
328 x[np+1] = x[0];
329 y[np+1] = y[0];
330 npe = np;
331 } else {
332 x[np+1] = pX1;
333 y[np+1] = pY1;
334 x[np+2] = x[0];
335 y[np+2] = y[0];
336 npe = np + 2;
337 }
338 for (i=0;i<npe;i++) {
339 gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
340 }
341 }
342 else {
343 this->SetStartPoint(gPad->AbsPixeltoX(px1), gPad->AbsPixeltoY(py1));
344 this->SetRadius(TMath::Abs(gPad->AbsPixeltoX(px1-r1)-gPad->AbsPixeltoX(px1+r1))/2);
345 if (pTop) gPad->ShowGuidelines(this, event, 't', true);
346 if (pBot) gPad->ShowGuidelines(this, event, 'b', true);
347 if (pL) gPad->ShowGuidelines(this, event, 'l', true);
348 if (pR) gPad->ShowGuidelines(this, event, 'r', true);
349 gPad->Modified(kTRUE);
350 gPad->Update();
351 }
352 }
353 if (pINSIDE) {
354 dpx = px-pxold; dpy = py-pyold;
355 px1 += dpx; py1 += dpy;
356 if (!opaque) {
357 for (i=0;i<=npe;i++) { x[i] += dpx; y[i] += dpy;}
358 for (i=0;i<npe;i++) gVirtualX->DrawLine(x[i], y[i], x[i+1], y[i+1]);
359 } else {
360 this->SetStartPoint(gPad->AbsPixeltoX(px1), gPad->AbsPixeltoY(py1));
361 gPad->ShowGuidelines(this, event, 'i', true);
362 gPad->Modified(kTRUE);
363 gPad->Update();
364 }
365 }
366 pTx = pBx = px1;
367 pRx = px1+r1;
368 pLx = px1-r1;
369 pRy = pLy = py1;
370 pTy = py1-r1;
371 pBy = py1+r1;
372 if (!opaque) {
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(pRx+4, py1-4, pRx+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(pLx+4, py1-4, pLx+4, py1+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, pBy-4, px1+4, pBy+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 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
389 }
390 pxold = px;
391 pyold = py;
392 break;
393
394 case kButton1Up:
395 if (opaque) {
396 gPad->ShowGuidelines(this, event);
397 } else {
398 fX1 = gPad->AbsPixeltoX(px1);
399 fY1 = gPad->AbsPixeltoY(py1);
400 rLx = gPad->AbsPixeltoX(px1+r1);
401 rRx = gPad->AbsPixeltoX(px1-r1);
402 fR1 = TMath::Abs(rRx-rLx)/2;
403 }
404 Build();
405 gPad->Modified(kTRUE);
406 if (!opaque) gVirtualX->SetLineColor(-1);
407 }
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Save primitive as a C++ statement(s) on output stream out
412
413void TCurlyArc::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
414{
415 if (gROOT->ClassSaved(TCurlyArc::Class())) {
416 out<<" ";
417 } else {
418 out<<" TCurlyArc *";
419 }
420 out<<"curlyarc = new TCurlyArc("
421 <<fX1<<","<<fY1<<","<<fR1<<","<<fPhimin<<","<<fPhimax<<","
422 <<fWaveLength<<","<<fAmplitude<<");"<<std::endl;
423 if (!fIsCurly) {
424 out<<" curlyarc->SetWavy();"<<std::endl;
425 }
426 SaveLineAttributes(out,"curlyarc",1,1,1);
427 out<<" curlyarc->Draw();"<<std::endl;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Set Curly Arc center.
432
434{
435 fX1 = x;
436 fY1 = y;
437 Build();
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Set Curly Arc radius.
442
444{
445 fR1 = x;
446 Build();
447}
448
449////////////////////////////////////////////////////////////////////////////////
450/// Set Curly Arc minimum Phi.
451
453{
454 fPhimin = x;
455 Build();
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// Set Curly Arc maximum Phi.
460
462{
463 fPhimax = x;
464 Build();
465}
466
467////////////////////////////////////////////////////////////////////////////////
468/// Set default wave length.
469
471{
472 fgDefaultWaveLength = WaveLength;
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Set default wave amplitude.
477
479{
480 fgDefaultAmplitude = Amplitude ;
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Set default "IsCurly".
485
487{
488 fgDefaultIsCurly = IsCurly;
489}
490
491////////////////////////////////////////////////////////////////////////////////
492/// Get default wave length.
493
495{
496 return fgDefaultWaveLength;
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Get default wave amplitude.
501
503{
504 return fgDefaultAmplitude;
505}
506
507////////////////////////////////////////////////////////////////////////////////
508/// Get default "IsCurly".
509
511{
512 return fgDefaultIsCurly;
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Return the bounding Box of the Line
517
519{
520 Rectangle_t BBox{0,0,0,0};
521 if (!gPad) return BBox;
522
523 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1());
524
525 BBox.fX = gPad->XtoPixel(fX1-fR1);
526 BBox.fY = gPad->YtoPixel(fY1+R2);
527 BBox.fWidth = gPad->XtoPixel(fX1+fR1)-gPad->XtoPixel(fX1-fR1);
528 BBox.fHeight = gPad->YtoPixel(fY1-R2)-gPad->YtoPixel(fY1+R2);
529 return (BBox);
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Return the center of the BoundingBox as TPoint in pixels
534
536{
537 TPoint p(0,0);
538 if (!gPad) return (p);
539 p.SetX(gPad->XtoPixel(fX1));
540 p.SetY(gPad->YtoPixel(fY1));
541 return(p);
542}
543
544////////////////////////////////////////////////////////////////////////////////
545/// Set center of the BoundingBox
546
548{
549 if (!gPad) return;
550 fX1 = gPad->PixeltoX(p.GetX());
551 fY1 = gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0));
552 Build();
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Set X coordinate of the center of the BoundingBox
557
559{
560 if (!gPad) return;
561 fX1 = gPad->PixeltoX(x);
562 Build();
563}
564
565////////////////////////////////////////////////////////////////////////////////
566/// Set Y coordinate of the center of the BoundingBox
567
569{
570 if (!gPad) return;
571 fY1 = gPad->PixeltoY(y-gPad->VtoPixel(0));
572 Build();
573}
574
575////////////////////////////////////////////////////////////////////////////////
576/// Set left hand side of BoundingBox to a value
577/// (resize in x direction on left)
578
580{
581 if (!gPad) return;
582 Double_t x1 = gPad->PixeltoX(x);
583 if (x1>fX1+fR1) return;
584
585 fR1 = (fX1+fR1-x1)*0.5;
586 fX1 = x1 + fR1;
587}
588
589////////////////////////////////////////////////////////////////////////////////
590/// Set right hand side of BoundingBox to a value
591/// (resize in x direction on right)
592
594{
595 if (!gPad) return;
596 Double_t x2 = gPad->PixeltoX(x);
597 if (x2<fX1-fR1) return;
598
599 fR1 = (x2-fX1+fR1)*0.5;
600 fX1 = x2-fR1;
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Set top of BoundingBox to a value (resize in y direction on top)
605
607{
608 if (!gPad) return;
609 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1());
610
611 Double_t y1 = gPad->PixeltoY(y-gPad->VtoPixel(0));
612 if (y1<fY1-R2) return;
613
614 fR1 = (y1-fY1+R2)*0.5 / (TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1()));
615 fY1 = y1-R2;
616}
617
618////////////////////////////////////////////////////////////////////////////////
619/// Set bottom of BoundingBox to a value
620/// (resize in y direction on bottom)
621
623{
624 if (!gPad) return;
625 Double_t R2 = fR1 * TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1());
626
627 Double_t y2 = gPad->PixeltoY(y-gPad->VtoPixel(0));
628
629 if (y2>fY1+R2) return;
630
631 fR1 = (fY1+R2-y2)*0.5 / (TMath::Abs(gPad->GetY2()-gPad->GetY1())/TMath::Abs(gPad->GetX2()-gPad->GetX1()));
632 fY1 = y2+R2;
633}
@ 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:373
@ kBottomSide
Definition GuiTypes.h:373
@ kTopSide
Definition GuiTypes.h:373
@ kLeftSide
Definition GuiTypes.h:373
@ kMove
Definition GuiTypes.h:374
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
winID h TVirtualViewer3D TVirtualGLPainter p
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 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 winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
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 y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:406
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
virtual void Modify()
Change current line attributes if necessary.
Definition TAttLine.cxx:247
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:275
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition TCurlyArc.h:16
Rectangle_t GetBBox() override
Return the bounding Box of the Line.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an arc.
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void SetRadius(Double_t radius)
Set Curly Arc radius.
static Bool_t GetDefaultIsCurly()
Get default "IsCurly".
void Build() override
Create a curly (Gluon) or wavy (Gamma) arc.
Definition TCurlyArc.cxx:75
virtual void SetPhimin(Double_t phimin)
Set Curly Arc minimum Phi.
Double_t fTheta
used internally
Definition TCurlyArc.h:22
static Double_t GetDefaultWaveLength()
Get default wave length.
static TClass * Class()
virtual void SetCenter(Double_t x1, Double_t y1)
Set Curly Arc center.
Double_t fPhimax
end phi (degrees)
Definition TCurlyArc.h:21
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right)
TCurlyArc()
Default constructor.
Definition TCurlyArc.cxx:45
static Double_t fgDefaultWaveLength
default wavelength
Definition TCurlyArc.h:24
static void SetDefaultWaveLength(Double_t WaveLength)
Set default wave length.
static void SetDefaultAmplitude(Double_t Amplitude)
Set default wave amplitude.
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
static Double_t GetDefaultAmplitude()
Get default wave amplitude.
static void SetDefaultIsCurly(Bool_t IsCurly)
Set default "IsCurly".
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
TPoint GetBBoxCenter() override
Return the center of the BoundingBox as TPoint in pixels.
static Bool_t fgDefaultIsCurly
default curly type
Definition TCurlyArc.h:26
void SavePrimitive(std::ostream &out, Option_t *="") override
Save primitive as a C++ statement(s) on output stream out.
void SetBBoxCenter(const TPoint &p) override
Set center of the BoundingBox.
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the BoundingBox.
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
virtual void SetPhimax(Double_t phimax)
Set Curly Arc maximum Phi.
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the BoundingBox.
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
virtual void SetStartPoint(Double_t x1, Double_t y1)
Set start point.
Int_t fNsteps
used internally (controls precision)
Definition TCurlyLine.h:28
virtual void Build()
Create a curly (Gluon) or wavy (Gamma) line.
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
Bool_t fIsCurly
true: Gluon, false: Gamma
Definition TCurlyLine.h:29
Double_t * GetX() const
Definition TPolyLine.h:54
Double_t * GetY() const
Definition TPolyLine.h:55
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
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:646
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:594
constexpr Double_t Pi()
Definition TMath.h:37
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:588
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
#define R2(v, w, x, y, z, i)
Definition sha1.inl:137
Rectangle structure (maps to the X11 XRectangle structure)
Definition GuiTypes.h:361