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