Logo ROOT   6.18/05
Reference Guide
TGLLegoPainter.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 14/06/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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#include <algorithm>
12#include <cctype>
13
14#include "KeySymbols.h"
15#include "TVirtualX.h"
16#include "Buttons.h"
17#include "TString.h"
18#include "TColor.h"
19#include "TROOT.h"
20#include "TClass.h"
21#include "TStyle.h"
22#include "TAxis.h"
23#include "TMath.h"
24#include "TH1.h"
25
26#include "TGLLegoPainter.h"
27#include "TGLPlotCamera.h"
28#include "TGLIncludes.h"
29
30/** \class TGLLegoPainter
31\ingroup opengl
32Plot-painter implementing LEGO rendering of TH2 histograms in
33cartesian, polar, cylindrical and spherical coordinates.
34*/
35
37
38////////////////////////////////////////////////////////////////////////////////
39///Ctor.
40
42 : TGLPlotPainter(hist, cam, coord, kFALSE, kTRUE, kTRUE),
43 fLegoType(kColorSimple),
44 fMinZ(0.),
45 fDrawErrors(kFALSE)
46{
47}
48
49////////////////////////////////////////////////////////////////////////////////
50///Obtain bin's info (i, j, value).
51
53{
54 fBinInfo = "";
55
56 if (fSelectedPart) {
58 if (fHist->Class())
59 fBinInfo += fHist->Class()->GetName();
60 fBinInfo += "::";
62 } else if (!fHighColor) {
65 fBinInfo.Form("(binx = %d; biny = %d; binc = %f)", binI, binJ,
66 fHist->GetBinContent(binI, binJ));
67 } else
68 fBinInfo = "Switch to true-color mode to obtain correct info";
69 }
70
71 return (Char_t *)fBinInfo.Data();
72}
73
74////////////////////////////////////////////////////////////////////////////////
75///Select method.
76
78{
79 Bool_t ret = kFALSE;
80 switch (fCoord->GetCoordType()) {
81 case kGLCartesian:
82 ret = InitGeometryCartesian(); break;
83 case kGLPolar:
84 ret = InitGeometryPolar(); break;
85 case kGLCylindrical:
86 ret = InitGeometryCylindrical(); break;
87 case kGLSpherical:
88 ret = InitGeometrySpherical(); break;
89 default:
90 return kFALSE;
91 }
93 return ret;
94}
95
96////////////////////////////////////////////////////////////////////////////////
97///Geometry for lego in cartesian coords.
98
100{
102 return kFALSE;
103
105
106 //Find bin edges
107 const Int_t nX = fCoord->GetNXBins();
108 const Double_t barWidth = fHist->GetBarWidth(), barOffset = fHist->GetBarOffset();
109 const TGLVertex3 *frame = fBackBox.Get3DBox();
110 fXEdges.resize(nX);
111
112 if (fCoord->GetXLog()) {
113 for (Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
114 const Double_t xWidth = fXAxis->GetBinWidth(ir);
115 Double_t low = fXAxis->GetBinLowEdge(ir) + xWidth * barOffset;
116 fXEdges[i].first = TMath::Log10(low) * fCoord->GetXScale();
117 fXEdges[i].second = TMath::Log10(low + xWidth * barWidth) * fCoord->GetXScale();
118 if (fXEdges[i].second > frame[1].X())
119 fXEdges[i].second = frame[1].X();
120 if (fXEdges[i].first < frame[0].X())
121 fXEdges[i].first = frame[0].X();
122 if (fXEdges[i].second < frame[0].X())
123 fXEdges[i].second = frame[0].X();
124 }
125 } else {
126 for (Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
127 const Double_t xWidth = fXAxis->GetBinWidth(ir);
128 fXEdges[i].first = (fXAxis->GetBinLowEdge(ir) + xWidth * barOffset) * fCoord->GetXScale();
129 fXEdges[i].second = fXEdges[i].first + xWidth * barWidth * fCoord->GetXScale();
130 if (fXEdges[i].second > frame[1].X())
131 fXEdges[i].second = frame[1].X();
132 if (fXEdges[i].first < frame[0].X())
133 fXEdges[i].first = frame[0].X();
134 if (fXEdges[i].second < frame[0].X())
135 fXEdges[i].second = frame[0].X();
136 }
137 }
138
139 const Int_t nY = fCoord->GetNYBins();
140 fYEdges.resize(nY);
141
142 if (fCoord->GetYLog()) {
143 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
144 const Double_t yWidth = fYAxis->GetBinWidth(jr);
145 Double_t low = fYAxis->GetBinLowEdge(jr) + yWidth * barOffset;
146 fYEdges[j].first = TMath::Log10(low) * fCoord->GetYScale();
147 fYEdges[j].second = TMath::Log10(low + yWidth * barWidth) * fCoord->GetYScale();
148 if (fYEdges[j].second > frame[2].Y())
149 fYEdges[j].second = frame[2].Y();
150 if (fYEdges[j].first < frame[0].Y())
151 fYEdges[j].first = frame[0].Y();
152 if (fYEdges[j].second < frame[0].Y())
153 fYEdges[j].second = frame[0].Y();
154 }
155 } else {
156 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
157 const Double_t yWidth = fYAxis->GetBinWidth(jr);
158 fYEdges[j].first = (fYAxis->GetBinLowEdge(jr) + yWidth * barOffset) * fCoord->GetYScale();
159 fYEdges[j].second = fYEdges[j].first + yWidth * barWidth * fCoord->GetYScale();
160 if (fYEdges[j].second > frame[2].Y())
161 fYEdges[j].second = frame[2].Y();
162 if (fYEdges[j].first < frame[0].Y())
163 fYEdges[j].first = frame[0].Y();
164 if (fYEdges[j].second < frame[0].Y())
165 fYEdges[j].second = frame[0].Y();
166 }
167 }
168
169 fMinZ = frame[0].Z();
170 if (fMinZ < 0.)
171 frame[4].Z() > 0. ? fMinZ = 0. : fMinZ = frame[4].Z();
172
173 if (fCoord->Modified()) {
175 fXOZSectionPos = frame[0].Y();
176 fYOZSectionPos = frame[0].X();
177 fXOYSectionPos = frame[0].Z();
180 }
181
183 fMinMaxVal.second = fMinMaxVal.first;
184
185 for (Int_t i = fCoord->GetFirstXBin(), e = fCoord->GetLastXBin(); i <= e; ++i) {
186 for (Int_t j = fCoord->GetFirstYBin(), e1 = fCoord->GetLastYBin(); j <= e1; ++j) {
187 Double_t val = fHist->GetBinContent(i, j);
188 fMinMaxVal.first = TMath::Min(fMinMaxVal.first, val);
189 fMinMaxVal.second = TMath::Max(fMinMaxVal.second, val);
190 }
191 }
192
193 ClampZ(fMinMaxVal.first);
194 ClampZ(fMinMaxVal.second);
195
196 return kTRUE;
197}
198
199////////////////////////////////////////////////////////////////////////////////
200///Geometry for lego in polar coords.
201
203{
205 return kFALSE;
206
208
209 if (fCoord->Modified()) {
212 }
213
214 const Int_t nY = fCoord->GetNYBins();//yBins.second - yBins.first + 1;
215 fYEdges.resize(nY);
216
217 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
218 fYEdges[j].first = ((fYAxis->GetBinLowEdge(jr)) - fCoord->GetYRange().first) /
220 fYEdges[j].second = ((fYAxis->GetBinUpEdge(jr)) - fCoord->GetYRange().first) /
222 }
223
224 const Int_t nX = fCoord->GetNXBins();
225 fCosSinTableX.resize(nX + 1);
226 const Double_t fullAngle = fXAxis->GetXmax() - fXAxis->GetXmin();
227 const Double_t phiLow = fXAxis->GetXmin();
228 Double_t angle = 0;
229 for (Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
230 angle = (fXAxis->GetBinLowEdge(ir) - phiLow) / fullAngle * TMath::TwoPi();
231 fCosSinTableX[i].first = TMath::Cos(angle);
232 fCosSinTableX[i].second = TMath::Sin(angle);
233 }
234 angle = (fXAxis->GetBinUpEdge(fCoord->GetLastXBin()) - phiLow) / fullAngle * TMath::TwoPi();
235 fCosSinTableX[nX].first = TMath::Cos(angle);
236 fCosSinTableX[nX].second = TMath::Sin(angle);
237
238 fMinZ = fBackBox.Get3DBox()[0].Z();
239 if (fMinZ < 0.)
240 fBackBox.Get3DBox()[4].Z() > 0. ? fMinZ = 0. : fMinZ = fBackBox.Get3DBox()[4].Z();
241
243 fMinMaxVal.second = fMinMaxVal.first;
244
245 for (Int_t i = fCoord->GetFirstXBin(), e = fCoord->GetLastXBin(); i <= e; ++i) {
246 for (Int_t j = fCoord->GetFirstYBin(), e1 = fCoord->GetLastYBin(); j <= e1; ++j) {
247 Double_t val = fHist->GetBinContent(i, j);
248 fMinMaxVal.first = TMath::Min(fMinMaxVal.first, val);
249 fMinMaxVal.second = TMath::Max(fMinMaxVal.second, val);
250 }
251 }
252
253 ClampZ(fMinMaxVal.first);
254 ClampZ(fMinMaxVal.second);
255
256 return kTRUE;
257}
258
259////////////////////////////////////////////////////////////////////////////////
260///Geometry for lego in cylindrical coords.
261
263{
265 return kFALSE;
266
268
269 const Int_t nY = fCoord->GetNYBins();
270 fYEdges.resize(nY);
271
272 if (fCoord->GetYLog()) {
273 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
276 }
277 } else {
278 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
279 fYEdges[j].first = fYAxis->GetBinLowEdge(jr) * fCoord->GetYScale();
280 fYEdges[j].second = fYAxis->GetBinUpEdge(jr) * fCoord->GetYScale();
281 }
282 }
283
284 const Int_t nX = fCoord->GetNXBins();
285 fCosSinTableX.resize(nX + 1);
286 const Double_t fullAngle = fXAxis->GetXmax() - fXAxis->GetXmin();
287 const Double_t phiLow = fXAxis->GetXmin();
288 Double_t angle = 0.;
289 for (Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
290 angle = (fXAxis->GetBinLowEdge(ir) - phiLow) / fullAngle * TMath::TwoPi();
291 fCosSinTableX[i].first = TMath::Cos(angle);
292 fCosSinTableX[i].second = TMath::Sin(angle);
293 }
294 angle = (fXAxis->GetBinUpEdge(fCoord->GetLastXBin()) - phiLow) / fullAngle * TMath::TwoPi();
295 fCosSinTableX[nX].first = TMath::Cos(angle);
296 fCosSinTableX[nX].second = TMath::Sin(angle);
297
298 if (fCoord->Modified()) {
301 }
302
303 fMinZ = fCoord->GetZRange().first;
304 if (fMinZ < 0.)
305 fCoord->GetZRange().second > 0. ? fMinZ = 0. : fMinZ = fCoord->GetZRange().second;
306
307
309 fMinMaxVal.second = fMinMaxVal.first;
310
311 for (Int_t i = fCoord->GetFirstXBin(), e = fCoord->GetLastXBin(); i <= e; ++i) {
312 for (Int_t j = fCoord->GetFirstYBin(), e1 = fCoord->GetLastYBin(); j <= e1; ++j) {
313 Double_t val = fHist->GetBinContent(i, j);
314 fMinMaxVal.first = TMath::Min(fMinMaxVal.first, val);
315 fMinMaxVal.second = TMath::Max(fMinMaxVal.second, val);
316 }
317 }
318
319 return kTRUE;
320}
321
322////////////////////////////////////////////////////////////////////////////////
323///Geometry for lego in spherical coords.
324
326{
328 return kFALSE;
329
331
332 const Int_t nY = fCoord->GetNYBins();
333 fCosSinTableY.resize(nY + 1);
334 const Double_t fullTheta = fYAxis->GetXmax() - fYAxis->GetXmin();
335 const Double_t thetaLow = fYAxis->GetXmin();
336 Double_t angle = 0.;
337 for (Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
338 angle = (fYAxis->GetBinLowEdge(jr) - thetaLow) / fullTheta * TMath::Pi();
339 fCosSinTableY[j].first = TMath::Cos(angle);
340 fCosSinTableY[j].second = TMath::Sin(angle);
341 }
342 angle = (fYAxis->GetBinUpEdge(fCoord->GetLastYBin()) - thetaLow) / fullTheta * TMath::Pi();
343 fCosSinTableY[nY].first = TMath::Cos(angle);
344 fCosSinTableY[nY].second = TMath::Sin(angle);
345
346 const Int_t nX = fCoord->GetNXBins();
347 fCosSinTableX.resize(nX + 1);
348 const Double_t fullPhi = fXAxis->GetXmax() - fXAxis->GetXmin();
349 const Double_t phiLow = fXAxis->GetXmin();
350
351 for (Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
352 angle = (fXAxis->GetBinLowEdge(ir) - phiLow) / fullPhi * TMath::TwoPi();
353 fCosSinTableX[i].first = TMath::Cos(angle);
354 fCosSinTableX[i].second = TMath::Sin(angle);
355 }
356
357 angle = (fXAxis->GetBinUpEdge(fCoord->GetLastXBin()) - phiLow) / fullPhi * TMath::TwoPi();
358 fCosSinTableX[nX].first = TMath::Cos(angle);
359 fCosSinTableX[nX].second = TMath::Sin(angle);
360
361 fMinZ = fCoord->GetZRange().first;
362 if (fMinZ < 0.)
363 fCoord->GetZRange().second > 0. ? fMinZ = 0. : fMinZ = fCoord->GetZRange().second;
364
366 fMinMaxVal.second = fMinMaxVal.first;
367
368 for (Int_t i = fCoord->GetFirstXBin(), e = fCoord->GetLastXBin(); i <= e; ++i) {
369 for (Int_t j = fCoord->GetFirstYBin(), e1 = fCoord->GetLastYBin(); j <= e1; ++j) {
370 Double_t val = fHist->GetBinContent(i, j);
371 fMinMaxVal.first = TMath::Min(fMinMaxVal.first, val);
372 fMinMaxVal.second = TMath::Max(fMinMaxVal.second, val);
373 }
374 }
375
376
377 return kTRUE;
378}
379
380////////////////////////////////////////////////////////////////////////////////
381///User clicks on a lego with middle mouse button (middle for pad).
382
384{
385 fMousePosition.fX = px;
387 fCamera->StartPan(px, py);
388 fBoxCut.StartMovement(px, py);
389}
390
391////////////////////////////////////////////////////////////////////////////////
392///Move lego or section.
393
395{
399
402 fCamera->Pan(px, py);
403
406 } else if (fSelectedPart > 0) {
407 //Convert py into bottom-top orientation.
408 py = fCamera->GetHeight() - py;
409
412
415
416 if (!fHighColor) {
419 else
420 MoveSection(px, py);
421 } else
422 MoveSection(px, py);
423
426 }
427
430}
431
432////////////////////////////////////////////////////////////////////////////////
433///Parse additional options.
434
436{
437 using namespace std;
438 const Ssiz_t legoPos = option.Index("lego");//"lego" _already_ _exists_ in a string.
439 if (legoPos + 4 < option.Length() && isdigit(option[legoPos + 4])) {
440 switch (option[legoPos + 4] - '0') {
441 case 1:
443 break;
444 case 2:
446 break;
447 case 3:
449 break;
450 default:
452 break;
453 }
454 } else
456 //check 'e' option
457 Ssiz_t ePos = option.Index("e");
458 if (ePos == legoPos + 1)
459 ePos = option.Index("e", legoPos + 4);
460 fDrawErrors = ePos != kNPOS ? kTRUE : kFALSE;
461
462 option.Index("z") == kNPOS ? fDrawPalette = kFALSE : fDrawPalette = kTRUE;
463}
464
465////////////////////////////////////////////////////////////////////////////////
466///Initialize some gl state variables.
467
469{
470 glEnable(GL_DEPTH_TEST);
471 glEnable(GL_LIGHTING);
472 glEnable(GL_LIGHT0);
473 //For lego, back polygons are culled (but not for sections).
474 glEnable(GL_CULL_FACE);
475 glCullFace(GL_BACK);
476
477 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
478}
479
480////////////////////////////////////////////////////////////////////////////////
481///Return some gl states to original values.
482
484{
485 glDisable(GL_DEPTH_TEST);
486 glDisable(GL_LIGHTING);
487 glDisable(GL_LIGHT0);
488 glDisable(GL_CULL_FACE);
489 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
490}
491
492////////////////////////////////////////////////////////////////////////////////
493///Select method corresponding to coordinate system.
494
496{
497 //Shift plot to point of origin.
498 const Rgl::PlotTranslation trGuard(this);
499
500 switch (fCoord->GetCoordType()) {
501 case kGLCartesian:
502 return DrawLegoCartesian();
503 case kGLPolar:
504 return DrawLegoPolar();
505 case kGLCylindrical:
506 return DrawLegoCylindrical();
507 case kGLSpherical:
508 return DrawLegoSpherical();
509 default:;
510 }
511}
512
513////////////////////////////////////////////////////////////////////////////////
514///Lego in cartesian system.
515
517{
518 if (fCoord->GetCoordType() == kGLCartesian) {
520 const TGLDisableGuard cullGuard(GL_CULL_FACE);
521 DrawSections();
522 }
523
524 //const TGLDisableGuard depthTest(GL_DEPTH_TEST); //[0-0]
525
526 if (!fSelectionPass) {
527 glEnable(GL_POLYGON_OFFSET_FILL);//[0
528 glPolygonOffset(1.f, 1.f);
529 SetLegoColor();
531 //Lego is semi-transparent if we have any sections.
532 glEnable(GL_BLEND);//[1
533 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
534 }
535 }
536
537 //Using front point, find the correct order to draw bars from
538 //back to front (it's important only for semi-transparent lego).
539 //Only in cartesian.
540 const Int_t nX = fXEdges.size();
541 const Int_t nY = fYEdges.size();
542 const Int_t frontPoint = fBackBox.GetFrontPoint();
543 Int_t iInit = 0, jInit = 0, irInit = fCoord->GetFirstXBin(), jrInit = fCoord->GetFirstYBin();
544 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit = fCoord->GetLastXBin(), -1);
545 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit = fCoord->GetLastYBin(), -1);
546
548 if (!PreparePalette()) {
551 } else
552 fPalette.EnableTexture(GL_MODULATE);
553 }
554
557
558 for(Int_t i = iInit, ir = irInit; addI > 0 ? i < nX : i >= 0; i += addI, ir += addI) {
559 for(Int_t j = jInit, jr = jrInit; addJ > 0 ? j < nY : j >= 0; j += addJ, jr += addJ) {
560 Double_t zMax = fHist->GetBinContent(ir, jr) * fCoord->GetFactor();
561 if (!ClampZ(zMax))
562 continue;
563
564 const Int_t binID = fSelectionBase + i * fCoord->GetNYBins() + j;
565
568 else if(!fHighColor && fSelectedPart == binID)
569 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gOrangeEmission);
570
571 if (fLegoType == kCylindricBars) {
573 fYEdges[j].second, fMinZ, zMax);
574 } else if (fLegoType == kColorLevel && !fSelectionPass) {
577 fPalette.GetTexCoord(zMax), frontPoint);
578 } else {
580 fYEdges[j].second, fMinZ, zMax, frontPoint);
581 }
582
583 if (!fHighColor && !fSelectionPass && fSelectedPart == binID)
584 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gNullEmission);
585 }
586 }
587
590
591 //Draw outlines for non-cylindrical bars.
592 if (!fSelectionPass) {
593 glDisable(GL_POLYGON_OFFSET_FILL);//0]
594 const TGLDisableGuard lightGuard(GL_LIGHTING);//[2 - 2]
596 glColor3d(0., 0., 0.);
597 else
598 glColor4d(0., 0., 0., 0.4);
599 glPolygonMode(GL_FRONT, GL_LINE);//[3
600
601 const TGLEnableGuard blendGuard(GL_BLEND);//[4-4] + 1]
602 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
603 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);//[5-5]
604 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
605
606 for(Int_t i = iInit, ir = irInit; addI > 0 ? i < nX : i >= 0; i += addI, ir += addI) {
607 for(Int_t j = jInit, jr = jrInit; addJ > 0 ? j < nY : j >= 0; j += addJ, jr += addJ) {
608 Double_t zMax = fHist->GetBinContent(ir, jr) * fCoord->GetFactor();
609 if (!ClampZ(zMax))
610 continue;
611 if (fLegoType != kCylindricBars) {
613 fYEdges[j].second, fMinZ, zMax, frontPoint);
614 }
615 if (fDrawErrors && zMax > 0.) {
616 Double_t errorZMax = (fHist->GetBinContent(ir, jr) + fHist->GetBinError(ir, jr)) * fCoord->GetFactor();
617 ClampZ(errorZMax);
619 fYEdges[j].second, zMax, errorZMax);
620 }
621 }
622 }
623
624 glPolygonMode(GL_FRONT, GL_FILL);//3]
625 }
626
628 DrawPalette();
629}
630
631////////////////////////////////////////////////////////////////////////////////
632///Lego in polar system.
633
635{
636 const Int_t nX = fCosSinTableX.size() - 1;
637 const Int_t nY = fYEdges.size();
638
639 if (!fSelectionPass) {
640 SetLegoColor();
641 glEnable(GL_POLYGON_OFFSET_FILL);
642 glPolygonOffset(1.f, 1.f);
643 }
644
645 Double_t points[4][2] = {};
646
648 if (!PreparePalette()) {
651 } else
652 fPalette.EnableTexture(GL_MODULATE);
653 }
654
657
658 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
659 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
660 Double_t zMax = fHist->GetBinContent(ir, jr);
661 if (!ClampZ(zMax))
662 continue;
663 points[0][0] = fYEdges[j].first * fCosSinTableX[i].first;
664 points[0][1] = fYEdges[j].first * fCosSinTableX[i].second;
665 points[1][0] = fYEdges[j].second * fCosSinTableX[i].first;
666 points[1][1] = fYEdges[j].second * fCosSinTableX[i].second;
667 points[2][0] = fYEdges[j].second * fCosSinTableX[i + 1].first;
668 points[2][1] = fYEdges[j].second * fCosSinTableX[i + 1].second;
669 points[3][0] = fYEdges[j].first * fCosSinTableX[i + 1].first;
670 points[3][1] = fYEdges[j].first * fCosSinTableX[i + 1].second;
671
672 const Int_t binID = fSelectionBase + i * fCoord->GetNYBins() + j;
673
676 else if(!fHighColor && fSelectedPart == binID)
677 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gOrangeEmission);
678
681 fPalette.GetTexCoord(zMax));
682 else
684
685 if (!fHighColor && !fSelectionPass && fSelectedPart == binID)
686 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gNullEmission);
687 }
688 }
689
692
693 //Draw outlines.
694 if (!fSelectionPass) {
695 glDisable(GL_POLYGON_OFFSET_FILL);//0]
696 const TGLDisableGuard lightGuard(GL_LIGHTING);//[2-2]
697 glColor3d(0., 0., 0.);
698 glPolygonMode(GL_FRONT, GL_LINE);//[3
699 const TGLEnableGuard blendGuard(GL_BLEND);
700 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
701 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);
702 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
703
704 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
705 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
706 Double_t zMax = fHist->GetBinContent(ir, jr);
707 if (!ClampZ(zMax))
708 continue;
709 points[0][0] = fYEdges[j].first * fCosSinTableX[i].first;
710 points[0][1] = fYEdges[j].first * fCosSinTableX[i].second;
711 points[1][0] = fYEdges[j].second * fCosSinTableX[i].first;
712 points[1][1] = fYEdges[j].second * fCosSinTableX[i].second;
713 points[2][0] = fYEdges[j].second * fCosSinTableX[i + 1].first;
714 points[2][1] = fYEdges[j].second * fCosSinTableX[i + 1].second;
715 points[3][0] = fYEdges[j].first * fCosSinTableX[i + 1].first;
716 points[3][1] = fYEdges[j].first * fCosSinTableX[i + 1].second;
718 }
719 }
720
721 glPolygonMode(GL_FRONT, GL_FILL);//3]
722 }
723
725 DrawPalette();
726}
727
728////////////////////////////////////////////////////////////////////////////////
729///Lego in cylindrical system.
730
732{
733 const Int_t nX = fCosSinTableX.size() - 1;
734 const Int_t nY = fYEdges.size();
735 Double_t legoR = gStyle->GetLegoInnerR();
736 if (legoR > 1. || legoR < 0.)
737 legoR = 0.5;
738 const Double_t rRange = fCoord->GetZLength();
739
740 if (!fSelectionPass) {
741 SetLegoColor();
742 glEnable(GL_POLYGON_OFFSET_FILL);
743 glPolygonOffset(1.f, 1.f);
744 }
745
746 Double_t points[4][2] = {};
747 const Double_t sc = (1 - legoR) * fCoord->GetXScale();
748 legoR *= fCoord->GetXScale();
749
751 if (!PreparePalette()) {
754 } else
755 fPalette.EnableTexture(GL_MODULATE);
756 }
757
760
761 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
762 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
763 Double_t zMin = legoR + (fMinZ - fCoord->GetZRange().first) / rRange * sc;
764 Double_t zMax = legoR + (fHist->GetBinContent(ir, jr) - fCoord->GetZRange().first) / rRange * sc;
765 if (zMin > zMax)
766 std::swap(zMin, zMax);
767
768 points[0][0] = fCosSinTableX[i].first * zMin;
769 points[0][1] = fCosSinTableX[i].second * zMin;
770 points[1][0] = fCosSinTableX[i].first * zMax;
771 points[1][1] = fCosSinTableX[i].second * zMax;
772 points[2][0] = fCosSinTableX[i + 1].first * zMax;
773 points[2][1] = fCosSinTableX[i + 1].second * zMax;
774 points[3][0] = fCosSinTableX[i + 1].first * zMin;
775 points[3][1] = fCosSinTableX[i + 1].second * zMin;
776
777 const Int_t binID = fSelectionBase + i * fCoord->GetNYBins() + j;
778
781 else if(!fHighColor && fSelectedPart == binID)
782 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gOrangeEmission);
783
787 }else
789
790 if(!fSelectionPass && !fHighColor && fSelectedPart == binID)
791 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gNullEmission);
792 }
793 }
794
797
798 //Draw outlines.
799 if (!fSelectionPass) {
800 glDisable(GL_POLYGON_OFFSET_FILL);//0]
801 const TGLDisableGuard lightGuard(GL_LIGHTING);//[2-2]
802 glColor3d(0., 0., 0.);
803 glPolygonMode(GL_FRONT, GL_LINE);//[3
804
805 const TGLEnableGuard blendGuard(GL_BLEND);
806 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
807 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);
808 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
809
810 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
811 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
812 Double_t zMin = legoR + (fMinZ - fCoord->GetZRange().first) / rRange * sc;
813 Double_t zMax = legoR + (fHist->GetBinContent(ir, jr) - fCoord->GetZRange().first) / rRange * sc;
814 if (zMin > zMax)
815 std::swap(zMin, zMax);
816
817 points[0][0] = fCosSinTableX[i].first * zMin;
818 points[0][1] = fCosSinTableX[i].second * zMin;
819 points[1][0] = fCosSinTableX[i].first * zMax;
820 points[1][1] = fCosSinTableX[i].second * zMax;
821 points[2][0] = fCosSinTableX[i + 1].first * zMax;
822 points[2][1] = fCosSinTableX[i + 1].second * zMax;
823 points[3][0] = fCosSinTableX[i + 1].first * zMin;
824 points[3][1] = fCosSinTableX[i + 1].second * zMin;
826 }
827 }
828
829 glPolygonMode(GL_FRONT, GL_FILL);//3]
830 }
831
833 DrawPalette();
834}
835
836////////////////////////////////////////////////////////////////////////////////
837///Lego in spherical system.
838
840{
841 const Int_t nX = fCosSinTableX.size() - 1;
842 const Int_t nY = fCosSinTableY.size() - 1;
843 const Double_t rRange = fCoord->GetZLength();
844 Double_t legoR = gStyle->GetLegoInnerR();
845 if (legoR > 1. || legoR < 0.)
846 legoR = 0.5;
847
848 if (!fSelectionPass) {
849 SetLegoColor();
850 glEnable(GL_POLYGON_OFFSET_FILL);
851 glPolygonOffset(1.f, 1.f);
852 }
853
854 Double_t points[8][3] = {};
855 const Double_t sc = 1 - legoR;
856
858 if (!PreparePalette()) {
861 } else
862 fPalette.EnableTexture(GL_MODULATE);
863 }
864
867
868 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
869 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
870 Double_t zMin = legoR + (fMinZ - fCoord->GetZRange().first) / rRange * sc;
871 Double_t zMax = legoR + (fHist->GetBinContent(ir, jr) - fCoord->GetZRange().first) / rRange * sc;
872 if (zMin > zMax)
873 std::swap(zMin, zMax);
874
875 points[4][0] = zMin * fCosSinTableY[j].second * fCosSinTableX[i].first;
876 points[4][1] = zMin * fCosSinTableY[j].second * fCosSinTableX[i].second;
877 points[4][2] = zMin * fCosSinTableY[j].first;
878 points[5][0] = zMin * fCosSinTableY[j].second * fCosSinTableX[i + 1].first;
879 points[5][1] = zMin * fCosSinTableY[j].second * fCosSinTableX[i + 1].second;
880 points[5][2] = zMin * fCosSinTableY[j].first;
881 points[6][0] = zMax * fCosSinTableY[j].second * fCosSinTableX[i + 1].first;
882 points[6][1] = zMax * fCosSinTableY[j].second * fCosSinTableX[i + 1].second;
883 points[6][2] = zMax * fCosSinTableY[j].first;
884 points[7][0] = zMax * fCosSinTableY[j].second * fCosSinTableX[i].first;
885 points[7][1] = zMax * fCosSinTableY[j].second * fCosSinTableX[i].second;
886 points[7][2] = zMax * fCosSinTableY[j].first;
887 points[0][0] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i].first;
888 points[0][1] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i].second;
889 points[0][2] = zMin * fCosSinTableY[j + 1].first;
890 points[1][0] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].first;
891 points[1][1] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].second;
892 points[1][2] = zMin * fCosSinTableY[j + 1].first;
893 points[2][0] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].first;
894 points[2][1] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].second;
895 points[2][2] = zMax * fCosSinTableY[j + 1].first;
896 points[3][0] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i].first;
897 points[3][1] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i].second;
898 points[3][2] = zMax * fCosSinTableY[j + 1].first;
899
900 const Int_t binID = fSelectionBase + i * fCoord->GetNYBins() + j;
901
904 else if(!fHighColor && fSelectedPart == binID)
905 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gOrangeEmission);
909 else
911
912 if(!fHighColor && fSelectedPart == binID)
913 glMaterialfv(GL_FRONT, GL_EMISSION, Rgl::gNullEmission);
914 }
915 }
916
919
920 //Draw outlines.
921 if (!fSelectionPass) {
922 glDisable(GL_POLYGON_OFFSET_FILL);//0]
923 const TGLDisableGuard lightGuard(GL_LIGHTING);//[2-2]
924 glColor3d(0., 0., 0.);
925 glPolygonMode(GL_FRONT, GL_LINE);//[3
926 const TGLEnableGuard blendGuard(GL_BLEND);
927 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
928 const TGLEnableGuard smoothGuard(GL_LINE_SMOOTH);
929 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
930
931 for(Int_t i = 0, ir = fCoord->GetFirstXBin(); i < nX; ++i, ++ir) {
932 for(Int_t j = 0, jr = fCoord->GetFirstYBin(); j < nY; ++j, ++jr) {
933 Double_t zMin = legoR + (fMinZ - fCoord->GetZRange().first) / rRange * sc;
934 Double_t zMax = legoR + (fHist->GetBinContent(ir, jr) - fCoord->GetZRange().first) / rRange * sc;
935 if (zMin > zMax)
936 std::swap(zMin, zMax);
937
938 points[4][0] = zMin * fCosSinTableY[j].second * fCosSinTableX[i].first;
939 points[4][1] = zMin * fCosSinTableY[j].second * fCosSinTableX[i].second;
940 points[4][2] = zMin * fCosSinTableY[j].first;
941 points[5][0] = zMin * fCosSinTableY[j].second * fCosSinTableX[i + 1].first;
942 points[5][1] = zMin * fCosSinTableY[j].second * fCosSinTableX[i + 1].second;
943 points[5][2] = zMin * fCosSinTableY[j].first;
944 points[6][0] = zMax * fCosSinTableY[j].second * fCosSinTableX[i + 1].first;
945 points[6][1] = zMax * fCosSinTableY[j].second * fCosSinTableX[i + 1].second;
946 points[6][2] = zMax * fCosSinTableY[j].first;
947 points[7][0] = zMax * fCosSinTableY[j].second * fCosSinTableX[i].first;
948 points[7][1] = zMax * fCosSinTableY[j].second * fCosSinTableX[i].second;
949 points[7][2] = zMax * fCosSinTableY[j].first;
950 points[0][0] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i].first;
951 points[0][1] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i].second;
952 points[0][2] = zMin * fCosSinTableY[j + 1].first;
953 points[1][0] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].first;
954 points[1][1] = zMin * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].second;
955 points[1][2] = zMin * fCosSinTableY[j + 1].first;
956 points[2][0] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].first;
957 points[2][1] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i + 1].second;
958 points[2][2] = zMax * fCosSinTableY[j + 1].first;
959 points[3][0] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i].first;
960 points[3][1] = zMax * fCosSinTableY[j + 1].second * fCosSinTableX[i].second;
961 points[3][2] = zMax * fCosSinTableY[j + 1].first;
963 }
964 }
965
966 glPolygonMode(GL_FRONT, GL_FILL);//3]
967 }
968
970 DrawPalette();
971}
972
973////////////////////////////////////////////////////////////////////////////////
974///Set lego's color.
975
977{
978 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
979
981 if (const TColor *c = gROOT->GetColor(fHist->GetFillColor()))
982 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
983
984 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
985 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
986 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
987 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
988}
989
990////////////////////////////////////////////////////////////////////////////////
991///XOZ plane parallel section.
992
994{
995 Int_t binY = -1;
996
997 for (Int_t i = 0, e = fYEdges.size(); i < e; ++i) {
999 binY = i;
1000 break;
1001 }
1002 }
1003
1004 if (binY >= 0) {
1005 binY += fCoord->GetFirstYBin();
1006 glColor3d(1., 0., 0.);
1007 glLineWidth(3.f);
1008 //Draw 2d hist on the profile's plane.
1009 for (UInt_t i = 0, ir = fCoord->GetFirstXBin(), e = fXEdges.size(); i < e; ++i, ++ir) {
1010 Double_t zMax = fHist->GetBinContent(Int_t(ir), binY);
1011 if (!ClampZ(zMax))
1012 continue;
1013
1014 glBegin(GL_LINE_LOOP);
1015 glVertex3d(fXEdges[i].first, fXOZSectionPos, fMinZ);
1016 glVertex3d(fXEdges[i].first, fXOZSectionPos, zMax);
1017 glVertex3d(fXEdges[i].second, fXOZSectionPos, zMax);
1018 glVertex3d(fXEdges[i].second, fXOZSectionPos, fMinZ);
1019 glEnd();
1020 }
1021
1022 glLineWidth(1.f);
1023 }
1024}
1025
1026////////////////////////////////////////////////////////////////////////////////
1027///YOZ plane parallel section.
1028
1030{
1031 Int_t binX = -1;
1032
1033 for (Int_t i = 0, e = fXEdges.size(); i < e; ++i) {
1035 binX = i;
1036 break;
1037 }
1038 }
1039
1040 if (binX >= 0) {
1041 binX += fCoord->GetFirstXBin();//fBinsX.first;
1042 glColor3d(1., 0., 0.);
1043 glLineWidth(3.f);
1044 //Draw 2d hist on the profile's plane.
1045 for (UInt_t i = 0, ir = fCoord->GetFirstYBin(), e = fYEdges.size(); i < e; ++i, ++ir) {
1046 Double_t zMax = fHist->GetBinContent(binX, ir);
1047 if (!ClampZ(zMax))
1048 continue;
1049
1050 glBegin(GL_LINE_LOOP);
1051 glVertex3d(fYOZSectionPos, fYEdges[i].first, fMinZ);
1052 glVertex3d(fYOZSectionPos, fYEdges[i].first, zMax);
1053 glVertex3d(fYOZSectionPos, fYEdges[i].second, zMax);
1054 glVertex3d(fYOZSectionPos, fYEdges[i].second, fMinZ);
1055 glEnd();
1056 }
1057
1058 glLineWidth(1.f);
1059 }
1060}
1061
1062////////////////////////////////////////////////////////////////////////////////
1063///Empty. No such sections for lego.
1064
1066{
1067}
1068
1069////////////////////////////////////////////////////////////////////////////////
1070///Remove all sections and repaint.
1071
1073{
1074 const TGLVertex3 *frame = fBackBox.Get3DBox();
1075 if (event == kButton1Double && (fXOZSectionPos > frame[0].Y() || fYOZSectionPos > frame[0].X())) {
1076 fXOZSectionPos = frame[0].Y();
1077 fYOZSectionPos = frame[0].X();
1078 if (fBoxCut.IsActive())
1080 //gGLManager->PaintSingleObject(this);
1081 if (!gVirtualX->IsCmdThread())
1082 gROOT->ProcessLineFast(Form("((TGLPlotPainter *)0x%lx)->Paint()", (ULong_t)this));
1083 else
1084 Paint();
1085 } else if (event == kKeyPress && (py == kKey_c || py == kKey_C)) {
1086 Info("ProcessEvent", "Box cut does not exist for lego");
1087 }
1088}
1089
1090////////////////////////////////////////////////////////////////////////////////
1091///Clamp z value.
1092
1094{
1095 if (fCoord->GetZLog())
1096 if (zVal <= 0.)
1097 return kFALSE;
1098 else
1099 zVal = TMath::Log10(zVal) * fCoord->GetZScale();
1100 else
1101 zVal *= fCoord->GetZScale();
1102
1103 const TGLVertex3 *frame = fBackBox.Get3DBox();
1104
1105 if (zVal > frame[4].Z())
1106 zVal = frame[4].Z();
1107 else if (zVal < frame[0].Z())
1108 zVal = frame[0].Z();
1109
1110 return kTRUE;
1111}
1112
1113////////////////////////////////////////////////////////////////////////////////
1114///Initialize color palette.
1115
1117{
1118 if(fMinMaxVal.first == fMinMaxVal.second)
1119 return kFALSE;//must be std::abs(fMinMaxVal.second - fMinMaxVal.first) < ...
1120
1121 //User-defined contours are disabled, to be fixed in a future.
1124
1125 UInt_t paletteSize = gStyle->GetNumberContours();
1126 if (!paletteSize)
1127 paletteSize = 20;
1128
1129 return fPalette.GeneratePalette(paletteSize, Rgl::Range_t(fMinZ, fMinMaxVal.second));
1130}
1131
1132////////////////////////////////////////////////////////////////////////////////
1133///Draw. Palette.
1134///Originally, fCamera was never null.
1135///It can be a null now because of gl-viewer.
1136
1138{
1139 if (!fCamera) {
1140 //Thank you, gl-viewer!
1141 return;
1142 }
1143
1145
1146 glFinish();
1147
1148 fCamera->SetCamera();
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153///Draw. Palette. Axis.
1154
1156{
1157 gVirtualX->SetDrawMode(TVirtualX::kCopy);//TCanvas by default sets in kInverse
1159}
@ kKeyPress
Definition: Buttons.h:20
@ kButton1Double
Definition: Buttons.h:24
@ kKey_C
Definition: KeySymbols.h:128
@ kKey_c
Definition: KeySymbols.h:160
#define c(i)
Definition: RSha256.hxx:101
#define e(i)
Definition: RSha256.hxx:103
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
int Int_t
Definition: RtypesCore.h:41
int Ssiz_t
Definition: RtypesCore.h:63
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
@ kWhite
Definition: Rtypes.h:63
void Info(const char *location, const char *msgfmt,...)
@ kGLSpherical
Definition: TGLUtil.h:46
@ kGLCylindrical
Definition: TGLUtil.h:45
@ kGLPolar
Definition: TGLUtil.h:44
@ kGLCartesian
Definition: TGLUtil.h:43
#define gROOT
Definition: TROOT.h:414
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Definition: TStyle.h:406
#define gVirtualX
Definition: TVirtualX.h:345
point * points
Definition: X3DBuffer.c:22
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:30
Double_t GetXmax() const
Definition: TAxis.h:134
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition: TAxis.cxx:504
Double_t GetXmin() const
Definition: TAxis.h:133
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition: TAxis.cxx:526
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition: TAxis.cxx:514
The color creation and management class.
Definition: TColor.h:19
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
void TurnOnOff()
Turn the box cut on/off.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
Bool_t IsActive() const
Plot-painter implementing LEGO rendering of TH2 histograms in cartesian, polar, cylindrical and spher...
Bool_t InitGeometryCartesian()
Geometry for lego in cartesian coords.
Bool_t PreparePalette() const
Initialize color palette.
void DrawLegoSpherical() const
Lego in spherical system.
std::vector< Rgl::Range_t > fXEdges
Bool_t InitGeometryCylindrical()
Geometry for lego in cylindrical coords.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Remove all sections and repaint.
TGLLevelPalette fPalette
void DrawLegoPolar() const
Lego in polar system.
void DrawSectionXOZ() const
XOZ plane parallel section.
Bool_t ClampZ(Double_t &zVal) const
Clamp z value.
void InitGL() const
Initialize some gl state variables.
Bool_t InitGeometrySpherical()
Geometry for lego in spherical coords.
TGLQuadric fQuadric
TGLLegoPainter(const TGLLegoPainter &)
void DrawPalette() const
Draw.
void DrawSectionYOZ() const
YOZ plane parallel section.
void DrawLegoCartesian() const
Lego in cartesian system.
void SetLegoColor() const
Set lego's color.
Bool_t InitGeometry()
Select method.
void DrawSectionXOY() const
Empty. No such sections for lego.
void StartPan(Int_t px, Int_t py)
User clicks on a lego with middle mouse button (middle for pad).
std::vector< Rgl::Range_t > fYEdges
void DeInitGL() const
Return some gl states to original values.
std::vector< CosSin_t > fCosSinTableX
Rgl::Range_t fMinMaxVal
void DrawLegoCylindrical() const
Lego in cylindrical system.
char * GetPlotInfo(Int_t px, Int_t py)
Obtain bin's info (i, j, value).
std::vector< CosSin_t > fCosSinTableY
void DrawPlot() const
Select method corresponding to coordinate system.
Bool_t InitGeometryPolar()
Geometry for lego in polar coords.
ELegoType fLegoType
void AddOption(const TString &stringOption)
Parse additional options.
void DrawPaletteAxis() const
Draw. Palette. Axis.
void Pan(Int_t px, Int_t py)
Move lego or section.
void DisableTexture() const
Disable 1D texture.
Definition: TGLUtil.cxx:4246
Double_t GetTexCoord(Double_t z) const
Get tex coordinate.
Definition: TGLUtil.cxx:4263
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
Definition: TGLUtil.cxx:4162
void EnableTexture(Int_t mode) const
Enable 1D texture.
Definition: TGLUtil.cxx:4227
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
Definition: TGLPlotBox.cxx:198
const TGLVertex3 * Get3DBox() const
Get 3D box.
Definition: TGLPlotBox.cxx:303
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Definition: TGLPlotBox.cxx:184
Int_t GetFrontPoint() const
The nearest point.
Definition: TGLPlotBox.cxx:294
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:22
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]
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Double_t GetZLength() const
Z length.
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.
Bool_t GetXLog() const
Get X log.
Int_t GetFirstXBin() const
Int_t GetFirstYBin() const
const Rgl::Range_t & GetZRange() const
Z range.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void ResetModified()
Reset modified.
Bool_t GetYLog() const
Get Y log.
Bool_t GetZLog() const
Get Z log.
Bool_t Modified() const
Modified.
Double_t GetXScale() const
Double_t GetZScale() const
Int_t GetNXBins() const
Number of X bins.
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
const Rgl::Range_t & GetYRange() const
Y range.
Int_t GetLastYBin() const
Int_t GetNYBins() const
Number of Y bins.
Int_t GetLastXBin() const
EGLCoordType GetCoordType() const
Get coordinates type.
Double_t GetYLength() const
Y length.
Double_t GetFactor() const
Get factor.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
void DrawSections() const
Draw sections (if any).
Double_t fPadTheta
std::vector< Double_t > fZLevels
Double_t fXOYSectionPos
void RestoreModelviewMatrix() const
Double_t fXOZSectionPos
TGLBoxCut fBoxCut
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
TGLPlotBox fBackBox
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
Bool_t fUpdateSelection
TGLPlotCamera * fCamera
void RestoreProjectionMatrix() const
Double_t fYOZSectionPos
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:83
Double_t X() const
Definition: TGLUtil.h:118
Double_t Z() const
Definition: TGLUtil.h:122
Double_t Y() const
Definition: TGLUtil.h:120
The TH1 histogram class.
Definition: TH1.h:56
virtual Float_t GetBarWidth() const
Definition: TH1.h:252
virtual Float_t GetBarOffset() const
Definition: TH1.h:251
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
Definition: TH1.cxx:8476
@ kUserContour
user specified contour levels
Definition: TH1.h:161
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:4882
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
void ResetBit(UInt_t f)
Definition: TObject.h:171
SCoord_t fY
Definition: TPoint.h:36
SCoord_t fX
Definition: TPoint.h:35
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
const char * Data() const
Definition: TString.h:364
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
Float_t GetLegoInnerR() const
Definition: TStyle.h:227
Int_t GetNumberContours() const
Definition: TStyle.h:228
void swap(RDirectoryEntry &e1, RDirectoryEntry &e2) noexcept
void DrawTrapezoid(const Double_t ver[][2], Double_t zMin, Double_t zMax, Bool_t color=kTRUE)
Definition: TGLUtil.cxx:3349
void DrawTrapezoidTextured(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
Definition: TGLUtil.cxx:3419
const Float_t gNullEmission[]
Definition: TGLUtil.cxx:2848
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition: TGLUtil.cxx:2892
void SetZLevels(TAxis *zAxis, Double_t zMin, Double_t zMax, Double_t zScale, std::vector< Double_t > &zLevels)
Definition: TGLUtil.cxx:3821
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
void DrawTrapezoidTextured2(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
Definition: TGLUtil.cxx:3496
void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
Definition: TGLUtil.cxx:3245
void DrawError(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Definition: TGLUtil.cxx:3299
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1194
void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego's bar as a 3d box.
Definition: TGLUtil.cxx:3008
void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax, Int_t front)
Draws lego's bar as a 3d box LULULULU.
Definition: TGLUtil.cxx:3135
const Float_t gOrangeEmission[]
Definition: TGLUtil.cxx:2845
static constexpr double second
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
Double_t Cos(Double_t)
Definition: TMath.h:629
constexpr Double_t Pi()
Definition: TMath.h:38
Double_t Sin(Double_t)
Definition: TMath.h:625
Double_t Log10(Double_t x)
Definition: TMath.h:752
constexpr Double_t TwoPi()
Definition: TMath.h:45
Definition: first.py:1