Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLH2PolyPainter.cxx
Go to the documentation of this file.
1#include <algorithm>
2#include <stdexcept>
3#include <cassert>
4
5#include "TMultiGraph.h"
6#include "TH2Poly.h"
7#include "TGraph.h"
8#include "TStyle.h"
9#include "TError.h"
10#include "TColor.h"
11#include "TMath.h"
12#include "TList.h"
13#include "TROOT.h"
14
15#include "TGLH2PolyPainter.h"
16#include "TGLPlotCamera.h"
17#include "TGLIncludes.h"
18
19/** \class TGLH2PolyPainter
20\ingroup opengl
21Paint TH2Poly.
22*/
23
24
25////////////////////////////////////////////////////////////////////////////////
26///Ctor.
27
30 fZLog(kFALSE),
31 fZMin(0.)
32{
33 if(!dynamic_cast<TH2Poly *>(hist)) {
34 Error("TGLH2PolyPainter::TGLH2PolyPainter", "bad histogram, must be a valid TH2Poly *");
35 throw std::runtime_error("bad TH2Poly");
36 }
37}
38
39////////////////////////////////////////////////////////////////////////////////
40///Show number of bin and bin contents, if bin is under the cursor.
41
43{
44 fBinInfo = "";
45 if (fSelectedPart) {
47 if (fHist->Class())
48 fBinInfo += fHist->Class()->GetName();
49 fBinInfo += "::";
51 } else if (!fHighColor) {
53 TH2Poly *h = static_cast<TH2Poly *>(fHist);
54 fBinInfo.Form("%s (bin = %d; binc = %f)", h->GetBinTitle(binIndex), binIndex, h->GetBinContent(binIndex));//+ 1: bins in ROOT start from 1.
55 } else
56 fBinInfo = "Switch to true-color mode to obtain the correct info";
57 }
58
59 return (Char_t *)fBinInfo.Data();
60}
61
62////////////////////////////////////////////////////////////////////////////////
63///Tesselate polygons, if not done yet.
64///All pointers are validated here (and in functions called from here).
65///If any pointer is invalid - zero, or has unexpected type (dynamic_cast fails) -
66///InitGeometry will return false and nothing will be painted later.
67///That's why there are no checks in other functions.
68
70{
71 TH2Poly* hp = static_cast<TH2Poly *>(fHist);
72 if (!fCoord->SetRanges(hp))
73 return kFALSE;
74
77 fCoord->GetZRangeScaled(), 1.);
78
79 //This code is different from lego.
80 //Currently, negative bin contents are not supported.
81 fZMin = fBackBox.Get3DBox()[0].Z();
82
83 if (hp->GetNewBinAdded()) {
84 if (!CacheGeometry())
85 return kFALSE;
86 hp->SetNewBinAdded(kFALSE);
87 hp->SetBinContentChanged(kFALSE);
88 } else if (hp->GetBinContentChanged() || fZLog != fCoord->GetZLog()) {
89 if (!UpdateGeometry())
90 return kFALSE;
91 hp->SetBinContentChanged(kFALSE);
92 }
93
94 fZLog = fCoord->GetZLog();
95
96 return kTRUE;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100///User clicks on a lego with middle mouse button (middle for pad).
101
103{
104 fMousePosition.fX = px;
106 fCamera->StartPan(px, py);
107 fBoxCut.StartMovement(px, py);
108}
109
110////////////////////////////////////////////////////////////////////////////////
111///Mouse events handler.
112
114{
115 if (fSelectedPart >= fSelectionBase) {//Pan camera.
118
121 fCamera->Pan(px, py);
122
125 } else if (fSelectedPart > 0) {
126 //Convert py into bottom-top orientation.
127 py = fCamera->GetHeight() - py;
128
131
134
135 if (!fHighColor) {
138 }
139 }
140
143 }
144
147}
148
149////////////////////////////////////////////////////////////////////////////////
150///No additional options.
151
152void TGLH2PolyPainter::AddOption(const TString &/*stringOption*/)
153{
154}
155
156////////////////////////////////////////////////////////////////////////////////
157///No events.
158
159void TGLH2PolyPainter::ProcessEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/)
160{
161}
162
163////////////////////////////////////////////////////////////////////////////////
164///Initialize some gl state variables.
165
177
178////////////////////////////////////////////////////////////////////////////////
179///Return some gl states to original values.
180
189
190namespace {
191
192Double_t Distance(const Double_t *p1, const Double_t *p2);
193Bool_t IsPolygonCW(const Double_t *xs, const Double_t *ys, Int_t n);
194
195}
196
197////////////////////////////////////////////////////////////////////////////////
198///Draw extruded polygons and plot's frame.
199
201{
202 //Shift plot to point of origin.
203 const Rgl::PlotTranslation trGuard(this);
204
206
208 DrawCaps();
209}
210
211////////////////////////////////////////////////////////////////////////////////
212///Extruded part of bins.
213///GL_QUADS, GL_QUAD_STRIP - have the same time on my laptop, so I use
214///GL_QUADS and forgot about vertex arrays (can require more memory BTW).
215
217{
218 TList *bins = static_cast<TH2Poly *>(fHist)->GetBins();
219 Int_t binIndex = 0;
220 for(TObjLink * link = bins->FirstLink(); link; link = link->Next(), ++binIndex) {
221 TH2PolyBin *bin = static_cast<TH2PolyBin *>(link->GetObject());
222 //const Double_t zMax = bin->GetContent() * fCoord->GetZScale();
223 Double_t zMax = bin->GetContent();
224 ClampZ(zMax);
225
226 if (const TGraph * poly = dynamic_cast<TGraph*>(bin->GetPolygon())) {
227 //DrawExtrusion(poly, zMin, zMax, binIndex);
229 } else if (const TMultiGraph * mg = dynamic_cast<TMultiGraph*>(bin->GetPolygon())) {
230 //DrawExtrusion(mg, zMin, zMax, binIndex);
232 }//else is impossible.
233 }
234}
235
236////////////////////////////////////////////////////////////////////////////////
237///Extrude polygon, described by TGraph.
238
240{
241 const Double_t *xs = poly->GetX();
242 const Double_t *ys = poly->GetY();
243
244 const Int_t nV = poly->GetN();
245
246 //nV can never be less than 3 - InitGeometry fails on such polygons.
247 //So, no checks here.
248
250
251 if (fSelectionPass) {
252 if (!fHighColor)
254 } else {
258 }
259
260 //Before, orientation was always done in TH2Poly.
261 //Now we do it every time here.
262 FillTemporaryPolygon(xs, ys, 0., nV); //0. == z is not important here.
263
264 Double_t normal[3] = {};
265 for (Int_t j = 0; j < nV - 1; ++j) {
266 const Double_t v0[] = {fPolygon[j * 3], fPolygon[j * 3 + 1], zMin};
267 const Double_t v1[] = {fPolygon[(j + 1) * 3], fPolygon[(j + 1) * 3 + 1], zMin};
268
269 if (Distance(v0, v1) < 1e-10)
270 continue;
271
272 const Double_t v2[] = {v1[0], v1[1], zMax};
273 const Double_t v3[] = {v0[0], v0[1], zMax};
274
277 }
278
279 //Now, close the polygon.
280 const Double_t v0[] = {fPolygon[(nV - 1) * 3], fPolygon[(nV - 1) * 3 + 1], zMin};
281 const Double_t v1[] = {fPolygon[0], fPolygon[1], zMin};
282
283 if (Distance(v0, v1) > 1e-10) {
284 const Double_t v2[] = {v1[0], v1[1], zMax};
285 const Double_t v3[] = {v0[0], v0[1], zMax};
286
289 }
290
293}
294
295////////////////////////////////////////////////////////////////////////////////
296///Multigraph contains a list of graphs, draw them.
297
299{
300 const TList *graphs = mg->GetListOfGraphs();
301 for (TObjLink *link = graphs->FirstLink(); link; link = link->Next())
302 DrawExtrusion((TGraph *)(link->GetObject()), zMin, zMax, binIndex);
303}
304
305////////////////////////////////////////////////////////////////////////////////
306///Caps on bins.
307
309{
310 Int_t binIndex = 0;
311 const TList *bins = static_cast<TH2Poly *>(fHist)->GetBins();
312 CIter_t cap = fCaps.begin();
313
314 assert(bins->FirstLink());
315
316 //Very ugly iteration statement. Number of caps is equal to number of links (in a list
317 //of bins including nested links in multigraphs. But this is not obvious from the code here,
318 //so, I've added check cap != fCaps.end() to make it more or less clear.
319
320 for (TObjLink *link = bins->FirstLink(); link && cap != fCaps.end(); link = link->Next()) {
321 TH2PolyBin *polyBin = static_cast<TH2PolyBin *>(link->GetObject());
322 if (dynamic_cast<TGraph *>(polyBin->GetPolygon())) {
323 DrawCap(cap, binIndex, false/*top cap*/);
324 DrawCap(cap, binIndex, true/*bottom cap*/);
325 ++cap;
326 } else if (TMultiGraph *mg = dynamic_cast<TMultiGraph *>(polyBin->GetPolygon())) {
327 const TList *gs = mg->GetListOfGraphs();
328 TObjLink *graphLink = gs->FirstLink();
329 for (; graphLink && cap != fCaps.end(); graphLink = graphLink->Next(), ++cap) {
330 DrawCap(cap, binIndex, false/*top cap*/);
331 DrawCap(cap, binIndex, true/*bottom cap*/);
332 }
333 }
334
335 ++binIndex;
336 }
337}
338
339////////////////////////////////////////////////////////////////////////////////
340///Draw a cap on top of a bin.
341
343{
345 if (fSelectionPass) {
346 if (!fHighColor)
348 } else {
352 }
353
354 glNormal3d(0., 0., bottomCap ? -1. : 1.);
355
356 if (bottomCap)
358
359 const Rgl::Pad::Tesselation_t &t = *cap;
360 typedef std::list<Rgl::Pad::MeshPatch_t>::const_iterator CMIter_t;
361 if (bottomCap) {
362 for (CMIter_t p = t.begin(); p != t.end(); ++p) {
363 const std::vector<Double_t> &vs = p->fPatch;
364 glBegin(GLenum(p->fPatchType));
365 for (UInt_t i = 0; i < vs.size(); i += 3)
366 glVertex3d(vs[i], vs[i + 1], fZMin);
367 glEnd();
368 }
369 } else {
370 for (CMIter_t p = t.begin(); p != t.end(); ++p) {
371 const std::vector<Double_t> &vs = p->fPatch;
372 glBegin(GLenum(p->fPatchType));
373 for (UInt_t i = 0; i < vs.size(); i += 3)
374 glVertex3dv(&vs[i]);
375 glEnd();
376 }
377 }
378
379
382
383 if (bottomCap) // Restore the counter-clockwise orientation:
385}
386
387////////////////////////////////////////////////////////////////////////////////
388///Cache all data for TH2Poly object.
389
391{
392 TH2Poly *hp = static_cast<TH2Poly *>(fHist);
393 TList *bins = hp->GetBins();
394 if (!bins || !bins->GetEntries()) {
395 Error("TGLH2PolyPainter::CacheGeometry", "Empty list of bins in TH2Poly");
396 return kFALSE;
397 }
398
399 const Double_t zMin = fHist->GetMinimum();
400 const Double_t zMax = fHist->GetMaximum();
402
403 fBinColors.clear();
404 fBinColors.reserve(bins->GetEntries());
405 fPolygon.clear();
406 fCaps.clear();
407
409
410 for (TObjLink * link = bins->FirstLink(); link; link = link->Next()) {
411 TH2PolyBin * bin = static_cast<TH2PolyBin *>(link->GetObject());
412 if (!bin || !bin->GetPolygon()) {
413 Error("TGH2PolyPainter::InitGeometry", "Null bin or polygon pointer in a list of bins");
414 return kFALSE;
415 }
416
417 Double_t binZ = bin->GetContent();
418 if (!ClampZ(binZ)) {
419 Error("TGLH2PolyPainter::CacheGeometry", "Negative bin content and log scale");
420 return kFALSE;
421 }
422
423 if (const TGraph *g = dynamic_cast<TGraph *>(bin->GetPolygon())) {
425 return kFALSE;
426 } else if (const TMultiGraph *mg = dynamic_cast<TMultiGraph *>(bin->GetPolygon())) {
428 return kFALSE;
429 } else {
430 Error("TGLH2PolyPainter::CacheGeometry", "Bin contains object of unknown type");
431 return kFALSE;
432 }
433
434 const Int_t colorIndex = gStyle->GetColorPalette(Int_t(((bin->GetContent() - zMin) / (zMax - zMin)) * (nColors - 1)));
435 fBinColors.push_back(colorIndex);
436 }
437
438 return kTRUE;
439}
440
441////////////////////////////////////////////////////////////////////////////////
442///Tesselate a polygon described by TGraph.
443
445{
446 const Double_t *xs = g->GetX();
447 const Double_t *ys = g->GetY();
448
449 if (!xs || !ys) {
450 Error("TGLH2PolyPainter::BuildTesselation", "null array(s) in a polygon");
451 return kFALSE;
452 }
453
454 const Int_t nV = g->GetN();
455 if (nV < 3) {
456 Error("TGLH2PolyPainter::BuildTesselation", "number of vertices in a polygon must be >= 3");
457 return kFALSE;
458 }
459
460 fCaps.push_back(Rgl::Pad::Tesselation_t());
462
463 tess.SetDump(&fCaps.back());
464
465 GLUtesselator *t = (GLUtesselator *)tess.GetTess();
468
469 glNormal3d(0., 0., 1.);
470
471 for (Int_t j = 0; j < nV; ++j) {
472 gluTessVertex(t, &fPolygon[j * 3], &fPolygon[j * 3]);
473 }
474 gluEndPolygon(t);
475
476 return kTRUE;
477}
478
479////////////////////////////////////////////////////////////////////////////////
480///Iterate over multi graph contents and tesselate nested TGraphs.
481
483{
484 const TList *graphs = mg->GetListOfGraphs();
485 if (!graphs) {
486 Error("TGLH2PolyPainter::BuildTesselation", "null list of graphs in a multigraph");
487 return kFALSE;
488 }
489
490 for(TObjLink *link = graphs->FirstLink(); link; link = link->Next()) {
491 const TGraph *graph = dynamic_cast<TGraph *>(link->GetObject());
492 if (!graph) {
493 Error("TGLH2PolyPainter::BuildTesselation", "TGraph expected inside a multigraph, got something else");
494 return kFALSE;
495 }
496
497 if (!BuildTesselation(tess, graph, z))
498 return kFALSE;
499 }
500
501 return kTRUE;
502}
503
504////////////////////////////////////////////////////////////////////////////////
505///Update cap's z-coordinates for all caps.
506///Here no pointers are checked, this was already done
507///by InitGeometry.
508
510{
511 TH2Poly *hp = static_cast<TH2Poly *>(fHist);
512 TList *bins = hp->GetBins();
513
514 std::list<Rgl::Pad::Tesselation_t>::iterator cap = fCaps.begin();
515
516 //Ugly iteration statements, but still, number of links and caps will be
517 //ok - this is checked in InitGeometry. Check cap != fCaps.end() is added
518 //to make it clear (not required).
519 for (TObjLink *link = bins->FirstLink(); link && cap != fCaps.end(); link = link->Next()) {
520 TH2PolyBin *b = static_cast<TH2PolyBin *>(link->GetObject());
521 Double_t z = b->GetContent();
522 ClampZ(z);
523 //Update z coordinate in all patches.
524 if (dynamic_cast<TGraph *>(b->GetPolygon())) {
525 //Only one cap.
527 Rgl::Pad::Tesselation_t::iterator patch = tess.begin();
528 for (; patch != tess.end(); ++patch) {
529 std::vector<Double_t> &mesh = patch->fPatch;
530 for (UInt_t i = 0, e = mesh.size() / 3; i < e; ++i)
531 mesh[i * 3 + 2] = z;
532 }
533
534 ++cap;
535 } else if (const TMultiGraph *mg = dynamic_cast<TMultiGraph *>(b->GetPolygon())) {
536 const TList *gs = mg->GetListOfGraphs();
537 for (TObjLink * graphLink = gs->FirstLink(); graphLink && cap != fCaps.end(); graphLink = graphLink->Next(), ++cap) {
539 Rgl::Pad::Tesselation_t::iterator patch = tess.begin();
540 for (; patch != tess.end(); ++patch) {
541 std::vector<Double_t> &mesh = patch->fPatch;
542 for (UInt_t i = 0, e = mesh.size() / 3; i < e; ++i)
543 mesh[i * 3 + 2] = z;
544 }
545 }
546 }//else is impossible and processed by InitGeometry.
547 }
548
549 return kTRUE;
550}
551
552////////////////////////////////////////////////////////////////////////////////
553///Set bin's color.
554
556{
557 if (binIndex >= Int_t(fBinColors.size())) {
558 Error("TGLH2PolyPainter::SetBinColor", "bin index is out of range %d, must be <= %d",
559 binIndex, int(fBinColors.size()));
560 return;
561 }
562
563 //Convert color index into RGB.
564 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
565
566 if (const TColor *c = gROOT->GetColor(fBinColors[binIndex]))
567 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
568
570 const Float_t specColor[] = {0.2f, 0.2f, 0.2f, 0.2f};
573}
574
575////////////////////////////////////////////////////////////////////////////////
576///No sections.
577
581
582////////////////////////////////////////////////////////////////////////////////
583///No sections.
584
588
589////////////////////////////////////////////////////////////////////////////////
590///No sections.
591
595
596////////////////////////////////////////////////////////////////////////////////
597///Not yet.
598
600{
601}
602
603////////////////////////////////////////////////////////////////////////////////
604///Not yet.
605
609
610////////////////////////////////////////////////////////////////////////////////
611///Since I probably have to re-orient polygon, I need a temporary polygon.
612
614{
615 const Double_t xScale = fCoord->GetXScale();
616 const Double_t yScale = fCoord->GetYScale();
617
618 fPolygon.resize(nV * 3);
619 for (Int_t j = 0; j < nV; ++j) {
620 fPolygon[j * 3] = xs[j] * xScale;
621 fPolygon[j * 3 + 1] = ys[j] * yScale;
622 fPolygon[j * 3 + 2] = z;
623 }
624
625 if (IsPolygonCW(xs, ys, nV))
627}
628
629////////////////////////////////////////////////////////////////////////////////
630///Code taken from the original TH2Poly.
631
633{
634 const Int_t nV = Int_t(fPolygon.size() / 3);
635 for (Int_t a = 0; a <= (nV / 2) - 1; a++) {
636 const Int_t b = nV - 1 - a;
637 std::swap(fPolygon[a * 3], fPolygon[b * 3]);
638 std::swap(fPolygon[a * 3 + 1], fPolygon[b * 3 + 1]);
639 }
640}
641
642////////////////////////////////////////////////////////////////////////////////
643///Clamp z value.
644
646{
647 if (fCoord->GetZLog()) {
648 if (zVal <= 0.)
649 return kFALSE;
650 else
652 } else
653 zVal *= fCoord->GetZScale();
654
655 const TGLVertex3 *frame = fBackBox.Get3DBox();
656
657 if (zVal > frame[4].Z())
658 zVal = frame[4].Z();
659 else if (zVal < frame[0].Z())
660 zVal = frame[0].Z();
661
662 return kTRUE;
663}
664
665
666namespace {
667
668////////////////////////////////////////////////////////////////////////////////
669///
670
671Double_t Distance(const Double_t *p1, const Double_t *p2)
672{
673 return TMath::Sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +
674 (p1[1] - p2[1]) * (p1[1] - p2[1]) +
675 (p1[2] - p2[2]) * (p1[2] - p2[2]));
676}
677
678////////////////////////////////////////////////////////////////////////////////
679///Before, TH2Poly always produced good GL polygons - CCW. Now,
680///this code (by Deniz Gunceler) was deleted from TH2Poly.
681
683{
684 Double_t signedArea = 0.;
685
686 for (Int_t j = 0; j < n - 1; ++j)
687 signedArea += xs[j] * ys[j + 1] - ys[j] * xs[j + 1];
688
689 return signedArea < 0.;
690}
691
692}
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
winID h TVirtualViewer3D TVirtualGLPainter p
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
const_iterator begin() const
const_iterator end() const
virtual Int_t GetEntries() const
The color creation and management class.
Definition TColor.h:22
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
Bool_t IsActive() const
void Pan(Int_t px, Int_t py) override
Mouse events handler.
char * GetPlotInfo(Int_t px, Int_t py) override
Show number of bin and bin contents, if bin is under the cursor.
void FillTemporaryPolygon(const Double_t *xs, const Double_t *ys, Double_t z, Int_t n) const
Since I probably have to re-orient polygon, I need a temporary polygon.
void DrawCaps() const
Caps on bins.
void InitGL() const override
Initialize some gl state variables.
void MakePolygonCCW() const
Code taken from the original TH2Poly.
Bool_t InitGeometry() override
Tesselate polygons, if not done yet.
void DeInitGL() const override
Return some gl states to original values.
std::list< Rgl::Pad::Tesselation_t > fCaps
void DrawSectionXOY() const override
No sections.
Bool_t BuildTesselation(Rgl::Pad::Tesselator &tess, const TGraph *g, Double_t z)
Tesselate a polygon described by TGraph.
std::list< Rgl::Pad::Tesselation_t >::const_iterator CIter_t
void DrawPlot() const override
Draw extruded polygons and plot's frame.
void AddOption(const TString &stringOption) override
No additional options.
void DrawCap(CIter_t cap, Int_t bin, bool bottomCap) const
Draw a cap on top of a bin.
TGLH2PolyPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Ctor.
void DrawPalette() const
Not yet.
Bool_t UpdateGeometry()
Update cap's z-coordinates for all caps.
std::vector< Double_t > fPolygon
Bool_t ClampZ(Double_t &zVal) const
Clamp z value.
Bool_t CacheGeometry()
Cache all data for TH2Poly object.
void DrawSectionXOZ() const override
No sections.
void SetBinColor(Int_t bin) const
Set bin's color.
void DrawPaletteAxis() const override
Not yet.
void DrawSectionYOZ() const override
No sections.
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
No events.
void DrawExtrusion() const
Extruded part of bins.
std::vector< Int_t > fBinColors
void StartPan(Int_t px, Int_t py) override
User clicks on a lego with middle mouse button (middle for pad).
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
const TGLVertex3 * Get3DBox() const
Get 3D box.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Camera for TGLPlotPainter and sub-classes.
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void SetCamera() const
Viewport and projection.
void Pan(Int_t px, Int_t py)
Pan camera.
Int_t GetHeight() const
viewport[3]
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
Double_t GetYScale() const
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
Bool_t GetZLog() const
Get Z log.
Double_t GetXScale() const
Double_t GetZScale() const
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
std::vector< Double_t > fZLevels
void RestoreModelviewMatrix() const
TGLPlotCoordinates * fCoord
TGLPlotBox fBackBox
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Double_t Z() const
Definition TGLUtil.h:123
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
static TClass * Class()
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition TH1.cxx:8586
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Definition TH1.cxx:8676
Helper class to represent a bin in the TH2Poly histogram.
Definition TH2Poly.h:25
Double_t GetContent() const
Definition TH2Poly.h:35
TObject * GetPolygon() const
Definition TH2Poly.h:38
2D Histogram with Polygonal Bins
Definition TH2Poly.h:66
A doubly linked list.
Definition TList.h:38
virtual TObjLink * FirstLink() const
Definition TList.h:102
A TMultiGraph is a collection of TGraph (or derived) objects.
Definition TMultiGraph.h:34
TList * GetListOfGraphs() const
Definition TMultiGraph.h:68
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2362
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition TStyle.cxx:1102
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition TStyle.cxx:1176
const Int_t n
Definition legend1.C:16
std::list< MeshPatch_t > Tesselation_t
void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &normal)
Draw quad face.
Definition TGLUtil.cxx:2952
const Float_t gNullEmission[]
Definition TGLUtil.cxx:2846
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition TGLUtil.cxx:2890
const Double_t gH2PolyScaleXY
const Float_t gOrangeEmission[]
Definition TGLUtil.cxx:2843
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
Definition TMath.h:1299
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:773