16#include "TGLIncludes.h"
79 last = strlen(label) - 1;
80 for (
Int_t i = 0; i <= last; i++) {
81 if (strchr(
"1234567890-+.", label[i])) {
86 Error(
"LabelsLimits",
"attempt to draw a blank label");
97 if (s ==
"-." || s ==
"-0")
126 if (bw1 < xmicros && absMaxLog < 0) {
150 if (
fExp % 3 == 0 && absMax >= rne)
break;
180 if (if1 > 14) if1 = 14;
181 if (if2 > 14) if2 = 14;
182 if (if2)
fFormat.Form(
"%%%d.%df", if1, if2);
183 else fFormat.Form(
"%%%d.%df", if1 + 1, 1);
187 chtemp.
Form(
"%g", dwlabel);
202 font.
Render(txt, p.
X(), p.
Y(), p.
Z(), aH, aV);
210 glTranslated(p.
X(), p.
Y(), p.
Z());
213 font.
Render(txt, 0, 0, 0, aH, aV);
240 glTranslated(offVec.
X(), offVec.
Y(), offVec.
Z());
245 for (LabVec_t::const_iterator it =
fLabVec.begin(); it !=
fLabVec.end(); ++it) {
297 glVertex3dv(
start.Arr());
298 glVertex3dv(end.
Arr());
304 Float_t tmsOrderSecond = tmsOrderFirst * 0.5;
306 TMVec_t::const_iterator it =
fTMVec.begin();
309 for (
Int_t t = 1; t < nt; ++t, ++it) {
310 pos =
fDir * ((*it).first);
312 glVertex3dv(pos.Arr());
314 glVertex3dv((pos +
fTMOff[dim]*tmsOrderSecond).Arr());
316 glVertex3dv((pos +
fTMOff[dim]*tmsOrderFirst).Arr());
332 Error(
"TGLAxisPainter::PaintAxis",
"axis without range");
343 Double_t bl1=0, bh1=0, bl2=0, bh2=0;
365 for (
Int_t t2 = 1; t2 < bn2; t2++)
389 for (
Int_t i = 0; i <= bn1; i++) {
405 GLdouble mm[16], pm[16];
407 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
408 glGetDoublev(GL_PROJECTION_MATRIX, pm);
409 glGetIntegerv(GL_VIEWPORT, vp);
411 GLdouble dn[3], up[3];
412 gluProject(
fDir.X()*min,
fDir.Y()*min,
fDir.Z()*min, mm, pm, vp, &dn[0], &dn[1], &dn[2]);
413 gluProject(
fDir.X()*max,
fDir.Y()*max,
fDir.Z()*max, mm, pm, vp, &up[0], &up[1], &up[2]);
415 (up[1] - dn[1]) * (up[1] - dn[1]) +
416 (up[2] - dn[2]) * (up[2] - dn[2]));
431 glDisable(GL_LIGHTING);
480 glGetDoublev(GL_MODELVIEW_MATRIX, mm);
481 glGetIntegerv(GL_VIEWPORT, vp);
482 GLdouble projX[4], projY[4], projZ[4];
485 cornerX[0] = x0; cornerY[0] = y0;
486 cornerX[1] = x1; cornerY[1] = y0;
487 cornerX[2] = x1; cornerY[2] = y1;
488 cornerX[3] = x0; cornerY[3] = y1;
489 gluProject(cornerX[0], cornerY[0], z0, mm, pm, vp, &projX[0], &projY[0], &projZ[0]);
490 gluProject(cornerX[1], cornerY[1], z0, mm, pm, vp, &projX[1], &projY[1], &projZ[1]);
491 gluProject(cornerX[2], cornerY[2], z0, mm, pm, vp, &projX[2], &projY[2], &projZ[2]);
492 gluProject(cornerX[3], cornerY[3], z0, mm, pm, vp, &projX[3], &projY[3], &projZ[3]);
499 for (
Int_t i = 1; i < 4; ++i) {
505 fAxisTitlePos[2].Set(cornerX[idxLeft], cornerY[idxLeft], z1);
513 for (
Int_t i = 0; i < 4; ++i) {
518 if (projZ[i] > zMin) zMin = projZ[i];
520 Int_t xyIdx = idxFront;
521 if (zMin - zt < 1
e-2) xyIdx = 0;
553 glGetDoublev(GL_MODELVIEW_MATRIX, mm.
Arr());
554 glGetDoublev(GL_PROJECTION_MATRIX, pm);
555 glGetIntegerv(GL_VIEWPORT, vp);
563 (up[1] - dn[1]) * (up[1] - dn[1]) +
564 (up[2] - dn[2]) * (up[2] - dn[2]));
622 Double_t sx = (bbox.XMax() - bbox.XMin()) / (
fAxis[0]->GetXmax() -
fAxis[0]->GetXmin());
623 Double_t sy = (bbox.YMax() - bbox.YMin()) / (
fAxis[1]->GetXmax() -
fAxis[1]->GetXmin());
624 Double_t sz = (bbox.ZMax() - bbox.ZMin()) / (
fAxis[2]->GetXmax() -
fAxis[2]->GetXmin());
628 glScaled(sx, sy, sz);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
int Ssiz_t
String size (currently int).
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Class to manage histogram axis.
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]
~TGLAxisPainterBox() override
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.
TGLAxisPainter(const TGLAxisPainter &)=delete
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=nullptr) 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
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)
TH1 is the base class of all histogram classes in ROOT.
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).
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
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)
Returns the largest of a and b.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Int_t FloorNint(Double_t x)
Returns the nearest integer of TMath::Floor(x).
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.