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
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
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
123 const TString &zFun, Double_t uMin, Double_t uMax,
124 Double_t vMin, Double_t vMax)
125 : TNamed(name, name),
126 fEquation(nullptr),
127 fURange(uMin, uMax),
128 fVRange(vMin, vMax),
131{
132 if (!xFun.Length() || !yFun.Length() || !zFun.Length()) {
133 Error("TGLParametricEquation", "One of string expressions is empty");
134 MakeZombie();
135 return;
136 }
137
138 TString equation(xFun);
139 equation.ToLower();
140 ReplaceUVNames(equation);
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();
150 ReplaceUVNames(equation);
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();
160 ReplaceUVNames(equation);
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
171 Double_t uMin, Double_t uMax, Double_t vMin, Double_t vMax)
172 : TNamed(name, name),
173 fEquation(equation),
174 fURange(uMin, uMax),
175 fVRange(vMin, vMax),
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
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
327 fEquation->SetModified(kFALSE);
328
329 fMesh.resize(fMeshSize * fMeshSize);
330 fMesh.SetRowLen(fMeshSize);
331
332 const Rgl::Range_t uRange(fEquation->GetURange());
333 const Rgl::Range_t vRange(fEquation->GetVRange());
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) {
348 fEquation->EvalVertex(newVert, u, v);
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());
375 fCartesianYAxis.SetTitle("y");
376 fCartesianZAxis.Set(fMeshSize, min.Z(), max.Z());
377 fCartesianZAxis.SetTitle("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
404 fBackBox.SetPlotBox(fCoord->GetXRangeScaled(),
405 fCoord->GetYRangeScaled(),
406 fCoord->GetZRangeScaled());
407 if (fCamera) fCamera->SetViewVolume(fBackBox.Get3DBox());
408 }
409
410 return kTRUE;
411}
412
413////////////////////////////////////////////////////////////////////////////////
414///User clicks right mouse button (in a pad).
415
417{
418 fMousePosition.fX = px;
419 fMousePosition.fY = fCamera->GetHeight() - py;
420 fCamera->StartPan(px, py);
421 fBoxCut.StartMovement(px, fCamera->GetHeight() - 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
434 fCamera->SetCamera();
435 fCamera->Apply(fPadPhi, fPadTheta);
436
437 if (fBoxCut.IsActive() && (fSelectedPart >= kXAxis && fSelectedPart <= kZAxis))
438 fBoxCut.MoveBox(px, fCamera->GetHeight() - py, fSelectedPart);
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()) {
472 fBoxCut.TurnOnOff();
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 {
482 fBoxCut.TurnOnOff();
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
502{
503 glEnable(GL_DEPTH_TEST);
504 glEnable(GL_LIGHTING);
505 glEnable(GL_LIGHT0);
506 glDisable(GL_CULL_FACE);
507 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511///Initialize gl state.
512
514{
515 glDisable(GL_DEPTH_TEST);
516 glDisable(GL_LIGHTING);
517 glDisable(GL_LIGHT0);
518 glDisable(GL_CULL_FACE);
519 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
520}
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) {
533 glEnable(GL_POLYGON_OFFSET_FILL);
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
554 if (fBoxCut.IsInCut(xMin, xMax, yMin, yMax, zMin, zMax))
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)
565 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j + 1].fRGBA);
566 glVertex3dv(fMesh[i][j + 1].fPos.CArr());
567
568 glNormal3dv(fMesh[i][j].fNormal.CArr());
569 if(fColorScheme != -1)
570 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j].fRGBA);
571 glVertex3dv(fMesh[i][j].fPos.CArr());
572
573 glNormal3dv(fMesh[i + 1][j].fNormal.CArr());
574 if(fColorScheme != -1)
575 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i + 1][j].fRGBA);
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)
585 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, fMesh[i][j].fRGBA);
586 glVertex3dv(fMesh[i][j].fPos.CArr());
587 }
588 }
589
590 glEnd();
591
592 if (!fSelectionPass && fShowMesh) {
593 glDisable(GL_POLYGON_OFFSET_FILL);
594 const TGLDisableGuard lightGuard(GL_LIGHTING);
595 const TGLEnableGuard blendGuard(GL_BLEND);
596 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);
597
598 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
599 glColor4d(0., 0., 0., 0.5);
600 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
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
614 if (fBoxCut.IsInCut(xMin, xMax, yMin, yMax, zMin, zMax))
615 continue;
616 }
617 glBegin(GL_POLYGON);
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
626 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
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
643 const Rgl::Range_t uRange(fEquation->GetURange());
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};
682 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
683 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.f);
684
685 if (fColorScheme == -1) {
686 const Float_t outerDiff[] = {0.5f, 0.42f, 0.f, 1.f};
687 glMaterialfv(GL_FRONT, GL_DIFFUSE, outerDiff);
688 const Float_t innerDiff[] = {0.5f, 0.2f, 0.f, 1.f};
689 glMaterialfv(GL_BACK, GL_DIFFUSE, innerDiff);
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
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
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)
char name[80]
Definition TGX11.cxx:148
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2496
#define gVirtualX
Definition TVirtualX.h:375
void Copy(TObject &axis) const override
Copy axis structure to another axis.
Definition TAxis.cxx:211
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).
Camera for TGLPlotPainter and sub-classes.
TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord, Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable)
TGLPlotPainter's ctor.
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:9074
TAxis * GetZaxis()
Definition TH1.h:573
TAxis * GetXaxis()
Definition TH1.h:571
TAxis * GetYaxis()
Definition TH1.h:572
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:369
TNamed()
Definition TNamed.h:38
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1098
void MakeZombie()
Definition TObject.h:55
Bool_t IsZombie() const
Definition TObject.h:161
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
const char * Data() const
Definition TString.h:384
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
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
Definition TMath.h:1299
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
TMarker m
Definition textangle.C:8