Logo ROOT  
Reference Guide
TGLParametric.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 26/01/2007
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#include <cctype>
12
13#ifdef WIN32
14#ifndef NOMINMAX
15#define NOMINMAX
16#endif
17#endif
18
19#include "TVirtualX.h"
20#include "TString.h"
21#include "TROOT.h"
22#include "TH3.h"
23
24#include "TGLPlotCamera.h"
25#include "TGLParametric.h"
26#include "TGLIncludes.h"
27#include "TVirtualPad.h"
28#include "KeySymbols.h"
29#include "Buttons.h"
30#include "TColor.h"
31#include "TMath.h"
32
33namespace
34{
35
36 /////////////////////////////////////////////////////////////////////////////
37 ///User defines equations using names 'u' and 'v' for
38 ///parameters. But TF2 works with 'x' and 'y'. So,
39 ///find 'u' and 'v' (which are not parts of other names)
40 ///and replace them with 'x' and 'y' correspondingly.
41
42 void ReplaceUVNames(TString &equation)
43 {
44 using namespace std;
45 const Ssiz_t len = equation.Length();
46 //TF2 requires 'y' in formula.
47 //'v' <=> 'y', so if none 'v' was found, I'll append "+0*y" to the equation.
48 Int_t vFound = 0;
49
50 for (Ssiz_t i = 0; i < len;) {
51 const char c = equation[i];
52 if (!isalpha(c)) {
53 ++i;
54 continue;
55 } else{
56 ++i;
57 if (c == 'u' || c == 'v') {
58 //1. This 'u' or 'v' is the last symbol in a string or
59 //2. After this 'u' or 'v' symbol, which cannot be part of longer name.
60 if (i == len || (!isalpha(equation[i]) && !isdigit(equation[i]) && equation[i] != '_')) {
61 //Replace 'u' with 'x' or 'v' with 'y'.
62 equation[i - 1] = c == 'u' ? 'x' : (++vFound, 'y');
63 } else {
64 //This 'u' or 'v' is the beginning of some longer name.
65 //Skip the remaining part of this name.
66 while (i < len && (isalpha(equation[i]) || isdigit(equation[i]) || equation[i] == '_'))
67 ++i;
68 }
69 } else {
70 while (i < len && (isalpha(equation[i]) || isdigit(equation[i]) || equation[i] == '_'))
71 ++i;
72 }
73 }
74 }
75
76 if (!vFound)
77 equation += "+0*y";
78 }
79
80}
81
82/** \class TGLParametricEquation
83\ingroup opengl
84A parametric surface is a surface defined by a parametric equation, involving
85two parameters (u, v):
86
87~~~ {.cpp}
88S(u, v) = (x(u, v), y(u, v), z(u, v)).
89~~~
90
91For example, "limpet torus" surface can be defined as:
92
93~~~ {.cpp}
94 x = cos(u) / (sqrt(2) + sin(v))
95 y = sin(u) / (sqrt(2) + sin(v))
96 z = 1 / (sqrt(2) + cos(v)),
97~~~
98
99where -pi <= u <= pi, -pi <= v <= pi.
100
101~~~ {.cpp}
102 TGLParametricEquation * eq =
103 new TGLParametricEquation("Limpet_torus", "cos(u) / (sqrt(2.) + sin(v))",
104 "sin(u) / (sqrt(2.) + sin(v))",
105 "1 / (sqrt(2) + cos(v))");
106~~~
107
108 `$ROOTSYS/tutorials/gl/glparametric.C` contains more examples.
109
110 Parametric equations can be specified:
111 - 1. by string expressions, as with TF2, but with 'u' instead of 'x' and
112 'v' instead of 'y'.
113 - 2. by function - see ParametricEquation_t declaration.
114
115*/
116
118
119////////////////////////////////////////////////////////////////////////////////
120///Surface is defined by three strings.
121///ROOT does not use exceptions in ctors,
122///so, I have to use MakeZombie to let
123///external user know about errors.
124
126 const TString &zFun, Double_t uMin, Double_t uMax,
127 Double_t vMin, Double_t vMax)
128 : TNamed(name, name),
129 fEquation(0),
130 fURange(uMin, uMax),
131 fVRange(vMin, vMax),
132 fConstrained(kFALSE),
133 fModified(kFALSE)
134{
135 if (!xFun.Length() || !yFun.Length() || !zFun.Length()) {
136 Error("TGLParametricEquation", "One of string expressions is empty");
137 MakeZombie();
138 return;
139 }
140
141 TString equation(xFun);
142 equation.ToLower();
143 ReplaceUVNames(equation);
144 fXEquation.reset(new TF2(name + "xEquation", equation.Data(), uMin, uMax, vMin, vMax));
145 //Formula was incorrect.
146 if (fXEquation->IsZombie()) {
147 MakeZombie();
148 return;
149 }
150
151 equation = yFun;
152 equation.ToLower();
153 ReplaceUVNames(equation);
154 fYEquation.reset(new TF2(name + "yEquation", equation.Data(), uMin, uMax, vMin, vMax));
155 //Formula was incorrect.
156 if (fYEquation->IsZombie()) {
157 MakeZombie();
158 return;
159 }
160
161 equation = zFun;
162 equation.ToLower();
163 ReplaceUVNames(equation);
164 fZEquation.reset(new TF2(name + "zEquation", equation.Data(), uMin, uMax, vMin, vMax));
165 //Formula was incorrect.
166 if (fZEquation->IsZombie())
167 MakeZombie();
168}
169
170////////////////////////////////////////////////////////////////////////////////
171///Surface defined by user's function (see ParametricEquation_t declaration in TGLParametricEquation.h)
172
174 Double_t uMin, Double_t uMax, Double_t vMin, Double_t vMax)
175 : TNamed(name, name),
176 fEquation(equation),
177 fURange(uMin, uMax),
178 fVRange(vMin, vMax),
179 fConstrained(kFALSE),
180 fModified(kFALSE)
181{
182 if (!fEquation) {
183 Error("TGLParametricEquation", "Function ptr is null");
184 MakeZombie();
185 }
186}
187
188////////////////////////////////////////////////////////////////////////////////
189///[uMin, uMax]
190
192{
193 return fURange;
194}
195
196////////////////////////////////////////////////////////////////////////////////
197///[vMin, vMax]
198
200{
201 return fVRange;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205///Check is constrained.
206
208{
209 return fConstrained;
210}
211
212////////////////////////////////////////////////////////////////////////////////
213///Set constrained.
214
216{
217 fConstrained = c;
218}
219
220////////////////////////////////////////////////////////////////////////////////
221///Something was changed in parametric equation (or constrained option was changed).
222
224{
225 return fModified;
226}
227
228////////////////////////////////////////////////////////////////////////////////
229///Set modified.
230
232{
233 fModified = m;
234}
235
236////////////////////////////////////////////////////////////////////////////////
237///Calculate vertex.
238
240{
241 if (fEquation)
242 return fEquation(newVertex, u, v);
243
244 if (IsZombie())
245 return;
246
247 newVertex.X() = fXEquation->Eval(u, v);
248 newVertex.Y() = fYEquation->Eval(u, v);
249 newVertex.Z() = fZEquation->Eval(u, v);
250}
251
252////////////////////////////////////////////////////////////////////////////////
253///Check, if parametric surface is under cursor.
254
256{
257 if (fPainter.get())
258 return fPainter->DistancetoPrimitive(px, py);
259 return 9999;
260}
261
262////////////////////////////////////////////////////////////////////////////////
263///Pass event to painter.
264
266{
267 if (fPainter.get())
268 return fPainter->ExecuteEvent(event, px, py);
269}
270
271////////////////////////////////////////////////////////////////////////////////
272///No object info yet.
273
275{
276 static char mess[] = { "parametric surface" };
277 return mess;
278}
279
280////////////////////////////////////////////////////////////////////////////////
281///Delegate paint.
282
284{
285 if (!fPainter.get())
286 fPainter.reset(new TGLHistPainter(this));
287 fPainter->Paint("dummyoption");
288}
289
290/** \class TGLParametricPlot
291\ingroup opengl
292*/
293
295
296////////////////////////////////////////////////////////////////////////////////
297///Constructor.
298
300 TGLPlotCamera *camera)
301 : TGLPlotPainter(camera),
302 fMeshSize(90),
303 fShowMesh(kFALSE),
304 fColorScheme(4),
305 fEquation(eq)
306{
310
312
313 InitGeometry();
314 InitColors();
315}
316
317////////////////////////////////////////////////////////////////////////////////
318///Build mesh. The surface is 'immutable':
319///the only reason to rebuild it - the change in size or
320///if one of equations contain reference to TF2 function, whose
321///parameters were changed.
322
324{
325 // const Bool_t constrained = kTRUE;//fEquation->IsConstrained();
326
327 if (fMeshSize * fMeshSize != (Int_t)fMesh.size() || fEquation->IsModified()) {
328 if (fEquation->IsZombie())
329 return kFALSE;
330
332
333 fMesh.resize(fMeshSize * fMeshSize);
334 fMesh.SetRowLen(fMeshSize);
335
336 const Rgl::Range_t uRange(fEquation->GetURange());
337 const Rgl::Range_t vRange(fEquation->GetVRange());
338
339 const Double_t dU = (uRange.second - uRange.first) / (fMeshSize - 1);
340 const Double_t dV = (vRange.second - vRange.first) / (fMeshSize - 1);
341 const Double_t dd = 0.001;
342 Double_t u = uRange.first;
343
344 TGLVertex3 min;
345 fEquation->EvalVertex(min, uRange.first, vRange.first);
346 TGLVertex3 max(min), newVert, v1, v2;
347 using namespace TMath;
348
349 for (Int_t i = 0; i < fMeshSize; ++i) {
350 Double_t v = vRange.first;
351 for (Int_t j = 0; j < fMeshSize; ++j) {
352 fEquation->EvalVertex(newVert, u, v);
353 min.X() = Min(min.X(), newVert.X());
354 max.X() = Max(max.X(), newVert.X());
355 min.Y() = Min(min.Y(), newVert.Y());
356 max.Y() = Max(max.Y(), newVert.Y());
357 min.Z() = Min(min.Z(), newVert.Z());
358 max.Z() = Max(max.Z(), newVert.Z());
359
360 fMesh[i][j].fPos = newVert;
361
362 v += dV;
363 }
364 u += dU;
365 }
366
367 TH3F hist("tmp", "tmp", 2, -1., 1., 2, -1., 1., 2, -1., 1.);
368 hist.SetDirectory(0);
369 //TAxis has a lot of attributes, defaults, set by ctor,
370 //are not enough to be correctly painted by TGaxis object.
371 //To simplify their initialization - I use temporary histogram.
375
376 fCartesianXAxis.Set(fMeshSize, min.X(), max.X());
377 fCartesianXAxis.SetTitle("x");//it's lost when copying from temp. hist.
378 fCartesianYAxis.Set(fMeshSize, min.Y(), max.Y());
380 fCartesianZAxis.Set(fMeshSize, min.Z(), max.Z());
382
384 return kFALSE;
385
386 for (Int_t i = 0; i < fMeshSize; ++i) {
387 for (Int_t j = 0; j < fMeshSize; ++j) {
388 TGLVertex3 &ver = fMesh[i][j].fPos;
389 ver.X() *= fCoord->GetXScale(), ver.Y() *= fCoord->GetYScale(), ver.Z() *= fCoord->GetZScale();
390 }
391 }
392
393 u = uRange.first;
394 for (Int_t i = 0; i < fMeshSize; ++i) {
395 Double_t v = vRange.first;
396 for (Int_t j = 0; j < fMeshSize; ++j) {
397 TGLVertex3 &ver = fMesh[i][j].fPos;
398 fEquation->EvalVertex(v1, u + dd, v);
399 fEquation->EvalVertex(v2, u, v + dd);
400 v1.X() *= fCoord->GetXScale(), v1.Y() *= fCoord->GetYScale(), v1.Z() *= fCoord->GetZScale();
401 v2.X() *= fCoord->GetXScale(), v2.Y() *= fCoord->GetYScale(), v2.Z() *= fCoord->GetZScale();
402 Normal2Plane(ver.CArr(), v1.CArr(), v2.CArr(), fMesh[i][j].fNormal.Arr());
403 v += dV;
404 }
405 u += dU;
406 }
407
412 }
413
414 return kTRUE;
415}
416
417////////////////////////////////////////////////////////////////////////////////
418///User clicks right mouse button (in a pad).
419
421{
422 fMousePosition.fX = px;
424 fCamera->StartPan(px, py);
426}
427
428////////////////////////////////////////////////////////////////////////////////
429///User's moving mouse cursor, with middle mouse button pressed (for pad).
430///Calculate 3d shift related to 2d mouse movement.
431
433{
434 if (fSelectedPart) {
437
440
443 else
444 fCamera->Pan(px, py);
445
448 }
449
451}
452
453////////////////////////////////////////////////////////////////////////////////
454///No object info yet.
455
457{
458 static char mess[] = { "parametric surface" };
459 return mess;
460}
461
462////////////////////////////////////////////////////////////////////////////////
463///No additional options for parametric surfaces.
464
466{
467}
468
469////////////////////////////////////////////////////////////////////////////////
470///Change color/mesh size or switch on/off mesh/box cut.
471///Left double click - remove box cut.
472
474{
475 if (event == kButton1Double && fBoxCut.IsActive()) {
477 if (!gVirtualX->IsCmdThread())
478 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%lx)->Paint()", (ULong_t)this));
479 else
480 Paint();
481 } else if (event == kKeyPress) {
482 if (py == kKey_c || py == kKey_C) {
483 if (fHighColor)
484 Info("ProcessEvent", "Switch to true color to use box cut");
485 else {
488 }
489 } else if (py == kKey_s || py == kKey_S) {
490 fColorScheme == 20 ? fColorScheme = -1 : ++fColorScheme;
491 InitColors();//color scheme was changed! recalculate vertices colors.
492 } else if (py == kKey_w || py == kKey_W) {
494 } else if (py == kKey_l || py == kKey_L) {
495 fMeshSize == kHigh ? fMeshSize = kLow : fMeshSize += 15;
496 InitGeometry();
497 InitColors();
498 }
499 }
500}
501
502////////////////////////////////////////////////////////////////////////////////
503///Initialize gl state.
504
506{
507 glEnable(GL_DEPTH_TEST);
508 glEnable(GL_LIGHTING);
509 glEnable(GL_LIGHT0);
510 glDisable(GL_CULL_FACE);
511 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
512}
513
514////////////////////////////////////////////////////////////////////////////////
515///Initialize gl state.
516
518{
519 glDisable(GL_DEPTH_TEST);
520 glDisable(GL_LIGHTING);
521 glDisable(GL_LIGHT0);
522 glDisable(GL_CULL_FACE);
523 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
524}
525
526////////////////////////////////////////////////////////////////////////////////
527///Draw parametric surface.
528
530{
531 //Shift plot to point of origin.
532 const Rgl::PlotTranslation trGuard(this);
533
534 if (!fSelectionPass) {
536 if (fShowMesh) {
537 glEnable(GL_POLYGON_OFFSET_FILL);
538 glPolygonOffset(1.f, 1.f);
539 }
540 } else {
542 }
543
544 glBegin(GL_TRIANGLES);
545
546 for (Int_t i = 0; i < fMeshSize - 1; ++i) {
547 for (Int_t j = 0; j < fMeshSize - 1; ++j) {
548 if (fBoxCut.IsActive()) {
549 using TMath::Min;
550 using TMath::Max;
551 const Double_t xMin = Min(Min(fMesh[i][j].fPos.X(), fMesh[i + 1][j].fPos.X()), Min(fMesh[i][j + 1].fPos.X(), fMesh[i + 1][j + 1].fPos.X()));
552 const Double_t xMax = Max(Max(fMesh[i][j].fPos.X(), fMesh[i + 1][j].fPos.X()), Max(fMesh[i][j + 1].fPos.X(), fMesh[i + 1][j + 1].fPos.X()));
553 const Double_t yMin = Min(Min(fMesh[i][j].fPos.Y(), fMesh[i + 1][j].fPos.Y()), Min(fMesh[i][j + 1].fPos.Y(), fMesh[i + 1][j + 1].fPos.Y()));
554 const Double_t yMax = Max(Max(fMesh[i][j].fPos.Y(), fMesh[i + 1][j].fPos.Y()), Max(fMesh[i][j + 1].fPos.Y(), fMesh[i + 1][j + 1].fPos.Y()));
555 const Double_t zMin = Min(Min(fMesh[i][j].fPos.Z(), fMesh[i + 1][j].fPos.Z()), Min(fMesh[i][j + 1].fPos.Z(), fMesh[i + 1][j + 1].fPos.Z()));
556 const Double_t zMax = Max(Max(fMesh[i][j].fPos.Z(), fMesh[i + 1][j].fPos.Z()), Max(fMesh[i][j + 1].fPos.Z(), fMesh[i + 1][j + 1].fPos.Z()));
557
558 if (fBoxCut.IsInCut(xMin, xMax, yMin, yMax, zMin, zMax))
559 continue;
560 }
561
562 glNormal3dv(fMesh[i + 1][j + 1].fNormal.CArr());
563 if(fColorScheme != -1)
564 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j + 1].fRGBA);
565 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
566
567 glNormal3dv(fMesh[i][j + 1].fNormal.CArr());
568 if(fColorScheme != -1)
569 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j + 1].fRGBA);
570 glVertex3dv(fMesh[i][j + 1].fPos.CArr());
571
572 glNormal3dv(fMesh[i][j].fNormal.CArr());
573 if(fColorScheme != -1)
574 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j].fRGBA);
575 glVertex3dv(fMesh[i][j].fPos.CArr());
576
577 glNormal3dv(fMesh[i + 1][j].fNormal.CArr());
578 if(fColorScheme != -1)
579 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j].fRGBA);
580 glVertex3dv(fMesh[i + 1][j].fPos.CArr());
581
582 glNormal3dv(fMesh[i + 1][j + 1].fNormal.CArr());
583 if(fColorScheme != -1)
584 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j + 1].fRGBA);
585 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
586
587 glNormal3dv(fMesh[i][j].fNormal.CArr());
588 if(fColorScheme != -1)
589 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j].fRGBA);
590 glVertex3dv(fMesh[i][j].fPos.CArr());
591 }
592 }
593
594 glEnd();
595
596 if (!fSelectionPass && fShowMesh) {
597 glDisable(GL_POLYGON_OFFSET_FILL);
598 const TGLDisableGuard lightGuard(GL_LIGHTING);
599 const TGLEnableGuard blendGuard(GL_BLEND);
600 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);
601
602 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
603 glColor4d(0., 0., 0., 0.5);
604 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
605
606 for (Int_t i = 0; i < fMeshSize - 1; ++i) {
607 for (Int_t j = 0; j < fMeshSize - 1; ++j) {
608 if (fBoxCut.IsActive()) {
609 using TMath::Min;
610 using TMath::Max;
611 const Double_t xMin = Min(Min(fMesh[i][j].fPos.X(), fMesh[i + 1][j].fPos.X()), Min(fMesh[i][j + 1].fPos.X(), fMesh[i + 1][j + 1].fPos.X()));
612 const Double_t xMax = Max(Max(fMesh[i][j].fPos.X(), fMesh[i + 1][j].fPos.X()), Max(fMesh[i][j + 1].fPos.X(), fMesh[i + 1][j + 1].fPos.X()));
613 const Double_t yMin = Min(Min(fMesh[i][j].fPos.Y(), fMesh[i + 1][j].fPos.Y()), Min(fMesh[i][j + 1].fPos.Y(), fMesh[i + 1][j + 1].fPos.Y()));
614 const Double_t yMax = Max(Max(fMesh[i][j].fPos.Y(), fMesh[i + 1][j].fPos.Y()), Max(fMesh[i][j + 1].fPos.Y(), fMesh[i + 1][j + 1].fPos.Y()));
615 const Double_t zMin = Min(Min(fMesh[i][j].fPos.Z(), fMesh[i + 1][j].fPos.Z()), Min(fMesh[i][j + 1].fPos.Z(), fMesh[i + 1][j + 1].fPos.Z()));
616 const Double_t zMax = Max(Max(fMesh[i][j].fPos.Z(), fMesh[i + 1][j].fPos.Z()), Max(fMesh[i][j + 1].fPos.Z(), fMesh[i + 1][j + 1].fPos.Z()));
617
618 if (fBoxCut.IsInCut(xMin, xMax, yMin, yMax, zMin, zMax))
619 continue;
620 }
621 glBegin(GL_POLYGON);
622 glVertex3dv(fMesh[i][j].fPos.CArr());
623 glVertex3dv(fMesh[i][j + 1].fPos.CArr());
624 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
625 glVertex3dv(fMesh[i + 1][j].fPos.CArr());
626 glEnd();
627 }
628 }
629
630 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
631 }
632
633 if (fBoxCut.IsActive())
635}
636
637////////////////////////////////////////////////////////////////////////////////
638///Calculate colors for vertices,
639///using one of 20 color themes.
640///-1 simple 'metal' surface.
641
643{
644 if (fColorScheme == -1)
645 return;
646
647 const Rgl::Range_t uRange(fEquation->GetURange());
648
649 const Float_t dU = Float_t((uRange.second - uRange.first) / (fMeshSize - 1));
650 Float_t u = Float_t(uRange.first);
651
652 for (Int_t i = 0; i < fMeshSize; ++i) {
653 for (Int_t j = 0; j < fMeshSize; ++j)
654 Rgl::GetColor(u, uRange.first, uRange.second, fColorScheme, fMesh[i][j].fRGBA);
655 u += dU;
656 }
657}
658
659////////////////////////////////////////////////////////////////////////////////
660///No such sections.
661
663{
664}
665
666////////////////////////////////////////////////////////////////////////////////
667///No such sections.
668
670{
671}
672
673////////////////////////////////////////////////////////////////////////////////
674///No such sections.
675
677{
678}
679
680////////////////////////////////////////////////////////////////////////////////
681///Set material properties.
682
684{
685 const Float_t specular[] = {1.f, 1.f, 1.f, 1.f};
686 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
687 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.f);
688
689 if (fColorScheme == -1) {
690 const Float_t outerDiff[] = {0.5f, 0.42f, 0.f, 1.f};
691 glMaterialfv(GL_FRONT, GL_DIFFUSE, outerDiff);
692 const Float_t innerDiff[] = {0.5f, 0.2f, 0.f, 1.f};
693 glMaterialfv(GL_BACK, GL_DIFFUSE, innerDiff);
694 }
695}
@ kKeyPress
Definition: Buttons.h:20
@ kButton1Double
Definition: Buttons.h:24
#define GL_TRUE
Definition: GL_glu.h:262
#define GL_TRIANGLES
Definition: GL_glu.h:287
#define GL_FALSE
Definition: GL_glu.h:261
#define GL_POLYGON
Definition: GL_glu.h:292
@ kKey_W
Definition: KeySymbols.h:148
@ kKey_L
Definition: KeySymbols.h:137
@ kKey_l
Definition: KeySymbols.h:169
@ kKey_C
Definition: KeySymbols.h:128
@ kKey_S
Definition: KeySymbols.h:144
@ kKey_s
Definition: KeySymbols.h:176
@ kKey_w
Definition: KeySymbols.h:180
@ kKey_c
Definition: KeySymbols.h:160
#define c(i)
Definition: RSha256.hxx:101
const Bool_t kFALSE
Definition: RtypesCore.h:90
unsigned long ULong_t
Definition: RtypesCore.h:53
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
void Info(const char *location, const char *msgfmt,...)
void(* ParametricEquation_t)(TGLVertex3 &, Double_t u, Double_t v)
Definition: TGLParametric.h:33
char name[80]
Definition: TGX11.cxx:109
#define gROOT
Definition: TROOT.h:406
char * Form(const char *fmt,...)
#define gVirtualX
Definition: TVirtualX.h:338
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition: TAxis.cxx:728
virtual void Copy(TObject &axis) const
Copy axis structure to another axis.
Definition: TAxis.cxx:207
A 2-Dim function with parameters.
Definition: TF2.h:29
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
Bool_t IsInCut(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax) const
Check, if box defined by xmin/xmax etc. is in cut.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
void TurnOnOff()
Turn the box cut on/off.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
Bool_t IsActive() const
The histogram painter class using OpenGL.
A parametric surface is a surface defined by a parametric equation, involving two parameters (u,...
Definition: TGLParametric.h:35
Rgl::Range_t GetVRange() const
[vMin, vMax]
ParametricEquation_t fEquation
Definition: TGLParametric.h:43
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Pass event to painter.
void Paint(Option_t *option)
Delegate paint.
Bool_t IsModified() const
Something was changed in parametric equation (or constrained option was changed).
TGLParametricEquation(const TString &name, const TString &xEquation, const TString &yEquation, const TString &zEquation, Double_t uMin, Double_t uMax, Double_t vMin, Double_t vMax)
Surface is defined by three strings.
char * GetObjectInfo(Int_t px, Int_t py) const
No object info yet.
Rgl::Range_t GetURange() const
[uMin, uMax]
Bool_t IsConstrained() const
Check is constrained.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Check, if parametric surface is under cursor.
Rgl::Range_t fVRange
Definition: TGLParametric.h:46
Rgl::Range_t fURange
Definition: TGLParametric.h:45
void EvalVertex(TGLVertex3 &newVertex, Double_t u, Double_t v) const
Calculate vertex.
void SetConstrained(Bool_t c)
Set constrained.
void SetModified(Bool_t m)
Set modified.
TGLParametricPlot(TGLParametricEquation *equation, TGLPlotCamera *camera)
Constructor.
void InitColors()
Calculate colors for vertices, using one of 20 color themes.
void DeInitGL() const
Initialize gl state.
Bool_t InitGeometry()
Build mesh.
void AddOption(const TString &option)
No additional options for parametric surfaces.
void InitGL() const
Initialize gl state.
void DrawSectionXOY() const
No such sections.
void DrawSectionYOZ() const
No such sections.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color/mesh size or switch on/off mesh/box cut.
char * GetPlotInfo(Int_t px, Int_t py)
No object info yet.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
void DrawPlot() const
Draw parametric surface.
void SetSurfaceColor() const
Set material properties.
TGLPlotCoordinates fCartesianCoord
TGLParametricEquation * fEquation
TGL2DArray< Vertex_t > fMesh
Definition: TGLParametric.h:99
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void DrawSectionXOZ() const
No such sections.
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
Definition: TGLPlotBox.cxx:198
const TGLVertex3 * Get3DBox() const
Get 3D box.
Definition: TGLPlotBox.cxx:303
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:22
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void SetCamera() const
Viewport and projection.
void Pan(Int_t px, Int_t py)
Pan camera.
Int_t GetHeight() const
viewport[3]
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
Double_t GetYScale() const
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
Double_t GetXScale() const
Double_t GetZScale() const
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
Double_t fPadTheta
void RestoreModelviewMatrix() const
TGLBoxCut fBoxCut
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
TGLPlotBox fBackBox
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
Bool_t fUpdateSelection
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:83
Double_t X() const
Definition: TGLUtil.h:118
Double_t Z() const
Definition: TGLUtil.h:122
Double_t Y() const
Definition: TGLUtil.h:120
const Double_t * CArr() const
Definition: TGLUtil.h:125
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8393
TAxis * GetZaxis()
Definition: TH1.h:318
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TAxis * GetYaxis()
Definition: TH1.h:317
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:267
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:149
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
void MakeZombie()
Definition: TObject.h:49
SCoord_t fY
Definition: TPoint.h:36
SCoord_t fX
Definition: TPoint.h:35
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
const char * Data() const
Definition: TString.h:364
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition: TGLUtil.cxx:2892
void GetColor(Float_t v, Float_t vmin, Float_t vmax, Int_t type, Float_t *rgba)
This function creates color for parametric surface's vertex, using its 'u' value.
Definition: TGLUtil.cxx:3878
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1194
TMath.
Definition: TMathBase.h:35
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculate a normal vector of a plane.
Definition: TMath.h:1179
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
auto * m
Definition: textangle.C:8