Logo ROOT   6.10/09
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
32 Plot-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 
53 char *TGLTF3Painter::GetPlotInfo(Int_t /*px*/, Int_t /*py*/)
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];
86  fXOZSectionPos = vertex.Y();
87  fYOZSectionPos = vertex.X();
88  fXOYSectionPos = vertex.Z();
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);
103  fBoxCut.StartMovement(px, fCamera->GetHeight() - 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 
117  fCamera->SetCamera();
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 
131  fCamera->SetCamera();
133 
134  if (!fHighColor) {
136  fBoxCut.MoveBox(px, py, fSelectedPart);
137  } else {
138  //MoveSection(px, py);
139  }
140  } else {
141  //MoveSection(px, py);
142  }
143 
146  }
147 
148  fMousePosition.fX = px, fMousePosition.fY = py;
150 }
151 
152 ////////////////////////////////////////////////////////////////////////////////
153 ///No options for tf3
154 
155 void 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) {
166  fStyle < kMaple2 ? fStyle = ETF3Style(fStyle + 1) : fStyle = kDefault;
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 {
171  fBoxCut.TurnOnOff();
173  }
174  }
175  } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
176  if (fBoxCut.IsActive())
177  fBoxCut.TurnOnOff();
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())
223  else
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 
238  SetSurfaceColor();
239 
240  if (!fBoxCut.IsActive()) {
242  } else {
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())
274  else
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())
285  else
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) {
312  DrawDefaultPlot();
313  } else {
314  DrawMaplePlot();
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() ||
346  fYOZSectionPos > fBackBox.Get3DBox()[0].X() ||
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.
427  if (!fCoord->SetRanges(fHist, kFALSE, kTRUE))
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)
446  fColorLevels[i] = fHist->GetContourLevelPad(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 
454  fPalette.GeneratePalette(nContours, fMinMax, kFALSE);
455  } else {
456  //Only one iso (ROOT's standard).
457  fColorLevels.resize(nContours = 1);
458  fColorLevels[0] = fHist->GetSumOfWeights() / (fHist->GetNbinsX() * fHist->GetNbinsY() * fHist->GetNbinsZ());
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);
507  fBoxCut.StartMovement(px, fCamera->GetHeight() - 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 
522  fCamera->SetCamera();
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 
536  fCamera->SetCamera();
538 
539  if (!fHighColor) {
541  fBoxCut.MoveBox(px, py, fSelectedPart);
542  } else {
543  //MoveSection(px, py);
544  }
545  } else {
546  //MoveSection(px, py);
547  }
548 
551 
552  }
553 
554  fMousePosition.fX = px, fMousePosition.fY = py;
556 }
557 
558 ////////////////////////////////////////////////////////////////////////////////
559 ///No additional options for TGLIsoPainter.
560 
561 void 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 {
575  fBoxCut.TurnOnOff();
577  }
578  }
579  } else if (event == kButton1Double && (fBoxCut.IsActive() || HasSections())) {
580  if (fBoxCut.IsActive())
581  fBoxCut.TurnOnOff();
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 
756 void 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)
771  else {
774  }
775  }
776 }
777 
778 ////////////////////////////////////////////////////////////////////////////////
779 ///Find max/min bin contents for TH3.
780 
782 {
783  fMinMax.first = fHist->GetBinContent(fXAxis->GetFirst(), fYAxis->GetFirst(), fZAxis->GetFirst());
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 }
std::vector< UInt_t > fTris
Definition: TGLIsoMesh.h:83
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
void FindMinMax()
Find max/min bin contents for TH3.
void RestoreModelviewMatrix() const
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:21
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:444
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
float Float_t
Definition: RtypesCore.h:53
tomato 3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:267
Bool_t InitGeometry()
Create mesh.
Double_t fYOZSectionPos
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
void DrawSections() const
Draw sections (if any).
void DrawPlot() const
Draw mesh.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
Definition: TH1.cxx:7103
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:4639
const TGLVertex3 * Get3DBox() const
Get 3D box.
Definition: TGLPlotBox.cxx:303
SCoord_t fX
Definition: TPoint.h:35
virtual Int_t GetNbinsZ() const
Definition: TH1.h:279
#define gROOT
Definition: TROOT.h:375
SCoord_t fY
Definition: TPoint.h:36
Basic string class.
Definition: TString.h:129
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void TurnOnOff()
Turn the box cut on/off.
Bool_t InitGeometry()
Initializes meshes for 3d iso contours.
void Pan(Int_t px, Int_t py)
User&#39;s moving mouse cursor, with middle mouse button pressed (for pad).
A slice of a TH3.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
virtual Int_t GetDimension() const
Definition: TH1.h:263
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
Definition: TH1.cxx:7535
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
Plot-painter for TF3 functions.
Definition: TGLTF3Painter.h:29
Double_t fXOZSectionPos
void DeInitGL() const
Initialize OpenGL state variables.
Bool_t IsActive() const
void Info(const char *location, const char *msgfmt,...)
void SetCamera() const
Viewport and projection.
void SetSurfaceColor() const
Set color for surface.
TGLPlotBox fBackBox
void InitGL() const
Initialize OpenGL state variables.
void DeInitGL() const
Initialize OpenGL state variables.
user specified contour levels
Definition: TH1.h:149
void Error(const char *location, const char *msgfmt,...)
void SetViewVolume(const TGLVertex3 *box)
&#39;box&#39; is the TGLPlotPainter&#39;s back box&#39;s coordinates.
The 3-D histogram classes derived from the 1-D histogram classes.
Definition: TH3.h:31
TGLTH3Slice fXOZSlice
Definition: TGLTF3Painter.h:43
tomato 3-D histogram with an int per channel (see TH1 documentation)}
Definition: TH3.h:230
REAL * vertex
Definition: triangle.c:512
void DrawSectionYOZ() const
Draw YOZ parallel section.
Definition: Rtypes.h:55
TGLTH3Slice fYOZSlice
Definition: TGLTF3Painter.h:44
void AddOption(const TString &stringOption)
No options for tf3.
Double_t fPadTheta
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition: TGLUtil.cxx:2858
tomato 3-D histogram with a short per channel (see TH1 documentation)
Definition: TH3.h:194
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
void DrawSectionXOY() const
Draw XOY parallel section.
void InitGL() const
Initialize OpenGL state variables.
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:455
tomato 3-D histogram with a double per channel (see TH1 documentation)}
Definition: TH3.h:304
void DrawSectionYOZ() const
Draw YOZ parallel section.
A 3-Dim function with parameters.
Definition: TF3.h:28
void SetMesh(Mesh_t &mesh, Double_t isoValue)
Grid geometry.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
void DrawPlot() const
Draw mesh.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void ResetModified()
Reset modified.
void Pan(Int_t px, Int_t py)
Pan camera.
void SetSurfaceColor(Int_t ind) const
Set color for surface.
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
char * Form(const char *fmt,...)
"gliso" option for TH3.
Definition: TGLTF3Painter.h:85
void DrawSlice(Double_t pos) const
Draw slice.
void AddOption(const TString &option)
No additional options for TGLIsoPainter.
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
Definition: TH1.cxx:7564
void Pan(Int_t px, Int_t py)
User&#39;s moving mouse cursor, with middle mouse button pressed (for pad).
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
std::vector< Double_t > fZLevels
#define gVirtualX
Definition: TVirtualX.h:350
void DrawSectionXOZ() const
Draw XOZ parallel section.
const Bool_t kFALSE
Definition: RtypesCore.h:92
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
std::vector< V > fNorms
Definition: TGLIsoMesh.h:82
ETF3Style fStyle
Definition: TGLTF3Painter.h:38
Double_t Z() const
Definition: TGLUtil.h:122
Double_t GetYScale() const
void DrawDefaultPlot() const
Surface with material properties and lighting.
#define ClassImp(name)
Definition: Rtypes.h:336
Bool_t HasSections() const
Any section exists.
double f(double x)
std::list< Mesh_t >::const_iterator ConstMeshIter_t
Definition: TGLTF3Painter.h:90
double Double_t
Definition: RtypesCore.h:55
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
Bool_t Modified() const
Modified.
Rgl::Mc::TIsoMesh< Double_t > fMesh
Definition: TGLTF3Painter.h:40
unsigned long ULong_t
Definition: RtypesCore.h:51
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:30
void SaveProjectionMatrix() const
The TH1 histogram class.
Definition: TH1.h:56
The color creation and management class.
Definition: TColor.h:19
tomato 3-D histogram with a byte per channel (see TH1 documentation)
Definition: TH3.h:158
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
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
Bool_t HasSections() const
Any section exists.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
TGLTH3Slice fXOYSlice
Definition: TGLTF3Painter.h:45
Double_t fXOYSectionPos
void BuildMesh(const DataSource *src, const TGridGeometry< ValueType > &geom, MeshType_t *mesh, ValueType iso)
Build iso-mesh using marching cubes.
void StartMovement(Int_t px, Int_t py)
Start cut&#39;s movement.
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:200
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 Rgl::Range_t & GetXRangeScaled() const
Scaled range.
void DrawSectionXOY() const
Draw XOY parallel section.
std::list< Mesh_t >::iterator MeshIter_t
Definition: TGLTF3Painter.h:89
unsigned char UChar_t
Definition: RtypesCore.h:34
virtual Int_t GetNbinsX() const
Definition: TH1.h:277
std::vector< V > fVerts
Definition: TGLIsoMesh.h:81
Bool_t fUpdateSelection
Int_t GetHeight() const
viewport[3]
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
void SaveModelviewMatrix() const
TGLPlotCoordinates * fCoord
Double_t Y() const
Definition: TGLUtil.h:120
virtual void Paint()
Draw lego/surf/whatever you can.
const Bool_t kTRUE
Definition: RtypesCore.h:91
char * GetPlotInfo(Int_t px, Int_t py)
Coords for point on surface under cursor.
TGLBoxCut fBoxCut
Double_t GetZScale() const
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
void DrawSectionXOZ() const
Draw XOZ parallel section.
Double_t GetXScale() const
virtual Int_t GetNbinsY() const
Definition: TH1.h:278
Double_t X() const
Definition: TGLUtil.h:118