55 fPhysicalShapeColor(0),
59 fXAxis(hist->GetXaxis()),
60 fYAxis(hist->GetYaxis()),
61 fZAxis(hist->GetZaxis()),
64 fUpdateSelection(
kTRUE),
70 fBackBox(xoy, xoz, yoz),
73 fSelectionBase(kTrueColorSelectionBase),
78 fPadPhi =
gPad->GetPhi();
79 fPadTheta =
gPad->GetTheta();
88 fPhysicalShapeColor(0),
92 fXAxis(data->GetXAxis()),
93 fYAxis(data->GetYAxis()),
94 fZAxis(data->GetZAxis()),
97 fUpdateSelection(
kTRUE),
106 fSelectionBase(kTrueColorSelectionBase),
160 glGetIntegerv(GL_VIEWPORT, vp);
164 glDepthMask(GL_TRUE);
168 glPushAttrib(GL_LIGHTING_BIT);
177 glClear(GL_DEPTH_BUFFER_BIT);
179 const Float_t pos[] = {0.f, 0.f, 0.f, 1.f};
180 glLightfv(GL_LIGHT0, GL_POSITION, pos);
198 glViewport(vp[0], vp[1], vp[2], vp[3]);
201 glDepthMask(GL_FALSE);
242 Error(
"TGLPlotPainter::PrintPlot",
"Could not (re)open ps file for GL output");
248 Int_t gl2psFormat = GL2PS_EPS;
249 Int_t gl2psSort = GL2PS_BSP_SORT;
251 Int_t state = GL2PS_OVERFLOW;
252 GLint gl2psoption = GL2PS_USE_CURRENT_VIEWPORT |
255 GL2PS_OCCLUSION_CULL |
258 while (state == GL2PS_OVERFLOW) {
259 buffsize += 1024*1024;
260 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
NULL,
261 gl2psFormat, gl2psSort, gl2psoption,
262 GL_RGBA, 0,
NULL,0, 0, 0,
263 buffsize, output,
NULL);
265 state = gl2psEndPage();
280 glMatrixMode(GL_PROJECTION);
282 glMatrixMode(GL_MODELVIEW);
288 glDepthMask(GL_TRUE);
289 glClearColor(0.
f, 0.
f, 0.
f, 0.
f);
290 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
302 glDepthMask(GL_FALSE);
303 glDisable(GL_DEPTH_TEST);
306 glMatrixMode(GL_PROJECTION);
308 glMatrixMode(GL_MODELVIEW);
384 if (frontPoint == 2) {
387 }
else if (!frontPoint) {
390 }
else if (frontPoint == 1) {
393 }
else if (frontPoint == 3) {
398 if (frontPoint == 2) {
401 }
else if (!frontPoint) {
404 }
else if (frontPoint == 1) {
407 }
else if (frontPoint == 3) {
414 glGetDoublev(GL_MODELVIEW_MATRIX, mv);
416 glGetDoublev(GL_PROJECTION_MATRIX, pr);
418 glGetIntegerv(GL_VIEWPORT, vp);
422 gluProject(0., 0.,
fXOYSectionPos, mv, pr, vp, &winVertex[0], &winVertex[1], &winVertex[2]);
427 &winVertex[0], &winVertex[1], &winVertex[2]);
431 gluUnProject(winVertex[0], winVertex[1], winVertex[2], mv, pr, vp,
432 newPoint, newPoint + 1, newPoint + 2);
462 glEnable(GL_POLYGON_OFFSET_FILL);
463 glPolygonOffset(1.
f, 1.
f);
465 glDisable(GL_POLYGON_OFFSET_FILL);
473 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
474 glDepthMask(GL_FALSE);
479 glLineStipple(1, stipple);
481 glColor3d(0., 0., 0.);
488 glDepthMask(GL_TRUE);
505 glEnable(GL_POLYGON_OFFSET_FILL);
506 glPolygonOffset(1.
f, 1.
f);
508 glDisable(GL_POLYGON_OFFSET_FILL);
516 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
517 glDepthMask(GL_FALSE);
521 glLineStipple(1, 0x5555);
523 glColor3d(0., 0., 0.);
530 glDepthMask(GL_TRUE);
547 glEnable(GL_POLYGON_OFFSET_FILL);
548 glPolygonOffset(1.
f, 1.
f);
551 glDisable(GL_POLYGON_OFFSET_FILL);
559 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
560 glDepthMask(GL_FALSE);
562 glDepthMask(GL_TRUE);
592 glMatrixMode(GL_MODELVIEW);
600 glMatrixMode(GL_PROJECTION);
608 glMatrixMode(GL_MODELVIEW);
616 glMatrixMode(GL_PROJECTION);
657 if (fCoordType != type) {
736 fModified = !fModified;
752 switch (fCoordType) {
754 return SetRangesPolar(hist);
756 return SetRangesCylindrical(hist);
758 return SetRangesSpherical(hist);
761 return SetRangesCartesian(hist, errors, zBins);
770 return fXBins.second - fXBins.first + 1;
778 return fYBins.second - fYBins.first + 1;
786 return fZBins.second - fZBins.first + 1;
826 return fXRange.second - fXRange.first;
842 return fYRange.second - fYRange.first;
859 return fZRange.second - fZRange.first;
868 return fXRangeScaled;
876 return fYRangeScaled;
884 return fZRangeScaled;
913 if (!FindAxisRange(hist->
GetXaxis(), fXLog, xBins, xRange)) {
914 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set X axis to log scale");
920 if (!FindAxisRange(hist->
GetYaxis(), fYLog, yBins, yRange)) {
921 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set Y axis to log scale");
930 if (!FindAxisRange(hist->
GetZaxis(), fZLog, zBins, zRange)) {
931 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Cannot set Z axis to log scale");
934 }
else if (!FindAxisRange(hist, fZLog, xBins, yBins, zRange, factor, errors)) {
935 Error(
"TGLPlotCoordinates::SetRangesCartesian",
936 "Log scale is requested for Z, but maximum less or equal 0. (%f)", zRange.second);
941 const Double_t x = xRange.second - xRange.first;
942 const Double_t y = yRange.second - yRange.first;
943 const Double_t z = zRange.second - zRange.first;
945 if (!x || !y || !z) {
946 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Zero axis range.");
950 if (xRange != fXRange || yRange != fYRange || zRange != fZRange ||
951 xBins != fXBins || yBins != fYBins || zBins != fZBins || fFactor != factor)
956 fXRange = xRange, fXBins = xBins, fYRange = yRange, fYBins = yBins, fZRange = zRange, fZBins = zBins;
968 fXRangeScaled.first = fXRange.first * fXScale, fXRangeScaled.second = fXRange.second * fXScale;
969 fYRangeScaled.first = fYRange.first * fYScale, fYRangeScaled.second = fYRange.second * fYScale;
970 fZRangeScaled.first = fZRange.first * fZScale, fZRangeScaled.second = fZRange.second * fZScale;
993 if (!FindAxisRange(hist, fZLog, zRange))
997 const Double_t x = xRange.second - xRange.first;
998 const Double_t y = yRange.second - yRange.first;
999 const Double_t z = zRange.second - zRange.first;
1001 if (!x || !y || !z) {
1002 Error(
"TGLPlotCoordinates::SetRanges",
"Zero axis range.");
1006 if (xRange != fXRange || yRange != fYRange || zRange != fZRange ||
1007 xBins != fXBins || yBins != fYBins || zBins != fZBins || fFactor != factor)
1012 fXRange = xRange, fXBins = xBins, fYRange = yRange, fYBins = yBins, fZRange = zRange, fZBins = zBins;
1019 fXRangeScaled.first = fXRange.first * fXScale, fXRangeScaled.second = fXRange.second * fXScale;
1020 fYRangeScaled.first = fYRange.first * fYScale, fYRangeScaled.second = fYRange.second * fYScale;
1021 fZRangeScaled.first = fZRange.first * fZScale, fZRangeScaled.second = fZRange.second * fZScale;
1035 FindAxisRange(xAxis,
kFALSE, xBins, xRange);
1040 FindAxisRange(yAxis,
kFALSE, yBins, yRange);
1046 FindAxisRange(zAxis,
kFALSE, zBins, zRange);
1049 const Double_t x = xRange.second - xRange.first;
1050 const Double_t y = yRange.second - yRange.first;
1051 const Double_t z = zRange.second - zRange.first;
1053 if (!x || !y || !z) {
1054 Error(
"TGLPlotCoordinates::SetRangesCartesian",
"Zero axis range.");
1058 if (xRange != fXRange || yRange != fYRange || zRange != fZRange ||
1059 xBins != fXBins || yBins != fYBins || zBins != fZBins || fFactor != factor)
1064 fXRange = xRange, fXBins = xBins, fYRange = yRange, fYBins = yBins, fZRange = zRange, fZBins = zBins;
1076 fXRangeScaled.first = fXRange.first * fXScale, fXRangeScaled.second = fXRange.second * fXScale;
1077 fYRangeScaled.first = fYRange.first * fYScale, fYRangeScaled.second = fYRange.second * fYScale;
1078 fZRangeScaled.first = fZRange.first * fZScale, fZRangeScaled.second = fZRange.second * fZScale;
1091 FindAxisRange(xAxis,
kFALSE, xBins, phiRange);
1092 if (xBins.second - xBins.first + 1 > 360) {
1093 Error(
"TGLPlotCoordinates::SetRangesPolar",
"To many PHI sectors");
1100 FindAxisRange(yAxis,
kFALSE, yBins, roRange);
1104 if (!FindAxisRange(hist, fZLog, xBins, yBins, zRange, factor,
kFALSE))
1106 Error(
"TGLPlotCoordinates::SetRangesPolar",
1107 "Log scale is requested for Z, but maximum less or equal 0. (%f)", zRange.second);
1111 const Double_t z = zRange.second - zRange.first;
1112 if (!z || !(phiRange.second - phiRange.first) || !(roRange.second - roRange.first)) {
1113 Error(
"TGLPlotCoordinates::SetRangesPolar",
"Zero axis range.");
1117 if (phiRange != fXRange || roRange != fYRange || zRange != fZRange ||
1118 xBins != fXBins || yBins != fYBins || fFactor != factor)
1121 fXRange = phiRange, fXBins = xBins;
1122 fYRange = roRange, fYBins = yBins;
1131 fXRangeScaled.first = -fXScale, fXRangeScaled.second = fXScale;
1132 fYRangeScaled.first = -fYScale, fYRangeScaled.second = fYScale;
1133 fZRangeScaled.first = fZRange.first * fZScale, fZRangeScaled.second = fZRange.second * fZScale;
1149 FindAxisRange(xAxis,
kFALSE, xBins, angleRange);
1150 if (xBins.second - xBins.first + 1 > 360) {
1151 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"To many PHI sectors");
1154 if (!FindAxisRange(yAxis, fYLog, yBins, heightRange)) {
1155 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"Cannot set Y axis to log scale");
1158 FindAxisRange(hist,
kFALSE, xBins, yBins, radiusRange, factor,
kFALSE);
1160 const Double_t x = angleRange.second - angleRange.first;
1161 const Double_t y = heightRange.second - heightRange.first;
1162 const Double_t z = radiusRange.second - radiusRange.first;
1164 if (!x || !y || !z) {
1165 Error(
"TGLPlotCoordinates::SetRangesCylindrical",
"Zero axis range.");
1169 if (angleRange != fXRange || heightRange != fYRange ||
1170 radiusRange != fZRange || xBins != fXBins ||
1171 yBins != fYBins || fFactor != factor)
1174 fXRange = angleRange, fXBins = xBins;
1175 fYRange = heightRange, fYBins = yBins;
1176 fZRange = radiusRange;
1184 fXRangeScaled.first = -fXScale, fXRangeScaled.second = fXScale;
1185 fYRangeScaled.first = fYRange.first * fYScale, fYRangeScaled.second = fYRange.second * fYScale;
1186 fZRangeScaled.first = -fZScale, fZRangeScaled.second = fZScale;
1199 if (xBins.second - xBins.first + 1 > 360) {
1200 Error(
"TGLPlotCoordinates::SetRangesSpherical",
"To many PHI sectors");
1207 if (yBins.second - yBins.first + 1 > 180) {
1208 Error(
"TGLPlotCoordinates::SetRangesSpherical",
"To many THETA sectors");
1214 FindAxisRange(hist,
kFALSE, xBins, yBins, radiusRange, factor,
kFALSE);
1216 if (xBins != fXBins || yBins != fYBins ||
1217 phiRange != fXRange || thetaRange != fYRange ||
1218 radiusRange != fZRange || fFactor != factor)
1224 fYRange = thetaRange,
1225 fZRange = radiusRange;
1232 fXRangeScaled.first = -fXScale, fXRangeScaled.second = fXScale;
1233 fYRangeScaled.first = -fYScale, fYRangeScaled.second = fYScale;
1234 fZRangeScaled.first = -fZScale, fZRangeScaled.second = fZScale;
1254 for (
const Int_t lastBin = axis->
GetLast(); currBin <= lastBin; ++currBin)
1277 if (range.second <= 0.)
1282 if (range.first <= 0.) {
1285 if (bin > bins.second)
1290 if (bin > bins.second)
1315 zRange.second = hist->
GetBinContent(hist->
GetBin(xBins.first, yBins.first)), zRange.first = zRange.second;
1318 for (
Int_t i = xBins.first; i <= xBins.second; ++i) {
1319 for (
Int_t j = yBins.first; j <= yBins.second; ++j) {
1321 if (val > 0. && errors)
1323 zRange.second =
TMath::Max(val, zRange.second);
1324 zRange.first =
TMath::Min(val, zRange.first);
1334 if (logZ && zRange.second <= 0.)
1337 if (zRange.first >= zRange.second)
1338 zRange.first = 0.001 * zRange.second;
1341 if (summ) factor /= summ;
1342 if (!factor) factor = 1.;
1344 Warning(
"TGLPlotPainter::ExtractAxisZInfo",
1345 "Negative factor, negative ranges - possible incorrect behavior");
1347 zRange.second *= factor;
1348 zRange.first *= factor;
1351 if (zRange.first <= 0.)
1352 zRange.first =
TMath::Min(1., 0.001 * zRange.second);
1363 zRange.second += margin * (zRange.second - zRange.first);
1366 zRange.first >= 0 ? zRange.first = 0. : zRange.first -= margin * (zRange.second - zRange.first);
1368 zRange.first >= 0 && zRange.first - margin * (zRange.second - zRange.first) <= 0 ?
1369 zRange.first = 0 : zRange.first -= margin * (zRange.second - zRange.first);
1382 Error(
"FindAxisRange",
"TH2Poly returned empty list of bins");
1389 if (zRange.first >= zRange.second)
1390 zRange.first = 0.001 * zRange.second;
1393 if (zRange.second < 1
e-20) {
1394 Error(
"FindAxisRange",
"Failed to switch Z axis to logarithmic scale");
1398 if (zRange.first <= 0.)
1399 zRange.first =
TMath::Min(1., 0.001 * zRange.second);
1410 zRange.second += margin * (zRange.second - zRange.first);
1412 zRange.first >= 0 ? zRange.first = 0. : zRange.first -= margin * (zRange.second - zRange.first);
1414 zRange.first >= 0 && zRange.first - margin * (zRange.second - zRange.first) <= 0 ?
1415 zRange.first = 0 : zRange.first -= margin * (zRange.second - zRange.first);
1477 const Int_t frontPoint = fPlotBox->GetFrontPoint();
1479 const TGLVertex3 center((box[0].
X() + box[1].
X()) / 2, (box[0].
Y() + box[2].
Y()) / 2,
1480 (box[0].
Z() + box[4].
Z()) / 2);
1481 fXLength = fFactor * (box[1].
X() - box[0].
X());
1482 fYLength = fFactor * (box[2].
Y() - box[0].
Y());
1483 fZLength = fFactor * (box[4].
Z() - box[0].
Z());
1487 fCenter.X() = box[0].
X();
1488 fCenter.Y() = box[0].
Y();
1491 fCenter.X() = box[1].
X();
1492 fCenter.Y() = box[0].
Y();
1495 fCenter.X() = box[2].
X();
1496 fCenter.Y() = box[2].
Y();
1499 fCenter.X() = box[0].
X();
1500 fCenter.Y() = box[2].
Y();
1504 fCenter.Z() = box[0].
Z() * 0.5 + box[4].
Z() * 0.5;
1513 if (!selectionPass) {
1514 glDisable(GL_LIGHTING);
1519 glVertex3d(fXRange.first, (fYRange.first + fYRange.second) / 2, (fZRange.first + fZRange.second) / 2);
1520 glVertex3d(fXRange.second, (fYRange.first + fYRange.second) / 2, (fZRange.first + fZRange.second) / 2);
1525 glVertex3d((fXRange.first + fXRange.second) / 2, fYRange.first, (fZRange.first + fZRange.second) / 2);
1526 glVertex3d((fXRange.first + fXRange.second) / 2, fYRange.second, (fZRange.first + fZRange.second) / 2);
1531 glVertex3d((fXRange.first + fXRange.second) / 2, (fYRange.first + fYRange.second) / 2, fZRange.first);
1532 glVertex3d((fXRange.first + fXRange.second) / 2, (fYRange.first + fYRange.second) / 2, fZRange.second);
1536 glEnable(GL_LIGHTING);
1538 GLboolean oldBlendState =
kFALSE;
1539 glGetBooleanv(GL_BLEND, &oldBlendState);
1544 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1547 const Float_t diffuseColor[] = {0.f, 0.f, 1.f, 0.1f};
1548 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuseColor);
1551 fZRange.first, fZRange.second, fPlotBox->GetFrontPoint());
1554 glDisable(GL_BLEND);
1559 glVertex3d(fXRange.first, (fYRange.first + fYRange.second) / 2, (fZRange.first + fZRange.second) / 2);
1560 glVertex3d(fXRange.second, (fYRange.first + fYRange.second) / 2, (fZRange.first + fZRange.second) / 2);
1565 glVertex3d((fXRange.first + fXRange.second) / 2, fYRange.first, (fZRange.first + fZRange.second) / 2);
1566 glVertex3d((fXRange.first + fXRange.second) / 2, fYRange.second, (fZRange.first + fZRange.second) / 2);
1571 glVertex3d((fXRange.first + fXRange.second) / 2, (fYRange.first + fYRange.second) / 2, fZRange.first);
1572 glVertex3d((fXRange.first + fXRange.second) / 2, (fYRange.first + fYRange.second) / 2, fZRange.second);
1593 glGetDoublev(GL_MODELVIEW_MATRIX, mv);
1595 glGetDoublev(GL_PROJECTION_MATRIX, pr);
1597 glGetIntegerv(GL_VIEWPORT, vp);
1602 gluProject(fCenter.X(), 0., 0., mv, pr, vp, &winVertex[0], &winVertex[1], &winVertex[2]);
1605 gluProject(0., fCenter.Y(), 0., mv, pr, vp, &winVertex[0], &winVertex[1], &winVertex[2]);
1608 gluProject(0., 0., fCenter.Z(), mv, pr, vp, &winVertex[0], &winVertex[1], &winVertex[2]);
1612 winVertex[0] += px - fMousePos.fX;
1613 winVertex[1] += py - fMousePos.fY;
1615 gluUnProject(winVertex[0], winVertex[1], winVertex[2], mv, pr, vp,
1616 newPoint, newPoint + 1, newPoint + 2);
1622 if (newPoint[0] >= box[1].
X() + 0.4 * fXLength)
1624 if (newPoint[0] <= box[0].
X() - 0.4 * fXLength)
1626 fCenter.X() = newPoint[0];
1629 if (newPoint[1] >= box[2].
Y() + 0.4 * fYLength)
1631 if (newPoint[1] <= box[0].
Y() - 0.4 * fYLength)
1633 fCenter.Y() = newPoint[1];
1636 if (newPoint[2] >= box[4].
Z() + 0.4 * fZLength)
1638 if (newPoint[2] <= box[0].
Z() - 0.4 * fZLength)
1640 fCenter.Z() = newPoint[2];
1657 fXRange.first = fCenter.X() - fXLength / 2.;
1658 fXRange.second = fCenter.X() + fXLength / 2.;
1659 fYRange.first = fCenter.Y() - fYLength / 2.;
1660 fYRange.second = fCenter.Y() + fYLength / 2.;
1661 fZRange.first = fCenter.Z() - fZLength / 2.;
1662 fZRange.second = fCenter.Z() + fZLength / 2.;
1664 fXRange.first =
TMath::Max(fXRange.first, box[0].
X());
1665 fXRange.first =
TMath::Min(fXRange.first, box[1].
X());
1666 fXRange.second =
TMath::Min(fXRange.second, box[1].
X());
1667 fXRange.second =
TMath::Max(fXRange.second, box[0].
X());
1669 fYRange.first =
TMath::Max(fYRange.first, box[0].
Y());
1670 fYRange.first =
TMath::Min(fYRange.first, box[2].
Y());
1671 fYRange.second =
TMath::Min(fYRange.second, box[2].
Y());
1672 fYRange.second =
TMath::Max(fYRange.second, box[0].
Y());
1674 fZRange.first =
TMath::Max(fZRange.first, box[0].
Z());
1675 fZRange.first =
TMath::Min(fZRange.first, box[4].
Z());
1676 fZRange.second =
TMath::Min(fZRange.second, box[4].
Z());
1677 fZRange.second =
TMath::Max(fZRange.second, box[0].
Z());
1686 if (((xMin >= fXRange.first && xMin < fXRange.second) || (xMax > fXRange.first && xMax <= fXRange.second)) &&
1687 ((yMin >= fYRange.first && yMin < fYRange.second) || (yMax > fYRange.first && yMax <= fYRange.second)) &&
1688 ((zMin >= fZRange.first && zMin < fZRange.second) || (zMax > fZRange.first && zMax <= fZRange.second)))
1763 Int_t low = 1, up = 2;
1868 for (
Int_t level = low; level < up; ++ level)
1893 for (
Int_t level = low; level < up; ++ level)
1918 for (
Int_t level = low; level < up; ++ level)
1961 glBegin(GL_POLYGON);
1963 glVertex3d(xMin, pos, zMin);
1965 glVertex3d(xMin, pos, zMax);
1967 glVertex3d(xMax, pos, zMax);
1969 glVertex3d(xMax, pos, zMin);
1982 glBegin(GL_POLYGON);
1984 glVertex3d(pos, yMin, zMin);
1986 glVertex3d(pos, yMax, zMin);
1988 glVertex3d(pos, yMax, zMax);
1990 glVertex3d(pos, yMin, zMax);
2003 glBegin(GL_POLYGON);
2005 glVertex3d(xMax, yMin, pos);
2007 glVertex3d(xMax, yMax, pos);
2009 glVertex3d(xMin, yMax, pos);
2011 glVertex3d(xMin, yMin, pos);
2026 glBegin(GL_LINE_LOOP);
2027 glVertex3d(xMin, yMin, zMin);
2028 glVertex3d(xMax, yMin, zMin);
2029 glVertex3d(xMax, yMax, zMin);
2030 glVertex3d(xMin, yMax, zMin);
2033 glBegin(GL_LINE_LOOP);
2034 glVertex3d(xMin, yMin, zMax);
2035 glVertex3d(xMax, yMin, zMax);
2036 glVertex3d(xMax, yMax, zMax);
2037 glVertex3d(xMin, yMax, zMax);
2041 glVertex3d(xMin, yMin, zMin);
2042 glVertex3d(xMin, yMin, zMax);
2043 glVertex3d(xMax, yMin, zMin);
2044 glVertex3d(xMax, yMin, zMax);
2045 glVertex3d(xMax, yMax, zMin);
2046 glVertex3d(xMax, yMax, zMax);
2047 glVertex3d(xMin, yMax, zMin);
2048 glVertex3d(xMin, yMax, zMax);
2059 glColor3d(1., 0., 0.);
2064 DrawBoxOutline(box[0].
X(), box[1].
X(),
2067 box[0].
Z(), box[4].
Z());
2072 box[0].
Y(), box[2].
Y(),
2073 box[0].
Z(), box[4].
Z());
2076 DrawBoxOutline(box[0].
X(), box[1].
X(),
2077 box[0].
Y(), box[2].
Y(),
2092 const Double_t center[] = {(box[0].
X() + box[1].
X()) / 2,
2093 (box[0].
Y() + box[2].
Y()) / 2,
2094 (box[0].
Z() + box[4].
Z()) / 2};
2097 glTranslated(-center[0], -center[1], -center[2]);
2124 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2126 glMatrixMode(GL_PROJECTION);
2130 glMatrixMode(GL_MODELVIEW);
2139 glBegin(GL_POLYGON);
2141 glColor4ub(color[0], color[1], color[2], 150);
2142 glVertex2d(leftX, margin + i * h);
2143 glVertex2d(rightX, margin + i * h);
2144 glVertex2d(rightX, margin + (i + 1) * h);
2145 glVertex2d(leftX, margin + (i + 1) * h);
2150 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
2151 glColor4d(0., 0., 0., 0.5);
2154 glBegin(GL_LINE_LOOP);
2155 glVertex2d(leftX, margin + i * h);
2156 glVertex2d(rightX, margin + i * h);
2157 glVertex2d(rightX, margin + (i + 1) * h);
2158 glVertex2d(leftX, margin + (i + 1) * h);
2168 const std::vector<Double_t> & levels)
2174 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2176 glMatrixMode(GL_PROJECTION);
2180 glMatrixMode(GL_MODELVIEW);
2187 const Double_t range = levels.back() - levels.front();
2192 const Double_t yMin = margin + (levels[i] - levels.front()) / range * h;
2193 const Double_t yMax = margin + (levels[i + 1] - levels.front()) / range * h;
2194 glBegin(GL_POLYGON);
2196 glColor4ub(color[0], color[1], color[2], opacity);
2197 glVertex2d(leftX, yMin);
2198 glVertex2d(rightX, yMin);
2199 glVertex2d(rightX, yMax);
2200 glVertex2d(leftX, yMax);
2205 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
2206 glColor4d(0., 0., 0., 0.5);
2209 const Double_t yMin = (levels[i] - levels.front()) / range * h;
2210 const Double_t yMax = (levels[i + 1] - levels.front()) / range * h;
2212 glBegin(GL_LINE_LOOP);
2213 glVertex2d(leftX, margin + yMin);
2214 glVertex2d(rightX, margin + yMin);
2215 glVertex2d(rightX, margin + yMax);
2216 glVertex2d(leftX, margin + yMax);
2232 pixelW =
UInt_t(pixelW / scale);
2233 pixelH =
UInt_t(pixelH / scale);
2238 +
gPad->GetYlowNDC() *
gPad->GetWh())));
2240 +
gPad->GetYlowNDC() *
gPad->GetWh())));
2256 TGaxis axisPainter(x, yMin, x, yMax, zMin, zMax, 510, logZ ?
"G" :
"");
2257 axisPainter.
Paint();
2259 gPad->SetLogx(logX);
2260 gPad->SetLogy(logY);
void ResetBoxGeometry()
Set geometry using plot's back box.
virtual const char * GetName() const
Returns name of object.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
virtual Double_t GetMaximumStored() const
Double_t GetFactor() const
Get factor.
Int_t GetFrontPoint() const
The nearest point.
void SetRowLen(Int_t len)
void RestoreModelviewMatrix() const
const Rgl::BinRange_t & GetZBins() const
Z bins range.
Camera for TGLPlotPainter and sub-classes.
Int_t GetFirstXBin() const
void ReadColorBuffer(Int_t width, Int_t height)
Read color buffer.
void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &normal)
Draw quad face.
Int_t GetFirst() const
Return first bin on the axis i.e.
Int_t GetNYBins() const
Number of Y bins.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
const Rgl::BinRange_t & GetYBins() const
Y bins range.
Int_t GetNumberContours() const
const Float_t gNullEmission[]
void PrintPlot() const
Generate PS using gl2ps.
Bool_t GetZLog() const
Get Z log.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
void swap(TDirectoryEntry &e1, TDirectoryEntry &e2) noexcept
std::pair< Double_t, Double_t > Range_t
Double_t GetHistTopMargin() const
virtual Double_t GetMinimumStored() const
virtual Double_t GetNormFactor() const
R__EXTERN TStyle * gStyle
Double_t GetYLength() const
Y length.
EGLCoordType GetCoordType() const
Get coordinates type.
void DrawSections() const
Draw sections (if any).
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Int_t GetPaletteSize() const
Get. Palette. Size.
Double_t GetTexCoord(Double_t z) const
Get tex coordinate.
virtual Int_t GetEntries() const
const TGLVertex3 * Get3DBox() const
Get 3D box.
const Rgl::BinRange_t & GetXBins() const
X bins range.
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
Double_t GetZLength() const
Z length.
const Rgl::Range_t & GetZRange() const
Z range.
void DrawSliceTextured(Double_t pos) const
Draw slice textured.
Bool_t PreparePalette() const
Initialize color palette.
Int_t GetNXBins() const
Number of X bins.
const Float_t gBlueEmission[]
Int_t GetWidth() const
viewport[2]
Short_t Min(Short_t a, Short_t b)
R__EXTERN TVirtualMutex * gROOTMutex
void TurnOnOff()
Turn the box cut on/off.
const UChar_t * GetColour(Double_t z) const
Get color.
Bool_t GetYLog() const
Get Y log.
void AdjustBox()
Box cut is limited by plot's sizes.
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
const TGLPlotCoordinates * fCoord
void FindMinMax(Int_t sliceBegin, Int_t sliceEnd) const
Find minimum and maximum for slice.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawAxes(Int_t frontPoint, const Int_t *viewport, const TGLVertex3 *box2D, const TGLPlotCoordinates *plotCoord, TAxis *xAxis, TAxis *yAxis, TAxis *zAxis)
Using front point, find, where to draw axes and which labels to use for them gVirtualX->SelectWindow(...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Bool_t SetRangesCartesian(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges, etc.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetNZBins() const
Number of Z bins.
const Double_t gH2PolyScaleXY
virtual void SetFrameColor(const TColor *frameColor)
Set plot's back box color.
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
TGL2DArray< Double_t > fTexCoords
virtual ~TGLBoxCut()
Destructor.
The TNamed class is the base class for all named ROOT classes.
3 component (x/y/z) vertex class.
virtual void DrawPaletteAxis() const
Draw. Palette. Axis.
void EnableTexture(Int_t mode) const
Enable 1D texture.
Double_t Log10(Double_t x)
virtual Bool_t PlotSelected(Int_t px, Int_t py)
Read color buffer content to find selected object.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual void DrawSectionYOZ() const =0
void SetCamera() const
Viewport and projection.
Int_t GetFirstYBin() const
void SetYLog(Bool_t yLog)
If log changed, sections must be reset, set fModified.
3 component (x/y/z) vector class.
const TColor * GetPadColor() const
Get pad color.
Implementation of a box around a histogram/function for plot-painters.
Bool_t SetRangesSpherical(const TH1 *hist)
Set ranges spherical.
void Error(const char *location, const char *msgfmt,...)
The 3-D histogram classes derived from the 1-D histogram classes.
Int_t ColorToObjectID(const UChar_t *color, Bool_t highColor)
const UChar_t * GetPixelColor(Int_t px, Int_t py) const
Get pixel color.
Bool_t GetXLog() const
Get X log.
Bool_t SetRangesPolar(const TH1 *hist)
Set bin ranges, ranges, etc.
Double_t GetXLength() const
X length.
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
static void StartEmbeddedPS()
this function used by gl-in-pad
void RestoreProjectionMatrix() const
void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego's bar as a 3d box.
Int_t GetLastYBin() const
void SetSliceWidth(Int_t width=1)
Set Slice width.
TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord, Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable)
TGLPlotPainter's ctor.
Int_t GetLast() const
Return last bin on the axis i.e.
Class to manage histogram axis.
void DrawSliceFrame(Int_t low, Int_t up) const
Draw slice frame.
static void InitializeIfNeeded()
Initialize globals that require other libraries to be initialized.
A 3-Dim function with parameters.
std::pair< Int_t, Int_t > BinRange_t
virtual void DrawSectionXOY() const =0
void SetPadColor(const TColor *color)
Used in a pad.
Bool_t GetHistMinimumZero() const
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void ResetModified()
Reset modified.
const Rgl::Range_t & GetXRange() const
X range.
void DrawSlice(Double_t pos) const
Draw slice.
Int_t FindFrontPoint() const
Convert 3d points into window coordinate system and find the nearest.
void SetXLog(Bool_t xLog)
If log changed, sections must be reset, set fModified.
virtual void ClearBuffers() const
TGLSelectionBuffer fSelection
void Warning(const char *location, const char *msgfmt,...)
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
std::vector< Double_t > fZLevels
#define R__LOCKGUARD2(mutex)
void SetActive(Bool_t a)
Turn the box cut on/off.
void PrepareTexCoords(Double_t pos, Int_t sliceBegin, Int_t sliceEnd) const
Prepare TexCoords.
Double_t GetYScale() const
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
void SetFrameColor(const TColor *color)
Back box color.
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
Int_t GetY() const
viewport[1]
Bool_t Modified() const
Modified.
void SaveProjectionMatrix() const
Double_t GetMinimum() const
Returns the minimum value of the histogram.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void DrawSectionXOZ() const =0
The color creation and management class.
Int_t GetFirstZBin() const
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
const Rgl::Range_t & GetYRange() const
Y range.
virtual void DeInitGL() const =0
void DisableTexture() const
Disable 1D texture.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
Bool_t IsVariableBinSize() const
Int_t GetLastXBin() const
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
you should not use this method at all Int_t Int_t z
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
const Float_t * fPhysicalShapeColor
void SetZLog(Bool_t zLog)
If log changed, sections must be reset, set fModified.
const TGLPlotPainter * fPainter
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
Short_t Max(Short_t a, Short_t b)
static void CloseEmbeddedPS()
this function used by gl-in-pad Restore the gVirtualPS output stream
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
R__EXTERN TVirtualPS * gVirtualPS
Bool_t SetRangesCylindrical(const TH1 *hist)
Set ranges cylindrical.
virtual void InitGL() const =0
TGLTH3Slice(const TString &sliceName, const TH3 *hist, const TGLPlotCoordinates *coord, const TGLPlotBox *box, ESliceAxis axis)
Constructor.
Used by plot-painters to determine the area of the plot that is cut away.
Int_t GetLastZBin() const
virtual Double_t GetCellError(Int_t binx, Int_t biny) const
Int_t GetHeight() const
viewport[3]
void SaveModelviewMatrix() const
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
TGLPlotCoordinates * fCoord
virtual void Paint()
Draw lego/surf/whatever you can.
virtual void DrawPlot() const =0
virtual ~TGLPlotCoordinates()
Destructor.
void InvalidateSelection()
Selection must be updated.
Double_t GetZScale() const
Double_t GetMaximum() const
Returns the maximum value of the histogram.
Int_t GetX() const
viewport[0]
Double_t GetXScale() const
2D Histogram with Polygonal Bins
const TGLVertex3 * Get2DBox() const
Get 2D box.
Bool_t IsInCut(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax) const
Check, if box defined by xmin/xmax etc. is in cut.