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) override;
95 Bool_t InitGeometry() override;
96 void StartPan(Int_t px, Int_t py) override;
97 void Pan(Int_t px, Int_t py) override;
98 void AddOption(const TString &option) override;
99 void ProcessEvent(Int_t event, Int_t px, Int_t py) override;
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 override;
119 void DeInitGL()const override;
120
121 void DrawPlot()const override;
122
123 //Empty overriders.
124 void DrawSectionXOZ()const override{}
125 void DrawSectionYOZ()const override{}
126 void DrawSectionXOY()const override{}
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
short Color_t
Definition RtypesCore.h:92
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
winID h TVirtualViewer3D TVirtualGLPainter char GetPlotInfo
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
TGL5DPainter implements "gl5d" option for TTree::Draw.
void ShowBoxCut(Bool_t show)
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
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 &)
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
TGL5DPainter(const TGL5DPainter &)
void SetNContours(Int_t num)
Set the number of predefined contours.
void InitGL() const override
Initialize OpenGL state variables.
void DrawSectionXOZ() const override
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.
void DrawPlot() const override
Draw a set of meshes.
Double_t GetAlpha() const
void SetAlpha(Double_t newAlpha)
Set selection range parameter.
Rgl::Range_t fV5PredictedRange
void DrawCloud() const
Draw full cloud of points.
void Pan(Int_t px, Int_t py) override
Mouse events handler.
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
Bool_t InitGeometry() override
Create mesh.
void DeInitGL() const override
Return some gl states to original values.
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.
void DrawSectionXOY() const override
void AddOption(const TString &option) override
No additional options for TGL5DPainter.
Double_t fAlpha
std::vector< Double_t >::size_type size_type
void DrawSectionYOZ() const override
TGL5DDataSet * fData
const Surf_t fDummy
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:139
const Double_t sigma
std::pair< Double_t, Double_t > Range_t
Definition TGLUtil.h:1202
std::vector< Double_t > fPreds