ROOT  6.06/09
Reference Guide
TGLParametric.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 26/01/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TGLParametric
13 #define ROOT_TGLParametric
14 
15 #include <memory>
16 
17 #ifndef ROOT_TGLHistPainter
18 #include "TGLHistPainter.h"
19 #endif
20 #ifndef ROOT_TGLUtil
21 #include "TGLUtil.h"
22 #endif
23 #ifndef ROOT_TAxis
24 #include "TAxis.h"
25 #endif
26 #ifndef ROOT_TF2
27 #include "TF2.h"
28 #endif
29 
30 class TString;
31 
32 //////////////////////////////////////////////////////////////////////////
33 // //
34 // TGLParametricEquation //
35 // //
36 // Parametric equations drawing with GL. //
37 // //
38 //////////////////////////////////////////////////////////////////////////
39 
40 
42 
43 class TGLParametricEquation : public TNamed {
44 private:
45  typedef std::auto_ptr<TF2> Ptr_t;
46 
47  Ptr_t fXEquation;
48  Ptr_t fYEquation;
49  Ptr_t fZEquation;
50 
52 
55 
58 
59  typedef std::auto_ptr<TGLHistPainter> Painter_t;
60  //C++ compiler do not need TGLhistPainter definition here, but I'm not sure about CINT,
61  //so I've included TGLHistPainter definition.
62  Painter_t fPainter;
63 
64 public:
65  TGLParametricEquation(const TString &name, const TString &xEquation,
66  const TString &yEquation, const TString &zEquation,
67  Double_t uMin, Double_t uMax,
68  Double_t vMin, Double_t vMax);
70  Double_t uMin, Double_t uMax, Double_t vMin, Double_t vMax);
71 
72  Rgl::Range_t GetURange()const;
73  Rgl::Range_t GetVRange()const;
74 
75  Bool_t IsConstrained()const;
76  void SetConstrained(Bool_t c);
77 
78  Bool_t IsModified()const;
79  void SetModified(Bool_t m);
80 
81  void EvalVertex(TGLVertex3 &newVertex, Double_t u, Double_t v)const;
82 
84  void ExecuteEvent(Int_t event, Int_t px, Int_t py);
85  char *GetObjectInfo(Int_t px, Int_t py) const;
86  void Paint(Option_t *option);
87 
88 private:
89 
92 
93  ClassDef(TGLParametricEquation, 0)//Equation of parametric surface.
94 };
95 
97 private:
98  struct Vertex_t {
102  };
103 
104  enum EMeshSize {kLow = 30, kHigh = 150};
105 
108 
111 
113 
117 
119 
120 public:
122 
124  void StartPan(Int_t px, Int_t py);
125  void Pan(Int_t px, Int_t py);
126  char *GetPlotInfo(Int_t px, Int_t py);
127  void AddOption(const TString &option);
128  void ProcessEvent(Int_t event, Int_t px, Int_t py);
129 
130 private:
131  void InitGL()const;
132  void DeInitGL()const;
133 
134  void DrawPlot()const;
135 
136  void InitColors();
137 
138  void DrawSectionXOZ()const;
139  void DrawSectionYOZ()const;
140  void DrawSectionXOY()const;
141 
142  void SetSurfaceColor()const;
143 
146 
147  ClassDef(TGLParametricPlot, 0)//Parametric plot's painter.
148 };
149 
150 #endif
void InitGL() const
Initialize gl state.
ParametricEquation_t fEquation
Definition: TGLParametric.h:51
std::auto_ptr< TF2 > Ptr_t
Definition: TGLParametric.h:45
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:21
TGLParametricEquation & operator=(const TGLParametricEquation &)
void EvalVertex(TGLVertex3 &newVertex, Double_t u, Double_t v) const
Calculate vertex.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
TGLPlotCoordinates fCartesianCoord
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
void DrawSectionYOZ() const
No such sections.
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1197
void SetConstrained(Bool_t c)
Set constrained.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Check, if parametric surface is under cursor.
void DeInitGL() const
Initialize gl state.
Rgl::Range_t fURange
Definition: TGLParametric.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:86
Bool_t IsModified() const
Something was changed in parametric equation (or constrained option was changed). ...
TGL2DArray< Vertex_t > fMesh
void SetSurfaceColor() const
Set material properties.
3 component (x/y/z) vector class.
Definition: TGLUtil.h:250
TGLParametricEquation(const TString &name, const TString &xEquation, const TString &yEquation, const TString &zEquation, Double_t uMin, Double_t uMax, Double_t vMin, Double_t vMax)
TGLParametricEquation * fEquation
Class to manage histogram axis.
Definition: TAxis.h:36
SVector< double, 2 > v
Definition: Dict.h:5
void(* ParametricEquation_t)(TGLVertex3 &, Double_t u, Double_t v)
Definition: TGLParametric.h:41
ClassDef(TVirtualGLPainter, 0)
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
TMarker * m
Definition: textangle.C:8
A parametric surface is a surface defined by a parametric equation, involving two parameters (u...
Definition: TGLParametric.h:43
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
Rgl::Range_t GetVRange() const
[vMin, vMax]
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Pass event to painter.
Bool_t InitGeometry()
Build mesh.
Rgl::Range_t GetURange() const
[uMin, uMax]
Rgl::Range_t fVRange
Definition: TGLParametric.h:54
TGLParametricPlot(TGLParametricEquation *equation, TGLPlotCamera *camera)
double Double_t
Definition: RtypesCore.h:55
Bool_t IsConstrained() const
Check is constrained.
void DrawSectionXOY() const
No such sections.
void AddOption(const TString &option)
No additional options for parametric surfaces.
void DrawSectionXOZ() const
No such sections.
#define name(a, b)
Definition: linkTestLib0.cpp:5
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
std::auto_ptr< TGLHistPainter > Painter_t
Definition: TGLParametric.h:59
typedef void((*Func_t)())
void Paint(Option_t *option)
Delegate paint.
void SetModified(Bool_t m)
Set modified.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color/mesh size or switch on/off mesh/box cut.
void InitColors()
Calculate colors for vertices, using one of 20 color themes.
char * GetObjectInfo(Int_t px, Int_t py) const
No object info yet.
void DrawPlot() const
Draw parametric surface.
TGLParametricPlot & operator=(const TGLParametricPlot &)
char * GetPlotInfo(Int_t px, Int_t py)
No object info yet.