Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLTF3Painter.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 31/08/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, 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
12#include <typeinfo>
13
14#include "KeySymbols.h"
15#include "TVirtualX.h"
16#include "Buttons.h"
17#include "TString.h"
18#include "TROOT.h"
19#include "TColor.h"
20#include "TMath.h"
21#include "TH3.h"
22#include "TF3.h"
23
24#include "TGLMarchingCubes.h"
25#include "TGLPlotCamera.h"
26#include "TGLTF3Painter.h"
27#include "TGLIncludes.h"
28
29/** \class TGLTF3Painter
30\ingroup opengl
31Plot-painter for TF3 functions.
32*/
33
35
36////////////////////////////////////////////////////////////////////////////////
37/// Constructor.
38
40 : TGLPlotPainter(hist, camera, coord, kFALSE, kFALSE, kFALSE),
41 fStyle(kDefault),
42 fF3(fun),
43 fXOZSlice("XOZ", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kXOZ),
44 fYOZSlice("YOZ", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kYOZ),
45 fXOYSlice("XOY", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kXOY)
46{
47}
48
49////////////////////////////////////////////////////////////////////////////////
50///Coords for point on surface under cursor.
51
53{
54 static char mess[] = { "fun3" };
55 return mess;
56}
57
58////////////////////////////////////////////////////////////////////////////////
59///Create mesh.
60
62{
64
66 return kFALSE;
67
70
71 //Build mesh for TF3 surface
72 fMesh.ClearMesh();
73
74 Rgl::Mc::TMeshBuilder<TF3, Double_t> builder(kFALSE);//no averaged normals.
75 //Set grid parameters.
79
80 builder.BuildMesh(fF3, geom, &fMesh, 0.);
81
82 if (fCoord->Modified()) {
84 const TGLVertex3 &vertex = fBackBox.Get3DBox()[0];
89 }
90
91 return kTRUE;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95///User clicks right mouse button (in a pad).
96
98{
99 fMousePosition.fX = px;
101 fCamera->StartPan(px, py);
103}
104
105////////////////////////////////////////////////////////////////////////////////
106///User's moving mouse cursor, with middle mouse button pressed (for pad).
107///Calculate 3d shift related to 2d mouse movement.
108///Slicing is disabled (since somebody has broken it).
109
111{
112 if (fSelectedPart >= fSelectionBase) {//Pan camera.
115
118 fCamera->Pan(px, py);
119
122 } else if (fSelectedPart > 0) {
123 //Convert py into bottom-top orientation.
124 //Possibly, move box here
125 py = fCamera->GetHeight() - py;
126
129
132
133 if (!fHighColor) {
136 } else {
137 //MoveSection(px, py);
138 }
139 } else {
140 //MoveSection(px, py);
141 }
142
145 }
146
149}
150
151////////////////////////////////////////////////////////////////////////////////
152///No options for tf3
153
154void TGLTF3Painter::AddOption(const TString &/*option*/)
155{
156}
157
158////////////////////////////////////////////////////////////////////////////////
159///Change color scheme.
160
162{
163 if (event == kKeyPress) {
164 if (py == kKey_s || py == kKey_S) {
166 } else if (py == kKey_c || py == kKey_C) {
167 if (fHighColor)
168 Info("ProcessEvent", "Cut box does not work in high color, please, switch to true color");
169 else {
172 }
173 }
174 } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
175 if (fBoxCut.IsActive())
177 const TGLVertex3 *frame = fBackBox.Get3DBox();
178 fXOZSectionPos = frame[0].Y();
179 fYOZSectionPos = frame[0].X();
180 fXOYSectionPos = frame[0].Z();
181
182 if (!gVirtualX->IsCmdThread())
183 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%zx)->Paint()", (size_t)this));
184 else
185 Paint();
186 }
187}
188
189////////////////////////////////////////////////////////////////////////////////
190///Initialize OpenGL state variables.
191
193{
194 glEnable(GL_LIGHTING);
195 glEnable(GL_LIGHT0);
196 glEnable(GL_DEPTH_TEST);
197 glDisable(GL_CULL_FACE);
198 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
199}
200
201////////////////////////////////////////////////////////////////////////////////
202///Initialize OpenGL state variables.
203
205{
206 glDisable(GL_LIGHTING);
207 glDisable(GL_LIGHT0);
208 glDisable(GL_DEPTH_TEST);
209 glDisable(GL_CULL_FACE);
210 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
211}
212
213////////////////////////////////////////////////////////////////////////////////
214///Draw triangles, no normals, no lighting.
215
217{
219
220 if (!fBoxCut.IsActive())
221 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris);
222 else
223 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris, fBoxCut);
224}
225
226////////////////////////////////////////////////////////////////////////////////
227///Surface with material properties and lighting.
228
230{
231 if (HasSections()) {
232 glEnable(GL_BLEND);
233 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
234 glDepthMask(GL_FALSE);
235 }
236
238
239 if (!fBoxCut.IsActive()) {
240 Rgl::DrawMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris);
241 } else {
242 Rgl::DrawMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris, fBoxCut);
243 }
244
245 if (HasSections()) {
246 glDisable(GL_BLEND);
247 glDepthMask(GL_TRUE);
248 }
249}
250
251////////////////////////////////////////////////////////////////////////////////
252///Colored surface, without lighting and
253///material properties.
254
256{
257 const TGLDisableGuard lightGuard(GL_LIGHTING);
258
259 if (HasSections() && fStyle < kMaple2) {
260 glEnable(GL_BLEND);
261 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
262 glDepthMask(GL_FALSE);
263 }
264
265 if (fStyle == kMaple1) {//Shaded polygons and outlines.
266 glEnable(GL_POLYGON_OFFSET_FILL);//[1
267 glPolygonOffset(1.f, 1.f);
268 } else if (fStyle == kMaple2)//Colored outlines only.
269 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);//[2
270
271 if(!fBoxCut.IsActive())
272 Rgl::DrawMapleMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris);
273 else
274 Rgl::DrawMapleMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris, fBoxCut);
275
276 if (fStyle == kMaple1) {
277 //Draw outlines.
278 glDisable(GL_POLYGON_OFFSET_FILL);//1]
279 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);//[3
280 glColor4d(0., 0., 0., 0.25);
281
282 if(!fBoxCut.IsActive())
283 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris);
284 else
285 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris, fBoxCut);
286
287 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);//[3
288 } else if (fStyle == kMaple2)
289 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
290
291 if (HasSections() && fStyle < kMaple2) {
292 glDisable(GL_BLEND);
293 glDepthMask(GL_TRUE);
294 }
295}
296
297////////////////////////////////////////////////////////////////////////////////
298///Draw mesh.
299
301{
302 //Shift plot to point of origin.
303 const Rgl::PlotTranslation trGuard(this);
304
306 DrawSections();
307
308 if (fSelectionPass) {
310 } else if (fStyle == kDefault) {
312 } else {
314 }
315
316 if (fBoxCut.IsActive())
318}
319
320////////////////////////////////////////////////////////////////////////////////
321///Set color for surface.
322
324{
325 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
326
327 if (fF3->GetFillColor() != kWhite)
328 if (const TColor *c = gROOT->GetColor(fF3->GetFillColor()))
329 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
330
331 glMaterialfv(GL_BACK, GL_DIFFUSE, diffColor);
332 diffColor[0] /= 2, diffColor[1] /= 2, diffColor[2] /= 2;
333 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffColor);
334 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
335 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
336 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
337}
338
339////////////////////////////////////////////////////////////////////////////////
340///Any section exists.
341
343{
344 return fXOZSectionPos > fBackBox.Get3DBox()[0].Y() ||
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Draw XOZ parallel section.
351
353{
354 if (fSelectionPass)
355 return;
357}
358
359////////////////////////////////////////////////////////////////////////////////
360/// Draw YOZ parallel section.
361
363{
364 if (fSelectionPass)
365 return;
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Draw XOY parallel section.
371
373{
374 if (fSelectionPass)
375 return;
377}
378
379
380/** \class TGLIsoPainter
381\ingroup opengl
382"gliso" option for TH3.
383*/
384
386
387////////////////////////////////////////////////////////////////////////////////
388///Constructor.
389
391 : TGLPlotPainter(hist, camera, coord, kFALSE, kFALSE, kFALSE),
392 fXOZSlice("XOZ", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kXOZ),
393 fYOZSlice("YOZ", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kYOZ),
394 fXOYSlice("XOY", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kXOY),
395 fInit(kFALSE)
396{
397 if (hist->GetDimension() < 3)
398 Error("TGLIsoPainter::TGLIsoPainter", "Wrong type of histogramm, must have 3 dimensions");
399}
400
401////////////////////////////////////////////////////////////////////////////////
402///Return info for plot part under cursor.
403
405{
406 static char mess[] = { "iso" };
407 return mess;
408}
409
410////////////////////////////////////////////////////////////////////////////////
411///Initializes meshes for 3d iso contours.
412
414{
415 if (fHist->GetDimension() < 3) {
416 Error("TGLIsoPainter::TGLIsoPainter", "Wrong type of histogramm, must have 3 dimensions");
417 return kFALSE;
418 }
419
420 //Create mesh.
421 if (fInit)
422 return kTRUE;
423
424 //Only in cartesian.
427 return kFALSE;
428
431
432 //Move old meshes into the cache.
433 if (!fIsos.empty())
434 fCache.splice(fCache.begin(), fIsos);
435 //Number of contours == number of iso surfaces.
436 UInt_t nContours = fHist->GetContour();
437
438 if (nContours > 1) {
439 fColorLevels.resize(nContours);
440 FindMinMax();
441
443 //There are user defined contours (iso-levels).
444 for (UInt_t i = 0; i < nContours; ++i)
446 } else {
447 //Equidistant iso-surfaces.
448 const Double_t isoStep = (fMinMax.second - fMinMax.first) / nContours;
449 for (UInt_t i = 0; i < nContours; ++i)
450 fColorLevels[i] = fMinMax.first + i * isoStep;
451 }
452
454 } else {
455 //Only one iso (ROOT's standard).
456 fColorLevels.resize(nContours = 1);
458 }
459
460 MeshIter_t firstMesh = fCache.begin();
461 //Initialize meshes, trying to reuse mesh from
462 //mesh cache.
463 for (UInt_t i = 0; i < nContours; ++i) {
464 if (firstMesh != fCache.end()) {
465 //There is a mesh in a cache.
466 SetMesh(*firstMesh, fColorLevels[i]);
467 MeshIter_t next = firstMesh;
468 ++next;
469 fIsos.splice(fIsos.begin(), fCache, firstMesh);
470 firstMesh = next;
471 } else {
472 //No meshes in a cache.
473 //Create new one and _swap_ data (look at Mesh_t::Swap in a header)
474 //between empty mesh in a list and this mesh
475 //to avoid real copying.
476 Mesh_t newMesh;
477 SetMesh(newMesh, fColorLevels[i]);
478 fIsos.push_back(fDummyMesh);
479 fIsos.back().Swap(newMesh);
480 }
481 }
482
483 if (fCoord->Modified()) {
489 }
490
491 //Avoid rebuilding the mesh.
492 fInit = kTRUE;
493
494 return kTRUE;
495
496}
497
498////////////////////////////////////////////////////////////////////////////////
499///User clicks right mouse button (in a pad).
500
502{
503 fMousePosition.fX = px;
505 fCamera->StartPan(px, py);
507}
508
509////////////////////////////////////////////////////////////////////////////////
510///User's moving mouse cursor, with middle mouse button pressed (for pad).
511///Calculate 3d shift related to 2d mouse movement.
512///User's moving mouse cursor, with middle mouse button pressed (for pad).
513///Calculate 3d shift related to 2d mouse movement.
514
516{
517 if (fSelectedPart >= fSelectionBase) {//Pan camera.
520
523 fCamera->Pan(px, py);
524
527 } else if (fSelectedPart > 0) {
528 //Convert py into bottom-top orientation.
529 //Possibly, move box here
530 py = fCamera->GetHeight() - py;
531
534
537
538 if (!fHighColor) {
541 } else {
542 //MoveSection(px, py);
543 }
544 } else {
545 //MoveSection(px, py);
546 }
547
550
551 }
552
555}
556
557////////////////////////////////////////////////////////////////////////////////
558///No additional options for TGLIsoPainter.
559
560void TGLIsoPainter::AddOption(const TString &/*option*/)
561{
562}
563
564////////////////////////////////////////////////////////////////////////////////
565///Change color scheme.
566
568{
569 if (event == kKeyPress) {
570 if (py == kKey_c || py == kKey_C) {
571 if (fHighColor)
572 Info("ProcessEvent", "Cut box does not work in high color, please, switch to true color");
573 else {
576 }
577 }
578 } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
579 if (fBoxCut.IsActive())
581 const TGLVertex3 *frame = fBackBox.Get3DBox();
582 fXOZSectionPos = frame[0].Y();
583 fYOZSectionPos = frame[0].X();
584 fXOYSectionPos = frame[0].Z();
585
586 if (!gVirtualX->IsCmdThread())
587 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%zx)->Paint()", (size_t)this));
588 else
589 Paint();
590 }
591}
592
593////////////////////////////////////////////////////////////////////////////////
594///Initialize OpenGL state variables.
595
597{
598 glEnable(GL_LIGHTING);
599 glEnable(GL_LIGHT0);
600 glEnable(GL_DEPTH_TEST);
601 glDisable(GL_CULL_FACE);
602 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
603}
604
605////////////////////////////////////////////////////////////////////////////////
606///Initialize OpenGL state variables.
607
609{
610 glDisable(GL_LIGHTING);
611 glDisable(GL_LIGHT0);
612 glDisable(GL_DEPTH_TEST);
613 glDisable(GL_CULL_FACE);
614 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
615}
616
617////////////////////////////////////////////////////////////////////////////////
618///Draw mesh.
619
621{
622 //Shift plot to point of origin.
623 const Rgl::PlotTranslation trGuard(this);
624
625
627 DrawSections();
628
629 if (fIsos.size() != fColorLevels.size()) {
630 Error("TGLIsoPainter::DrawPlot", "Non-equal number of levels and isos");
631 return;
632 }
633
634 if (!fSelectionPass && HasSections()) {
635 //Surface is semi-transparent during dynamic profiling.
636 //Having several complex nested surfaces, it's not easy
637 //(possible?) to implement correct and _efficient_ transparency
638 //drawing. So, artefacts are possbile.
639 glEnable(GL_BLEND);
640 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
641 glDepthMask(GL_FALSE);
642 }
643
644 UInt_t colorInd = 0;
645 ConstMeshIter_t iso = fIsos.begin();
646
647 for (; iso != fIsos.end(); ++iso, ++colorInd)
648 DrawMesh(*iso, colorInd);
649
650 if (!fSelectionPass && HasSections()) {
651 glDisable(GL_BLEND);
652 glDepthMask(GL_TRUE);
653 }
654
655 if (fBoxCut.IsActive())
657}
658
659////////////////////////////////////////////////////////////////////////////////
660/// Draw XOZ parallel section.
661
663{
664 if (fSelectionPass)
665 return;
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Draw YOZ parallel section.
671
673{
674 if (fSelectionPass)
675 return;
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// Draw XOY parallel section.
681
683{
684 if (fSelectionPass)
685 return;
687}
688
689////////////////////////////////////////////////////////////////////////////////
690///Any section exists.
691
693{
694 return fXOZSectionPos > fBackBox.Get3DBox()[0].Y() || fYOZSectionPos > fBackBox.Get3DBox()[0].X() ||
696}
697
698////////////////////////////////////////////////////////////////////////////////
699///Set color for surface.
700
702{
703 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.25f};
704
705 if (fColorLevels.size() == 1) {
706 if (fHist->GetFillColor() != kWhite)
707 if (const TColor *c = gROOT->GetColor(fHist->GetFillColor()))
708 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
709 } else {
710 const UChar_t *color = fPalette.GetColour(ind);
711 diffColor[0] = color[0] / 255.;
712 diffColor[1] = color[1] / 255.;
713 diffColor[2] = color[2] / 255.;
714 }
715
716 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
717 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
718 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
719 diffColor[0] /= 3.5, diffColor[1] /= 3.5, diffColor[2] /= 3.5;
720 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, diffColor);
721 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 30.f);
722}
723
724////////////////////////////////////////////////////////////////////////////////
725///Grid geometry.
726
728{
731 //Clear mesh if it was from cache.
732 m.ClearMesh();
733 //Select correct TMeshBuilder type.
734 if (typeid(*fHist) == typeid(TH3C)) {
736 builder.BuildMesh(static_cast<TH3C *>(fHist), geom, &m, isoValue);
737 } else if (typeid(*fHist) == typeid(TH3S)) {
739 builder.BuildMesh(static_cast<TH3S *>(fHist), geom, &m, isoValue);
740 } else if (typeid(*fHist) == typeid(TH3I)) {
742 builder.BuildMesh(static_cast<TH3I *>(fHist), geom, &m, isoValue);
743 } else if (typeid(*fHist) == typeid(TH3F)) {
745 builder.BuildMesh(static_cast<TH3F *>(fHist), geom, &m, isoValue);
746 } else if (typeid(*fHist) == typeid(TH3D)) {
748 builder.BuildMesh(static_cast<TH3D *>(fHist), geom, &m, isoValue);
749 }
750}
751
752////////////////////////////////////////////////////////////////////////////////
753///Draw TF3 surface
754
755void TGLIsoPainter::DrawMesh(const Mesh_t &m, Int_t level) const
756{
757 if (!fSelectionPass)
758 SetSurfaceColor(level);
759
760 if (!fBoxCut.IsActive()) {
761 if (!fSelectionPass)
762 Rgl::DrawMesh(m.fVerts, m.fNorms, m.fTris);
763 else {
765 Rgl::DrawMesh(m.fVerts, m.fTris);
766 }
767 } else {
768 if (!fSelectionPass)
769 Rgl::DrawMesh(m.fVerts, m.fNorms, m.fTris, fBoxCut);
770 else {
772 Rgl::DrawMesh(m.fVerts, m.fTris, fBoxCut);
773 }
774 }
775}
776
777////////////////////////////////////////////////////////////////////////////////
778///Find max/min bin contents for TH3.
779
781{
783 fMinMax.second = fMinMax.first;
784
785 for (Int_t i = fXAxis->GetFirst(), ei = fXAxis->GetLast(); i <= ei; ++i) {
786 for (Int_t j = fYAxis->GetFirst(), ej = fYAxis->GetLast(); j <= ej; ++j) {
787 for (Int_t k = fZAxis->GetFirst(), ek = fZAxis->GetLast(); k <= ek; ++k) {
788 const Double_t binContent = fHist->GetBinContent(i, j, k);
789 fMinMax.first = TMath::Min(binContent, fMinMax.first);
790 fMinMax.second = TMath::Max(binContent, fMinMax.second);
791 }
792 }
793 }
794}
@ kKeyPress
Definition Buttons.h:20
@ kButton1Double
Definition Buttons.h:24
#define GL_TRUE
Definition GL_glu.h:262
#define GL_FALSE
Definition GL_glu.h:261
@ kKey_C
Definition KeySymbols.h:128
@ kKey_S
Definition KeySymbols.h:144
@ kKey_s
Definition KeySymbols.h:176
@ kKey_c
Definition KeySymbols.h:160
#define c(i)
Definition RSha256.hxx:101
unsigned char UChar_t
Definition RtypesCore.h:38
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ kWhite
Definition Rtypes.h:65
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:230
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:197
@ kGLCartesian
Definition TGLUtil.h:44
#define gROOT
Definition TROOT.h:405
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
@ kDefault
Definition TSystem.h:229
#define gVirtualX
Definition TVirtualX.h:338
void BuildMesh(const DataSource *src, const TGridGeometry< ValueType > &geom, MeshType_t *mesh, ValueType iso)
Build iso-mesh using marching cubes.
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:30
Int_t GetLast() const
Return last bin on the axis i.e.
Definition TAxis.cxx:469
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition TAxis.cxx:458
The color creation and management class.
Definition TColor.h:19
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1823
A 3-Dim function with parameters.
Definition TF3.h:28
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
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
"gliso" option for TH3.
TGLTH3Slice fXOZSlice
Bool_t HasSections() const
Any section exists.
MeshList_t fCache
Bool_t InitGeometry()
Initializes meshes for 3d iso contours.
void DrawSectionYOZ() const
Draw YOZ parallel section.
void DrawPlot() const
Draw mesh.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
TGLTH3Slice fYOZSlice
void AddOption(const TString &option)
No additional options for TGLIsoPainter.
TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DeInitGL() const
Initialize OpenGL state variables.
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
TGLLevelPalette fPalette
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
Rgl::Range_t fMinMax
void InitGL() const
Initialize OpenGL state variables.
std::list< Mesh_t >::iterator MeshIter_t
void FindMinMax()
Find max/min bin contents for TH3.
std::vector< Double_t > fColorLevels
void SetMesh(Mesh_t &mesh, Double_t isoValue)
Grid geometry.
MeshList_t fIsos
void DrawSectionXOY() const
Draw XOY parallel section.
void DrawSectionXOZ() const
Draw XOZ parallel section.
TGLTH3Slice fXOYSlice
void SetSurfaceColor(Int_t ind) const
Set color for surface.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
std::list< Mesh_t >::const_iterator ConstMeshIter_t
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
const UChar_t * GetColour(Double_t z) const
Get color.
Definition TGLUtil.cxx:4300
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
Definition TGLUtil.cxx:4170
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.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
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.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
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.
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
void ResetModified()
Reset modified.
Bool_t Modified() const
Modified.
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 DrawSections() const
Draw sections (if any).
std::vector< Double_t > fZLevels
Double_t fXOYSectionPos
void RestoreModelviewMatrix() const
Double_t fXOZSectionPos
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
TGLPlotBox fBackBox
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
Double_t fYOZSectionPos
Plot-painter for TF3 functions.
void InitGL() const
Initialize OpenGL state variables.
void DrawPlot() const
Draw mesh.
Rgl::Mc::TIsoMesh< Double_t > fMesh
void AddOption(const TString &stringOption)
No options for tf3.
TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
char * GetPlotInfo(Int_t px, Int_t py)
Coords for point on surface under cursor.
void DrawDefaultPlot() const
Surface with material properties and lighting.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
TGLTH3Slice fXOZSlice
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
void DeInitGL() const
Initialize OpenGL state variables.
TGLTH3Slice fXOYSlice
void SetSurfaceColor() const
Set color for surface.
void DrawSectionXOY() const
Draw XOY parallel section.
ETF3Style fStyle
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
void DrawSectionYOZ() const
Draw YOZ parallel section.
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
void DrawSectionXOZ() const
Draw XOZ parallel section.
TGLTH3Slice fYOZSlice
Bool_t InitGeometry()
Create mesh.
Bool_t HasSections() const
Any section exists.
A slice of a TH3.
void DrawSlice(Double_t pos) const
Draw slice.
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
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual Int_t GetNbinsY() const
Definition TH1.h:296
virtual Int_t GetNbinsZ() const
Definition TH1.h:297
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
Definition TH1.cxx:8306
virtual Int_t GetDimension() const
Definition TH1.h:281
@ kUserContour
User specified contour levels.
Definition TH1.h:164
virtual Int_t GetNbinsX() const
Definition TH1.h:295
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5025
virtual Int_t GetContour(Double_t *levels=nullptr)
Return contour values into array levels if pointer levels is non zero.
Definition TH1.cxx:8277
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition TH1.cxx:7827
3-D histogram with a byte per channel (see TH1 documentation)
Definition TH3.h:153
3-D histogram with a double per channel (see TH1 documentation)}
Definition TH3.h:307
3-D histogram with a float per channel (see TH1 documentation)}
Definition TH3.h:268
3-D histogram with an int per channel (see TH1 documentation)}
Definition TH3.h:229
3-D histogram with a short per channel (see TH1 documentation)
Definition TH3.h:191
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:31
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
Basic string class.
Definition TString.h:139
void DrawMapleMesh(const std::vector< Double_t > &vs, const std::vector< Double_t > &ns, const std::vector< UInt_t > &ts)
Colored mesh with lighting disabled.
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition TGLUtil.cxx:2900
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
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