Logo ROOT  
Reference Guide
TGLAxisPainter.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#include "TGLAxisPainter.h"
13
14#include "TGLRnrCtx.h"
15#include "TGLCamera.h"
16#include "TGLIncludes.h"
17#include "TGLRnrCtx.h"
18#include "TGLFontManager.h"
19
20#include "TAttAxis.h"
21#include "TAxis.h"
22#include "TH1.h"
23#include "THLimitsFinder.h"
24
25#include "TMath.h"
26#include "TPRegexp.h"
27
28/** \class TGLAxisPainterBox
29\ingroup opengl
30Utility class to paint axis in GL.
31*/
32
34
35////////////////////////////////////////////////////////////////////////////////
36
38 fExp(0),
39 fMaxDigits(5),
40 fDecimals(0),
41
42 fAttAxis(0), fUseAxisColors(kTRUE),
43
44 fFontMode(TGLFont::kTexture),
45 fDir(1, 0, 0),
46 fTMNDim(1),
47 fLabelPixelFontSize(14), fLabel3DFontSize(1.0),
48 fTitlePixelFontSize(14), fTitle3DFontSize(1.0),
49
50 fLabelAlignH(TGLFont::kCenterH),
51 fLabelAlignV(TGLFont::kCenterV),
52 fAllZeroesRE(0)
53{
54 // Constructor.
55
56 fAllZeroesRE = new TPMERegexp("[-+]?0\\.0*$", "o");
57}
58
59////////////////////////////////////////////////////////////////////////////////
60/// Destructor.
61
63{
64 delete fAllZeroesRE;
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Set label align.
69
71{
74}
75
76////////////////////////////////////////////////////////////////////////////////
77/// Find first and last character of a label.
78
79void TGLAxisPainter::LabelsLimits(const char *label, Int_t &first, Int_t &last) const
80{
81 last = strlen(label) - 1;
82 for (Int_t i = 0; i <= last; i++) {
83 if (strchr("1234567890-+.", label[i])) {
84 first = i;
85 return;
86 }
87 }
88 Error("LabelsLimits", "attempt to draw a blank label");
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Returns formatted text suitable for display of value.
93
95{
96 s.Form(fFormat, val);
97 s = s.Strip(TString::kLeading);
98
99 if (s == "-." || s == "-0")
100 {
101 s = "0";
102 return;
103 }
104
105 Ssiz_t ld = s.Last('.') + 1;
106 if (s.Length() - ld > fDecimals)
107 s.Remove(ld + fDecimals);
108
109
110 if (fDecimals == 0 && s.EndsWith("."))
111 s.Remove(s.Length() -1);
112
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Construct print format from given primary bin width.
118
120{
121 Double_t absMax = TMath::Max(TMath::Abs(min), TMath::Abs(max));
122 Double_t epsilon = 1e-5;
123 Double_t absMaxLog = TMath::Log10(absMax) + epsilon;
124
125 fExp = 0;
126 Int_t if1, if2;
127 Double_t xmicros = TMath::Power(10, -fMaxDigits);
128 if (bw1 < xmicros && absMaxLog < 0) {
129 // First case : bin width less than 0.001
130 fExp = (Int_t)absMaxLog;
131 if (fExp % 3 == 1) fExp += TMath::Sign(2, fExp);
132 if (fExp % 3 == 2) fExp += TMath::Sign(1, fExp);
133 if1 = fMaxDigits;
134 if2 = fMaxDigits - 2;
135 } else {
136 // Use x 10 n format. (only powers of 3 allowed)
137 Float_t af = (absMax > 1) ? absMaxLog : TMath::Log10(absMax * 0.0001);
138 af += epsilon;
139 Int_t clog = Int_t(af) + 1;
140
141 if (clog > fMaxDigits) {
142 while (1) {
143 fExp++;
144 absMax /= 10;
145 if (fExp % 3 == 0 && absMax <= TMath::Power(10, fMaxDigits - 1)) break;
146 }
147 } else if (clog < -fMaxDigits) {
148 Double_t rne = 1 / TMath::Power(10, fMaxDigits - 2);
149 while (1) {
150 fExp--;
151 absMax *= 10;
152 if (fExp % 3 == 0 && absMax >= rne) break;
153 }
154 }
155
156 Int_t na = 0;
157 for (Int_t i = fMaxDigits - 1; i > 0; i--) {
158 if (TMath::Abs(absMax) < TMath::Power(10, i)) na = fMaxDigits - i;
159 }
160 Double_t size = TMath::Abs(max - min);
161 Int_t ndyn = (Int_t)(size / bw1);
162 while (ndyn) {
163 if (size / ndyn <= 0.999 && na < fMaxDigits - 2) {
164 na++;
165 ndyn /= 10;
166 } else break;
167 }
168 if2 = na;
169 if1 = TMath::Max(clog + na, fMaxDigits) + 1;
170 }
171
172 // compose text format
173 if (TMath::Min(min, max) < 0)if1 = if1 + 1;
174 if1 = TMath::Min(if1, 32);
175
176 // In some cases, if1 and if2 are too small....
177 Double_t dwlabel = bw1 * TMath::Power(10, -fExp);
178 while (dwlabel < TMath::Power(10, -if2)) {
179 if1++;
180 if2++;
181 }
182 if (if1 > 14) if1 = 14;
183 if (if2 > 14) if2 = 14;
184 if (if2) fFormat.Form("%%%d.%df", if1, if2);
185 else fFormat.Form("%%%d.%df", if1 + 1, 1);
186
187 // get decimal number
188 TString chtemp;
189 chtemp.Form("%g", dwlabel);
190 fDecimals = 0;
191 if (chtemp.First('.') != kNPOS)
192 fDecimals = chtemp.Length() - chtemp.First('.') - 1;
193}
194
195// Utility functions.
196
197////////////////////////////////////////////////////////////////////////////////
198/// Render text at the given position. Offset depends of text alignment.
199
201{
203 {
204 font.Render(txt, p.X(), p.Y(), p.Z(), aH, aV);
205 }
206 else
207 {
208 // In case of non pixmap font, size is adjusted to the projected view in order to
209 // be visible on zoom out. In other words texture and polygon fonts imitate
210 // pixmap font behaviour.
211 glPushMatrix();
212 glTranslated(p.X(), p.Y(), p.Z());
214 glScaled(sc, sc, 1);
215 font.Render(txt, 0, 0, 0, aH, aV);
216 glPopMatrix();
217 }
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Set label font derived from TAttAxis.
222
223void TGLAxisPainter::SetLabelFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t fontSize, Double_t size3d)
224{
225 rnrCtx.RegisterFontNoScale(fontSize, fontName, fFontMode, fLabelFont);
226 fLabel3DFontSize = size3d;
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Render label reading prepared list ov value-pos pairs.
232
234{
235 if (fUseAxisColors)
237
238 glPushMatrix();
239
241 TGLVector3 offVec = fTMOff[0] * off;
242 glTranslated(offVec.X(), offVec.Y(), offVec.Z());
243
245 Double_t p = 0.;
246 TString s;
247 for (LabVec_t::const_iterator it = fLabVec.begin(); it != fLabVec.end(); ++it) {
248 FormAxisValue((*it).second, s);
249 p = (*it).first;
251 }
252
254 glPopMatrix();
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// Set title font derived from TAttAxis.
259
260void TGLAxisPainter::SetTitleFont(TGLRnrCtx &rnrCtx, const char* fontName,
261 Int_t fontSize, Double_t size3d)
262{
263 rnrCtx.RegisterFontNoScale(fontSize, fontName, fFontMode, fTitleFont);
265 fTitle3DFontSize = size3d;
266}
267
268////////////////////////////////////////////////////////////////////////////////
269/// Draw title at given position.
270
272{
273 if (fUseAxisColors)
275
276 TString title = (fExp) ? Form("%s [10^%d]", txt.Data(), fExp) : txt;
278 RnrText(title, pos, aH, aV, fTitleFont);
280}
281
282////////////////////////////////////////////////////////////////////////////////
283/// Render axis main line and tick-marks.
284
286{
287 if (fUseAxisColors)
289
291 glBegin(GL_LINES);
292
293 // Main line.
294 //
295 Float_t min = fTMVec.front().first;
296 Float_t max = fTMVec.back().first;
297 TGLVector3 start = fDir * min;
298 TGLVector3 end = fDir * max;
299 glVertex3dv(start.Arr());
300 glVertex3dv(end.Arr());
301
302 // Tick-marks.
303 // Support three possible directions and two orders.
304 //
305 Float_t tmsOrderFirst = fAttAxis->GetTickLength();
306 Float_t tmsOrderSecond = tmsOrderFirst * 0.5;
307 TGLVector3 pos;
308 TMVec_t::const_iterator it = fTMVec.begin();
309 Int_t nt = fTMVec.size()-1;
310 ++it;
311 for (Int_t t = 1; t < nt; ++t, ++it) {
312 pos = fDir * ((*it).first);
313 for (Int_t dim = 0; dim < fTMNDim; dim++) {
314 glVertex3dv(pos.Arr());
315 if ((*it).second)
316 glVertex3dv((pos + fTMOff[dim]*tmsOrderSecond).Arr());
317 else
318 glVertex3dv((pos + fTMOff[dim]*tmsOrderFirst).Arr());
319 }
320 }
321 glEnd();
322}
323
324////////////////////////////////////////////////////////////////////////////////
325/// GL render TAxis.
326
328{
329 fAttAxis = ax;
330 Double_t min = ax->GetXmin();
331 Double_t max = ax->GetXmax();
332 if (min == max)
333 {
334 Error("TGLAxisPainter::PaintAxis", "axis without range");
335 return;
336 }
337
338 //___________________________________________________________________________
339 // Fill labels value-pos and tick-marks position-length.
340
342 Int_t n2a = fAttAxis->GetNdivisions() - n1a * 100;
343 Int_t bn1, bn2;
344 Double_t bw1, bw2; // primary , secondary bin width
345 Double_t bl1=0, bh1=0, bl2=0, bh2=0; // bin low, high values
346
347 // Read limits from users range
348 THLimitsFinder::Optimize(min, max, n1a, bl1, bh1, bn1, bw1);
349 THLimitsFinder::Optimize(bl1, bl1 + bw1, n2a, bl2, bh2, bn2, bw2);
350
351 //___________________________________________________________________________
352
353 // Get TM. First and last values are reserved for axis range
354 //
355 fTMVec.clear();
356 fLabVec.clear();
357
358 fTMVec.push_back(TM_t(min, -1));
359
360 Double_t v1 = bl1;
361 Double_t v2 = 0;
362 for (Int_t t1 = 0; t1 <= bn1; t1++)
363 {
364 fTMVec.push_back(TM_t(v1, 0));
365 fLabVec.push_back(Lab_t(v1, v1));
366 v2 = v1 + bw2;
367 for (Int_t t2 = 1; t2 < bn2; t2++)
368 {
369 if (v2 > max) break;
370 fTMVec.push_back(TM_t(v2, 1));
371 v2 += bw2;
372 }
373 v1 += bw1;
374 }
375
376 // complete low edges for 1.st order TM
377 v2 = bl1 -bw2;
378 while (v2 > min) {
379 fTMVec.push_back(TM_t(v2, 1));
380 v2 -= bw2;
381 }
382
383 fTMVec.push_back(TM_t(max, -1));
384
385 //___________________________________________________________________________
386 // Get labels. In this case trivial one-one mapping.
387
388 Double_t p = bl1;
389 fLabVec.clear();
390 SetTextFormat(min, max, bw1);
391 for (Int_t i = 0; i <= bn1; i++) {
392 fLabVec.push_back(Lab_t(p, p));
393 p += bw1;
394 }
395
396 //___________________________________________________________________________
397 // Set font.
398
399 // First projected axis length needed if use relative font size.
400 const char* labFontName = TGLFontManager::GetFontNameFromId(fAttAxis->GetLabelFont());
401 const char* titleFontName = TGLFontManager::GetFontNameFromId(fAttAxis->GetTitleFont());
402
403 // pixel font size is set externally for pixmap and bitmap fonts
404 // for texture and polygon fonts font size is set here, to get font resolution
406 {
407 GLdouble mm[16], pm[16];
408 GLint vp[4];
409 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
410 glGetDoublev(GL_PROJECTION_MATRIX, pm);
411 glGetIntegerv(GL_VIEWPORT, vp);
412
413 GLdouble dn[3], up[3];
414 gluProject(fDir.X()*min, fDir.Y()*min, fDir.Z()*min, mm, pm, vp, &dn[0], &dn[1], &dn[2]);
415 gluProject(fDir.X()*max, fDir.Y()*max, fDir.Z()*max, mm, pm, vp, &up[0], &up[1], &up[2]);
416 Double_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0]) +
417 (up[1] - dn[1]) * (up[1] - dn[1]) +
418 (up[2] - dn[2]) * (up[2] - dn[2]));
419
422 }
423
424 SetLabelFont(rnrCtx, labFontName, fLabelPixelFontSize, (max - min)*fAttAxis->GetLabelSize());
425 SetTitleFont(rnrCtx, titleFontName, fTitlePixelFontSize, (max - min)*fAttAxis->GetTitleSize());
426
427 //___________________________________________________________________________
428 // Draw.
429
430 if (!fUseAxisColors)
431 TGLUtil::Color(rnrCtx.ColorSet().Markup());
432
433 glDisable(GL_LIGHTING);
434 RnrLines();
435 RnrLabels();
436
437 if (ax->GetTitle())
439}
440
441
442/** \class TGLAxisPainterBox
443\ingroup opengl
444Painter class for axes encompassing a 3D box.
445*/
446
448
449////////////////////////////////////////////////////////////////////////////////
450/// Constructor.
451
454{
455 fAxis[0] = fAxis[1] = fAxis[2] = 0;
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// Destructor.
460
462{
463}
464
465////////////////////////////////////////////////////////////////////////////////
466/// Get position of axes and titles from projected corners.
467
469{
470 Double_t x0 = fAxis[0]->GetXmin();
471 Double_t x1 = fAxis[0]->GetXmax();
472
473 Double_t y0 = fAxis[1]->GetXmin();
474 Double_t y1 = fAxis[1]->GetXmax();
475
476 Double_t z0 = fAxis[2]->GetXmin();
477 Double_t z1 = fAxis[2]->GetXmax();
478
479 // project corner points
480 const GLdouble *pm = rnrCtx.RefCamera().RefLastNoPickProjM().CArr();
481 GLdouble mm[16];
482 GLint vp[4];
483 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
484 glGetIntegerv(GL_VIEWPORT, vp);
485 GLdouble projX[4], projY[4], projZ[4];
486 GLdouble cornerX[4];
487 GLdouble cornerY[4];
488 cornerX[0] = x0; cornerY[0] = y0;
489 cornerX[1] = x1; cornerY[1] = y0;
490 cornerX[2] = x1; cornerY[2] = y1;
491 cornerX[3] = x0; cornerY[3] = y1;
492 gluProject(cornerX[0], cornerY[0], z0, mm, pm, vp, &projX[0], &projY[0], &projZ[0]);
493 gluProject(cornerX[1], cornerY[1], z0, mm, pm, vp, &projX[1], &projY[1], &projZ[1]);
494 gluProject(cornerX[2], cornerY[2], z0, mm, pm, vp, &projX[2], &projY[2], &projZ[2]);
495 gluProject(cornerX[3], cornerY[3], z0, mm, pm, vp, &projX[3], &projY[3], &projZ[3]);
496
497
498 // Z axis location (left most corner)
499 //
500 Int_t idxLeft = 0;
501 Float_t xt = projX[0];
502 for (Int_t i = 1; i < 4; ++i) {
503 if (projX[i] < xt) {
504 xt = projX[i];
505 idxLeft = i;
506 }
507 }
508 fAxisTitlePos[2].Set(cornerX[idxLeft], cornerY[idxLeft], z1);
509
510
511 // XY axis location (closest to eye) first
512 //
513 Float_t zt = 1.f;
514 Float_t zMin = 0.f;
515 Int_t idxFront = 0;
516 for (Int_t i = 0; i < 4; ++i) {
517 if (projZ[i] < zt) {
518 zt = projZ[i];
519 idxFront = i;
520 }
521 if (projZ[i] > zMin) zMin = projZ[i];
522 }
523 Int_t xyIdx = idxFront;
524 if (zMin - zt < 1e-2) xyIdx = 0; // avoid flipping in front view
525
526
527 switch (xyIdx) {
528 case 0:
529 fAxisTitlePos[0].Set(x1, y0, z0);
530 fAxisTitlePos[1].Set(x0, y1, z0);
531 break;
532 case 1:
533 fAxisTitlePos[0].Set(x1, y0, z0);
534 fAxisTitlePos[1].Set(x0, y1, z0);
535 break;
536 case 2:
537 fAxisTitlePos[0].Set(x0, y1, z0);
538 fAxisTitlePos[1].Set(x1, y0, z0);
539 break;
540 case 3:
541 fAxisTitlePos[0].Set(x1, y1, z0);
542 fAxisTitlePos[1].Set(x0, y0, z0);
543 break;
544 }
545}
546
547////////////////////////////////////////////////////////////////////////////////
548/// Draw XYZ axis with bitmap font.
549
551{
552 // set font size first depending on size of projected axis
554 GLdouble pm[16];
555 GLint vp[4];
556 glGetDoublev(GL_MODELVIEW_MATRIX, mm.Arr());
557 glGetDoublev(GL_PROJECTION_MATRIX, pm);
558 glGetIntegerv(GL_VIEWPORT, vp);
559
560 // determine bitmap font size from length of projected vertical
561 GLdouble dn[3];
562 GLdouble up[3];
563 gluProject(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxis[2]->GetXmin(), mm.Arr(), pm, vp, &dn[0], &dn[1], &dn[2]);
564 gluProject(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxis[2]->GetXmax(), mm.Arr(), pm, vp, &up[0], &up[1], &up[2]);
565 Double_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0]) +
566 (up[1] - dn[1]) * (up[1] - dn[1]) +
567 (up[2] - dn[2]) * (up[2] - dn[2]));
568 SetLabelPixelFontSize(TMath::CeilNint(len*fAxis[2]->GetLabelSize()));
569 SetTitlePixelFontSize(TMath::CeilNint(len*fAxis[2]->GetTitleSize()));
570
571
572 // Z axis
573 //
574 // tick-mark vector = 10 pixels left
575 fAxis[2]->SetTickLength(1.); // leave this relative factor neutral
576 TGLVertex3 worldRef(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxisTitlePos[2].Z());
577 RefTMOff(0) = rnrCtx.RefCamera().ViewportDeltaToWorld(worldRef, -10, 0, &mm);
578 SetTMNDim(1);
579 RefDir().Set(0., 0., 1.);
581 glPushMatrix();
582 glTranslatef(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), 0);
583 RefTitlePos().Set(RefTMOff(0).X(), RefTMOff(0).Y(),fAxisTitlePos[2].Z());
584 PaintAxis(rnrCtx, fAxis[2]);
585 glPopMatrix();
586
587 // XY Axis
588 //
589 SetTMNDim(2);
590 RefTMOff(1).Set(0, 0, fAxis[2]->GetXmin()- fAxis[2]->GetXmax());
592 // X
593 glPushMatrix();
594 RefDir().Set(1, 0, 0);
595 Float_t yOff = fAxis[0]->GetXmax() - fAxis[0]->GetXmin();
596 yOff *= 0.5f;
597 if (fAxisTitlePos[0].Y() < fAxis[1]->GetXmax()) yOff = -yOff;
598 RefTMOff(0).Set(0, yOff, 0);
599 glTranslatef(0, fAxisTitlePos[0].Y(), fAxisTitlePos[0].Z());
600 RefTitlePos().Set(fAxisTitlePos[0].X(), yOff*1.5*fAxis[0]->GetTickLength(), 0);
601 PaintAxis(rnrCtx, fAxis[0]);
602 glPopMatrix();
603
604 // Y
605 glPushMatrix();
606 RefDir().Set(0, 1, 0);
607 Float_t xOff = fAxis[1]->GetXmax() - fAxis[1]->GetXmin();
608 if (fAxisTitlePos[1].X() < fAxis[0]->GetXmax()) xOff = -xOff;
609 RefTMOff(0).Set(xOff, 0, 0);
610 glTranslatef(fAxisTitlePos[1].X(), 0, fAxisTitlePos[1].Z());
611 RefTitlePos().Set(xOff*1.5*fAxis[1]->GetTickLength(), fAxisTitlePos[1].Y(), 0);
612 PaintAxis(rnrCtx, fAxis[1]);
613 glPopMatrix();
614}
615
616////////////////////////////////////////////////////////////////////////////////
617
619 TH1 *histo,
620 const TGLBoundingBox &bbox)
621{
622 fAxis[0] = histo->GetXaxis();
623 fAxis[1] = histo->GetYaxis();
624 fAxis[2] = histo->GetZaxis();
625 // fAxis[2]->SetTitle("Z");
626 // fAxis[2]->SetLabelSize(0.04);
627 // fAxis[2]->SetTitleSize(0.05);
628
629 Double_t sx = (bbox.XMax() - bbox.XMin()) / (fAxis[0]->GetXmax() - fAxis[0]->GetXmin());
630 Double_t sy = (bbox.YMax() - bbox.YMin()) / (fAxis[1]->GetXmax() - fAxis[1]->GetXmin());
631 Double_t sz = (bbox.ZMax() - bbox.ZMin()) / (fAxis[2]->GetXmax() - fAxis[2]->GetXmin());
632
633 // draw
634 glPushMatrix();
635 glScaled(sx, sy, sz);
636 SetAxis3DTitlePos(rnrCtx);
637 DrawAxis3D(rnrCtx);
638 glPopMatrix();
639}
double GLdouble
Definition: GL_glu.h:279
#define GL_LINES
Definition: GL_glu.h:284
int GLint
Definition: GL_glu.h:272
#define h(i)
Definition: RSha256.hxx:106
#define e(i)
Definition: RSha256.hxx:103
static const double x1[5]
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
int Int_t
Definition: RtypesCore.h:41
int Ssiz_t
Definition: RtypesCore.h:63
const Bool_t kFALSE
Definition: RtypesCore.h:88
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
void Error(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
virtual Color_t GetTitleColor() const
Definition: TAttAxis.h:46
virtual Color_t GetLabelColor() const
Definition: TAttAxis.h:38
virtual Int_t GetNdivisions() const
Definition: TAttAxis.h:36
virtual Color_t GetAxisColor() const
Definition: TAttAxis.h:37
virtual Style_t GetTitleFont() const
Definition: TAttAxis.h:47
virtual Float_t GetLabelOffset() const
Definition: TAttAxis.h:40
virtual Style_t GetLabelFont() const
Definition: TAttAxis.h:39
virtual Float_t GetTitleSize() const
Definition: TAttAxis.h:44
virtual Float_t GetLabelSize() const
Definition: TAttAxis.h:41
virtual Float_t GetTickLength() const
Definition: TAttAxis.h:45
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition: TAttAxis.cxx:280
Class to manage histogram axis.
Definition: TAxis.h:30
Double_t GetXmax() const
Definition: TAxis.h:134
Double_t GetXmin() const
Definition: TAxis.h:133
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:129
Utility class to paint axis in GL.
void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx)
Get position of axes and titles from projected corners.
void PlotStandard(TGLRnrCtx &rnrCtx, TH1 *histo, const TGLBoundingBox &bbox)
void DrawAxis3D(TGLRnrCtx &rnrCtx)
Draw XYZ axis with bitmap font.
TGLAxisPainterBox()
Constructor.
TGLVector3 fAxisTitlePos[3]
virtual ~TGLAxisPainterBox()
Destructor.
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
TPMERegexp * fAllZeroesRE
LabVec_t fLabVec
void LabelsLimits(const char *label, Int_t &first, Int_t &last) const
Find first and last character of a label.
void RnrLines() const
Render axis main line and tick-marks.
TGLVector3 & RefDir()
Int_t fLabelPixelFontSize
TGLFont::ETextAlignV_e fLabelAlignV
TGLFont fTitleFont
Bool_t fUseAxisColors
std::pair< Float_t, Int_t > TM_t
TGLVector3 fTitlePos
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
TGLVector3 fTMOff[3]
TGLFont fLabelFont
TAttAxis * fAttAxis
Double_t fLabel3DFontSize
void RnrText(const TString &txt, const TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV, const TGLFont &font) const
Render text at the given position. Offset depends of text alignment.
TGLVector3 & RefTitlePos()
TGLFont::ETextAlignH_e fLabelAlignH
Int_t fTitlePixelFontSize
void SetTitleFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set title font derived from TAttAxis.
void FormAxisValue(Double_t x, TString &s) const
Returns formatted text suitable for display of value.
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
void SetLabelPixelFontSize(Int_t fs)
void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const
Draw title at given position.
std::pair< Float_t, Float_t > Lab_t
void SetTMNDim(Int_t x)
TGLVector3 & RefTMOff(Int_t i)
Double_t fTitle3DFontSize
virtual ~TGLAxisPainter()
Destructor.
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
TGLVector3 fDir
void SetTitlePixelFontSize(Int_t fs)
TGLFont::EMode fFontMode
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Double_t XMin() const
Double_t ZMax() const
Double_t XMax() const
Double_t YMin() const
Double_t YMax() const
Double_t ZMin() const
TGLMatrix & RefLastNoPickProjM() const
Definition: TGLCamera.h:174
TGLVector3 ViewportDeltaToWorld(const TGLVertex3 &worldRef, Double_t viewportXDelta, Double_t viewportYDelta, TGLMatrix *modviewMat=0) const
Apply a 2D viewport delta (shift) to the projection of worldRef onto viewport, returning the resultan...
Definition: TGLCamera.cxx:546
TGLColor & Markup()
Definition: TGLUtil.h:853
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
A wrapper class for FTFont.
Int_t GetSize() const
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void PostRender() const
Reset GL state after FTFont rendering.
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition: TGLUtil.h:597
const Double_t * CArr() const
Definition: TGLUtil.h:663
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
Definition: TGLRnrCtx.cxx:367
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Definition: TGLRnrCtx.cxx:278
TGLCamera & RefCamera()
Definition: TGLRnrCtx.h:157
static void Color(const TGLColor &color)
Set color from TGLColor.
Definition: TGLUtil.cxx:1692
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition: TGLUtil.cxx:1938
3 component (x/y/z) vector class.
Definition: TGLUtil.h:247
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 * Arr()
Definition: TGLUtil.h:126
void Set(Double_t x, Double_t y, Double_t z)
Definition: TGLUtil.h:209
Double_t Y() const
Definition: TGLUtil.h:120
The TH1 histogram class.
Definition: TH1.h:56
TAxis * GetZaxis()
Definition: TH1.h:318
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TAxis * GetYaxis()
Definition: TH1.h:317
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
Int_t Substitute(TString &s, const TString &r, Bool_t doDollarSubst=kTRUE)
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is t...
Definition: TPRegexp.cxx:874
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:499
const char * Data() const
Definition: TString.h:364
@ kLeading
Definition: TString.h:262
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
static constexpr double s
static constexpr double mm
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition: TMath.h:703
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
T1 Sign(T1 a, T2 b)
Definition: TMathBase.h:165
Int_t FloorNint(Double_t x)
Definition: TMath.h:697
Double_t Sqrt(Double_t x)
Definition: TMath.h:681
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:725
Int_t CeilNint(Double_t x)
Definition: TMath.h:689
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
Double_t Log10(Double_t x)
Definition: TMath.h:754
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
Definition: first.py:1
auto * t1
Definition: textangle.C:20
REAL epsilon
Definition: triangle.c:617