Logo ROOT   6.16/01
Reference Guide
TGLTF3Painter.h
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#ifndef ROOT_TGLTF3Painter
13#define ROOT_TGLTF3Painter
14
15#include <vector>
16#include <list>
17
18#include "TGLPlotPainter.h"
19#include "TGLIsoMesh.h"
20#include "TGLUtil.h"
21
22class TGLPlotCamera;
23class TF3;
24
25/*
26Draw TF3 using marching cubes.
27*/
28
30private:
31 enum ETF3Style {
36 };
37
39
42
46
47public:
48 TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
49
50 char *GetPlotInfo(Int_t px, Int_t py);
52 void StartPan(Int_t px, Int_t py);
53 void Pan(Int_t px, Int_t py);
54 void AddOption(const TString &stringOption);
55 void ProcessEvent(Int_t event, Int_t px, Int_t py);
56
57private:
58 void InitGL()const;
59 void DeInitGL()const;
60
61 void DrawPlot()const;
62 //
63 void DrawToSelectionBuffer()const;
64 void DrawDefaultPlot()const;
65 void DrawMaplePlot()const;
66 //
67
68 void SetSurfaceColor()const;
69 Bool_t HasSections()const;
70
71 void DrawSectionXOZ()const;
72 void DrawSectionYOZ()const;
73 void DrawSectionXOY()const;
74
75 ClassDef(TGLTF3Painter, 0) // GL TF3 painter.
76};
77
78/*
79 Iso painter draws iso surfaces - "gliso" option for TH3XXX::Draw.
80 Can be one-level iso (as standard non-gl "iso" option),
81 or multi-level iso: equidistant contours (if you only specify
82 number of contours, or at user defined levels).
83*/
84
86private:
88 typedef std::list<Mesh_t> MeshList_t;
89 typedef std::list<Mesh_t>::iterator MeshIter_t;
90 typedef std::list<Mesh_t>::const_iterator ConstMeshIter_t;
91
95
97 //List of meshes.
99 //Cached meshes (will be used if geometry must be rebuilt
100 //after TPad::PaintModified)
102 //Min and max bin contents.
104 //Palette. One color per iso-surface.
106 //Iso levels. Equidistant or user-defined.
107 std::vector<Double_t> fColorLevels;
108 //Now meshes are initialized only once.
109 //To be changed in future.
111
112public:
113 TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
114
115 //TGLPlotPainter final-overriders.
116 char *GetPlotInfo(Int_t px, Int_t py);
118 void StartPan(Int_t px, Int_t py);
119 void Pan(Int_t px, Int_t py);
120 void AddOption(const TString &option);
121 void ProcessEvent(Int_t event, Int_t px, Int_t py);
122
123private:
124 //TGLPlotPainter final-overriders.
125 void InitGL()const;
126 void DeInitGL()const;
127
128 void DrawPlot()const;
129 void DrawSectionXOZ()const;
130 void DrawSectionYOZ()const;
131 void DrawSectionXOY()const;
132 //Auxiliary methods.
133 Bool_t HasSections()const;
134 void SetSurfaceColor(Int_t ind)const;
135 void SetMesh(Mesh_t &mesh, Double_t isoValue);
136 void DrawMesh(const Mesh_t &mesh, Int_t level)const;
137 void FindMinMax();
138
141
142 ClassDef(TGLIsoPainter, 0) // Iso option for TH3.
143};
144
145#endif
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:324
A 3-Dim function with parameters.
Definition: TF3.h:28
"gliso" option for TH3.
Definition: TGLTF3Painter.h:85
TGLIsoPainter(const TGLIsoPainter &)
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
Rgl::Mc::TIsoMesh< Float_t > Mesh_t
Definition: TGLTF3Painter.h:87
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
std::list< Mesh_t > MeshList_t
Definition: TGLTF3Painter.h:88
Mesh_t fDummyMesh
Definition: TGLTF3Painter.h:96
void FindMinMax()
Find max/min bin contents for TH3.
std::vector< Double_t > fColorLevels
TGLIsoPainter & operator=(const TGLIsoPainter &)
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.
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:22
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
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.
The TH1 histogram class.
Definition: TH1.h:56
Basic string class.
Definition: TString.h:131
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1193