3 #include "TEveProjections.h" 7 #include "TEveProjectionManager.h" 11 #include "TGLRnrCtx.h" 13 #include "TMatrixDEigen.h" 14 #include "TMatrixDSym.h" 16 #include "TDecompSVD.h" 17 #include "TGLIncludes.h" 38 fE = SetModelDynCast<TEveEllipsoid>(
obj);
46 SetAxisAlignedBBox(((
TEveEllipsoid*)fExternalObj)->AssertBBox());
50 GLUquadric* quad =
nullptr;
59 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LIGHTING_BIT);
60 glEnable(GL_NORMALIZE);
62 quad = gluNewQuadric();
67 for (
int i = 0;
i < 3;
i++)
68 for (
int j = 0;
j < 3;
j++) {
71 TMatrixDEigen eig(
xxx);
75 for (
int i = 0;
i < 3;
i++)
76 for (
int j = 0;
j < 3;
j++) {
77 x(
i + 1,
j + 1) = eig.GetEigenVectors()(
i,
j);
80 TVector3
a =
x.GetBaseVec(1);
81 TVector3
c =
a.Cross(
x.GetBaseVec(2));
85 glMultMatrixd(
x.Array());
87 gluSphere(quad, 1., 30, 30);
115 fM = SetModelDynCast<TEveEllipsoidProjected>(
obj);
117 return fE !=
nullptr;
131 TEveProjection*
proj =
fM->GetManager()->GetProjection();
133 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
134 glDisable(GL_LIGHTING);
135 glDisable(GL_CULL_FACE);
138 if (
proj->GetType() == TEveProjection::kPT_RPhi)
149 float phiStart,
float phiEnd,
float phiStep, TEveVector&
v0, TEveVector& v1, TEveVector& v2)
const {
150 TEveProjection*
proj =
fM->GetManager()->GetProjection();
151 float phi = phiStart;
152 while (
phi < phiEnd) {
154 proj->ProjectVector(
v,
fM->fDepth);
155 glVertex3fv(
v.Arr());
159 TEveVector
v =
v0 + v1 * ((
float)
cos(phiEnd)) + v2 * ((
float)
sin(phiEnd));
160 proj->ProjectVector(
v,
fM->fDepth);
161 glVertex3fv(
v.Arr());
169 for (
int i = 0;
i < 2;
i++)
170 for (
int j = 0;
j < 2;
j++) {
174 TMatrixDEigen eig(
xxx);
175 TVectorD xxxEig(eig.GetEigenValuesRe());
179 TEveVector v1(eig.GetEigenVectors()(0, 0), eig.GetEigenVectors()(0, 1), 0);
181 TEveVector v2(eig.GetEigenVectors()(1, 0), eig.GetEigenVectors()(1, 1), 0);
184 TEveProjection*
proj =
fM->GetManager()->GetProjection();
192 TGLUtil::LineWidth(
fE->fLineWidth);
193 TGLUtil::Color(
fE->fLineColor);
195 glBegin(GL_LINE_LOOP);
202 TEveVector
p1 =
v0 - v1;
203 TEveVector
p2 =
v0 + v1;
204 proj->ProjectVector(
p1,
fM->fDepth);
205 proj->ProjectVector(
p2,
fM->fDepth);
206 glVertex3fv(
p1.Arr());
207 glVertex3fv(
p2.Arr());
211 TEveVector
p1 =
v0 - v2;
212 TEveVector
p2 =
v0 + v2;
213 proj->ProjectVector(
p1,
fM->fDepth);
214 proj->ProjectVector(
p2,
fM->fDepth);
215 glVertex3fv(
p1.Arr());
216 glVertex3fv(
p2.Arr());
229 for (
int i = 1;
i < 3;
i++)
230 for (
int j = 1;
j < 3;
j++) {
233 TMatrixDEigen eig(
xxx);
234 TVectorD xxxEig(eig.GetEigenValuesRe());
236 TEveVector v1(0, eig.GetEigenVectors()(1, 2), eig.GetEigenVectors()(2, 2));
239 TEveVector v2(0, eig.GetEigenVectors()(1, 1), eig.GetEigenVectors()(2, 1));
241 if (v1[1] * v2[2] > v1[2] * v2[1])
244 TEveProjection*
proj =
fM->GetManager()->GetProjection();
247 bool splitted =
false;
253 if (
proj->GetDisplaceOrigin())
254 bs =
proj->RefCenter()[1];
256 float da = v2[1] * v2[1] + v1[1] * v1[1];
257 float db = 2 * v1[1] * (
v0[1] -
bs);
258 float dc = (
v0[1] -
bs) * (
v0[1] -
bs) - v2[1] * v2[1];
263 float cosS1 = (-
db +
disc) / (2 *
da);
264 float cosS2 = (-
db -
disc) / (2 *
da);
265 if (TMath::Abs(cosS1) < 1) {
269 double phi1 = acos(cosS1);
270 double phi2 = acos(cosS2);
271 TEveVector ps1 =
v0 + v1 * ((
float)
cos(phi1)) + v2 * ((
float)
sin(phi1));
272 TEveVector ps2 =
v0 + v1 * ((
float)
cos(phi2)) + v2 * ((
float)
sin(phi2));
275 if (TMath::Abs(ps1[1] -
bs) > 1
e-5)
278 if (TMath::Abs(ps2[1] -
bs) > 1
e-5)
299 TGLUtil::LineWidth(
fE->fLineWidth);
300 TGLUtil::Color(
fE->fLineColor);
302 glBegin(GL_LINE_LOOP);
306 glBegin(GL_LINE_LOOP);
316 TGLUtil::LineWidth(
fE->fLineWidth);
317 TGLUtil::Color(
fE->fLineColor);
318 glBegin(GL_LINE_LOOP);
330 TEveProjection*
proj =
fM->GetManager()->GetProjection();
333 if (
proj->GetDisplaceOrigin())
334 bs =
proj->RefCenter()[1];
336 float off = (v2[1] >
v0[1]) ? 0.01 : -0.01;
337 TEveVector alu =
v0 + v2;
338 proj->ProjectVector(alu,
fM->fDepth);
339 glVertex3fv(alu.Arr());
341 if (TMath::Abs(
v0[1] / v2[1]) < 1) {
342 alu =
v0 - ((
float)((1 - off) * (
v0[1] -
bs) / v2[1])) * v2;
343 proj->ProjectVector(alu,
fM->fDepth);
344 glVertex3fv(alu.Arr());
348 alu =
v0 - ((
float)((1 + off) * (
v0[1] -
bs) / v2[1])) * v2;
349 proj->ProjectVector(alu,
fM->fDepth);
350 glVertex3fv(alu.Arr());
354 proj->ProjectVector(alu,
fM->fDepth);
355 glVertex3fv(alu.Arr());
void drawArch(float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Sin< T >::type sin(const T &t)
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Cos< T >::type cos(const T &t)
TEveEllipsoidProjectedGL()
TEveVector & RefExtent3D()
void DirectDraw(TGLRnrCtx &rnrCtx) const override
TEveEllipsoidProjected * fM
void drawRhoZAxis(TEveVector &v, TEveVector &) const
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override