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" 43 fE = SetModelDynCast<TEveEllipsoid>(
obj);
52 SetAxisAlignedBBox(((
TEveEllipsoid*)fExternalObj)->AssertBBox());
56 GLUquadric* quad =
nullptr;
66 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LIGHTING_BIT);
67 glEnable(GL_NORMALIZE );
69 quad = gluNewQuadric();
79 TMatrixDEigen eig(xxx);
87 x(
i+1, j+1) = eig.GetEigenVectors()(
i,j);
90 TVector3
a = x.GetBaseVec(1);
91 TVector3
c = a.Cross(x.GetBaseVec(2));
95 glMultMatrixd(x.Array());
97 gluSphere(quad,1. , 30, 30);
132 fM = SetModelDynCast<TEveEllipsoidProjected>(
obj);
134 return fE !=
nullptr;
150 TEveProjection *proj =
fM->GetManager()->GetProjection();
153 glPushAttrib(GL_ENABLE_BIT| GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
154 glDisable(GL_LIGHTING);
155 glDisable(GL_CULL_FACE);
158 if ( proj->GetType() == TEveProjection::kPT_RPhi)
170 TEveProjection *proj =
fM->GetManager()->GetProjection();
171 float phi = phiStart;
172 while (phi < phiEnd ) {
173 TEveVector
v = v0 + v1*((
float)
cos(phi)) + v2*((
float)
sin(phi));
174 proj->ProjectVector(v,
fM->fDepth);
175 glVertex3fv(v.Arr());
179 TEveVector
v = v0 + v1*((
float)
cos(phiEnd)) + v2*((
float)
sin(phiEnd));
180 proj->ProjectVector(v,
fM->fDepth);
181 glVertex3fv(v.Arr());
196 TMatrixDEigen eig(xxx);
197 TVectorD xxxEig ( eig.GetEigenValuesRe());
202 TEveVector v1(eig.GetEigenVectors()(0, 0) , eig.GetEigenVectors()(0, 1), 0 );
204 TEveVector v2(eig.GetEigenVectors()(1, 0) , eig.GetEigenVectors()(1, 1), 0 );
207 TEveProjection *proj =
fM->GetManager()->GetProjection();
215 TGLUtil::LineWidth(
fE->fLineWidth);
216 TGLUtil::Color(
fE->fLineColor);
218 glBegin(GL_LINE_LOOP);
225 TEveVector
p1 = v0 - v1;
226 TEveVector
p2 = v0 + v1;
227 proj->ProjectVector(p1,
fM->fDepth);
228 proj->ProjectVector(p2,
fM->fDepth);
229 glVertex3fv(p1.Arr());
230 glVertex3fv(p2.Arr());
234 TEveVector
p1 = v0 - v2;
235 TEveVector
p2 = v0 + v2;
236 proj->ProjectVector(p1,
fM->fDepth);
237 proj->ProjectVector(p2,
fM->fDepth);
238 glVertex3fv(p1.Arr());
239 glVertex3fv(p2.Arr());
261 TMatrixDEigen eig(xxx);
262 TVectorD xxxEig ( eig.GetEigenValuesRe());
265 TEveVector v1(0, eig.GetEigenVectors()(1, 2), eig.GetEigenVectors()(2, 2));
268 TEveVector v2(0, eig.GetEigenVectors()(1, 1), eig.GetEigenVectors()(2, 1));
270 if (v1[1]*v2[2] > v1[2]*v2[1])
274 TEveProjection *proj =
fM->GetManager()->GetProjection();
277 bool splitted =
false;
283 if (proj->GetDisplaceOrigin())
284 bs = proj->RefCenter()[1];
286 float da = v2[1]*v2[1] + v1[1]*v1[1];
287 float db = 2 * v1[1] * (v0[1]-bs);
288 float dc = (v0[1]-bs)*(v0[1]-bs) - v2[1]*v2[1];
289 float disc = (db*db -4*da*dc);
293 float cosS1 = ( -db +
disc)/(2 * da);
294 float cosS2 = ( -db -
disc)/(2 * da);
299 double phi1 = acos(cosS1);
300 double phi2 = acos(cosS2);
301 TEveVector ps1 = v0 + v1*((
float)
cos(phi1)) + v2*((
float)
sin(phi1));
302 TEveVector ps2 = v0 + v1*((
float)
cos(phi2)) + v2*((
float)
sin(phi2));
315 double phiOffset = phiStep*0.1;
323 drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
327 drawArch(phiMax + phiOffset, phiMax +
TMath::TwoPi() - (phiMax -phiMin) - phiOffset, phiStep, v0, v1, v2);
331 TGLUtil::LineWidth(
fE->fLineWidth);
332 TGLUtil::Color(
fE->fLineColor);
334 glBegin(GL_LINE_LOOP);
335 drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
338 glBegin(GL_LINE_LOOP);
339 drawArch(phiMax + phiOffset, phiMax +
TMath::TwoPi() - (phiMax -phiMin) - phiOffset, phiStep, v0, v1, v2);
350 TGLUtil::LineWidth(
fE->fLineWidth);
351 TGLUtil::Color(
fE->fLineColor);
352 glBegin(GL_LINE_LOOP);
365 TEveProjection* proj =
fM->GetManager()->GetProjection();
368 if (proj->GetDisplaceOrigin())
369 bs = proj->RefCenter()[1];
371 float off = (v2[1] > v0[1] ) ? 0.01 : -0.01;
372 TEveVector alu = v0 + v2;
373 proj->ProjectVector(alu,
fM->fDepth);
374 glVertex3fv(alu.Arr());
378 alu = v0 - ((
float) ((1-off) *(v0[1]-bs)/v2[1])) * v2;
379 proj->ProjectVector(alu,
fM->fDepth);
380 glVertex3fv(alu.Arr());
384 alu = v0 - ((
float) ((1+off) * (v0[1]-bs)/v2[1])) * v2;
385 proj->ProjectVector(alu,
fM->fDepth);
386 glVertex3fv(alu.Arr());
390 proj->ProjectVector(alu,
fM->fDepth);
391 glVertex3fv(alu.Arr());
void drawArch(float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Sin< T >::type sin(const T &t)
void DirectDraw(TGLRnrCtx &rnrCtx) const override
void drawRhoZAxis(TEveVector &v, TEveVector &) const
Cos< T >::type cos(const T &t)
TEveEllipsoidProjectedGL()
TEveVector & RefExtent3D()
TEveEllipsoidProjected * fM
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override