Logo ROOT   6.16/01
Reference Guide
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 "TVirtualGL.h"
15#include "KeySymbols.h"
16#include "TVirtualX.h"
17#include "Buttons.h"
18#include "TString.h"
19#include "TROOT.h"
20#include "TColor.h"
21#include "TMath.h"
22#include "TH3.h"
23#include "TF3.h"
24
25#include "TGLMarchingCubes.h"
26#include "TGLPlotCamera.h"
27#include "TGLTF3Painter.h"
28#include "TGLIncludes.h"
29
30/** \class TGLTF3Painter
31\ingroup opengl
32Plot-painter for TF3 functions.
33*/
34
36
37////////////////////////////////////////////////////////////////////////////////
38/// Constructor.
39
41 : TGLPlotPainter(hist, camera, coord, kFALSE, kFALSE, kFALSE),
42 fStyle(kDefault),
43 fF3(fun),
44 fXOZSlice("XOZ", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kXOZ),
45 fYOZSlice("YOZ", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kYOZ),
46 fXOYSlice("XOY", (TH3 *)hist, fun, coord, &fBackBox, TGLTH3Slice::kXOY)
47{
48}
49
50////////////////////////////////////////////////////////////////////////////////
51///Coords for point on surface under cursor.
52
54{
55 static char mess[] = { "fun3" };
56 return mess;
57}
58
59////////////////////////////////////////////////////////////////////////////////
60///Create mesh.
61
63{
65
67 return kFALSE;
68
71
72 //Build mesh for TF3 surface
73 fMesh.ClearMesh();
74
75 Rgl::Mc::TMeshBuilder<TF3, Double_t> builder(kFALSE);//no averaged normals.
76 //Set grid parameters.
80
81 builder.BuildMesh(fF3, geom, &fMesh, 0.2);
82
83 if (fCoord->Modified()) {
85 const TGLVertex3 &vertex = fBackBox.Get3DBox()[0];
90 }
91
92 return kTRUE;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96///User clicks right mouse button (in a pad).
97
99{
100 fMousePosition.fX = px;
102 fCamera->StartPan(px, py);
104}
105
106////////////////////////////////////////////////////////////////////////////////
107///User's moving mouse cursor, with middle mouse button pressed (for pad).
108///Calculate 3d shift related to 2d mouse movement.
109///Slicing is disabled (since somebody has broken it).
110
112{
113 if (fSelectedPart >= fSelectionBase) {//Pan camera.
116
119 fCamera->Pan(px, py);
120
123 } else if (fSelectedPart > 0) {
124 //Convert py into bottom-top orientation.
125 //Possibly, move box here
126 py = fCamera->GetHeight() - py;
127
130
133
134 if (!fHighColor) {
137 } else {
138 //MoveSection(px, py);
139 }
140 } else {
141 //MoveSection(px, py);
142 }
143
146 }
147
150}
151
152////////////////////////////////////////////////////////////////////////////////
153///No options for tf3
154
155void TGLTF3Painter::AddOption(const TString &/*option*/)
156{
157}
158
159////////////////////////////////////////////////////////////////////////////////
160///Change color scheme.
161
163{
164 if (event == kKeyPress) {
165 if (py == kKey_s || py == kKey_S) {
167 } else if (py == kKey_c || py == kKey_C) {
168 if (fHighColor)
169 Info("ProcessEvent", "Cut box does not work in high color, please, switch to true color");
170 else {
173 }
174 }
175 } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
176 if (fBoxCut.IsActive())
178 const TGLVertex3 *frame = fBackBox.Get3DBox();
179 fXOZSectionPos = frame[0].Y();
180 fYOZSectionPos = frame[0].X();
181 fXOYSectionPos = frame[0].Z();
182
183 if (!gVirtualX->IsCmdThread())
184 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%lx)->Paint()", (ULong_t)this));
185 else
186 Paint();
187 }
188}
189
190////////////////////////////////////////////////////////////////////////////////
191///Initialize OpenGL state variables.
192
194{
195 glEnable(GL_LIGHTING);
196 glEnable(GL_LIGHT0);
197 glEnable(GL_DEPTH_TEST);
198 glDisable(GL_CULL_FACE);
199 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
200}
201
202////////////////////////////////////////////////////////////////////////////////
203///Initialize OpenGL state variables.
204
206{
207 glDisable(GL_LIGHTING);
208 glDisable(GL_LIGHT0);
209 glDisable(GL_DEPTH_TEST);
210 glDisable(GL_CULL_FACE);
211 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
212}
213
214////////////////////////////////////////////////////////////////////////////////
215///Draw triangles, no normals, no lighting.
216
218{
220
221 if (!fBoxCut.IsActive())
222 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris);
223 else
224 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris, fBoxCut);
225}
226
227////////////////////////////////////////////////////////////////////////////////
228///Surface with material properties and lighting.
229
231{
232 if (HasSections()) {
233 glEnable(GL_BLEND);
234 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
235 glDepthMask(GL_FALSE);
236 }
237
239
240 if (!fBoxCut.IsActive()) {
241 Rgl::DrawMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris);
242 } else {
243 Rgl::DrawMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris, fBoxCut);
244 }
245
246 if (HasSections()) {
247 glDisable(GL_BLEND);
248 glDepthMask(GL_TRUE);
249 }
250}
251
252////////////////////////////////////////////////////////////////////////////////
253///Colored surface, without lighting and
254///material properties.
255
257{
258 const TGLDisableGuard lightGuard(GL_LIGHTING);
259
260 if (HasSections() && fStyle < kMaple2) {
261 glEnable(GL_BLEND);
262 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
263 glDepthMask(GL_FALSE);
264 }
265
266 if (fStyle == kMaple1) {//Shaded polygons and outlines.
267 glEnable(GL_POLYGON_OFFSET_FILL);//[1
268 glPolygonOffset(1.f, 1.f);
269 } else if (fStyle == kMaple2)//Colored outlines only.
270 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);//[2
271
272 if(!fBoxCut.IsActive())
273 Rgl::DrawMapleMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris);
274 else
275 Rgl::DrawMapleMesh(fMesh.fVerts, fMesh.fNorms, fMesh.fTris, fBoxCut);
276
277 if (fStyle == kMaple1) {
278 //Draw outlines.
279 glDisable(GL_POLYGON_OFFSET_FILL);//1]
280 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);//[3
281 glColor4d(0., 0., 0., 0.25);
282
283 if(!fBoxCut.IsActive())
284 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris);
285 else
286 Rgl::DrawMesh(fMesh.fVerts, fMesh.fTris, fBoxCut);
287
288 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);//[3
289 } else if (fStyle == kMaple2)
290 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
291
292 if (HasSections() && fStyle < kMaple2) {
293 glDisable(GL_BLEND);
294 glDepthMask(GL_TRUE);
295 }
296}
297
298////////////////////////////////////////////////////////////////////////////////
299///Draw mesh.
300
302{
303 //Shift plot to point of origin.
304 const Rgl::PlotTranslation trGuard(this);
305
307 DrawSections();
308
309 if (fSelectionPass) {
311 } else if (fStyle == kDefault) {
313 } else {
315 }
316
317 if (fBoxCut.IsActive())
319}
320
321////////////////////////////////////////////////////////////////////////////////
322///Set color for surface.
323
325{
326 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
327
328 if (fF3->GetFillColor() != kWhite)
329 if (const TColor *c = gROOT->GetColor(fF3->GetFillColor()))
330 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
331
332 glMaterialfv(GL_BACK, GL_DIFFUSE, diffColor);
333 diffColor[0] /= 2, diffColor[1] /= 2, diffColor[2] /= 2;
334 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffColor);
335 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
336 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
337 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
338}
339
340////////////////////////////////////////////////////////////////////////////////
341///Any section exists.
342
344{
345 return fXOZSectionPos > fBackBox.Get3DBox()[0].Y() ||
348}
349
350////////////////////////////////////////////////////////////////////////////////
351/// Draw XOZ parallel section.
352
354{
355 if (fSelectionPass)
356 return;
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Draw YOZ parallel section.
362
364{
365 if (fSelectionPass)
366 return;
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Draw XOY parallel section.
372
374{
375 if (fSelectionPass)
376 return;
378}
379
380
381/** \class TGLIsoPainter
382\ingroup opengl
383"gliso" option for TH3.
384*/
385
387
388////////////////////////////////////////////////////////////////////////////////
389///Constructor.
390
392 : TGLPlotPainter(hist, camera, coord, kFALSE, kFALSE, kFALSE),
393 fXOZSlice("XOZ", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kXOZ),
394 fYOZSlice("YOZ", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kYOZ),
395 fXOYSlice("XOY", (TH3 *)hist, coord, &fBackBox, TGLTH3Slice::kXOY),
396 fInit(kFALSE)
397{
398 if (hist->GetDimension() < 3)
399 Error("TGLIsoPainter::TGLIsoPainter", "Wrong type of histogramm, must have 3 dimensions");
400}
401
402////////////////////////////////////////////////////////////////////////////////
403///Return info for plot part under cursor.
404
406{
407 static char mess[] = { "iso" };
408 return mess;
409}
410
411////////////////////////////////////////////////////////////////////////////////
412///Initializes meshes for 3d iso contours.
413
415{
416 if (fHist->GetDimension() < 3) {
417 Error("TGLIsoPainter::TGLIsoPainter", "Wrong type of histogramm, must have 3 dimensions");
418 return kFALSE;
419 }
420
421 //Create mesh.
422 if (fInit)
423 return kTRUE;
424
425 //Only in cartesian.
428 return kFALSE;
429
432
433 //Move old meshes into the cache.
434 if (!fIsos.empty())
435 fCache.splice(fCache.begin(), fIsos);
436 //Number of contours == number of iso surfaces.
437 UInt_t nContours = fHist->GetContour();
438
439 if (nContours > 1) {
440 fColorLevels.resize(nContours);
441 FindMinMax();
442
444 //There are user defined contours (iso-levels).
445 for (UInt_t i = 0; i < nContours; ++i)
447 } else {
448 //Equidistant iso-surfaces.
449 const Double_t isoStep = (fMinMax.second - fMinMax.first) / nContours;
450 for (UInt_t i = 0; i < nContours; ++i)
451 fColorLevels[i] = fMinMax.first + i * isoStep;
452 }
453
455 } else {
456 //Only one iso (ROOT's standard).
457 fColorLevels.resize(nContours = 1);
459 }
460
461 MeshIter_t firstMesh = fCache.begin();
462 //Initialize meshes, trying to reuse mesh from
463 //mesh cache.
464 for (UInt_t i = 0; i < nContours; ++i) {
465 if (firstMesh != fCache.end()) {
466 //There is a mesh in a cache.
467 SetMesh(*firstMesh, fColorLevels[i]);
468 MeshIter_t next = firstMesh;
469 ++next;
470 fIsos.splice(fIsos.begin(), fCache, firstMesh);
471 firstMesh = next;
472 } else {
473 //No meshes in a cache.
474 //Create new one and _swap_ data (look at Mesh_t::Swap in a header)
475 //between empty mesh in a list and this mesh
476 //to avoid real copying.
477 Mesh_t newMesh;
478 SetMesh(newMesh, fColorLevels[i]);
479 fIsos.push_back(fDummyMesh);
480 fIsos.back().Swap(newMesh);
481 }
482 }
483
484 if (fCoord->Modified()) {
490 }
491
492 //Avoid rebuilding the mesh.
493 fInit = kTRUE;
494
495 return kTRUE;
496
497}
498
499////////////////////////////////////////////////////////////////////////////////
500///User clicks right mouse button (in a pad).
501
503{
504 fMousePosition.fX = px;
506 fCamera->StartPan(px, py);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511///User's moving mouse cursor, with middle mouse button pressed (for pad).
512///Calculate 3d shift related to 2d mouse movement.
513///User's moving mouse cursor, with middle mouse button pressed (for pad).
514///Calculate 3d shift related to 2d mouse movement.
515
517{
518 if (fSelectedPart >= fSelectionBase) {//Pan camera.
521
524 fCamera->Pan(px, py);
525
528 } else if (fSelectedPart > 0) {
529 //Convert py into bottom-top orientation.
530 //Possibly, move box here
531 py = fCamera->GetHeight() - py;
532
535
538
539 if (!fHighColor) {
542 } else {
543 //MoveSection(px, py);
544 }
545 } else {
546 //MoveSection(px, py);
547 }
548
551
552 }
553
556}
557
558////////////////////////////////////////////////////////////////////////////////
559///No additional options for TGLIsoPainter.
560
561void TGLIsoPainter::AddOption(const TString &/*option*/)
562{
563}
564
565////////////////////////////////////////////////////////////////////////////////
566///Change color scheme.
567
569{
570 if (event == kKeyPress) {
571 if (py == kKey_c || py == kKey_C) {
572 if (fHighColor)
573 Info("ProcessEvent", "Cut box does not work in high color, please, switch to true color");
574 else {
577 }
578 }
579 } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
580 if (fBoxCut.IsActive())
582 const TGLVertex3 *frame = fBackBox.Get3DBox();
583 fXOZSectionPos = frame[0].Y();
584 fYOZSectionPos = frame[0].X();
585 fXOYSectionPos = frame[0].Z();
586
587 if (!gVirtualX->IsCmdThread())
588 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%lx)->Paint()", (ULong_t)this));
589 else
590 Paint();
591 }
592}
593
594////////////////////////////////////////////////////////////////////////////////
595///Initialize OpenGL state variables.
596
598{
599 glEnable(GL_LIGHTING);
600 glEnable(GL_LIGHT0);
601 glEnable(GL_DEPTH_TEST);
602 glDisable(GL_CULL_FACE);
603 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
604}
605
606////////////////////////////////////////////////////////////////////////////////
607///Initialize OpenGL state variables.
608
610{
611 glDisable(GL_LIGHTING);
612 glDisable(GL_LIGHT0);
613 glDisable(GL_DEPTH_TEST);
614 glDisable(GL_CULL_FACE);
615 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
616}
617
618////////////////////////////////////////////////////////////////////////////////
619///Draw mesh.
620
622{
623 //Shift plot to point of origin.
624 const Rgl::PlotTranslation trGuard(this);
625
626
628 DrawSections();
629
630 if (fIsos.size() != fColorLevels.size()) {
631 Error("TGLIsoPainter::DrawPlot", "Non-equal number of levels and isos");
632 return;
633 }
634
635 if (!fSelectionPass && HasSections()) {
636 //Surface is semi-transparent during dynamic profiling.
637 //Having several complex nested surfaces, it's not easy
638 //(possible?) to implement correct and _efficient_ transparency
639 //drawing. So, artefacts are possbile.
640 glEnable(GL_BLEND);
641 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
642 glDepthMask(GL_FALSE);
643 }
644
645 UInt_t colorInd = 0;
646 ConstMeshIter_t iso = fIsos.begin();
647
648 for (; iso != fIsos.end(); ++iso, ++colorInd)
649 DrawMesh(*iso, colorInd);
650
651 if (!fSelectionPass && HasSections()) {
652 glDisable(GL_BLEND);
653 glDepthMask(GL_TRUE);
654 }
655
656 if (fBoxCut.IsActive())
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Draw XOZ parallel section.
662
664{
665 if (fSelectionPass)
666 return;
668}
669
670////////////////////////////////////////////////////////////////////////////////
671/// Draw YOZ parallel section.
672
674{
675 if (fSelectionPass)
676 return;
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Draw XOY parallel section.
682
684{
685 if (fSelectionPass)
686 return;
688}
689
690////////////////////////////////////////////////////////////////////////////////
691///Any section exists.
692
694{
695 return fXOZSectionPos > fBackBox.Get3DBox()[0].Y() || fYOZSectionPos > fBackBox.Get3DBox()[0].X() ||
697}
698
699////////////////////////////////////////////////////////////////////////////////
700///Set color for surface.
701
703{
704 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.25f};
705
706 if (fColorLevels.size() == 1) {
707 if (fHist->GetFillColor() != kWhite)
708 if (const TColor *c = gROOT->GetColor(fHist->GetFillColor()))
709 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
710 } else {
711 const UChar_t *color = fPalette.GetColour(ind);
712 diffColor[0] = color[0] / 255.;
713 diffColor[1] = color[1] / 255.;
714 diffColor[2] = color[2] / 255.;
715 }
716
717 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
718 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
719 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
720 diffColor[0] /= 3.5, diffColor[1] /= 3.5, diffColor[2] /= 3.5;
721 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, diffColor);
722 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 30.f);
723}
724
725////////////////////////////////////////////////////////////////////////////////
726///Grid geometry.
727
729{
732 //Clear mesh if it was from cache.
733 m.ClearMesh();
734 //Select correct TMeshBuilder type.
735 if (typeid(*fHist) == typeid(TH3C)) {
737 builder.BuildMesh(static_cast<TH3C *>(fHist), geom, &m, isoValue);
738 } else if (typeid(*fHist) == typeid(TH3S)) {
740 builder.BuildMesh(static_cast<TH3S *>(fHist), geom, &m, isoValue);
741 } else if (typeid(*fHist) == typeid(TH3I)) {
743 builder.BuildMesh(static_cast<TH3I *>(fHist), geom, &m, isoValue);
744 } else if (typeid(*fHist) == typeid(TH3F)) {
746 builder.BuildMesh(static_cast<TH3F *>(fHist), geom, &m, isoValue);
747 } else if (typeid(*fHist) == typeid(TH3D)) {
749 builder.BuildMesh(static_cast<TH3D *>(fHist), geom, &m, isoValue);
750 }
751}
752
753////////////////////////////////////////////////////////////////////////////////
754///Draw TF3 surface
755
756void TGLIsoPainter::DrawMesh(const Mesh_t &m, Int_t level) const
757{
758 if (!fSelectionPass)
759 SetSurfaceColor(level);
760
761 if (!fBoxCut.IsActive()) {
762 if (!fSelectionPass)
763 Rgl::DrawMesh(m.fVerts, m.fNorms, m.fTris);
764 else {
766 Rgl::DrawMesh(m.fVerts, m.fTris);
767 }
768 } else {
769 if (!fSelectionPass)
770 Rgl::DrawMesh(m.fVerts, m.fNorms, m.fTris, fBoxCut);
771 else {
773 Rgl::DrawMesh(m.fVerts, m.fTris, fBoxCut);
774 }
775 }
776}
777
778////////////////////////////////////////////////////////////////////////////////
779///Find max/min bin contents for TH3.
780
782{
784 fMinMax.second = fMinMax.first;
785
786 for (Int_t i = fXAxis->GetFirst(), ei = fXAxis->GetLast(); i <= ei; ++i) {
787 for (Int_t j = fYAxis->GetFirst(), ej = fYAxis->GetLast(); j <= ej; ++j) {
788 for (Int_t k = fZAxis->GetFirst(), ek = fZAxis->GetLast(); k <= ek; ++k) {
789 const Double_t binContent = fHist->GetBinContent(i, j, k);
790 fMinMax.first = TMath::Min(binContent, fMinMax.first);
791 fMinMax.second = TMath::Max(binContent, fMinMax.second);
792 }
793 }
794 }
795}
@ kKeyPress
Definition: Buttons.h:20
@ kButton1Double
Definition: Buttons.h:24
@ 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
int Int_t
Definition: RtypesCore.h:41
unsigned char UChar_t
Definition: RtypesCore.h:34
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
@ kWhite
Definition: Rtypes.h:62
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
@ kGLCartesian
Definition: TGLUtil.h:43
#define gROOT
Definition: TROOT.h:410
@ kDefault
Definition: TSocket.h:51
char * Form(const char *fmt,...)
#define gVirtualX
Definition: TVirtualX.h:345
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:455
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:444
The color creation and management class.
Definition: TColor.h:19
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.
Definition: TGLTF3Painter.h:85
TGLTH3Slice fXOZSlice
Definition: TGLTF3Painter.h:92
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
Definition: TGLTF3Painter.h:93
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
Definition: TGLTF3Painter.h:89
Mesh_t fDummyMesh
Definition: TGLTF3Painter.h:96
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
Definition: TGLTF3Painter.h:98
void DrawSectionXOY() const
Draw XOY parallel section.
void DrawSectionXOZ() const
Draw XOZ parallel section.
TGLTH3Slice fXOYSlice
Definition: TGLTF3Painter.h:94
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
Definition: TGLTF3Painter.h:90
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:4308
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
Definition: TGLUtil.cxx:4178
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
Definition: TGLPlotBox.cxx:198
const TGLVertex3 * Get3DBox() const
Get 3D box.
Definition: TGLPlotBox.cxx:303
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Definition: TGLPlotBox.cxx:184
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:22
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void SetCamera() const
Viewport and projection.
void Pan(Int_t px, Int_t py)
Pan camera.
Int_t GetHeight() const
viewport[3]
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
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).
Double_t fPadTheta
std::vector< Double_t > fZLevels
Double_t fXOYSectionPos
void RestoreModelviewMatrix() const
Double_t fXOZSectionPos
TGLBoxCut fBoxCut
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
TGLPlotBox fBackBox
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
Bool_t fUpdateSelection
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
Double_t fYOZSectionPos
Plot-painter for TF3 functions.
Definition: TGLTF3Painter.h:29
void InitGL() const
Initialize OpenGL state variables.
void DrawPlot() const
Draw mesh.
Rgl::Mc::TIsoMesh< Double_t > fMesh
Definition: TGLTF3Painter.h:40
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
Definition: TGLTF3Painter.h:43
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
Definition: TGLTF3Painter.h:45
void SetSurfaceColor() const
Set color for surface.
void DrawSectionXOY() const
Draw XOY parallel section.
ETF3Style fStyle
Definition: TGLTF3Painter.h:38
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
Definition: TGLTF3Painter.h:44
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:83
Double_t X() const
Definition: TGLUtil.h:118
Double_t Z() const
Definition: TGLUtil.h:122
Double_t Y() const
Definition: TGLUtil.h:120
The TH1 histogram class.
Definition: TH1.h:56
virtual Int_t GetNbinsY() const
Definition: TH1.h:293
virtual Int_t GetNbinsZ() const
Definition: TH1.h:294
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
Definition: TH1.cxx:7770
virtual Int_t GetDimension() const
Definition: TH1.h:278
@ kUserContour
user specified contour levels
Definition: TH1.h:161
virtual Int_t GetNbinsX() const
Definition: TH1.h:292
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:4790
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition: TH1.cxx:7297
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
Definition: TH1.cxx:7741
3-D histogram with a byte per channel (see TH1 documentation)
Definition: TH3.h:158
3-D histogram with a double per channel (see TH1 documentation)}
Definition: TH3.h:304
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:267
3-D histogram with an int per channel (see TH1 documentation)}
Definition: TH3.h:230
3-D histogram with a short per channel (see TH1 documentation)
Definition: TH3.h:194
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:172
SCoord_t fY
Definition: TPoint.h:36
SCoord_t fX
Definition: TPoint.h:35
Basic string class.
Definition: TString.h:131
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.
Definition: TGLIsoMesh.cxx:192
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition: TGLUtil.cxx:2908
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
Definition: TGLIsoMesh.cxx:39
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
auto * m
Definition: textangle.C:8
REAL * vertex
Definition: triangle.c:512