Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGL5DPainter.h
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 28/07/2009
3
4/*************************************************************************
5 * Copyright (C) 1995-2009, 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_TGL5DPainter
13#define ROOT_TGL5DPainter
14
15#include <vector>
16#include <list>
17
18#include "TGLMarchingCubes.h"
19#include "TGLPlotPainter.h"
20#include "TGLIsoMesh.h"
21#include "TKDEFGT.h"
22#include "TGLUtil.h"
23
24
25class TGLPlotCamera;
26class TGL5DDataSet;
27
28//
29//Painter to draw TGL5DDataSet ("gl5d" option for TTree).
30//
31
33public:
34 enum EDefaults {
36 kNLowPts = 50
37 };
38
40
41 //Iso surface.
42 struct Surf_t {
44 : f4D(0.), fRange(0.), fShowCloud(kFALSE), fHide(kFALSE),
46 {
47 }
48
49 Mesh_t fMesh; //Mesh.
50 Double_t f4D; //Iso-level.
51 Double_t fRange; //Selection critera (f4D +- fRange).
52 Bool_t fShowCloud;//Show/Hide original cloud.
53 Bool_t fHide; //Show/Hide surface.
54 Color_t fColor; //Color.
55 std::vector<Double_t> fPreds; //Predictions for 5-th variable.
56 Bool_t fHighlight;//If surface was selected via GUI - highlight it.
57 Int_t fAlpha; //Opacity percentage of a surface.
58 };
59
60 typedef std::list<Surf_t> SurfList_t;
61 typedef SurfList_t::iterator SurfIter_t;
62 typedef SurfList_t::const_iterator ConstSurfIter_t;
63
64private:
65 TKDEFGT fKDE; //Density estimator.
67
68 const Surf_t fDummy; //Empty surface (for effective insertion into list).
69 Bool_t fInit; //Geometry was set.
70
71 SurfList_t fIsos; //List of iso-surfaces.
72 TGL5DDataSet *fData; //Dataset to visualize.
73
74 typedef std::vector<Double_t>::size_type size_type;
75
78 Bool_t fShowSlider; //For future.
79
80 Double_t fAlpha; //Parameter to define selection range.
81 Int_t fNContours; //Number of "pre-defined" contours.
82
83public:
85
86 //Add new iso for selected value of v4. +- range
88 Double_t range = 1e-3, Int_t lowNumOfPoints = kNLowPts);
89
91 void RemoveSurface(SurfIter_t surf);
92
93 //TGLPlotPainter final-overriders.
94 char *GetPlotInfo(Int_t px, Int_t py);
96 void StartPan(Int_t px, Int_t py);
97 void Pan(Int_t px, Int_t py);
98 void AddOption(const TString &option);
99 void ProcessEvent(Int_t event, Int_t px, Int_t py);
100
101 //Methods for ged.
102 void ShowBoxCut(Bool_t show) {fBoxCut.SetActive(show);}
104
105 void SetAlpha(Double_t newAlpha);
106 Double_t GetAlpha()const{return fAlpha;}
107
108 void SetNContours(Int_t num);
110
111 void ResetGeometryRanges();
112
115
116private:
117 //TGLPlotPainter final-overriders.
118 void InitGL()const;
119 void DeInitGL()const;
120
121 void DrawPlot()const;
122
123 //Empty overriders.
124 void DrawSectionXOZ()const{}
125 void DrawSectionYOZ()const{}
126 void DrawSectionXOY()const{}
127
128 //Auxiliary functions.
129 void SetSurfaceColor(ConstSurfIter_t surf)const;
130 void DrawCloud()const;
131 void DrawSubCloud(Double_t v4, Double_t range, Color_t ci)const;
132 void DrawMesh(ConstSurfIter_t surf)const;
133
136};
137
138#endif
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
short Color_t
Definition RtypesCore.h:92
TGL5DPainter implements "gl5d" option for TTree::Draw.
void ShowBoxCut(Bool_t show)
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void SetSurfaceColor(ConstSurfIter_t surf) const
Set the color for iso-surface.
Bool_t IsBoxCutShown() const
Bool_t fShowSlider
void DrawMesh(ConstSurfIter_t surf) const
Draw one iso-surface.
SurfList_t fIsos
TGL5DPainter & operator=(const TGL5DPainter &)
TGL5DPainter(const TGL5DPainter &)
void SetNContours(Int_t num)
Set the number of predefined contours.
void ResetGeometryRanges()
No need to create or delete meshes, number of meshes (iso-levels) are the same, but meshes must be re...
SurfList_t::iterator SurfIter_t
SurfIter_t SurfacesBegin()
std::list::begin.
std::list< Surf_t > SurfList_t
Rgl::Range_t fV5SliderRange
void RemoveSurface(SurfIter_t surf)
Remove iso-surface.
Rgl::Mc::TMeshBuilder< TKDEFGT, Float_t > fMeshBuilder
SurfIter_t SurfacesEnd()
std::list::end.
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
void DrawSectionYOZ() const
void DrawSectionXOY() const
Double_t GetAlpha() const
void DeInitGL() const
Return some gl states to original values.
void SetAlpha(Double_t newAlpha)
Set selection range parameter.
Rgl::Range_t fV5PredictedRange
void DrawSectionXOZ() const
void DrawCloud() const
Draw full cloud of points.
SurfIter_t AddSurface(Double_t v4, Color_t ci, Double_t isoVal=1., Double_t sigma=1., Double_t range=1e-3, Int_t lowNumOfPoints=kNLowPts)
Try to add new iso-surface.
SurfList_t::const_iterator ConstSurfIter_t
void AddOption(const TString &option)
No additional options for TGL5DPainter.
Int_t GetNContours() const
Rgl::Mc::TIsoMesh< Float_t > Mesh_t
void DrawSubCloud(Double_t v4, Double_t range, Color_t ci) const
Draw cloud for selected iso-surface.
Double_t fAlpha
void Pan(Int_t px, Int_t py)
Mouse events handler.
void DrawPlot() const
Draw a set of meshes.
std::vector< Double_t >::size_type size_type
TGL5DDataSet * fData
void ProcessEvent(Int_t event, Int_t px, Int_t py)
void InitGL() const
Initialize OpenGL state variables.
const Surf_t fDummy
Bool_t InitGeometry()
Create mesh.
Bool_t IsActive() const
void SetActive(Bool_t a)
Turn the box cut on/off.
Camera for TGLPlotPainter and sub-classes.
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,...
Basic string class.
Definition TString.h:136
const Double_t sigma
std::pair< Double_t, Double_t > Range_t
Definition TGLUtil.h:1195
std::vector< Double_t > fPreds