Logo ROOT  
Reference Guide
 
Loading...
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/*************************************************************************
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#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
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
106glparametric.C contains more examples.
107
108Parametric equations can be specified:
109 - 1. by string expressions, as with TF2, but with 'u' instead of 'x' and
110 'v' instead of 'y'.
111 - 2. by function - see ParametricEquation_t declaration.
112
113*/
114
115
116////////////////////////////////////////////////////////////////////////////////
117///Surface is defined by three strings.
118///ROOT does not use exceptions in ctors,
119///so, I have to use MakeZombie to let
120///external user know about errors.
121
125 : TNamed(name, name),
126 fEquation(nullptr),
127 fURange(uMin, uMax),
128 fVRange(vMin, vMax),
129 fConstrained(kFALSE),
130 fModified(kFALSE)
131{
132 if (!xFun.Length() || !yFun.Length() || !zFun.Length()) {
133 Error("TGLParametricEquation", "One of string expressions is empty");
134 MakeZombie();
135 return;
136 }
137
139 equation.ToLower();
141 fXEquation = std::make_unique<TF2>(name + "xEquation", equation.Data(), uMin, uMax, vMin, vMax);
142 //Formula was incorrect.
143 if (fXEquation->IsZombie()) {
144 MakeZombie();
145 return;
146 }
147
148 equation = yFun;
149 equation.ToLower();
151 fYEquation = std::make_unique<TF2>(name + "yEquation", equation.Data(), uMin, uMax, vMin, vMax);
152 //Formula was incorrect.
153 if (fYEquation->IsZombie()) {
154 MakeZombie();
155 return;
156 }
157
158 equation = zFun;
159 equation.ToLower();
161 fZEquation = std::make_unique<TF2>(name + "zEquation", equation.Data(), uMin, uMax, vMin, vMax);
162 //Formula was incorrect.
163 if (fZEquation->IsZombie())
164 MakeZombie();
165}
166
167////////////////////////////////////////////////////////////////////////////////
168///Surface defined by user's function (see ParametricEquation_t declaration in TGLParametricEquation.h)
169
172 : TNamed(name, name),
173 fEquation(equation),
174 fURange(uMin, uMax),
175 fVRange(vMin, vMax),
176 fConstrained(kFALSE),
177 fModified(kFALSE)
178{
179 if (!fEquation) {
180 Error("TGLParametricEquation", "Function ptr is null");
181 MakeZombie();
182 }
183}
184
185////////////////////////////////////////////////////////////////////////////////
186///[uMin, uMax]
187
192
193////////////////////////////////////////////////////////////////////////////////
194///[vMin, vMax]
195
200
201////////////////////////////////////////////////////////////////////////////////
202///Check is constrained.
203
208
209////////////////////////////////////////////////////////////////////////////////
210///Set constrained.
211
216
217////////////////////////////////////////////////////////////////////////////////
218///Something was changed in parametric equation (or constrained option was changed).
219
224
225////////////////////////////////////////////////////////////////////////////////
226///Set modified.
227
232
233////////////////////////////////////////////////////////////////////////////////
234///Calculate vertex.
235
237{
238 if (fEquation)
239 return fEquation(newVertex, u, v);
240
241 if (IsZombie())
242 return;
243
244 newVertex.X() = fXEquation->Eval(u, v);
245 newVertex.Y() = fYEquation->Eval(u, v);
246 newVertex.Z() = fZEquation->Eval(u, v);
247}
248
249////////////////////////////////////////////////////////////////////////////////
250///Check, if parametric surface is under cursor.
251
253{
254 if (fPainter.get())
255 return fPainter->DistancetoPrimitive(px, py);
256 return 9999;
257}
258
259////////////////////////////////////////////////////////////////////////////////
260///Pass event to painter.
261
263{
264 if (fPainter.get())
265 return fPainter->ExecuteEvent(event, px, py);
266}
267
268////////////////////////////////////////////////////////////////////////////////
269///No object info yet.
270
272{
273 static char mess[] = { "parametric surface" };
274 return mess;
275}
276
277////////////////////////////////////////////////////////////////////////////////
278///Delegate paint.
279
281{
282 if (!fPainter.get())
283 fPainter = std::make_unique<TGLHistPainter>(this);
284 fPainter->Paint("dummyoption");
285}
286
287/** \class TGLParametricPlot
288\ingroup opengl
289*/
290
291
292////////////////////////////////////////////////////////////////////////////////
293///Constructor.
294
298 fMeshSize(90),
299 fShowMesh(kFALSE),
300 fColorScheme(4),
301 fEquation(eq)
302{
306
308
309 InitGeometry();
310 InitColors();
311}
312
313////////////////////////////////////////////////////////////////////////////////
314///Build mesh. The surface is 'immutable':
315///the only reason to rebuild it - the change in size or
316///if one of equations contain reference to TF2 function, whose
317///parameters were changed.
318
320{
321 // const Bool_t constrained = kTRUE;//fEquation->IsConstrained();
322
323 if (fMeshSize * fMeshSize != (Int_t)fMesh.size() || fEquation->IsModified()) {
324 if (fEquation->IsZombie())
325 return kFALSE;
326
328
329 fMesh.resize(fMeshSize * fMeshSize);
330 fMesh.SetRowLen(fMeshSize);
331
334
335 const Double_t dU = (uRange.second - uRange.first) / (fMeshSize - 1);
336 const Double_t dV = (vRange.second - vRange.first) / (fMeshSize - 1);
337 const Double_t dd = 0.001;
338 Double_t u = uRange.first;
339
340 TGLVertex3 min;
341 fEquation->EvalVertex(min, uRange.first, vRange.first);
342 TGLVertex3 max(min), newVert, v1, v2;
343 using namespace TMath;
344
345 for (Int_t i = 0; i < fMeshSize; ++i) {
346 Double_t v = vRange.first;
347 for (Int_t j = 0; j < fMeshSize; ++j) {
349 min.X() = Min(min.X(), newVert.X());
350 max.X() = Max(max.X(), newVert.X());
351 min.Y() = Min(min.Y(), newVert.Y());
352 max.Y() = Max(max.Y(), newVert.Y());
353 min.Z() = Min(min.Z(), newVert.Z());
354 max.Z() = Max(max.Z(), newVert.Z());
355
356 fMesh[i][j].fPos = newVert;
357
358 v += dV;
359 }
360 u += dU;
361 }
362
363 TH3F hist("tmp", "tmp", 2, -1., 1., 2, -1., 1., 2, -1., 1.);
364 hist.SetDirectory(nullptr);
365 //TAxis has a lot of attributes, defaults, set by ctor,
366 //are not enough to be correctly painted by TGaxis object.
367 //To simplify their initialization - I use temporary histogram.
371
372 fCartesianXAxis.Set(fMeshSize, min.X(), max.X());
373 fCartesianXAxis.SetTitle("x");//it's lost when copying from temp. hist.
374 fCartesianYAxis.Set(fMeshSize, min.Y(), max.Y());
376 fCartesianZAxis.Set(fMeshSize, min.Z(), max.Z());
378
380 return kFALSE;
381
382 for (Int_t i = 0; i < fMeshSize; ++i) {
383 for (Int_t j = 0; j < fMeshSize; ++j) {
384 TGLVertex3 &ver = fMesh[i][j].fPos;
385 ver.X() *= fCoord->GetXScale(), ver.Y() *= fCoord->GetYScale(), ver.Z() *= fCoord->GetZScale();
386 }
387 }
388
389 u = uRange.first;
390 for (Int_t i = 0; i < fMeshSize; ++i) {
391 Double_t v = vRange.first;
392 for (Int_t j = 0; j < fMeshSize; ++j) {
393 TGLVertex3 &ver = fMesh[i][j].fPos;
394 fEquation->EvalVertex(v1, u + dd, v);
395 fEquation->EvalVertex(v2, u, v + dd);
396 v1.X() *= fCoord->GetXScale(), v1.Y() *= fCoord->GetYScale(), v1.Z() *= fCoord->GetZScale();
397 v2.X() *= fCoord->GetXScale(), v2.Y() *= fCoord->GetYScale(), v2.Z() *= fCoord->GetZScale();
398 Normal2Plane(ver.CArr(), v1.CArr(), v2.CArr(), fMesh[i][j].fNormal.Arr());
399 v += dV;
400 }
401 u += dU;
402 }
403
408 }
409
410 return kTRUE;
411}
412
413////////////////////////////////////////////////////////////////////////////////
414///User clicks right mouse button (in a pad).
415
417{
418 fMousePosition.fX = px;
420 fCamera->StartPan(px, py);
422}
423
424////////////////////////////////////////////////////////////////////////////////
425///User's moving mouse cursor, with middle mouse button pressed (for pad).
426///Calculate 3d shift related to 2d mouse movement.
427
429{
430 if (fSelectedPart) {
433
436
439 else
440 fCamera->Pan(px, py);
441
444 }
445
447}
448
449////////////////////////////////////////////////////////////////////////////////
450///No object info yet.
451
453{
454 static char mess[] = { "parametric surface" };
455 return mess;
456}
457
458////////////////////////////////////////////////////////////////////////////////
459///No additional options for parametric surfaces.
460
462{
463}
464
465////////////////////////////////////////////////////////////////////////////////
466///Change color/mesh size or switch on/off mesh/box cut.
467///Left double click - remove box cut.
468
470{
471 if (event == kButton1Double && fBoxCut.IsActive()) {
473 if (!gVirtualX->IsCmdThread())
474 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%zx)->Paint()", (size_t)this));
475 else
476 Paint();
477 } else if (event == kKeyPress) {
478 if (py == kKey_c || py == kKey_C) {
479 if (fHighColor)
480 Info("ProcessEvent", "Switch to true color to use box cut");
481 else {
484 }
485 } else if (py == kKey_s || py == kKey_S) {
486 fColorScheme == 20 ? fColorScheme = -1 : ++fColorScheme;
487 InitColors();//color scheme was changed! recalculate vertices colors.
488 } else if (py == kKey_w || py == kKey_W) {
490 } else if (py == kKey_l || py == kKey_L) {
491 fMeshSize == kHigh ? fMeshSize = kLow : fMeshSize += 15;
492 InitGeometry();
493 InitColors();
494 }
495 }
496}
497
498////////////////////////////////////////////////////////////////////////////////
499///Initialize gl state.
500
509
510////////////////////////////////////////////////////////////////////////////////
511///Initialize gl state.
512
521
522////////////////////////////////////////////////////////////////////////////////
523///Draw parametric surface.
524
526{
527 //Shift plot to point of origin.
528 const Rgl::PlotTranslation trGuard(this);
529
530 if (!fSelectionPass) {
532 if (fShowMesh) {
534 glPolygonOffset(1.f, 1.f);
535 }
536 } else {
538 }
539
540 glBegin(GL_TRIANGLES);
541
542 for (Int_t i = 0; i < fMeshSize - 1; ++i) {
543 for (Int_t j = 0; j < fMeshSize - 1; ++j) {
544 if (fBoxCut.IsActive()) {
545 using TMath::Min;
546 using TMath::Max;
547 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()));
548 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()));
549 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()));
550 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()));
551 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()));
552 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()));
553
555 continue;
556 }
557
558 glNormal3dv(fMesh[i + 1][j + 1].fNormal.CArr());
559 if(fColorScheme != -1)
560 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j + 1].fRGBA);
561 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
562
563 glNormal3dv(fMesh[i][j + 1].fNormal.CArr());
564 if(fColorScheme != -1)
566 glVertex3dv(fMesh[i][j + 1].fPos.CArr());
567
568 glNormal3dv(fMesh[i][j].fNormal.CArr());
569 if(fColorScheme != -1)
571 glVertex3dv(fMesh[i][j].fPos.CArr());
572
573 glNormal3dv(fMesh[i + 1][j].fNormal.CArr());
574 if(fColorScheme != -1)
576 glVertex3dv(fMesh[i + 1][j].fPos.CArr());
577
578 glNormal3dv(fMesh[i + 1][j + 1].fNormal.CArr());
579 if(fColorScheme != -1)
580 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j + 1].fRGBA);
581 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
582
583 glNormal3dv(fMesh[i][j].fNormal.CArr());
584 if(fColorScheme != -1)
586 glVertex3dv(fMesh[i][j].fPos.CArr());
587 }
588 }
589
590 glEnd();
591
592 if (!fSelectionPass && fShowMesh) {
597
599 glColor4d(0., 0., 0., 0.5);
601
602 for (Int_t i = 0; i < fMeshSize - 1; ++i) {
603 for (Int_t j = 0; j < fMeshSize - 1; ++j) {
604 if (fBoxCut.IsActive()) {
605 using TMath::Min;
606 using TMath::Max;
607 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()));
608 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()));
609 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()));
610 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()));
611 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()));
612 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()));
613
615 continue;
616 }
618 glVertex3dv(fMesh[i][j].fPos.CArr());
619 glVertex3dv(fMesh[i][j + 1].fPos.CArr());
620 glVertex3dv(fMesh[i + 1][j + 1].fPos.CArr());
621 glVertex3dv(fMesh[i + 1][j].fPos.CArr());
622 glEnd();
623 }
624 }
625
627 }
628
629 if (fBoxCut.IsActive())
631}
632
633////////////////////////////////////////////////////////////////////////////////
634///Calculate colors for vertices,
635///using one of 20 color themes.
636///-1 simple 'metal' surface.
637
639{
640 if (fColorScheme == -1)
641 return;
642
644
645 const Float_t dU = Float_t((uRange.second - uRange.first) / (fMeshSize - 1));
646 Float_t u = Float_t(uRange.first);
647
648 for (Int_t i = 0; i < fMeshSize; ++i) {
649 for (Int_t j = 0; j < fMeshSize; ++j)
650 Rgl::GetColor(u, uRange.first, uRange.second, fColorScheme, fMesh[i][j].fRGBA);
651 u += dU;
652 }
653}
654
655////////////////////////////////////////////////////////////////////////////////
656///No such sections.
657
661
662////////////////////////////////////////////////////////////////////////////////
663///No such sections.
664
668
669////////////////////////////////////////////////////////////////////////////////
670///No such sections.
671
675
676////////////////////////////////////////////////////////////////////////////////
677///Set material properties.
678
680{
681 const Float_t specular[] = {1.f, 1.f, 1.f, 1.f};
684
685 if (fColorScheme == -1) {
686 const Float_t outerDiff[] = {0.5f, 0.42f, 0.f, 1.f};
688 const Float_t innerDiff[] = {0.5f, 0.2f, 0.f, 1.f};
690 }
691}
@ kKeyPress
Definition Buttons.h:20
@ kButton1Double
Definition Buttons.h:24
@ 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
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
int Ssiz_t
String size (currently int)
Definition RtypesCore.h:81
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:241
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:411
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
#define gVirtualX
Definition TVirtualX.h:337
void Copy(TObject &axis) const override
Copy axis structure to another axis.
Definition TAxis.cxx:210
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition TAxis.cxx:783
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
void AddOption(const TString &option) override
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
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:8978
TAxis * GetZaxis()
Definition TH1.h:574
TAxis * GetXaxis()
Definition TH1.h:572
TAxis * GetYaxis()
Definition TH1.h:573
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:326
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:173
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:159
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
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:138
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition TGLUtil.cxx:2890
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:3876
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:251
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
TMarker m
Definition textangle.C:8