16#include "TGLIncludes.h"
41 fAttAxis(0), fUseAxisColors(
kTRUE),
46 fLabelPixelFontSize(14), fLabel3DFontSize(1.0),
47 fTitlePixelFontSize(14), fTitle3DFontSize(1.0),
49 fLabelAlignH(
TGLFont::kCenterH),
50 fLabelAlignV(
TGLFont::kCenterV),
80 last = strlen(label) - 1;
81 for (
Int_t i = 0; i <= last; i++) {
82 if (strchr(
"1234567890-+.", label[i])) {
87 Error(
"LabelsLimits",
"attempt to draw a blank label");
98 if (
s ==
"-." ||
s ==
"-0")
110 s.Remove(
s.Length() -1);
127 if (bw1 < xmicros && absMaxLog < 0) {
151 if (
fExp % 3 == 0 && absMax >= rne)
break;
162 if (size / ndyn <= 0.999 && na <
fMaxDigits - 2) {
181 if (if1 > 14) if1 = 14;
182 if (if2 > 14) if2 = 14;
188 chtemp.
Form(
"%g", dwlabel);
203 font.
Render(txt, p.
X(), p.
Y(), p.
Z(), aH, aV);
211 glTranslated(p.
X(), p.
Y(), p.
Z());
214 font.
Render(txt, 0, 0, 0, aH, aV);
241 glTranslated(offVec.
X(), offVec.
Y(), offVec.
Z());
246 for (LabVec_t::const_iterator it =
fLabVec.begin(); it !=
fLabVec.end(); ++it) {
298 glVertex3dv(start.
Arr());
299 glVertex3dv(end.
Arr());
305 Float_t tmsOrderSecond = tmsOrderFirst * 0.5;
307 TMVec_t::const_iterator it =
fTMVec.begin();
310 for (
Int_t t = 1; t < nt; ++t, ++it) {
311 pos =
fDir * ((*it).first);
313 glVertex3dv(pos.
Arr());
315 glVertex3dv((pos +
fTMOff[dim]*tmsOrderSecond).Arr());
317 glVertex3dv((pos +
fTMOff[dim]*tmsOrderFirst).Arr());
333 Error(
"TGLAxisPainter::PaintAxis",
"axis without range");
344 Double_t bl1=0, bh1=0, bl2=0, bh2=0;
366 for (
Int_t t2 = 1; t2 < bn2; t2++)
390 for (
Int_t i = 0; i <= bn1; i++) {
408 glGetDoublev(GL_MODELVIEW_MATRIX,
mm);
409 glGetDoublev(GL_PROJECTION_MATRIX, pm);
410 glGetIntegerv(GL_VIEWPORT, vp);
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]);
416 (up[1] - dn[1]) * (up[1] - dn[1]) +
417 (up[2] - dn[2]) * (up[2] - dn[2]));
432 glDisable(GL_LIGHTING);
482 glGetDoublev(GL_MODELVIEW_MATRIX,
mm);
483 glGetIntegerv(GL_VIEWPORT, vp);
484 GLdouble projX[4], projY[4], projZ[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]);
501 for (
Int_t i = 1; i < 4; ++i) {
515 for (
Int_t i = 0; i < 4; ++i) {
520 if (projZ[i] > zMin) zMin = projZ[i];
522 Int_t xyIdx = idxFront;
523 if (zMin - zt < 1
e-2) xyIdx = 0;
555 glGetDoublev(GL_MODELVIEW_MATRIX,
mm.Arr());
556 glGetDoublev(GL_PROJECTION_MATRIX, pm);
557 glGetIntegerv(GL_VIEWPORT, vp);
565 (up[1] - dn[1]) * (up[1] - dn[1]) +
566 (up[2] - dn[2]) * (up[2] - dn[2]));
634 glScaled(sx, sy, sz);
static const double x1[5]
void Error(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
virtual Color_t GetTitleColor() const
virtual Color_t GetLabelColor() const
virtual Int_t GetNdivisions() const
virtual Color_t GetAxisColor() const
virtual Style_t GetTitleFont() const
virtual Float_t GetLabelOffset() const
virtual Style_t GetLabelFont() const
virtual Float_t GetTitleSize() const
virtual Float_t GetLabelSize() const
virtual Float_t GetTickLength() const
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Class to manage histogram axis.
const char * GetTitle() const
Returns title of object.
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
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.
Int_t fLabelPixelFontSize
TGLFont::ETextAlignV_e fLabelAlignV
std::pair< Float_t, Int_t > TM_t
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
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
TGLVector3 & RefTMOff(Int_t i)
Double_t fTitle3DFontSize
virtual ~TGLAxisPainter()
Destructor.
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
void SetTitlePixelFontSize(Int_t fs)
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
TGLMatrix & RefLastNoPickProjM() const
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...
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
A wrapper class for FTFont.
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.
const Double_t * CArr() const
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
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).
static void Color(const TGLColor &color)
Set color from TGLColor.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void Set(Double_t x, Double_t y, Double_t z)
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
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).
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...
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
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.
Short_t Max(Short_t a, Short_t b)
Int_t FloorNint(Double_t x)
Double_t Sqrt(Double_t x)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Int_t CeilNint(Double_t x)
Short_t Min(Short_t a, Short_t b)
Double_t Log10(Double_t x)