Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TGLFontManager.h"
18
19#include "TAttAxis.h"
20#include "TAxis.h"
21#include "TH1.h"
22#include "THLimitsFinder.h"
23
24#include "TMath.h"
25#include "TPRegexp.h"
26
27/** \class TGLAxisPainter
28\ingroup opengl
29Utility class to paint axis in GL.
30*/
31
33
34////////////////////////////////////////////////////////////////////////////////
35
37 fExp(0),
38 fMaxDigits(5),
39 fDecimals(0),
40
41 fAttAxis(0), fUseAxisColors(kTRUE),
42
43 fFontMode(TGLFont::kTexture),
44 fDir(1, 0, 0),
45 fTMNDim(1),
46 fLabelPixelFontSize(14), fLabel3DFontSize(1.0),
47 fTitlePixelFontSize(14), fTitle3DFontSize(1.0),
48
49 fLabelAlignH(TGLFont::kCenterH),
50 fLabelAlignV(TGLFont::kCenterV),
51 fAllZeroesRE(0)
52{
53 // Constructor.
54
55 fAllZeroesRE = new TPMERegexp("[-+]?0\\.0*$", "o");
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// Destructor.
60
62{
63 delete fAllZeroesRE;
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Set label align.
68
70{
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// Find first and last character of a label.
77
78void TGLAxisPainter::LabelsLimits(const char *label, Int_t &first, Int_t &last) const
79{
80 last = strlen(label) - 1;
81 for (Int_t i = 0; i <= last; i++) {
82 if (strchr("1234567890-+.", label[i])) {
83 first = i;
84 return;
85 }
86 }
87 Error("LabelsLimits", "attempt to draw a blank label");
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Returns formatted text suitable for display of value.
92
94{
95 s.Form(fFormat, val);
97
98 if (s == "-." || s == "-0")
99 {
100 s = "0";
101 return;
102 }
103
104 Ssiz_t ld = s.Last('.') + 1;
105 if (s.Length() - ld > fDecimals)
106 s.Remove(ld + fDecimals);
107
108
109 if (fDecimals == 0 && s.EndsWith("."))
110 s.Remove(s.Length() -1);
111
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Construct print format from given primary bin width.
117
119{
120 Double_t absMax = TMath::Max(TMath::Abs(min), TMath::Abs(max));
121 Double_t epsilon = 1e-5;
122 Double_t absMaxLog = TMath::Log10(absMax) + epsilon;
123
124 fExp = 0;
125 Int_t if1, if2;
126 Double_t xmicros = TMath::Power(10, -fMaxDigits);
127 if (bw1 < xmicros && absMaxLog < 0) {
128 // First case : bin width less than 0.001
129 fExp = (Int_t)absMaxLog;
130 if (fExp % 3 == 1) fExp += TMath::Sign(2, fExp);
131 if (fExp % 3 == 2) fExp += TMath::Sign(1, fExp);
132 if1 = fMaxDigits;
133 if2 = fMaxDigits - 2;
134 } else {
135 // Use x 10 n format. (only powers of 3 allowed)
136 Float_t af = (absMax > 1) ? absMaxLog : TMath::Log10(absMax * 0.0001);
137 af += epsilon;
138 Int_t clog = Int_t(af) + 1;
139
140 if (clog > fMaxDigits) {
141 while (1) {
142 fExp++;
143 absMax /= 10;
144 if (fExp % 3 == 0 && absMax <= TMath::Power(10, fMaxDigits - 1)) break;
145 }
146 } else if (clog < -fMaxDigits) {
147 Double_t rne = 1 / TMath::Power(10, fMaxDigits - 2);
148 while (1) {
149 fExp--;
150 absMax *= 10;
151 if (fExp % 3 == 0 && absMax >= rne) break;
152 }
153 }
154
155 Int_t na = 0;
156 for (Int_t i = fMaxDigits - 1; i > 0; i--) {
157 if (TMath::Abs(absMax) < TMath::Power(10, i)) na = fMaxDigits - i;
158 }
159 Double_t size = TMath::Abs(max - min);
160 Int_t ndyn = (Int_t)(size / bw1);
161 while (ndyn) {
162 if (size / ndyn <= 0.999 && na < fMaxDigits - 2) {
163 na++;
164 ndyn /= 10;
165 } else break;
166 }
167 if2 = na;
168 if1 = TMath::Max(clog + na, fMaxDigits) + 1;
169 }
170
171 // compose text format
172 if (TMath::Min(min, max) < 0)if1 = if1 + 1;
173 if1 = TMath::Min(if1, 32);
174
175 // In some cases, if1 and if2 are too small....
176 Double_t dwlabel = bw1 * TMath::Power(10, -fExp);
177 while (dwlabel < TMath::Power(10, -if2)) {
178 if1++;
179 if2++;
180 }
181 if (if1 > 14) if1 = 14;
182 if (if2 > 14) if2 = 14;
183 if (if2) fFormat.Form("%%%d.%df", if1, if2);
184 else fFormat.Form("%%%d.%df", if1 + 1, 1);
185
186 // get decimal number
187 TString chtemp;
188 chtemp.Form("%g", dwlabel);
189 fDecimals = 0;
190 if (chtemp.First('.') != kNPOS)
191 fDecimals = chtemp.Length() - chtemp.First('.') - 1;
192}
193
194// Utility functions.
195
196////////////////////////////////////////////////////////////////////////////////
197/// Render text at the given position. Offset depends of text alignment.
198
200{
202 {
203 font.Render(txt, p.X(), p.Y(), p.Z(), aH, aV);
204 }
205 else
206 {
207 // In case of non pixmap font, size is adjusted to the projected view in order to
208 // be visible on zoom out. In other words texture and polygon fonts imitate
209 // pixmap font behaviour.
210 glPushMatrix();
211 glTranslated(p.X(), p.Y(), p.Z());
213 glScaled(sc, sc, 1);
214 font.Render(txt, 0, 0, 0, aH, aV);
215 glPopMatrix();
216 }
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Set label font derived from TAttAxis.
221
222void TGLAxisPainter::SetLabelFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t fontSize, Double_t size3d)
223{
224 rnrCtx.RegisterFontNoScale(fontSize, fontName, fFontMode, fLabelFont);
225 fLabel3DFontSize = size3d;
227}
228
229////////////////////////////////////////////////////////////////////////////////
230/// Render label reading prepared list ov value-pos pairs.
231
233{
234 if (fUseAxisColors)
236
237 glPushMatrix();
238
240 TGLVector3 offVec = fTMOff[0] * off;
241 glTranslated(offVec.X(), offVec.Y(), offVec.Z());
242
244 Double_t p = 0.;
245 TString s;
246 for (LabVec_t::const_iterator it = fLabVec.begin(); it != fLabVec.end(); ++it) {
247 FormAxisValue((*it).second, s);
248 p = (*it).first;
250 }
251
253 glPopMatrix();
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Set title font derived from TAttAxis.
258
259void TGLAxisPainter::SetTitleFont(TGLRnrCtx &rnrCtx, const char* fontName,
260 Int_t fontSize, Double_t size3d)
261{
262 rnrCtx.RegisterFontNoScale(fontSize, fontName, fFontMode, fTitleFont);
264 fTitle3DFontSize = size3d;
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Draw title at given position.
269
271{
272 if (fUseAxisColors)
274
275 TString title = (fExp) ? Form("%s [10^%d]", txt.Data(), fExp) : txt;
277 RnrText(title, pos, aH, aV, fTitleFont);
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Render axis main line and tick-marks.
283
285{
286 if (fUseAxisColors)
288
290 glBegin(GL_LINES);
291
292 // Main line.
293 //
294 Float_t min = fTMVec.front().first;
295 Float_t max = fTMVec.back().first;
296 TGLVector3 start = fDir * min;
297 TGLVector3 end = fDir * max;
298 glVertex3dv(start.Arr());
299 glVertex3dv(end.Arr());
300
301 // Tick-marks.
302 // Support three possible directions and two orders.
303 //
304 Float_t tmsOrderFirst = fAttAxis->GetTickLength();
305 Float_t tmsOrderSecond = tmsOrderFirst * 0.5;
306 TGLVector3 pos;
307 TMVec_t::const_iterator it = fTMVec.begin();
308 Int_t nt = fTMVec.size()-1;
309 ++it;
310 for (Int_t t = 1; t < nt; ++t, ++it) {
311 pos = fDir * ((*it).first);
312 for (Int_t dim = 0; dim < fTMNDim; dim++) {
313 glVertex3dv(pos.Arr());
314 if ((*it).second)
315 glVertex3dv((pos + fTMOff[dim]*tmsOrderSecond).Arr());
316 else
317 glVertex3dv((pos + fTMOff[dim]*tmsOrderFirst).Arr());
318 }
319 }
320 glEnd();
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// GL render TAxis.
325
327{
328 fAttAxis = ax;
329 Double_t min = ax->GetXmin();
330 Double_t max = ax->GetXmax();
331 if (min == max)
332 {
333 Error("TGLAxisPainter::PaintAxis", "axis without range");
334 return;
335 }
336
337 //___________________________________________________________________________
338 // Fill labels value-pos and tick-marks position-length.
339
341 Int_t n2a = fAttAxis->GetNdivisions() - n1a * 100;
342 Int_t bn1, bn2;
343 Double_t bw1, bw2; // primary , secondary bin width
344 Double_t bl1=0, bh1=0, bl2=0, bh2=0; // bin low, high values
345
346 // Read limits from users range
347 THLimitsFinder::Optimize(min, max, n1a, bl1, bh1, bn1, bw1);
348 THLimitsFinder::Optimize(bl1, bl1 + bw1, n2a, bl2, bh2, bn2, bw2);
349
350 //___________________________________________________________________________
351
352 // Get TM. First and last values are reserved for axis range
353 //
354 fTMVec.clear();
355 fLabVec.clear();
356
357 fTMVec.push_back(TM_t(min, -1));
358
359 Double_t v1 = bl1;
360 Double_t v2 = 0;
361 for (Int_t t1 = 0; t1 <= bn1; t1++)
362 {
363 fTMVec.push_back(TM_t(v1, 0));
364 fLabVec.push_back(Lab_t(v1, v1));
365 v2 = v1 + bw2;
366 for (Int_t t2 = 1; t2 < bn2; t2++)
367 {
368 if (v2 > max) break;
369 fTMVec.push_back(TM_t(v2, 1));
370 v2 += bw2;
371 }
372 v1 += bw1;
373 }
374
375 // complete low edges for 1.st order TM
376 v2 = bl1 -bw2;
377 while (v2 > min) {
378 fTMVec.push_back(TM_t(v2, 1));
379 v2 -= bw2;
380 }
381
382 fTMVec.push_back(TM_t(max, -1));
383
384 //___________________________________________________________________________
385 // Get labels. In this case trivial one-one mapping.
386
387 Double_t p = bl1;
388 fLabVec.clear();
389 SetTextFormat(min, max, bw1);
390 for (Int_t i = 0; i <= bn1; i++) {
391 fLabVec.push_back(Lab_t(p, p));
392 p += bw1;
393 }
394
395 //___________________________________________________________________________
396 // Set font.
397
398 // First projected axis length needed if use relative font size.
399 const char* labFontName = TGLFontManager::GetFontNameFromId(fAttAxis->GetLabelFont());
400 const char* titleFontName = TGLFontManager::GetFontNameFromId(fAttAxis->GetTitleFont());
401
402 // pixel font size is set externally for pixmap and bitmap fonts
403 // for texture and polygon fonts font size is set here, to get font resolution
405 {
406 GLdouble mm[16], pm[16];
407 GLint vp[4];
408 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
409 glGetDoublev(GL_PROJECTION_MATRIX, pm);
410 glGetIntegerv(GL_VIEWPORT, vp);
411
412 GLdouble dn[3], up[3];
413 gluProject(fDir.X()*min, fDir.Y()*min, fDir.Z()*min, mm, pm, vp, &dn[0], &dn[1], &dn[2]);
414 gluProject(fDir.X()*max, fDir.Y()*max, fDir.Z()*max, mm, pm, vp, &up[0], &up[1], &up[2]);
415 Double_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0]) +
416 (up[1] - dn[1]) * (up[1] - dn[1]) +
417 (up[2] - dn[2]) * (up[2] - dn[2]));
418
421 }
422
423 SetLabelFont(rnrCtx, labFontName, fLabelPixelFontSize, (max - min)*fAttAxis->GetLabelSize());
424 SetTitleFont(rnrCtx, titleFontName, fTitlePixelFontSize, (max - min)*fAttAxis->GetTitleSize());
425
426 //___________________________________________________________________________
427 // Draw.
428
429 if (!fUseAxisColors)
430 TGLUtil::Color(rnrCtx.ColorSet().Markup());
431
432 glDisable(GL_LIGHTING);
433 RnrLines();
434 RnrLabels();
435
436 if (ax->GetTitle())
438}
439
440
441/** \class TGLAxisPainterBox
442\ingroup opengl
443Painter class for axes encompassing a 3D box.
444*/
445
447
448////////////////////////////////////////////////////////////////////////////////
449/// Constructor.
450
453{
454 fAxis[0] = fAxis[1] = fAxis[2] = 0;
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Destructor.
459
461{
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Get position of axes and titles from projected corners.
466
468{
469 Double_t x0 = fAxis[0]->GetXmin();
470 Double_t x1 = fAxis[0]->GetXmax();
471
472 Double_t y0 = fAxis[1]->GetXmin();
473 Double_t y1 = fAxis[1]->GetXmax();
474
475 Double_t z0 = fAxis[2]->GetXmin();
476 Double_t z1 = fAxis[2]->GetXmax();
477
478 // project corner points
479 const GLdouble *pm = rnrCtx.RefCamera().RefLastNoPickProjM().CArr();
480 GLdouble mm[16];
481 GLint vp[4];
482 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
483 glGetIntegerv(GL_VIEWPORT, vp);
484 GLdouble projX[4], projY[4], projZ[4];
485 GLdouble cornerX[4];
486 GLdouble cornerY[4];
487 cornerX[0] = x0; cornerY[0] = y0;
488 cornerX[1] = x1; cornerY[1] = y0;
489 cornerX[2] = x1; cornerY[2] = y1;
490 cornerX[3] = x0; cornerY[3] = y1;
491 gluProject(cornerX[0], cornerY[0], z0, mm, pm, vp, &projX[0], &projY[0], &projZ[0]);
492 gluProject(cornerX[1], cornerY[1], z0, mm, pm, vp, &projX[1], &projY[1], &projZ[1]);
493 gluProject(cornerX[2], cornerY[2], z0, mm, pm, vp, &projX[2], &projY[2], &projZ[2]);
494 gluProject(cornerX[3], cornerY[3], z0, mm, pm, vp, &projX[3], &projY[3], &projZ[3]);
495
496
497 // Z axis location (left most corner)
498 //
499 Int_t idxLeft = 0;
500 Float_t xt = projX[0];
501 for (Int_t i = 1; i < 4; ++i) {
502 if (projX[i] < xt) {
503 xt = projX[i];
504 idxLeft = i;
505 }
506 }
507 fAxisTitlePos[2].Set(cornerX[idxLeft], cornerY[idxLeft], z1);
508
509
510 // XY axis location (closest to eye) first
511 //
512 Float_t zt = 1.f;
513 Float_t zMin = 0.f;
514 Int_t idxFront = 0;
515 for (Int_t i = 0; i < 4; ++i) {
516 if (projZ[i] < zt) {
517 zt = projZ[i];
518 idxFront = i;
519 }
520 if (projZ[i] > zMin) zMin = projZ[i];
521 }
522 Int_t xyIdx = idxFront;
523 if (zMin - zt < 1e-2) xyIdx = 0; // avoid flipping in front view
524
525
526 switch (xyIdx) {
527 case 0:
528 fAxisTitlePos[0].Set(x1, y0, z0);
529 fAxisTitlePos[1].Set(x0, y1, z0);
530 break;
531 case 1:
532 fAxisTitlePos[0].Set(x1, y0, z0);
533 fAxisTitlePos[1].Set(x0, y1, z0);
534 break;
535 case 2:
536 fAxisTitlePos[0].Set(x0, y1, z0);
537 fAxisTitlePos[1].Set(x1, y0, z0);
538 break;
539 case 3:
540 fAxisTitlePos[0].Set(x1, y1, z0);
541 fAxisTitlePos[1].Set(x0, y0, z0);
542 break;
543 }
544}
545
546////////////////////////////////////////////////////////////////////////////////
547/// Draw XYZ axis with bitmap font.
548
550{
551 // set font size first depending on size of projected axis
552 TGLMatrix mm;
553 GLdouble pm[16];
554 GLint vp[4];
555 glGetDoublev(GL_MODELVIEW_MATRIX, mm.Arr());
556 glGetDoublev(GL_PROJECTION_MATRIX, pm);
557 glGetIntegerv(GL_VIEWPORT, vp);
558
559 // determine bitmap font size from length of projected vertical
560 GLdouble dn[3];
561 GLdouble up[3];
562 gluProject(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxis[2]->GetXmin(), mm.Arr(), pm, vp, &dn[0], &dn[1], &dn[2]);
563 gluProject(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxis[2]->GetXmax(), mm.Arr(), pm, vp, &up[0], &up[1], &up[2]);
564 Double_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0]) +
565 (up[1] - dn[1]) * (up[1] - dn[1]) +
566 (up[2] - dn[2]) * (up[2] - dn[2]));
567 SetLabelPixelFontSize(TMath::CeilNint(len*fAxis[2]->GetLabelSize()));
568 SetTitlePixelFontSize(TMath::CeilNint(len*fAxis[2]->GetTitleSize()));
569
570
571 // Z axis
572 //
573 // tick-mark vector = 10 pixels left
574 TGLVertex3 worldRef(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), fAxisTitlePos[2].Z());
575 RefTMOff(0) = rnrCtx.RefCamera().ViewportDeltaToWorld(worldRef, -10, 0, &mm);
576 SetTMNDim(1);
577 RefDir().Set(0., 0., 1.);
579 glPushMatrix();
580 glTranslatef(fAxisTitlePos[2].X(), fAxisTitlePos[2].Y(), 0);
581 RefTitlePos().Set(RefTMOff(0).X(), RefTMOff(0).Y(),fAxisTitlePos[2].Z());
582 PaintAxis(rnrCtx, fAxis[2]);
583 glPopMatrix();
584
585 // XY Axis
586 //
587 SetTMNDim(2);
588 RefTMOff(1).Set(0, 0, fAxis[2]->GetXmin()- fAxis[2]->GetXmax());
590 // X
591 glPushMatrix();
592 RefDir().Set(1, 0, 0);
593 Float_t yOff = fAxis[0]->GetXmax() - fAxis[0]->GetXmin();
594 yOff *= 0.5f;
595 if (fAxisTitlePos[0].Y() < fAxis[1]->GetXmax()) yOff = -yOff;
596 RefTMOff(0).Set(0, yOff, 0);
597 glTranslatef(0, fAxisTitlePos[0].Y(), fAxisTitlePos[0].Z());
598 RefTitlePos().Set(fAxisTitlePos[0].X(), yOff*1.5*fAxis[0]->GetTickLength(), 0);
599 PaintAxis(rnrCtx, fAxis[0]);
600 glPopMatrix();
601
602 // Y
603 glPushMatrix();
604 RefDir().Set(0, 1, 0);
605 Float_t xOff = fAxis[1]->GetXmax() - fAxis[1]->GetXmin();
606 if (fAxisTitlePos[1].X() < fAxis[0]->GetXmax()) xOff = -xOff;
607 RefTMOff(0).Set(xOff, 0, 0);
608 glTranslatef(fAxisTitlePos[1].X(), 0, fAxisTitlePos[1].Z());
609 RefTitlePos().Set(xOff*1.5*fAxis[1]->GetTickLength(), fAxisTitlePos[1].Y(), 0);
610 PaintAxis(rnrCtx, fAxis[1]);
611 glPopMatrix();
612}
613
614////////////////////////////////////////////////////////////////////////////////
615
617 TH1 *histo,
618 const TGLBoundingBox &bbox)
619{
620 fAxis[0] = histo->GetXaxis();
621 fAxis[1] = histo->GetYaxis();
622 fAxis[2] = histo->GetZaxis();
623
624 Double_t sx = (bbox.XMax() - bbox.XMin()) / (fAxis[0]->GetXmax() - fAxis[0]->GetXmin());
625 Double_t sy = (bbox.YMax() - bbox.YMin()) / (fAxis[1]->GetXmax() - fAxis[1]->GetXmin());
626 Double_t sz = (bbox.ZMax() - bbox.ZMin()) / (fAxis[2]->GetXmax() - fAxis[2]->GetXmin());
627
628 // draw
629 glPushMatrix();
630 glScaled(sx, sy, sz);
631 SetAxis3DTitlePos(rnrCtx);
632 DrawAxis3D(rnrCtx);
633 glPopMatrix();
634}
#define GL_LINES
Definition GL_glu.h:284
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:124
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:197
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
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
Class to manage histogram axis.
Definition TAxis.h:30
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:130
Double_t GetXmax() const
Definition TAxis.h:135
Double_t GetXmin() const
Definition TAxis.h:134
Painter class for axes encompassing a 3D box.
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.
Utility class to paint axis in GL.
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
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
std::pair< Float_t, Int_t > TM_t
TGLVector3 fTitlePos
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
TGLVector3 fTMOff[3]
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=nullptr) const
Apply a 2D viewport delta (shift) to the projection of worldRef onto viewport, returning the resultan...
TGLColor & Markup()
Definition TGLUtil.h:854
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:598
Double_t * Arr()
Definition TGLUtil.h:665
const Double_t * CArr() const
Definition TGLUtil.h:664
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.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
TGLCamera & RefCamera()
Definition TGLRnrCtx.h:157
static void Color(const TGLColor &color)
Set color from TGLColor.
Definition TGLUtil.cxx:1697
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition TGLUtil.cxx:1943
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Double_t X() const
Definition TGLUtil.h:119
Double_t Z() const
Definition TGLUtil.h:123
Double_t * Arr()
Definition TGLUtil.h:127
void Set(Double_t x, Double_t y, Double_t z)
Definition TGLUtil.h:210
Double_t Y() const
Definition TGLUtil.h:121
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
TAxis * GetZaxis()
Definition TH1.h:324
TAxis * GetXaxis()
Definition TH1.h:322
TAxis * GetYaxis()
Definition TH1.h:323
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:872
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:421
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2222
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1151
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition TString.cxx:531
const char * Data() const
Definition TString.h:380
@ kLeading
Definition TString.h:278
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:924
TString & Remove(Ssiz_t pos)
Definition TString.h:685
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2334
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:691
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:250
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:175
Int_t FloorNint(Double_t x)
Returns the nearest integer of TMath::Floor(x).
Definition TMath.h:684
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:660
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:719
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Definition TMath.h:672
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:198
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:760
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Definition first.py:1
auto * t1
Definition textangle.C:20
double epsilon
Definition triangle.c:618