33#include "TGLIncludes.h"
131 std::cout <<
"(" <<
fVals[0] <<
"," <<
fVals[1] <<
"," <<
fVals[2] <<
")" << std::endl;
210 glBegin(GL_LINE_LOOP);
212 glVertex3dv(
End().CArr());
333 Set(1.0, 1.0, 1.0, 0.0);
398 Error(
"TGLPlane::Normalise",
"trying to normalise plane with zero magnitude normal");
413 std::cout.precision(6);
414 std::cout <<
"Plane : " <<
fVals[0] <<
"x + " <<
fVals[1] <<
"y + " <<
fVals[2] <<
"z + " <<
fVals[3] << std::endl;
515 if (lineDir.
Mag() == 0.0) {
520 Dot(lineDir, lineDir);
536 return std::make_pair(
kTRUE, interVert);
557 plane.
B()*
line.Vector().Y() +
558 plane.
C()*
line.Vector().Z());
565 plane.
C()*
line.Start().Z() + plane.
D();
569 if (!extend && (factor < 0.0 || factor > 1.0)) {
574 return std::make_pair(
kTRUE,
line.Start() + toPlane);
647 arbAxis.
Set(1.0, 0.0, 0.0);
649 arbAxis.
Set(0.0, 1.0, 0.0);
651 arbAxis.
Set(0.0, 0.0, 1.0);
654 Set(origin, zAxis,
Cross(zAxisInt, arbAxis));
665 Set(origin, zAxis, xAxis);
700 for(
int r=0;
r<4; ++
r, ++C)
703 for(
int c=0;
c<4; ++
c, T+=4)
704 B[
c] = C[0]*T[0] + C[4]*T[1] + C[8]*T[2] + C[12]*T[3];
705 C[0] = B[0]; C[4] = B[1]; C[8] = B[2]; C[12] = B[3];
716 for (
int c=0;
c<4; ++
c, C+=4)
719 for(
int r=0;
r<4; ++
r, ++T)
720 B[
r] = T[0]*C[0] + T[4]*C[1] + T[8]*C[2] + T[12]*C[3];
721 C[0] = B[0]; C[1] = B[1]; C[2] = B[2]; C[3] = B[3];
751 for (
UInt_t i=0; i < 16; i++) {
780 fVals[12] = translation[0];
781 fVals[13] = translation[1];
782 fVals[14] = translation[2];
798 fVals[12] += vect[0];
799 fVals[13] += vect[1];
800 fVals[14] += vect[2];
810 fVals[12] += amount*C[0];
fVals[13] += amount*C[1];
fVals[14] += amount*C[2];
833 if (currentScale[0] != 0.0) {
834 fVals[0] *= scale[0]/currentScale[0];
835 fVals[1] *= scale[0]/currentScale[0];
836 fVals[2] *= scale[0]/currentScale[0];
838 Error(
"TGLMatrix::Scale()",
"zero scale div by zero");
841 if (currentScale[1] != 0.0) {
842 fVals[4] *= scale[1]/currentScale[1];
843 fVals[5] *= scale[1]/currentScale[1];
844 fVals[6] *= scale[1]/currentScale[1];
846 Error(
"TGLMatrix::Scale()",
"zero scale div by zero");
849 if (currentScale[2] != 0.0) {
850 fVals[8] *= scale[2]/currentScale[2];
851 fVals[9] *= scale[2]/currentScale[2];
852 fVals[10] *= scale[2]/currentScale[2];
854 Error(
"TGLMatrix::Scale()",
"zero scale div by zero");
876 rotMat[ 0] =
x*
x*(1-
c) +
c; rotMat[ 4] =
x*
y*(1-
c) - z*s; rotMat[ 8] =
x*z*(1-
c) +
y*s; rotMat[12] = pivot[0];
877 rotMat[ 1] =
y*
x*(1-
c) + z*s; rotMat[ 5] =
y*
y*(1-
c) +
c; rotMat[ 9] =
y*z*(1-
c) -
x*s; rotMat[13] = pivot[1];
878 rotMat[ 2] =
x*z*(1-
c) -
y*s; rotMat[ 6] =
y*z*(1-
c) +
x*s; rotMat[10] = z*z*(1-
c) +
c; rotMat[14] = pivot[2];
879 rotMat[ 3] = 0.0; rotMat[ 7] = 0.0; rotMat[11] = 0.0; rotMat[15] = 1.0;
884 *
this = rotMat * localToWorld * (*this);
897 --i1 <<= 2; --i2 <<= 2;
898 for(
int r=0;
r<4; ++
r, ++
c) {
899 b1 = cos*
c[i1] + sin*
c[i2];
900 b2 = cos*
c[i2] - sin*
c[i1];
901 c[i1] = b1;
c[i2] = b2;
917 for(
int c=0;
c<4; ++
c, C+=4) {
918 b1 = cos*C[i1] - sin*C[i2];
919 b2 = cos*C[i2] + sin*C[i1];
920 C[i1] = b1; C[i2] = b2;
930 for (
UInt_t i = 0; i < 3; i++) {
931 vertex[i] = orig[0] *
fVals[0+i] + orig[1] *
fVals[4+i] +
969 const Double_t det2_12_01 = M[1]*M[6] - M[5]*M[2];
970 const Double_t det2_12_02 = M[1]*M[10] - M[9]*M[2];
971 const Double_t det2_12_03 = M[1]*M[14] - M[13]*M[2];
972 const Double_t det2_12_13 = M[5]*M[14] - M[13]*M[6];
973 const Double_t det2_12_23 = M[9]*M[14] - M[13]*M[10];
974 const Double_t det2_12_12 = M[5]*M[10] - M[9]*M[6];
975 const Double_t det2_13_01 = M[1]*M[7] - M[5]*M[3];
976 const Double_t det2_13_02 = M[1]*M[11] - M[9]*M[3];
977 const Double_t det2_13_03 = M[1]*M[15] - M[13]*M[3];
978 const Double_t det2_13_12 = M[5]*M[11] - M[9]*M[7];
979 const Double_t det2_13_13 = M[5]*M[15] - M[13]*M[7];
980 const Double_t det2_13_23 = M[9]*M[15] - M[13]*M[11];
981 const Double_t det2_23_01 = M[2]*M[7] - M[6]*M[3];
982 const Double_t det2_23_02 = M[2]*M[11] - M[10]*M[3];
983 const Double_t det2_23_03 = M[2]*M[15] - M[14]*M[3];
984 const Double_t det2_23_12 = M[6]*M[11] - M[10]*M[7];
985 const Double_t det2_23_13 = M[6]*M[15] - M[14]*M[7];
986 const Double_t det2_23_23 = M[10]*M[15] - M[14]*M[11];
989 const Double_t det3_012_012 = M[0]*det2_12_12 - M[4]*det2_12_02 + M[8]*det2_12_01;
990 const Double_t det3_012_013 = M[0]*det2_12_13 - M[4]*det2_12_03 + M[12]*det2_12_01;
991 const Double_t det3_012_023 = M[0]*det2_12_23 - M[8]*det2_12_03 + M[12]*det2_12_02;
992 const Double_t det3_012_123 = M[4]*det2_12_23 - M[8]*det2_12_13 + M[12]*det2_12_12;
993 const Double_t det3_013_012 = M[0]*det2_13_12 - M[4]*det2_13_02 + M[8]*det2_13_01;
994 const Double_t det3_013_013 = M[0]*det2_13_13 - M[4]*det2_13_03 + M[12]*det2_13_01;
995 const Double_t det3_013_023 = M[0]*det2_13_23 - M[8]*det2_13_03 + M[12]*det2_13_02;
996 const Double_t det3_013_123 = M[4]*det2_13_23 - M[8]*det2_13_13 + M[12]*det2_13_12;
997 const Double_t det3_023_012 = M[0]*det2_23_12 - M[4]*det2_23_02 + M[8]*det2_23_01;
998 const Double_t det3_023_013 = M[0]*det2_23_13 - M[4]*det2_23_03 + M[12]*det2_23_01;
999 const Double_t det3_023_023 = M[0]*det2_23_23 - M[8]*det2_23_03 + M[12]*det2_23_02;
1000 const Double_t det3_023_123 = M[4]*det2_23_23 - M[8]*det2_23_13 + M[12]*det2_23_12;
1001 const Double_t det3_123_012 = M[1]*det2_23_12 - M[5]*det2_23_02 + M[9]*det2_23_01;
1002 const Double_t det3_123_013 = M[1]*det2_23_13 - M[5]*det2_23_03 + M[13]*det2_23_01;
1003 const Double_t det3_123_023 = M[1]*det2_23_23 - M[9]*det2_23_03 + M[13]*det2_23_02;
1004 const Double_t det3_123_123 = M[5]*det2_23_23 - M[9]*det2_23_13 + M[13]*det2_23_12;
1006 const Double_t det = M[0]*det3_123_123 - M[4]*det3_123_023 +
1007 M[8]*det3_123_013 - M[12]*det3_123_012;
1010 Warning(
"TGLMatrix::Invert",
"matrix is singular.");
1014 const Double_t oneOverDet = 1.0/det;
1015 const Double_t mn1OverDet = - oneOverDet;
1017 M[0] = det3_123_123 * oneOverDet;
1018 M[4] = det3_023_123 * mn1OverDet;
1019 M[8] = det3_013_123 * oneOverDet;
1020 M[12] = det3_012_123 * mn1OverDet;
1022 M[1] = det3_123_023 * mn1OverDet;
1023 M[5] = det3_023_023 * oneOverDet;
1024 M[9] = det3_013_023 * mn1OverDet;
1025 M[13] = det3_012_023 * oneOverDet;
1027 M[2] = det3_123_013 * oneOverDet;
1028 M[6] = det3_023_013 * mn1OverDet;
1029 M[10] = det3_013_013 * oneOverDet;
1030 M[14] = det3_012_013 * mn1OverDet;
1032 M[3] = det3_123_012 * mn1OverDet;
1033 M[7] = det3_023_012 * oneOverDet;
1034 M[11] = det3_013_012 * mn1OverDet;
1035 M[15] = det3_012_012 * oneOverDet;
1047 r.X() = M[0]*
v[0] + M[4]*
v[1] + M[8]*
v[2] + M[12]*w;
1048 r.Y() = M[1]*
v[0] + M[5]*
v[1] + M[9]*
v[2] + M[13]*w;
1049 r.Z() = M[2]*
v[0] + M[6]*
v[1] + M[10]*
v[2] + M[14]*w;
1060 r.X() = M[0]*
v[0] + M[4]*
v[1] + M[8]*
v[2];
1061 r.Y() = M[1]*
v[0] + M[5]*
v[1] + M[9]*
v[2];
1062 r.Z() = M[2]*
v[0] + M[6]*
v[1] + M[10]*
v[2];
1073 v.X() = M[0]*
r[0] + M[4]*
r[1] + M[8]*
r[2] + M[12]*w;
1074 v.Y() = M[1]*
r[0] + M[5]*
r[1] + M[9]*
r[2] + M[13]*w;
1075 v.Z() = M[2]*
r[0] + M[6]*
r[1] + M[10]*
r[2] + M[14]*w;
1085 v.X() = M[0]*
r[0] + M[4]*
r[1] + M[8]*
r[2];
1086 v.Y() = M[1]*
r[0] + M[5]*
r[1] + M[9]*
r[2];
1087 v.Z() = M[2]*
r[0] + M[6]*
r[1] + M[10]*
r[2];
1109 if (ss < 0.8 || ss > 1.2)
return kTRUE;
1111 if (ss < 0.8 || ss > 1.2)
return kTRUE;
1113 if (ss < 0.8 || ss > 1.2)
return kTRUE;
1128 std::cout.precision(6);
1132 std::cout <<
fVals[
y*4 +
x] <<
" ";
1134 std::cout <<
"]" << std::endl;
1179 SetColor(color_index, transparency);
1279 UChar_t alpha = (255*(100 - transparency))/100;
1307 fRGBA[3] = (255*(100 - transparency))/100;
1343 for (
Int_t i = 0; i < 5; ++i)
1356 for (
Int_t i = 0; i < 5; ++i)
1369 fMarkup .SetColor(200, 200, 200);
1386 fMarkup .SetColor(55, 55, 55);
1434#if defined(__APPLE_CC__) && __APPLE_CC__ > 4000 && __APPLE_CC__ < 5450 && !defined(__INTEL_COMPILER)
1435 typedef GLvoid (*tessfuncptr_t)(...);
1436#elif defined(__linux__) || defined(__FreeBSD__) || defined( __OpenBSD__ ) || defined(__sun) || defined (__CYGWIN__) || defined (__APPLE__)
1437 typedef GLvoid (*tessfuncptr_t)();
1438#elif defined (WIN32)
1439 typedef GLvoid (
CALLBACK *tessfuncptr_t)();
1441 #error "Error - need to define type tessfuncptr_t for this platform/compiler"
1448class TGLTesselatorWrap
1453 GLUtesselator *fTess;
1455 TGLTesselatorWrap(tessfuncptr_t vertex_func) : fTess(nullptr)
1457 fTess = gluNewTess();
1459 throw std::bad_alloc();
1461#if defined(__GNUC__) && __GNUC__ >= 8
1462#pragma GCC diagnostic push
1463#pragma GCC diagnostic ignored "-Wcast-function-type"
1466 gluTessCallback(fTess, (GLenum)GLU_BEGIN, (tessfuncptr_t) impl_glBegin);
1467 gluTessCallback(fTess, (GLenum)GLU_END, (tessfuncptr_t) impl_glEnd);
1468 gluTessCallback(fTess, (GLenum)GLU_VERTEX, vertex_func);
1470#if defined(__GNUC__) && __GNUC__ >= 8
1471#pragma GCC diagnostic pop
1476 virtual ~TGLTesselatorWrap()
1479 gluDeleteTess(fTess);
1492#if defined(__GNUC__) && __GNUC__ >= 8
1493#pragma GCC diagnostic push
1494#pragma GCC diagnostic ignored "-Wcast-function-type"
1497 static TGLTesselatorWrap singleton((tessfuncptr_t) impl_glVertex3fv);
1499#if defined(__GNUC__) && __GNUC__ >= 8
1500#pragma GCC diagnostic pop
1503 return singleton.fTess;
1513#if defined(__GNUC__) && __GNUC__ >= 8
1514#pragma GCC diagnostic push
1515#pragma GCC diagnostic ignored "-Wcast-function-type"
1518 static TGLTesselatorWrap singleton((tessfuncptr_t) impl_glVertex4fv);
1520#if defined(__GNUC__) && __GNUC__ >= 8
1521#pragma GCC diagnostic pop
1524 return singleton.fTess;
1534#if defined(__GNUC__) && __GNUC__ >= 8
1535#pragma GCC diagnostic push
1536#pragma GCC diagnostic ignored "-Wcast-function-type"
1539 static TGLTesselatorWrap singleton((tessfuncptr_t) impl_glVertex3dv);
1541#if defined(__GNUC__) && __GNUC__ >= 8
1542#pragma GCC diagnostic pop
1545 return singleton.fTess;
1555#if defined(__GNUC__) && __GNUC__ >= 8
1556#pragma GCC diagnostic push
1557#pragma GCC diagnostic ignored "-Wcast-function-type"
1560 static TGLTesselatorWrap singleton((tessfuncptr_t) impl_glVertex4dv);
1562#if defined(__GNUC__) && __GNUC__ >= 8
1563#pragma GCC diagnostic pop
1566 return singleton.fTess;
1576 if (init_done)
return;
1581 if (strcmp(
gEnv->GetValue(
"OpenGL.PointLineScalingFactor",
"native"),
"native") == 0)
1640 const GLubyte *errString;
1642 if ((errCode = glGetError()) != GL_NO_ERROR) {
1643 errString = gluErrorString(errCode);
1645 Error(loc,
"GL Error %s", (
const char *)errString);
1647 Error(
"TGLUtil::CheckError",
"GL Error %s", (
const char *)errString);
1673 Error(
"TGLUtil::UnlockColor",
"fgColorLockCount already 0.");
1700 glColor4ub(color.GetRed(), color.GetGreen(), color.GetBlue(), alpha);
1711 glColor4ub(color.GetRed(), color.GetGreen(), color.GetBlue(), (
UChar_t)(255*alpha));
1721 if (color_index < 0)
1725 glColor4f(
c->GetRed(),
c->GetGreen(),
c->GetBlue(), alpha);
1735 if (color_index < 0)
1739 glColor4f(
c->GetRed(),
c->GetGreen(),
c->GetBlue(), 1.0f - 0.01f*transparency);
1947 glMatrixMode(GL_PROJECTION);
1950 glGetFloatv(GL_PROJECTION_MATRIX, pm);
1951 for (
Int_t i=0; i<=12; i+=4) {
1952 pm[i] *= scale; pm[i+1] *= scale;
1955 glMatrixMode(GL_MODELVIEW);
1962 glMatrixMode(GL_PROJECTION);
1964 glMatrixMode(GL_MODELVIEW);
1978 glPushAttrib(GL_ENABLE_BIT | GL_POINT_BIT | GL_LINE_BIT);
1980 glDisable(GL_LIGHTING);
1984 if (s == 2 || s == 3 || s == 5 || s == 28)
1987 RenderPoints(marker, p,
n, pick_radius, selection, sec_selection);
2001 if (s == 2 || s == 3 || s == 5 || s == 28)
2020 glEnable(GL_POINT_SMOOTH);
2023 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2024 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
2029 glDisable(GL_POINT_SMOOTH);
2045 for (
Int_t i=0; i<
n; ++i, p+=3)
2056 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
2057 glVertexPointer(3, GL_FLOAT, 0, p);
2058 glEnableClientState(GL_VERTEX_ARRAY);
2062 const Int_t maxChunk = 8192;
2063 while (nleft > maxChunk)
2065 glDrawArrays(GL_POINTS, ndone, maxChunk);
2069 glDrawArrays(GL_POINTS, ndone, nleft);
2071 glPopClientAttrib();
2089 glEnable(GL_POINT_SMOOTH);
2092 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2093 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
2098 glDisable(GL_POINT_SMOOTH);
2106 glVertexPointer(3, GL_DOUBLE, 0, &
points[0]);
2107 glEnableClientState(GL_VERTEX_ARRAY);
2112 const Int_t maxChunk = 8192;
2113 while (nleft > maxChunk)
2115 glDrawArrays(GL_POINTS, ndone, maxChunk);
2121 glDrawArrays(GL_POINTS, ndone, nleft);
2123 glDisableClientState(GL_VERTEX_ARRAY);
2138 glEnable(GL_LINE_SMOOTH);
2143 glDisable(GL_LINE_SMOOTH);
2153 for (
Int_t i=0; i<
n; ++i, p+=3)
2157 glVertex3f(p[0]-
d, p[1], p[2]); glVertex3f(p[0]+
d, p[1], p[2]);
2158 glVertex3f(p[0], p[1]-
d, p[2]); glVertex3f(p[0], p[1]+
d, p[2]);
2159 glVertex3f(p[0], p[1], p[2]-
d); glVertex3f(p[0], p[1], p[2]+
d);
2167 for (
Int_t i=0; i<
n; ++i, p+=3)
2169 glVertex3f(p[0]-
d, p[1], p[2]); glVertex3f(p[0]+
d, p[1], p[2]);
2170 glVertex3f(p[0], p[1]-
d, p[2]); glVertex3f(p[0], p[1]+
d, p[2]);
2171 glVertex3f(p[0], p[1], p[2]-
d); glVertex3f(p[0], p[1], p[2]+
d);
2179 glDisable(GL_POINT_SMOOTH);
2182 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
2183 glVertexPointer(3, GL_FLOAT, 0, op);
2184 glEnableClientState(GL_VERTEX_ARRAY);
2188 const Int_t maxChunk = 8192;
2189 while (nleft > maxChunk)
2191 glDrawArrays(GL_POINTS, ndone, maxChunk);
2195 glDrawArrays(GL_POINTS, ndone, nleft);
2197 glPopClientAttrib();
2211 glEnable(GL_LINE_SMOOTH);
2216 glDisable(GL_LINE_SMOOTH);
2220 typedef std::vector<Double_t>::size_type size_type;
2224 for (size_type i = 0; i <
points.size(); i += 3) {
2226 glVertex3f(p[0] - dX, p[1], p[2]); glVertex3f(p[0] + dX, p[1], p[2]);
2227 glVertex3f(p[0], p[1] - dY, p[2]); glVertex3f(p[0], p[1] + dY, p[2]);
2228 glVertex3f(p[0], p[1], p[2] - dZ); glVertex3f(p[0], p[1], p[2] + dZ);
2234 glDisable(GL_LINE_SMOOTH);
2235 glDisable(GL_BLEND);
2252 glBegin(GL_LINE_STRIP);
2253 for (
Int_t i=0; i<
n; ++i, tp+=3)
2266 glPushAttrib(GL_ENABLE_BIT | GL_LINE_BIT);
2268 glDisable(GL_LIGHTING);
2276 case 2: pat = 0x3333;
break;
2277 case 3: pat = 0x5555;
break;
2278 case 4: pat = 0xf040;
break;
2279 case 5: pat = 0xf4f4;
break;
2280 case 6: pat = 0xf111;
break;
2281 case 7: pat = 0xf0f0;
break;
2282 case 8: pat = 0xff11;
break;
2283 case 9: pat = 0x3fff;
break;
2284 case 10: pat = 0x08ff;
break;
2287 glLineStipple(1, pat);
2288 glEnable(GL_LINE_STIPPLE);
2331 Float_t rgba[4] = {rgbai[0]/255.f, rgbai[1]/255.f, rgbai[2]/255.f, rgbai[3]/255.f};
2332 Float_t ambient[4] = {0.0, 0.0, 0.0, 1.0};
2333 Float_t specular[4] = {0.6, 0.6, 0.6, 1.0};
2334 Float_t emission[4] = {rgba[0]/4.f, rgba[1]/4.f, rgba[2]/4.f, rgba[3]};
2337 glMaterialfv(GL_FRONT, GL_DIFFUSE, rgba);
2338 glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
2339 glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
2340 glMaterialfv(GL_FRONT, GL_EMISSION, emission);
2341 glMaterialf(GL_FRONT, GL_SHININESS, 60.0);
2354 glTranslated(position.
X(), position.
Y(), position.
Z());
2383 glMultMatrixd(local.
CArr());
2389 headHeight =
size*2.0;
2391 headHeight =
size*1.4;
2396 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_INSIDE);
2399 glTranslated(0.0, 0.0,
vector.Mag() - headHeight);
2403 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_OUTSIDE);
2410 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_OUTSIDE);
2417 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_OUTSIDE);
2445 glMultMatrixd(local.
CArr());
2448 glTranslated(0.0, 0.0, -width/2.0);
2455 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_INSIDE);
2457 glTranslated(0.0, 0.0, width);
2458 gluQuadricOrientation(quad.
Get(), (GLenum)GLU_OUTSIDE);
2475 static const UChar_t defColor[4] = { 250, 110, 0, 255 };
2478 DrawSphere(pos, radius, rgba ? rgba : defColor);
2493 static const UChar_t axesColors[][4] = {
2502 static const UChar_t xyz[][8] = {
2503 {0x44, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0x44},
2504 {0x10, 0x10, 0x10, 0x10, 0x10, 0x28, 0x44, 0x44},
2505 {0x7c, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x7c}
2518 for (
UInt_t i = 0; i < 3; i++) {
2524 start[(i+1)%3] = 0.0;
2525 start[(i+2)%3] = 0.0;
2528 start[(i+1)%3] = min[(i+1)%3];
2529 start[(i+2)%3] = min[(i+2)%3];
2542 vector[i] = min[i] - max[i];
2554 vector[i] = max[i] - min[i];
2565 for (
UInt_t j = 0; j < 3; j++) {
2566 if (min[j] <= 0.0 && max[j] >= 0.0) {
2569 zero[(j+1)%3] = min[(j+1)%3];
2570 zero[(j+2)%3] = min[(j+2)%3];
2571 DrawSphere(zero, pixelSize*2.0, axesColors[j*2 + 1]);
2576 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
2581 glDisable(GL_LIGHTING);
2582 for (
UInt_t k = 0; k < 3; k++) {
2586 minPos[(k+1)%3] = 0.0;
2587 minPos[(k+2)%3] = 0.0;
2589 minPos[(k+1)%3] = min[(k+1)%3];
2590 minPos[(k+2)%3] = min[(k+2)%3];
2601 if (axisViewport.
Mag() < 1) {
2606 padPixels*axisViewport.
Y()/axisViewport.
Mag());
2609 padPixels*axisViewport.
Y()/axisViewport.
Mag());
2617 padPixels*axisViewport.
Y()/axisViewport.
Mag());
2618 glRasterPos3dv(namePos.
CArr());
2619 glBitmap(8, 8, 0.0, 4.0, 0.0, 0.0, xyz[k]);
2632 static const UChar_t digits[][8] = {
2633 {0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38},
2634 {0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x10, 0x10},
2635 {0x7c, 0x44, 0x20, 0x18, 0x04, 0x04, 0x44, 0x38},
2636 {0x38, 0x44, 0x04, 0x04, 0x18, 0x04, 0x44, 0x38},
2637 {0x04, 0x04, 0x04, 0x04, 0x7c, 0x44, 0x44, 0x44},
2638 {0x7c, 0x44, 0x04, 0x04, 0x7c, 0x40, 0x40, 0x7c},
2639 {0x7c, 0x44, 0x44, 0x44, 0x7c, 0x40, 0x40, 0x7c},
2640 {0x20, 0x20, 0x20, 0x10, 0x08, 0x04, 0x44, 0x7c},
2641 {0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38},
2642 {0x7c, 0x44, 0x04, 0x04, 0x7c, 0x44, 0x44, 0x7c},
2643 {0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
2644 {0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00},
2645 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
2651 xOffset = 3.5 * num.
Length();
2655 glRasterPos3dv(pos.CArr());
2657 if (num[i] ==
'.') {
2658 glBitmap(8, 8, xOffset, yOffset, 7.0, 0.0, digits[10]);
2659 }
else if (num[i] ==
'-') {
2660 glBitmap(8, 8, xOffset, yOffset, 7.0, 0.0, digits[11]);
2661 }
else if (num[i] ==
' ') {
2662 glBitmap(8, 8, xOffset, yOffset, 7.0, 0.0, digits[12]);
2663 }
else if (num[i] >=
'0' && num[i] <=
'9') {
2664 glBitmap(8, 8, xOffset, yOffset, 7.0, 0.0, digits[num[i] -
'0']);
2750 glEnable(GLenum(
fCap));
2758 glDisable(GLenum(
fCap));
2767 glDisable(GLenum(
fCap));
2775 glEnable(GLenum(
fCap));
2806 glPixelStorei(GL_PACK_ALIGNMENT, 1);
2807 glReadPixels(0, 0, w,
h, GL_RGBA, GL_UNSIGNED_BYTE, &
fBuffer[0]);
2818 glPixelStorei(GL_PACK_ALIGNMENT, 1);
2819 glReadPixels(
x,
y, w,
h, GL_RGBA, GL_UNSIGNED_BYTE, &
fBuffer[0]);
2853 RGB_t gColorTriplets[] = {{{255, 0, 0}},
2863 if (lhs.fRGB[0] < rhs.fRGB[0])
2865 else if (lhs.fRGB[0] > rhs.fRGB[0])
2867 else if (lhs.fRGB[1] < rhs.fRGB[1])
2869 else if (lhs.fRGB[1] > rhs.fRGB[1])
2871 else if (lhs.fRGB[2] < rhs.fRGB[2])
2877 typedef std::map<Int_t, RGB_t> ColorLookupTable_t;
2878 typedef ColorLookupTable_t::const_iterator CLTCI_t;
2880 ColorLookupTable_t gObjectIDToColor;
2882 typedef std::map<RGB_t, Int_t> ObjectLookupTable_t;
2883 typedef ObjectLookupTable_t::const_iterator OLTCI_t;
2885 ObjectLookupTable_t gColorToObjectID;
2893 glColor3ub(objectID & 0xff, (objectID & 0xff00) >> 8, (objectID & 0xff0000) >> 16);
2895 if (gObjectIDToColor.empty()) {
2897 for (
Int_t i = 0,
id = 1; i <
Int_t(
sizeof gColorTriplets /
sizeof(RGB_t)); ++i, ++
id)
2898 gObjectIDToColor[
id] = gColorTriplets[i];
2899 for (
Int_t i = 0,
id = 1; i <
Int_t(
sizeof gColorTriplets /
sizeof(RGB_t)); ++i, ++
id)
2900 gColorToObjectID[gColorTriplets[i]] =
id;
2903 CLTCI_t it = gObjectIDToColor.find(objectID);
2905 if (it != gObjectIDToColor.end())
2906 glColor3ub(it->second.fRGB[0], it->second.fRGB[1], it->second.fRGB[2]);
2908 Error(
"ObjectIDToColor",
"No color for such object ID: %d", objectID);
2909 glColor3ub(0, 0, 0);
2919 return pixel[0] | (pixel[1] << 8) | (pixel[2] << 16);
2921 if (gObjectIDToColor.empty())
2924 RGB_t triplet = {{pixel[0], pixel[1], pixel[2]}};
2925 OLTCI_t it = gColorToObjectID.find(triplet);
2927 if (it != gColorToObjectID.end())
2941 glBegin(GL_LINE_LOOP);
2942 glVertex3dv(
v1.CArr());
2943 glVertex3dv(
v2.CArr());
2944 glVertex3dv(
v3.CArr());
2945 glVertex3dv(
v4.CArr());
2955 glBegin(GL_POLYGON);
2956 glNormal3dv(normal.
CArr());
2957 glVertex3dv(
v0.CArr());
2958 glVertex3dv(
v1.CArr());
2959 glVertex3dv(
v2.CArr());
2960 glVertex3dv(
v3.CArr());
2971 glNormal3dv(normal);
2985 glBegin(GL_POLYGON);
2986 glNormal3dv(norm1.
CArr());
2987 glVertex3dv(
v1.CArr());
2988 glNormal3dv(norm2.
CArr());
2989 glVertex3dv(
v2.CArr());
2990 glNormal3dv(norm3.
CArr());
2991 glVertex3dv(
v3.CArr());
2995const Int_t gBoxFrontQuads[][4] = {{0, 1, 2, 3}, {4, 0, 3, 5}, {4, 5, 6, 7}, {7, 6, 2, 1}};
2996const Double_t gBoxFrontNormals[][3] = {{-1., 0., 0.}, {0., -1., 0.}, {1., 0., 0.}, {0., 1., 0.}};
2999const Int_t gBoxBackQuads[][4] = {{7, 1, 2, 6}, {4, 7, 6, 5}, {0, 4, 5, 3}, {0, 3, 2, 1}};
3000const Double_t gBoxBackNormals[][3] = {{0., -1., 0.}, {-1., 0., 0.}, {0., 1., 0.}, {1., 0., 0.}};
3010 std::swap(zMax, zMin);
3013 glBegin(GL_POLYGON);
3014 glNormal3d(0., 0., -1.);
3015 glVertex3d(xMax, yMin, zMin);
3016 glVertex3d(xMin, yMin, zMin);
3017 glVertex3d(xMin, yMax, zMin);
3018 glVertex3d(xMax, yMax, zMin);
3021 const Double_t box[][3] = {{xMin, yMin, zMax}, {xMin, yMax, zMax}, {xMin, yMax, zMin}, {xMin, yMin, zMin},
3022 {xMax, yMin, zMax}, {xMax, yMin, zMin}, {xMax, yMax, zMin}, {xMax, yMax, zMax}};
3025 glBegin(GL_POLYGON);
3027 glVertex3dv(
box[verts[0]]);
3028 glVertex3dv(
box[verts[1]]);
3029 glVertex3dv(
box[verts[2]]);
3030 glVertex3dv(
box[verts[3]]);
3035 glBegin(GL_POLYGON);
3037 glVertex3dv(
box[verts[0]]);
3038 glVertex3dv(
box[verts[1]]);
3039 glVertex3dv(
box[verts[2]]);
3040 glVertex3dv(
box[verts[3]]);
3044 glBegin(GL_POLYGON);
3045 glNormal3d(0., 0., 1.);
3046 glVertex3d(xMax, yMin, zMax);
3047 glVertex3d(xMax, yMax, zMax);
3048 glVertex3d(xMin, yMax, zMax);
3049 glVertex3d(xMin, yMin, zMax);
3060 std::swap(zMax, zMin);
3066 glBegin(GL_POLYGON);
3067 glNormal3d(0., 0., -1.);
3068 glVertex3d(xMax, yMin, zMin);
3069 glVertex3d(xMin, yMin, zMin);
3070 glVertex3d(xMin, yMax, zMin);
3071 glVertex3d(xMax, yMax, zMin);
3074 const Double_t box[][3] = {{xMin, yMin, zMax}, {xMin, yMax, zMax}, {xMin, yMax, zMin}, {xMin, yMin, zMin},
3075 {xMax, yMin, zMax}, {xMax, yMin, zMin}, {xMax, yMax, zMin}, {xMax, yMax, zMax}};
3080 glBegin(GL_POLYGON);
3082 glVertex3dv(
box[verts[0]]);
3083 glVertex3dv(
box[verts[1]]);
3084 glVertex3dv(
box[verts[2]]);
3085 glVertex3dv(
box[verts[3]]);
3090 glBegin(GL_POLYGON);
3092 glVertex3dv(
box[verts[0]]);
3093 glVertex3dv(
box[verts[1]]);
3094 glVertex3dv(
box[verts[2]]);
3095 glVertex3dv(
box[verts[3]]);
3101 glBegin(GL_POLYGON);
3103 glVertex3dv(
box[verts[0]]);
3104 glVertex3dv(
box[verts[1]]);
3105 glVertex3dv(
box[verts[2]]);
3106 glVertex3dv(
box[verts[3]]);
3111 glBegin(GL_POLYGON);
3113 glVertex3dv(
box[verts[0]]);
3114 glVertex3dv(
box[verts[1]]);
3115 glVertex3dv(
box[verts[2]]);
3116 glVertex3dv(
box[verts[3]]);
3120 glBegin(GL_POLYGON);
3121 glNormal3d(0., 0., 1.);
3122 glVertex3d(xMax, yMin, zMax);
3123 glVertex3d(xMax, yMax, zMax);
3124 glVertex3d(xMin, yMax, zMax);
3125 glVertex3d(xMin, yMin, zMax);
3138 std::swap(zMax, zMin);
3139 std::swap(texMax, texMin);
3143 glBegin(GL_POLYGON);
3144 glNormal3d(0., 0., 1.);
3145 glTexCoord1d(texMax);
3146 glVertex3d(xMax, yMin, zMax);
3147 glVertex3d(xMax, yMax, zMax);
3148 glVertex3d(xMin, yMax, zMax);
3149 glVertex3d(xMin, yMin, zMax);
3152 glBegin(GL_POLYGON);
3153 glTexCoord1d(texMin);
3154 glNormal3d(0., 0., -1.);
3155 glVertex3d(xMax, yMin, zMin);
3156 glVertex3d(xMin, yMin, zMin);
3157 glVertex3d(xMin, yMax, zMin);
3158 glVertex3d(xMax, yMax, zMin);
3161 const Double_t box[][3] = {{xMin, yMin, zMax}, {xMin, yMax, zMax}, {xMin, yMax, zMin}, {xMin, yMin, zMin},
3162 {xMax, yMin, zMax}, {xMax, yMin, zMin}, {xMax, yMax, zMin}, {xMax, yMax, zMax}};
3164 const Double_t tex[] = {texMax, texMax, texMin, texMin, texMax, texMin, texMin, texMax};
3167 glBegin(GL_POLYGON);
3169 glTexCoord1d(tex[verts[0]]);
3170 glVertex3dv(
box[verts[0]]);
3171 glTexCoord1d(tex[verts[1]]);
3172 glVertex3dv(
box[verts[1]]);
3173 glTexCoord1d(tex[verts[2]]);
3174 glVertex3dv(
box[verts[2]]);
3175 glTexCoord1d(tex[verts[3]]);
3176 glVertex3dv(
box[verts[3]]);
3181 glBegin(GL_POLYGON);
3183 glTexCoord1d(tex[verts[0]]);
3184 glVertex3dv(
box[verts[0]]);
3185 glTexCoord1d(tex[verts[1]]);
3186 glVertex3dv(
box[verts[1]]);
3187 glTexCoord1d(tex[verts[2]]);
3188 glVertex3dv(
box[verts[2]]);
3189 glTexCoord1d(tex[verts[3]]);
3190 glVertex3dv(
box[verts[3]]);
3199 assert(rgba1 !=
nullptr &&
"DrawBoxWithGradientFill, parameter 'rgba1' is null");
3200 assert(rgba2 !=
nullptr &&
"DrawBoxWithGradientFill, parameter 'rgba2' is null");
3202 glBegin(GL_POLYGON);
3219 assert(nPoints != 0 &&
3220 "DrawQuadStripWithRadialGradientFill, invalid number of points");
3221 assert(inner !=
nullptr &&
3222 "DrawQuadStripWithRadialGradientFill, parameter 'inner' is null");
3223 assert(innerRGBA !=
nullptr &&
3224 "DrawQuadStripWithRadialGradientFill, parameter 'innerRGBA' is null");
3225 assert(outer !=
nullptr &&
3226 "DrawQuadStripWithRadialGradientFill, parameter 'outer' is null");
3227 assert(outerRGBA !=
nullptr &&
3228 "DrawQuadStripWithRadialGradientFill, parameter 'outerRGBA' is null");
3230 glBegin(GL_QUAD_STRIP);
3231 for (
UInt_t j = 0; j < nPoints; ++j) {
3232 glColor4dv(innerRGBA);
3233 glVertex2dv(inner + j * 2);
3234 glColor4dv(outerRGBA);
3235 glVertex2dv(outer + j * 2);
3246 GLUquadric *quad = quadric->
Get();
3250 std::swap(zMin, zMax);
3251 const Double_t xCenter = xMin + (xMax - xMin) / 2;
3252 const Double_t yCenter = yMin + (yMax - yMin) / 2;
3256 glTranslated(xCenter, yCenter, zMin);
3257 gluCylinder(quad, radius, radius, zMax - zMin, 40, 1);
3260 glTranslated(xCenter, yCenter, zMax);
3261 gluDisk(quad, 0., radius, 40, 1);
3264 glTranslated(xCenter, yCenter, zMin);
3265 glRotated(180., 0., 1., 0.);
3266 gluDisk(quad, 0., radius, 40, 1);
3277 GLUquadric *quad = quadric->
Get();
3280 const Double_t xCenter = xMin + (xMax - xMin) / 2;
3281 const Double_t yCenter = yMin + (yMax - yMin) / 2;
3282 const Double_t zCenter = zMin + (zMax - zMin) / 2;
3285 TMath::Min((xMax - xMin) / 2, (yMax - yMin) / 2));
3288 glTranslated(xCenter, yCenter, zCenter);
3289 gluSphere(quad, radius, 10, 10);
3304 glVertex3d(xMin + xWid / 2, yMin + yWid / 2, zMin);
3305 glVertex3d(xMin + xWid / 2, yMin + yWid / 2, zMax);
3309 glVertex3d(xMin + xWid / 2, yMin, zMin);
3310 glVertex3d(xMin + xWid / 2, yMax, zMin);
3314 glVertex3d(xMin, yMin + yWid / 2, zMin);
3315 glVertex3d(xMax, yMin + yWid / 2, zMin);
3323 normal[0] =
v[0] /
n;
3324 normal[1] =
v[1] /
n;
3337 normal[0] = -
v[0] /
n;
3338 normal[1] = -
v[1] /
n;
3352 std::swap(zMin, zMax);
3354 glBegin(GL_POLYGON);
3355 glNormal3d(0., 0., 1.);
3356 glVertex3d(ver[0][0], ver[0][1], zMax);
3357 glVertex3d(ver[1][0], ver[1][1], zMax);
3358 glVertex3d(ver[2][0], ver[2][1], zMax);
3359 glVertex3d(ver[3][0], ver[3][1], zMax);
3362 glBegin(GL_POLYGON);
3363 glNormal3d(0., 0., -1.);
3364 glVertex3d(ver[0][0], ver[0][1], zMin);
3365 glVertex3d(ver[3][0], ver[3][1], zMin);
3366 glVertex3d(ver[2][0], ver[2][1], zMin);
3367 glVertex3d(ver[1][0], ver[1][1], zMin);
3371 Double_t trapezoid[][3] = {{ver[0][0], ver[0][1], zMin}, {ver[1][0], ver[1][1], zMin},
3372 {ver[2][0], ver[2][1], zMin}, {ver[3][0], ver[3][1], zMin},
3373 {ver[0][0], ver[0][1], zMax}, {ver[1][0], ver[1][1], zMax},
3374 {ver[2][0], ver[2][1], zMax}, {ver[3][0], ver[3][1], zMax}};
3376 glBegin(GL_POLYGON);
3377 CylindricalNormal(trapezoid[1], normal), glNormal3dv(normal), glVertex3dv(trapezoid[1]);
3378 CylindricalNormal(trapezoid[2], normal), glNormal3dv(normal), glVertex3dv(trapezoid[2]);
3379 CylindricalNormal(trapezoid[6], normal), glNormal3dv(normal), glVertex3dv(trapezoid[6]);
3380 CylindricalNormal(trapezoid[5], normal), glNormal3dv(normal), glVertex3dv(trapezoid[5]);
3383 glBegin(GL_POLYGON);
3390 glBegin(GL_POLYGON);
3393 glNormal3dv(normal);
3395 glVertex3dv(trapezoid[0]);
3396 glVertex3dv(trapezoid[1]);
3397 glVertex3dv(trapezoid[5]);
3398 glVertex3dv(trapezoid[4]);
3401 glBegin(GL_POLYGON);
3404 glNormal3dv(normal);
3406 glVertex3dv(trapezoid[3]);
3407 glVertex3dv(trapezoid[7]);
3408 glVertex3dv(trapezoid[6]);
3409 glVertex3dv(trapezoid[2]);
3421 std::swap(zMin, zMax);
3422 std::swap(texMin, texMax);
3426 glBegin(GL_POLYGON);
3427 glNormal3d(0., 0., 1.);
3428 glTexCoord1d(texMax);
3429 glVertex3d(ver[0][0], ver[0][1], zMax);
3430 glVertex3d(ver[1][0], ver[1][1], zMax);
3431 glVertex3d(ver[2][0], ver[2][1], zMax);
3432 glVertex3d(ver[3][0], ver[3][1], zMax);
3435 glBegin(GL_POLYGON);
3436 glNormal3d(0., 0., -1.);
3437 glTexCoord1d(texMin);
3438 glVertex3d(ver[0][0], ver[0][1], zMin);
3439 glVertex3d(ver[3][0], ver[3][1], zMin);
3440 glVertex3d(ver[2][0], ver[2][1], zMin);
3441 glVertex3d(ver[1][0], ver[1][1], zMin);
3445 Double_t trapezoid[][3] = {{ver[0][0], ver[0][1], zMin}, {ver[1][0], ver[1][1], zMin},
3446 {ver[2][0], ver[2][1], zMin}, {ver[3][0], ver[3][1], zMin},
3447 {ver[0][0], ver[0][1], zMax}, {ver[1][0], ver[1][1], zMax},
3448 {ver[2][0], ver[2][1], zMax}, {ver[3][0], ver[3][1], zMax}};
3450 glBegin(GL_POLYGON);
3451 CylindricalNormal(trapezoid[1], normal), glNormal3dv(normal), glTexCoord1d(texMin), glVertex3dv(trapezoid[1]);
3452 CylindricalNormal(trapezoid[2], normal), glNormal3dv(normal), glTexCoord1d(texMin), glVertex3dv(trapezoid[2]);
3453 CylindricalNormal(trapezoid[6], normal), glNormal3dv(normal), glTexCoord1d(texMax), glVertex3dv(trapezoid[6]);
3454 CylindricalNormal(trapezoid[5], normal), glNormal3dv(normal), glTexCoord1d(texMax), glVertex3dv(trapezoid[5]);
3457 glBegin(GL_POLYGON);
3458 CylindricalNormalInv(trapezoid[0], normal), glNormal3dv(normal), glTexCoord1d(texMin), glVertex3dv(trapezoid[0]);
3459 CylindricalNormalInv(trapezoid[4], normal), glNormal3dv(normal), glTexCoord1d(texMax), glVertex3dv(trapezoid[4]);
3460 CylindricalNormalInv(trapezoid[7], normal), glNormal3dv(normal), glTexCoord1d(texMax), glVertex3dv(trapezoid[7]);
3461 CylindricalNormalInv(trapezoid[3], normal), glNormal3dv(normal), glTexCoord1d(texMin), glVertex3dv(trapezoid[3]);
3464 glBegin(GL_POLYGON);
3466 glNormal3dv(normal);
3467 glTexCoord1d(texMin);
3468 glVertex3dv(trapezoid[0]);
3469 glTexCoord1d(texMin);
3470 glVertex3dv(trapezoid[1]);
3471 glTexCoord1d(texMax);
3472 glVertex3dv(trapezoid[5]);
3473 glTexCoord1d(texMax);
3474 glVertex3dv(trapezoid[4]);
3477 glBegin(GL_POLYGON);
3479 glNormal3dv(normal);
3480 glTexCoord1d(texMin);
3481 glVertex3dv(trapezoid[3]);
3482 glTexCoord1d(texMax);
3483 glVertex3dv(trapezoid[7]);
3484 glTexCoord1d(texMax);
3485 glVertex3dv(trapezoid[6]);
3486 glTexCoord1d(texMin);
3487 glVertex3dv(trapezoid[2]);
3498 std::swap(zMin, zMax);
3500 const Double_t trapezoid[][3] = {{ver[0][0], ver[0][1], zMin}, {ver[1][0], ver[1][1], zMin},
3501 {ver[2][0], ver[2][1], zMin}, {ver[3][0], ver[3][1], zMin},
3502 {ver[0][0], ver[0][1], zMax}, {ver[1][0], ver[1][1], zMax},
3503 {ver[2][0], ver[2][1], zMax}, {ver[3][0], ver[3][1], zMax}};
3504 const Double_t tex[] = {texMin, texMax, texMax, texMin, texMin, texMax, texMax, texMin};
3506 glBegin(GL_POLYGON);
3507 glNormal3d(0., 0., 1.);
3508 glTexCoord1d(tex[4]), glVertex3dv(trapezoid[4]);
3509 glTexCoord1d(tex[5]), glVertex3dv(trapezoid[5]);
3510 glTexCoord1d(tex[6]), glVertex3dv(trapezoid[6]);
3511 glTexCoord1d(tex[7]), glVertex3dv(trapezoid[7]);
3514 glBegin(GL_POLYGON);
3515 glNormal3d(0., 0., -1.);
3516 glTexCoord1d(tex[0]), glVertex3dv(trapezoid[0]);
3517 glTexCoord1d(tex[3]), glVertex3dv(trapezoid[3]);
3518 glTexCoord1d(tex[2]), glVertex3dv(trapezoid[2]);
3519 glTexCoord1d(tex[1]), glVertex3dv(trapezoid[1]);
3522 glBegin(GL_POLYGON);
3524 CylindricalNormal(trapezoid[1], normal), glNormal3dv(normal), glTexCoord1d(tex[1]), glVertex3dv(trapezoid[1]);
3525 CylindricalNormal(trapezoid[2], normal), glNormal3dv(normal), glTexCoord1d(tex[2]), glVertex3dv(trapezoid[2]);
3526 CylindricalNormal(trapezoid[6], normal), glNormal3dv(normal), glTexCoord1d(tex[6]), glVertex3dv(trapezoid[6]);
3527 CylindricalNormal(trapezoid[5], normal), glNormal3dv(normal), glTexCoord1d(tex[5]), glVertex3dv(trapezoid[5]);
3530 glBegin(GL_POLYGON);
3531 CylindricalNormalInv(trapezoid[0], normal), glNormal3dv(normal), glTexCoord1d(tex[0]), glVertex3dv(trapezoid[0]);
3532 CylindricalNormalInv(trapezoid[4], normal), glNormal3dv(normal), glTexCoord1d(tex[4]), glVertex3dv(trapezoid[4]);
3533 CylindricalNormalInv(trapezoid[7], normal), glNormal3dv(normal), glTexCoord1d(tex[7]), glVertex3dv(trapezoid[7]);
3534 CylindricalNormalInv(trapezoid[3], normal), glNormal3dv(normal), glTexCoord1d(tex[3]), glVertex3dv(trapezoid[3]);
3537 glBegin(GL_POLYGON);
3539 glNormal3dv(normal);
3540 glTexCoord1d(tex[0]), glVertex3dv(trapezoid[0]);
3541 glTexCoord1d(tex[1]), glVertex3dv(trapezoid[1]);
3542 glTexCoord1d(tex[5]), glVertex3dv(trapezoid[5]);
3543 glTexCoord1d(tex[4]), glVertex3dv(trapezoid[4]);
3546 glBegin(GL_POLYGON);
3548 glNormal3dv(normal);
3549 glTexCoord1d(tex[3]), glVertex3dv(trapezoid[3]);
3550 glTexCoord1d(tex[7]), glVertex3dv(trapezoid[7]);
3551 glTexCoord1d(tex[6]), glVertex3dv(trapezoid[6]);
3552 glTexCoord1d(tex[2]), glVertex3dv(trapezoid[2]);
3562 normal[0] =
v[0] /
n;
3563 normal[1] =
v[1] /
n;
3564 normal[2] =
v[2] /
n;
3578 normal[0] = -
v[0] /
n;
3579 normal[1] = -
v[1] /
n;
3580 normal[2] = -
v[2] /
n;
3594 glBegin(GL_POLYGON);
3596 glNormal3dv(normal);
3597 glVertex3dv(ver[0]);
3598 glVertex3dv(ver[1]);
3599 glVertex3dv(ver[2]);
3600 glVertex3dv(ver[3]);
3603 glBegin(GL_POLYGON);
3605 glNormal3dv(normal);
3606 glVertex3dv(ver[4]);
3607 glVertex3dv(ver[7]);
3608 glVertex3dv(ver[6]);
3609 glVertex3dv(ver[5]);
3613 glBegin(GL_POLYGON);
3615 glNormal3dv(normal);
3616 glVertex3dv(ver[0]);
3617 glVertex3dv(ver[3]);
3618 glVertex3dv(ver[7]);
3619 glVertex3dv(ver[4]);
3622 glBegin(GL_POLYGON);
3623 SphericalNormal(ver[3], normal), glNormal3dv(normal), glVertex3dv(ver[3]);
3624 SphericalNormal(ver[2], normal), glNormal3dv(normal), glVertex3dv(ver[2]);
3625 SphericalNormal(ver[6], normal), glNormal3dv(normal), glVertex3dv(ver[6]);
3626 SphericalNormal(ver[7], normal), glNormal3dv(normal), glVertex3dv(ver[7]);
3629 glBegin(GL_POLYGON);
3631 glNormal3dv(normal);
3632 glVertex3dv(ver[5]);
3633 glVertex3dv(ver[6]);
3634 glVertex3dv(ver[2]);
3635 glVertex3dv(ver[1]);
3638 glBegin(GL_POLYGON);
3651 if (texMin > texMax)
3652 std::swap(texMin, texMax);
3654 const Double_t tex[] = {texMin, texMin, texMax, texMax, texMin, texMin, texMax, texMax};
3655 glBegin(GL_POLYGON);
3657 glNormal3dv(normal);
3658 glTexCoord1d(tex[0]), glVertex3dv(ver[0]);
3659 glTexCoord1d(tex[1]), glVertex3dv(ver[1]);
3660 glTexCoord1d(tex[2]), glVertex3dv(ver[2]);
3661 glTexCoord1d(tex[3]), glVertex3dv(ver[3]);
3663 glBegin(GL_POLYGON);
3665 glNormal3dv(normal);
3666 glTexCoord1d(tex[4]), glVertex3dv(ver[4]);
3667 glTexCoord1d(tex[7]), glVertex3dv(ver[7]);
3668 glTexCoord1d(tex[6]), glVertex3dv(ver[6]);
3669 glTexCoord1d(tex[5]), glVertex3dv(ver[5]);
3671 glBegin(GL_POLYGON);
3673 glNormal3dv(normal);
3674 glTexCoord1d(tex[0]), glVertex3dv(ver[0]);
3675 glTexCoord1d(tex[3]), glVertex3dv(ver[3]);
3676 glTexCoord1d(tex[7]), glVertex3dv(ver[7]);
3677 glTexCoord1d(tex[4]), glVertex3dv(ver[4]);
3679 glBegin(GL_POLYGON);
3680 SphericalNormal(ver[3], normal), glNormal3dv(normal), glTexCoord1d(tex[3]), glVertex3dv(ver[3]);
3681 SphericalNormal(ver[2], normal), glNormal3dv(normal), glTexCoord1d(tex[2]), glVertex3dv(ver[2]);
3682 SphericalNormal(ver[6], normal), glNormal3dv(normal), glTexCoord1d(tex[6]), glVertex3dv(ver[6]);
3683 SphericalNormal(ver[7], normal), glNormal3dv(normal), glTexCoord1d(tex[7]), glVertex3dv(ver[7]);
3685 glBegin(GL_POLYGON);
3687 glNormal3dv(normal);
3688 glTexCoord1d(tex[5]), glVertex3dv(ver[5]);
3689 glTexCoord1d(tex[6]), glVertex3dv(ver[6]);
3690 glTexCoord1d(tex[2]), glVertex3dv(ver[2]);
3691 glTexCoord1d(tex[1]), glVertex3dv(ver[1]);
3693 glBegin(GL_POLYGON);
3694 SphericalNormalInv(ver[0], normal), glNormal3dv(normal), glTexCoord1d(tex[0]), glVertex3dv(ver[0]);
3695 SphericalNormalInv(ver[4], normal), glNormal3dv(normal), glTexCoord1d(tex[4]), glVertex3dv(ver[4]);
3696 SphericalNormalInv(ver[5], normal), glNormal3dv(normal), glTexCoord1d(tex[5]), glVertex3dv(ver[5]);
3697 SphericalNormalInv(ver[1], normal), glNormal3dv(normal), glTexCoord1d(tex[1]), glVertex3dv(ver[1]);
3709 if (xMin > xMax || z) option +=
"SDH=+";
3710 else option +=
"SDH=-";
3712 if (log) option +=
'G';
3724 static const Double_t zero = 0.001;
3745 axisPainter.
PaintAxis(xMin, yMin, xMax, yMax, min, max, nDiv, option.c_str());
3764 +
box[left].X() - vp[0]));
3766 + (1 -
gPad->GetHNDC() -
gPad->GetYlowNDC())
3767 *
gPad->GetWh() + vp[1]));
3769 +
box[fp].X() - vp[0]));
3771 + (1 -
gPad->GetHNDC() -
gPad->GetYlowNDC())
3772 *
gPad->GetWh() + vp[1]));
3774 *
gPad->GetWw() +
box[right].X() - vp[0]));
3776 + (1 -
gPad->GetHNDC() -
gPad->GetYlowNDC())
3777 *
gPad->GetWh() + vp[1]));
3789 if (xLeft - xMid || yLeft - yMid) {
3790 TAxis *axis = leftType ? yAxis : xAxis;
3791 if (leftLabel < leftMidLabel)
3792 Draw2DAxis(axis, xLeft, yLeft, xMid, yMid, leftLabel, leftMidLabel,
3795 Draw2DAxis(axis, xMid, yMid, xLeft, yLeft, leftMidLabel, leftLabel,
3799 if (xRight - xMid || yRight - yMid) {
3800 TAxis *axis = rightType ? yAxis : xAxis;
3802 if (rightMidLabel < rightLabel)
3803 Draw2DAxis(axis, xMid, yMid, xRight, yRight, rightMidLabel, rightLabel,
3806 Draw2DAxis(axis, xRight, yRight, xMid, yMid, rightLabel, rightMidLabel,
3811 +
box[left + 4].X() - vp[0]));
3813 + (1 -
gPad->GetHNDC() -
gPad->GetYlowNDC())
3814 *
gPad->GetWh() + vp[1]));
3820 Double_t zScale, std::vector<Double_t> &zLevels)
3824 Double_t binLow = 0., binHigh = 0., binWidth = 0.;
3826 zLevels.resize(nBins + 1);
3828 for (
Int_t i = 0; i < nBins + 1; ++i)
3829 zLevels[i] = (binLow + i * binWidth) * zScale;
3839 glBegin(GL_POLYGON);
3840 glNormal3dv(norm1.
CArr());
3842 glVertex3dv(
v1.CArr());
3843 glNormal3dv(norm2.
CArr());
3845 glVertex3dv(
v2.CArr());
3846 glNormal3dv(norm3.
CArr());
3848 glVertex3dv(
v3.CArr());
3859 glBegin(GL_POLYGON);
3860 glNormal3dv(normal.
CArr());
3862 glVertex3d(
v1.X(),
v1.Y(), z);
3864 glVertex3d(
v2.X(),
v2.Y(), z);
3866 glVertex3d(
v3.X(),
v3.Y(), z);
3897 if (
v < (vmin + 0.25 * dv)) {
3899 rgba[1] = 4 * (
v - vmin) / dv;
3901 }
else if (
v < (vmin + 0.5 * dv)) {
3904 rgba[2] = 1 + 4 * (vmin + 0.25 * dv -
v) / dv;
3905 }
else if (
v < (vmin + 0.75 * dv)) {
3906 rgba[0] = 4 * (
v - vmin - 0.5 * dv) / dv;
3911 rgba[1] = 1 + 4 * (vmin + 0.75 * dv -
v) / dv;
3916 rgba[0] = (
v - vmin) / dv;
3918 rgba[2] = (vmax -
v) / dv;
3921 rgba[0] = (
v - vmin) / dv;
3926 if (
v < (vmin + dv / 6.0)) {
3928 rgba[1] = 6 * (
v - vmin) / dv;
3930 }
else if (
v < (vmin + 2.0 * dv / 6.0)) {
3931 rgba[0] = 1 + 6 * (vmin + dv / 6.0 -
v) / dv;
3934 }
else if (
v < (vmin + 3.0 * dv / 6.0)) {
3937 rgba[2] = 6 * (
v - vmin - 2.0 * dv / 6.0) / dv;
3938 }
else if (
v < (vmin + 4.0 * dv / 6.0)) {
3940 rgba[1] = 1 + 6 * (vmin + 3.0 * dv / 6.0 -
v) / dv;
3942 }
else if (
v < (vmin + 5.0 * dv / 6.0)) {
3943 rgba[0] = 6 * (
v - vmin - 4.0 * dv / 6.0) / dv;
3949 rgba[2] = 1 + 6 * (vmin + 5.0 * dv / 6.0 -
v) / dv;
3953 rgba[0] = (
v - vmin) / (vmax - vmin);
3958 rgba[0] = (
v - vmin) / (vmax - vmin);
3959 rgba[1] = (vmax -
v) / (vmax - vmin);
3963 if (
v < (vmin + 0.25 * dv)) {
3965 rgba[1] = 4 * (
v - vmin) / dv;
3966 rgba[2] = 1 - rgba[1];
3967 }
else if (
v < (vmin + 0.5 * dv)) {
3968 rgba[0] = 4 * (
v - vmin - 0.25 * dv) / dv;
3969 rgba[1] = 1 - rgba[0];
3971 }
else if (
v < (vmin + 0.75 * dv)) {
3972 rgba[1] = 4 * (
v - vmin - 0.5 * dv) / dv;
3973 rgba[0] = 1 - rgba[1];
3977 rgba[2] = 4 * (
v - vmin - 0.75 * dv) / dv;
3978 rgba[1] = 1 - rgba[2];
3982 if (
v < (vmin + 0.5 * dv)) {
3983 rgba[0] = 2 * (
v - vmin) / dv;
3987 rgba[0] = 1 - 2 * (
v - vmin - 0.5 * dv) / dv;
3993 if (
v < (vmin + dv / 3)) {
3994 rgba[2] = 3 * (
v - vmin) / dv;
3996 rgba[0] = 1 - rgba[2];
3997 }
else if (
v < (vmin + 2 * dv / 3)) {
3999 rgba[1] = 3 * (
v - vmin - dv / 3) / dv;
4002 rgba[0] = 3 * (
v - vmin - 2 * dv / 3) / dv;
4003 rgba[1] = 1 - rgba[0];
4008 if (
v < (vmin + 0.2 * dv)) {
4010 rgba[1] = 5 * (
v - vmin) / dv;
4012 }
else if (
v < (vmin + 0.4 * dv)) {
4015 rgba[2] = 1 + 5 * (vmin + 0.2 * dv -
v) / dv;
4016 }
else if (
v < (vmin + 0.6 * dv)) {
4017 rgba[0] = 5 * (
v - vmin - 0.4 * dv) / dv;
4020 }
else if (
v < (vmin + 0.8 * dv)) {
4022 rgba[1] = 1 - 5 * (
v - vmin - 0.6 * dv) / dv;
4026 rgba[1] = 5 * (
v - vmin - 0.8 * dv) / dv;
4027 rgba[2] = 5 * (
v - vmin - 0.8 * dv) / dv;
4031 c1[0] = 200 / 255.0;
c1[1] = 60 / 255.0;
c1[2] = 0 / 255.0;
4032 c2[0] = 250 / 255.0;
c2[1] = 160 / 255.0;
c2[2] = 110 / 255.0;
4033 rgba[0] = (
c2[0] -
c1[0]) * (
v - vmin) / dv +
c1[0];
4034 rgba[1] = (
c2[1] -
c1[1]) * (
v - vmin) / dv +
c1[1];
4035 rgba[2] = (
c2[2] -
c1[2]) * (
v - vmin) / dv +
c1[2];
4038 c1[0] = 55 / 255.0;
c1[1] = 55 / 255.0;
c1[2] = 45 / 255.0;
4039 c2[0] = 200 / 255.0;
c2[1] = 60 / 255.0;
c2[2] = 0 / 255.0;
4040 c3[0] = 250 / 255.0;
c3[1] = 160 / 255.0;
c3[2] = 110 / 255.0;
4042 vmid = vmin + ratio * dv;
4044 rgba[0] = (
c2[0] -
c1[0]) * (
v - vmin) / (ratio*dv) +
c1[0];
4045 rgba[1] = (
c2[1] -
c1[1]) * (
v - vmin) / (ratio*dv) +
c1[1];
4046 rgba[2] = (
c2[2] -
c1[2]) * (
v - vmin) / (ratio*dv) +
c1[2];
4048 rgba[0] = (
c3[0] -
c2[0]) * (
v - vmid) / ((1-ratio)*dv) +
c2[0];
4049 rgba[1] = (
c3[1] -
c2[1]) * (
v - vmid) / ((1-ratio)*dv) +
c2[1];
4050 rgba[2] = (
c3[2] -
c2[2]) * (
v - vmid) / ((1-ratio)*dv) +
c2[2];
4054 c1[0] = 0 / 255.0;
c1[1] = 255 / 255.0;
c1[2] = 0 / 255.0;
4055 c2[0] = 255 / 255.0;
c2[1] = 150 / 255.0;
c2[2] = 0 / 255.0;
4056 c3[0] = 255 / 255.0;
c3[1] = 250 / 255.0;
c3[2] = 240 / 255.0;
4058 vmid = vmin + ratio * dv;
4060 rgba[0] = (
c2[0] -
c1[0]) * (
v - vmin) / (ratio*dv) +
c1[0];
4061 rgba[1] = (
c2[1] -
c1[1]) * (
v - vmin) / (ratio*dv) +
c1[1];
4062 rgba[2] = (
c2[2] -
c1[2]) * (
v - vmin) / (ratio*dv) +
c1[2];
4064 rgba[0] = (
c3[0] -
c2[0]) * (
v - vmid) / ((1-ratio)*dv) +
c2[0];
4065 rgba[1] = (
c3[1] -
c2[1]) * (
v - vmid) / ((1-ratio)*dv) +
c2[1];
4066 rgba[2] = (
c3[2] -
c2[2]) * (
v - vmid) / ((1-ratio)*dv) +
c2[2];
4071 rgba[1] = 1 - (
v - vmin) / dv;
4075 if (
v < (vmin + 0.25 * dv)) {
4077 rgba[1] = 4 * (
v - vmin) / dv;
4079 }
else if (
v < (vmin + 0.5 * dv)) {
4082 rgba[2] = 1 - 4 * (
v - vmin - 0.25 * dv) / dv;
4083 }
else if (
v < (vmin + 0.75 * dv)) {
4084 rgba[0] = 4 * (
v - vmin - 0.5 * dv) / dv;
4090 rgba[2] = 4 * (
v - vmin - 0.75 * dv) / dv;
4094 if (
v < (vmin + 0.5 * dv)) {
4096 rgba[1] = 2 * (
v - vmin) / dv;
4097 rgba[2] = 1 - 2 * (
v - vmin) / dv;
4099 rgba[0] = 2 * (
v - vmin - 0.5 * dv) / dv;
4100 rgba[1] = 1 - 2 * (
v - vmin - 0.5 * dv) / dv;
4105 if (
v < (vmin + 0.5 * dv)) {
4107 rgba[1] = 1 - 2 * (
v - vmin) / dv;
4108 rgba[2] = 2 * (
v - vmin) / dv;
4110 rgba[0] = 1 - 2 * (
v - vmin - 0.5 * dv) / dv;
4111 rgba[1] = 2 * (
v - vmin - 0.5 * dv) / dv;
4117 rgba[1] = (
v - vmin) / (vmax - vmin);
4121 rgba[0] = (
v - vmin) / (vmax - vmin);
4126 c1[0] = 0 / 255.0;
c1[1] = 160 / 255.0;
c1[2] = 0 / 255.0;
4127 c2[0] = 180 / 255.0;
c2[1] = 220 / 255.0;
c2[2] = 0 / 255.0;
4128 c3[0] = 250 / 255.0;
c3[1] = 220 / 255.0;
c3[2] = 170 / 255.0;
4130 vmid = vmin + ratio * dv;
4132 rgba[0] = (
c2[0] -
c1[0]) * (
v - vmin) / (ratio*dv) +
c1[0];
4133 rgba[1] = (
c2[1] -
c1[1]) * (
v - vmin) / (ratio*dv) +
c1[1];
4134 rgba[2] = (
c2[2] -
c1[2]) * (
v - vmin) / (ratio*dv) +
c1[2];
4136 rgba[0] = (
c3[0] -
c2[0]) * (
v - vmid) / ((1-ratio)*dv) +
c2[0];
4137 rgba[1] = (
c3[1] -
c2[1]) * (
v - vmid) / ((1-ratio)*dv) +
c2[1];
4138 rgba[2] = (
c3[2] -
c2[2]) * (
v - vmid) / ((1-ratio)*dv) +
c2[2];
4165 if (!(zRange.second - zRange.first))
4169 Error(
"TGLLevelPaletter::GeneratePalette",
4170 "Invalid palette size, must be a positive number");
4175 Error(
"TGLLevelPalette::GeneratePalette",
4176 "Number of contours %d is too big for GL 1D texture, try to reduce it to %d",
4182 while (nearestPow2 < paletteSize)
4185 fTexels.resize(4 * nearestPow2);
4189 const Int_t nColors =
gStyle->GetNumberOfColors();
4193 for (
UInt_t i = 0; i < paletteSize; ++i) {
4195 if (paletteInd > nColors - 1)
4196 paletteInd = nColors - 1;
4197 Int_t colorInd =
gStyle->GetColorPalette(paletteInd);
4201 c->GetRGB(rgb[0], rgb[1], rgb[2]);
4227 glEnable(GL_TEXTURE_1D);
4231 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
4232 glBindTexture(GL_TEXTURE_1D,
fTexture);
4233 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
4234 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
4235 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
4236 glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA,
fTexels.size() / 4, 0,
4237 GL_RGBA, GL_UNSIGNED_BYTE, &
fTexels[0]);
4238 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GLint(mode));
4247 glDisable(GL_TEXTURE_1D);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
int Ssiz_t
String size (currently int).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
float Float_t
Float 4 bytes (float).
Bool_t operator<(const TDatime &d1, const TDatime &d2)
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
std::pair< Bool_t, TGLLine3 > Intersection(const TGLPlane &p1, const TGLPlane &p2)
Find 3D line interestion of this plane with 'other'.
Double_t Dot(const TGLVector3 &v1, const TGLVector3 &v2)
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
virtual Int_t GetNdivisions() const
virtual Float_t GetLabelOffset() const
virtual Float_t GetTickLength() const
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
Class to manage histogram axis.
virtual Bool_t GetTimeDisplay() const
const char * ChooseTimeFormat(Double_t axislength=0)
Choose a reasonable time format from the coordinates in the active pad and the number of divisions in...
virtual const char * GetTimeFormatOnly() const
Return only the time format from the string fTimeFormat.
virtual const char * GetTimeFormat() const
static Int_t GetColor(const char *hexcolor)
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
void Scale(Double_t factor)
Isotropically scale bounding box along it's LOCAL axes, preserving center.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
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...
TGLVector3 WorldDeltaToViewport(const TGLVertex3 &worldRef, const TGLVector3 &worldDelta) const
Convert a 3D vector worldDelta (shift) about vertex worldRef to a viewport (screen) '3D' vector.
~TGLCapabilityEnabler()
Destructor - reset state if changed.
TGLCapabilityEnabler(const TGLCapabilityEnabler &)
TGLCapabilitySwitch(const TGLCapabilitySwitch &)
~TGLCapabilitySwitch()
Destructor - reset state if changed.
void StdLightBackground()
Set defaults for light (white) background.
TGLColorSet & operator=(const TGLColorSet &s)
Assignment operator.
void StdDarkBackground()
Set defaults for dark (black) background.
TGLColorSet()
Constructor. Sets default for dark background.
Class encapsulating color information in preferred GL format - an array of four unsigned bytes.
void SetTransparency(Char_t transparency)
Set alpha from the transparency.
Char_t GetTransparency() const
Returns transparency value.
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
TGLColor()
Default constructor. Color is initialized to black.
TString AsString() const
Return string describing the color.
TGLColor & operator=(const TGLColor &c)
Assignment operator.
Color_t GetColorIndex() const
Returns color-index representing the color.
~TGLDisableGuard()
TGLDisableGuard destructor.
TGLDisableGuard(Int_t cap)
TGLDisableGuard constructor.
~TGLEnableGuard()
TGLEnableGuard destructor.
TGLEnableGuard(Int_t cap)
TGLEnableGuard constructor.
TGLFloatHolder(const TGLFloatHolder &)=delete
const UChar_t * GetColour(Double_t z) const
Get color.
const std::vector< Double_t > * fContours
Int_t GetPaletteSize() const
Get. Palette. Size.
void SetContours(const std::vector< Double_t > *contours)
Clear :).
std::vector< UChar_t > fTexels
void DisableTexture() const
Disable 1D texture.
Double_t GetTexCoord(Double_t z) const
Get tex coordinate.
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
void EnableTexture(Int_t mode) const
Enable 1D texture.
3D space, fixed length, line class, with direction / length 'vector', passing through point 'vertex'.
TGLLine3(const TGLVertex3 &start, const TGLVertex3 &end)
Construct 3D line running from 'start' to 'end'.
const TGLVertex3 End() const
void Draw() const
Draw line in current basic GL color.
TGLVector3 fVector
! Vector of line from fVertex
TGLVertex3 fVertex
! Start vertex of line
void Set(const TGLVertex3 &start, const TGLVertex3 &end)
Set 3D line running from 'start' to 'end'.
16 component (4x4) transform matrix - column MAJOR as per GL.
void MultLeft(const TGLMatrix &lhs)
Multiply with matrix lhs on left.
TGLVector3 Multiply(const TGLVector3 &v, Double_t w=1) const
Multiply vector.
void Scale(const TGLVector3 &scale)
Set matrix axis scales to 'scale'.
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame.
Double_t Invert()
Invert the matrix, returns determinant.
void MoveLF(Int_t ai, Double_t amount)
Translate in local frame.
void SetIdentity()
Set matrix to identity.
void Transpose3x3()
Transpose the top left 3x3 matrix component along major diagonal Supported as currently incompatibili...
void RotatePF(Int_t i1, Int_t i2, Double_t amount)
Rotate in parent frame. Does optimised version of MultLeft.
void Move3LF(Double_t x, Double_t y, Double_t z)
Translate in local frame along all base vectors simultaneously.
const Double_t * CArr() const
void Rotate(const TGLVertex3 &pivot, const TGLVector3 &axis, Double_t angle)
Update matrix so resulting transform has been rotated about 'pivot' (in parent frame),...
virtual ~TGLMatrix()
Destroy matrix object.
TGLVector3 GetTranslation() const
Return the translation component of matrix.
void RotateIP(TGLVector3 &v) const
Rotate vector in-place. Translation is not applied.
Bool_t IsScalingForRender() const
Return true if matrix is to be considered a scaling matrix for rendering.
void TransformVertex(TGLVertex3 &vertex) const
Transform passed 'vertex' by this matrix - converts local frame to parent.
TGLVector3 GetScale() const
Get local axis scaling factors.
void MultRight(const TGLMatrix &rhs)
Multiply with matrix rhs on right.
void SetTranslation(Double_t x, Double_t y, Double_t z)
Set matrix translation components x,y,z.
void Set(const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis=nullptr)
Set matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
void MultiplyIP(TGLVector3 &v, Double_t w=1) const
Multiply vector in-place.
void Translate(const TGLVector3 &vect)
Shift matrix translation components by 'vect' in parent frame.
void Dump() const
Output 16 matrix components to std::cout.
TGLMatrix()
Construct default identity matrix:
3D plane class - of format Ax + By + Cz + D = 0
void Set(const TGLPlane &other)
Assign from other.
void Negate()
Negate the plane.
TGLVertex3 NearestOn(const TGLVertex3 &point) const
Return nearest point on plane.
TGLPlane & operator=(const TGLPlane &src)
Assignment operator.
void Normalise()
Normalise the plane.
TGLPlane()
Construct a default plane of x + y + z = 0.
Double_t DistanceTo(const TGLVertex3 &vertex) const
Distance from plane to vertex.
void Dump() const
Output plane equation to std::out.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Bool_t GetXLog() const
Get X log.
const Rgl::Range_t & GetZRange() const
Z range.
Bool_t GetYLog() const
Get Y log.
Bool_t GetZLog() const
Get Z log.
const Rgl::Range_t & GetYRange() const
Y range.
const Rgl::Range_t & GetXRange() const
X range.
Wrapper class for GLU quadric shape drawing object.
GLUquadric * Get()
Get the internal raw GLU quadric object. Created on first call.
TGLRect()
Construct empty rect object, corner (0,0), width/height 0.
Int_t Diagonal() const
Return the diagonal of the rectangle.
Rgl::EOverlap Overlap(const TGLRect &other) const
Return overlap result (kInside, kOutside, kPartial) of this rect with 'other'.
virtual ~TGLRect()
Destroy rect object.
Int_t fHeight
! Positive width/height
void Expand(Int_t x, Int_t y)
Expand the rect to encompass point (x,y).
const UChar_t * GetPixelColor(Int_t px, Int_t py) const
Get pixel color.
void ReadColorBuffer(Int_t width, Int_t height)
Read color buffer.
virtual ~TGLSelectionBuffer()
TGLSelectionBuffer destructor.
TGLSelectionBuffer()
TGLSelectionBuffer constructor.
std::vector< UChar_t > fBuffer
static void DrawSphere(const TGLVertex3 &position, Double_t radius, const UChar_t rgba[4])
Draw sphere, centered on vertex 'position', with radius 'radius', color 'rgba'.
static void Color4ubv(const UChar_t *rgba)
Wrapper for glColor4ubv.
static UInt_t GetDrawQuality()
static: get draw quality
static Int_t fgPickingRadius
static const UChar_t fgWhite[4]
static UInt_t fgDefaultDrawQuality
static void SetDrawQuality(UInt_t dq)
static: set draw quality
static Float_t GetPointSizeScale()
Get global point-size scale.
static void Color3f(Float_t r, Float_t g, Float_t b)
Wrapper for glColor3f.
static Float_t fgPointSize
static Float_t fgLineWidth
static Float_t fgScreenScalingFactor
static void ResetDrawQuality()
static: reset draw quality
static Float_t fgSimpleAxisWidthScale
static Float_t fgPointSizeScale
static Bool_t IsColorLocked()
Returns true if color lock-count is greater than 0.
static void Color3fv(const Float_t *rgb)
Wrapper for glColor3fv.
static void SetLineWidthScale(Float_t scale)
Set global line-width scale.
static void SetSimpleAxisWidthScale(Float_t s)
static UInt_t LockColor()
Prevent further color changes.
static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
Wrapper for glColor4f.
static void SetDrawColors(const UChar_t rgba[4])
Set basic draw colors from 4 component 'rgba' Used by other TGLUtil drawing routines.
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
static void BeginAttLine(const TAttLine &aline, Char_t transp, Int_t pick_radius=0, Bool_t selection=kFALSE)
Setup drawing parameters according to passed TAttLine.
static const UChar_t fgRed[4]
static void RenderPolyLine(const TAttLine &aline, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE)
Render poly-line as specified by the p-array.
static UInt_t GetDefaultDrawQuality()
static: get default draw quality
static void BeginExtendPickRegion(Float_t scale)
static void InitializeIfNeeded()
Initialize globals that require other libraries to be initialized.
static Float_t GetLineWidthScale()
Returns global line-width scale.
static Float_t fgPointLineScalingFactor
static UInt_t UnlockColor()
Allow color changes.
static void EndAttLine(Int_t pick_radius=0, Bool_t selection=kFALSE)
Restore previous line drawing state.
static void LineWidth(Float_t line_width)
Set the line-width, taking the global scaling into account.
static void DrawLine(const TGLLine3 &line, ELineHeadShape head, Double_t size, const UChar_t rgba[4])
Draw thick line (tube) defined by 'line', with head at end shape 'head' - box/arrow/none,...
static void Color(const TGLColor &color)
Set color from TGLColor.
static void DrawReferenceMarker(const TGLCamera &camera, const TGLVertex3 &pos, Float_t radius=3, const UChar_t *rgba=nullptr)
Draw a sphere- marker on world-coordinate 'pos' with pixel radius 'radius'.
static void DrawRing(const TGLVertex3 ¢er, const TGLVector3 &normal, Double_t radius, const UChar_t *rgba)
Draw ring, centered on 'center', lying on plane defined by 'center' & 'normal' of outer radius 'radiu...
static void Color3ubv(const UChar_t *rgb)
Wrapper for glColor3ubv.
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
static Int_t GetPickingRadius()
Returns picking radius.
static void SetPointSizeScale(Float_t scale)
Set global point-size scale.
static void Color4fv(const Float_t *rgba)
Wrapper for glColor4fv.
static void Color3ub(UChar_t r, UChar_t g, UChar_t b)
Wrapper for glColor3ub.
static UInt_t fgDrawQuality
static GLUtesselator * GetDrawTesselator4dv()
Returns a tesselator for direct drawing when using 4-vertices with double precision.
static const UChar_t fgBlue[4]
static const UChar_t fgGrey[4]
static Float_t PointSize()
Get the point-size, taking the global scaling into account.
static void EndExtendPickRegion()
static GLUtesselator * GetDrawTesselator3dv()
Returns a tesselator for direct drawing when using 3-vertices with double precision.
static GLUtesselator * GetDrawTesselator4fv()
Returns a tesselator for direct drawing when using 4-vertices with single precision.
static Float_t fgSimpleAxisBBoxScale
static const UChar_t fgGreen[4]
static UInt_t fgColorLockCount
static GLUtesselator * GetDrawTesselator3fv()
Returns a tesselator for direct drawing when using 3-vertices with single precision.
static void DrawSimpleAxes(const TGLCamera &camera, const TGLBoundingBox &bbox, Int_t axesType, Float_t labelScale=1)
Draw simple xyz-axes for given bounding-box.
static void SetSimpleAxisBBoxScale(Float_t s)
static void SetDefaultDrawQuality(UInt_t dq)
static: set default draw quality
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
static void DrawNumber(const TString &num, const TGLVertex3 &pos, Bool_t center=kFALSE)
Draw number in string 'num' via internal 8x8-pixel bitmap on vertex 'pos'.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
static Float_t fgLineWidthScale
static void RenderPolyMarkers(const TAttMarker &marker, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render polymarkers at points specified by p-array.
static const UChar_t fgYellow[4]
static void RenderPoints(const TAttMarker &marker, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render markers as circular or square points.
static Float_t GetPointLineScalingFactor()
Return extra scaling factor for points and lines.
static void Color4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
Wrapper for glColor4ub.
static void RenderCrosses(const TAttMarker &marker, Float_t *p, Int_t n, Bool_t sec_selection=kFALSE)
Render markers as crosses.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void Dump() const
Output vertex component values to std::cout.
void Minimum(const TGLVertex3 &other)
void Maximum(const TGLVertex3 &other)
void Set(Double_t x, Double_t y, Double_t z)
TGLVertex3()
Construct a default (0.0, 0.0, 0.0) vertex.
void Shift(TGLVector3 &shift)
Offset a vertex by vector 'shift'.
const Double_t * CArr() const
~TGLVertex3()
Destroy vertex object.
void SetTimeFormat(const char *tformat)
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
void SetLabelOffset(Float_t labeloffset)
virtual void ImportAxisAttributes(TAxis *axis)
void SetOption(Option_t *option="")
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.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawTrapezoid(const Double_t ver[][2], Double_t zMin, Double_t zMax, Bool_t color=kTRUE)
void DrawFaceTextured(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, Double_t t1, Double_t t2, Double_t t3, const TGLVector3 &norm1, const TGLVector3 &norm2, const TGLVector3 &norm3)
Draw textured triangle.
void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA, const Double_t *outer, const Double_t *outerRGBA)
TODO: is it possible to use GLdouble to avoid problems with Double_t/GLdouble if they are not the sam...
void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &normal)
Draw quad face.
void DrawTrapezoidTextured(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
const Float_t gNullEmission[]
const Int_t gFramePoints[][2]
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
const Float_t gBlueEmission[]
const Float_t gWhiteEmission[]
void SetZLevels(TAxis *zAxis, Double_t zMin, Double_t zMax, Double_t zScale, std::vector< Double_t > &zLevels)
void CylindricalNormalInv(const Double_t *v, Double_t *normal)
void DrawTrapezoidTextured2(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
const Int_t gBoxFrontQuads[][4]
const Float_t gGrayEmission[]
void GetColor(Float_t v, Float_t vmin, Float_t vmax, Int_t type, Float_t *rgba)
This function creates color for parametric surface's vertex, using its 'u' value.
const Int_t gBoxBackQuads[][4]
void SphericalNormal(const Double_t *v, Double_t *normal)
void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
const Int_t gAxisType[][2]
void DrawError(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
void SphericalNormalInv(const Double_t *v, Double_t *normal)
const Float_t gRedEmission[]
const Int_t gBoxBackPlanes[][2]
void DrawTransparentBox(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.
std::pair< Double_t, Double_t > Range_t
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.
const Double_t gBoxFrontNormals[][3]
const Float_t gGreenEmission[]
void CylindricalNormal(const Double_t *v, Double_t *normal)
void DrawQuadOutline(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVertex3 &v4)
Draw quad outline.
void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2, const Double_t *rgba1, const Double_t *rgba2)
void DrawSphere(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax, Int_t front)
Draws lego's bar as a 3d box LULULULU.
void DrawSmoothFace(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &norm1, const TGLVector3 &norm2, const TGLVector3 &norm3)
Draws triangle face, each vertex has its own averaged normal.
const Double_t gBoxBackNormals[][3]
const Float_t gOrangeEmission[]
void Draw2DAxis(TAxis *axis, Double_t xMin, Double_t yMin, Double_t xMax, Double_t yMax, Double_t min, Double_t max, Bool_t log, Bool_t z=kFALSE)
Int_t ColorToObjectID(const UChar_t *color, Bool_t highColor)
const Int_t gBoxFrontPlanes[][2]
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(...
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
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.
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.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.