17#include "TGLIncludes.h"
67 if (orig.empty())
return;
69 Float_t center =
fM->GetManager()->GetProjection()->GetProjectedCenter()[idx];
77 for (TGLAxisPainter::LabVec_t::iterator it = orig.begin(); it != orig.end(); ++it)
90 filtered.push_back(orig[minIdx]);
92 Float_t minDist = 4*
fM->GetLabelSize()*ref;
98 pos = orig[minIdx].first;
99 for (
Int_t i=minIdx-1; i>=0; --i)
101 if (
TMath::Abs(pos - orig[i].first) > minDist)
103 filtered.push_back(orig[i]);
110 if (minIdx < (
size -1))
112 pos = orig[minIdx].first;
115 if (
TMath::Abs(orig[i].first - pos) > minDist)
117 filtered.push_back(orig[i]);
124 if (filtered.size() >= 2)
127 fAxisPainter.SetTextFormat(orig.front().second, orig.back().second, orig[minIdx].second - orig[minIdx-1].second);
129 fAxisPainter.SetTextFormat(orig.front().second, orig.back().second, orig[minIdx+1].second - orig[minIdx].second);
135 fAxisPainter.SetTextFormat(orig.front().second, orig.back().second, orig.back().second - orig.front().second);
170 Int_t n2a =
fM->GetNdivisions() - n1a * 100;
173 Double_t bl1=0, bh1=0, bl2=0, bh2=0;
193 for (
Int_t i=1; i<bn2; i++)
195 if (pMinor > p2)
break;
203 pMinor = n1*bw1 -bw2;
222 Int_t n2a =
fM->GetNdivisions() - n1a * 100;
225 Double_t bl1=0, bh1=0, bl2=0, bh2=0;
249 for (
Int_t k=1; k<bn2; k++)
251 pSecond =
fProjection->GetScreenVal(ax,
v+k*bw2, dirVec, oCenter);
252 if (pSecond > p2)
break;
262 pSecond =
fProjection->GetScreenVal(ax,
v, dirVec, oCenter);
263 if (pSecond < p1)
break;
278 Float_t off = ( bb[ax*2 + 1] - bb[ax*2]) * 0.5;
284 if (frustMin > bbMin) {
286 min += (frustMax - frustMin) * 0.1;
293 if (frustMax < bbMax) {
295 max -= (frustMax - frustMin) * 0.1;
321 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
323 glDisable(GL_LIGHTING);
324 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
325 glEnable(GL_COLOR_MATERIAL);
326 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
327 glDisable(GL_CULL_FACE);
331 glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
332 glDepthRange(0, 0.001);
341 if (
fM->fUseColorSet)
348 glDisable(GL_LIGHTING);
353 if (
fM->GetDrawCenter())
358 glVertex3f(
c[0] +
d,
c[1],
c[2]); glVertex3f(
c[0] -
d,
c[1],
c[2]);
359 glVertex3f(
c[0],
c[1] +
d,
c[2]); glVertex3f(
c[0],
c[1] -
d,
c[2]);
360 glVertex3f(
c[0],
c[1],
c[2] +
d); glVertex3f(
c[0],
c[1],
c[2] -
d);
363 if (
fM->GetDrawOrigin())
369 glVertex3f(zero[0] +
d, zero[1], zero[2]); glVertex3f(zero[0] -
d, zero[1], zero[2]);
370 glVertex3f(zero[0], zero[1] +
d, zero[2]); glVertex3f(zero[0], zero[1] -
d, zero[2]);
371 glVertex3f(zero[0], zero[1], zero[2] +
d); glVertex3f(zero[0], zero[1], zero[2] -
d);
379 using namespace TMath;
381 glGetIntegerv(GL_VIEWPORT, vp);
403 glTranslatef( 0,
b, 0);
411 glTranslatef( 0, t, 0);
434 glTranslatef(
l, 0, 0);
442 glTranslatef(
r, 0, 0);
452 Warning(
"TEveProjectionAxesGL::DirectDraw",
"caught exception: '%s'.", exc.
Data());
455 glDepthRange(old_depth_range[0], old_depth_range[1]);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TEveVectorT< Float_t > TEveVector
Exception class thrown by TEve classes and macros.
TEveProjectionAxesGL()
Constructor.
void Draw(TGLRnrCtx &rnrCtx) const override
Draw function for TEveProjectionAxesGL. Skips line-pass of outline mode.
void SplitIntervalByVal(Float_t min, Float_t max, Int_t axis) const
Add tick-marks on fixed value step.
void SplitIntervalByPos(Float_t min, Float_t max, Int_t axis) const
Add tick-marks at equidistant position.
TEveProjection * fProjection
TGLAxisPainter fAxisPainter
void FilterOverlappingLabels(Int_t idx, Float_t ref) const
Filter overlapping labels.
void GetRange(Int_t ax, Float_t frustMin, Float_t frustMax, Float_t &start, Float_t &en) const
Get range from bounding box of projection manager and frustum size.
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Actual rendering code.
void SetBBox() override
Fill the bounding-box data of the logical-shape.
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Set model object.
void SplitInterval(Float_t x1, Float_t x2, Int_t axis) const
Build an array of tick-mark position-value pairs.
Axes for non-linear projections.
std::pair< Float_t, Int_t > TM_t
std::vector< Lab_t > LabVec_t
std::vector< TM_t > TMVec_t
std::pair< Float_t, Float_t > Lab_t
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
const TGLPlane & FrustumPlane(EFrustumPlane plane) const
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw the GL drawable, using draw flags.
TObject * fExternalObj
! Also plays the role of ID.
Bool_t fDLCache
! use display list caching
TT * SetModelDynCast(TObject *obj)
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Bool_t IsDrawPassOutlineLine() const
static void Color(const TGLColor &color)
Set color from TGLColor.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
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.
Mother of all ROOT objects.
const char * Data() const
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 Abs(Short_t d)
Returns the absolute value of parameter Short_t d.