82 Double_t wavelengthPix,amplitudePix, lengthPix, hPix;
91 pixeltoX = xrange / pxrange;
92 pixeltoY = yrange/pyrange;
99 lengthPix =
TMath::Sqrt((px2-px1)*(px2-px1) + (py1-py2)*(py1-py2));
109 lengthPix =
TMath::Sqrt((px2-px1)*(px2-px1) + (py1-py2)*(py1-py2));
119 Double_t lengthcycle = 0.5 * len2pi + 2 * amplitudePix;
121 Int_t nperiods = (
Int_t)((lengthPix - lengthcycle) / len2pi);
122 Double_t restlength = 0.5 * (lengthPix - nperiods * len2pi - lengthcycle);
123 fNsteps = (
Int_t)(anglestep * nperiods + anglestep / 2 + 4);
128 xv[0] = 0; yv[0] = 0;
129 xv[1] = restlength; yv[1] = 0;
131 Double_t x0 = amplitudePix + restlength;
133 for(i = 2; i <
fNsteps-1; i++){
154 xx = xv[i] * cosang - yv[i] * sinang;
155 yy = xv[i] * sinang + yv[i] * cosang;
190 static Int_t d1,d2,px1,px2,py1,py2;
191 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
219 px1old = px1; py1old = py1;
226 px2old = px2; py2old = py2;
233 pxold = px; pyold = py;
243 gVirtualX->DrawLine(px1old, py1old, px2, py2);
252 gVirtualX->DrawLine(px1, py1, px2old, py2old);
260 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
261 dx = px-pxold; dy = py-pyold;
262 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
263 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
277 gPad->ShowGuidelines(
this, event,
'2',
true);
279 gPad->ShowGuidelines(
this, event,
'3',
true);
283 gPad->ShowGuidelines(
this, event,
'1',
true);
285 gPad->ShowGuidelines(
this, event,
'4',
true);
292 gPad->ShowGuidelines(
this, event,
'4',
true);
294 gPad->ShowGuidelines(
this, event,
'1',
true);
298 gPad->ShowGuidelines(
this, event,
'3',
true);
300 gPad->ShowGuidelines(
this, event,
'2',
true);
304 gPad->ShowGuidelines(
this, event,
'i',
true);
314 gPad->ShowGuidelines(
this, event);
333 if (!opaque)
gVirtualX->SetLineColor(-1);
345 out<<
" TCurlyLine *";
347 out<<
"curlyline = new TCurlyLine("
351 out<<
" curlyline->SetWavy();"<<std::endl;
354 out<<
" curlyline->Draw();"<<std::endl;
467 Int_t px1, py1, px2, py2;
474 if (px1>px2) { tmp = px1; px1 = px2; px2 = tmp;}
475 if (py1>py2) { tmp = py1; py1 = py2; py2 = tmp;}
504 x1 =
x2 = y1 = y2 = 0;
static const double x2[5]
static const double x1[5]
virtual void Modify()
Change current line attributes if necessary.
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
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.
Implements curly or wavy polylines used to draw Feynman diagrams.
TCurlyLine()
Default constructor.
virtual void SetWaveLength(Double_t WaveLength)
Set wave length.
virtual void SetCurly()
Set curly.
Double_t fY1
start y, center for arc
virtual void SetAmplitude(Double_t x)
Set amplitude.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Double_t fWaveLength
wavelength of sinusoid in percent of pad height
Double_t fAmplitude
amplitude of sinusoid in percent of pad height
virtual void SetStartPoint(Double_t x1, Double_t y1)
Set start point.
Int_t fNsteps
used internally (controls precision)
virtual Rectangle_t GetBBox()
Return the bounding Box of the CurlyLine.
virtual void SetBBoxCenter(const TPoint &p)
Set center of the BoundingBox.
virtual void SetBBoxX2(const Int_t x)
Set right hands ide of BoundingBox to a value (resize in x direction on right)
virtual TPoint GetBBoxCenter()
Return the center of the BoundingBox as TPoint in pixels.
static Double_t GetDefaultWaveLength()
Get default wave length.
static Bool_t GetDefaultIsCurly()
Get default "IsCurly".
virtual void Build()
Create a curly (Gluon) or wavy (Gamma) line.
static void SetDefaultAmplitude(Double_t Amplitude)
Set default amplitude.
static void SetDefaultWaveLength(Double_t WaveLength)
Set default wave length.
static Bool_t fgDefaultIsCurly
default curly type
static Double_t GetDefaultAmplitude()
Get default amplitude.
virtual void SetEndPoint(Double_t x2, Double_t y2)
Set end point.
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the BoundingBox.
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the BoundingBox.
Double_t fX1
start x, center for arc
static Double_t fgDefaultWaveLength
default wavelength
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save primitive as a C++ statement(s) on output stream out.
static void SetDefaultIsCurly(Bool_t IsCurly)
Set default "IsCurly".
virtual void SetWavy()
Set wavy.
static Double_t fgDefaultAmplitude
default amplitude
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
Bool_t fIsCurly
true: Gluon, false: Gamma
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void SetPolyLine(Int_t n)
Resize this polyline to size n.
Short_t Max(Short_t a, Short_t b)
Double_t ATan2(Double_t y, Double_t x)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)