3 #define protected public
4 #include "TEveProjections.h"
9 #include "TEveProjectionManager.h"
13 #include "TGLRnrCtx.h"
15 #include "TMatrixDEigen.h"
16 #include "TMatrixDSym.h"
18 #include "TDecompSVD.h"
19 #include "TGLIncludes.h"
45 fE = SetModelDynCast<TEveEllipsoid>(
obj);
54 SetAxisAlignedBBox(((
TEveEllipsoid*)fExternalObj)->AssertBBox());
68 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LIGHTING_BIT);
69 glEnable(GL_NORMALIZE );
71 quad = gluNewQuadric();
81 TMatrixDEigen eig(xxx);
89 x(
i+1,
j+1) = eig.GetEigenVectors()(
i,
j);
92 TVector3
a = x.GetBaseVec(1);
93 TVector3
c = a.Cross(x.GetBaseVec(2));
97 glMultMatrixd(x.Array());
99 gluSphere(quad,1. , 30, 30);
134 fM = SetModelDynCast<TEveEllipsoidProjected>(
obj);
152 TEveProjection *proj =
fM->GetManager()->GetProjection();
155 glPushAttrib(GL_ENABLE_BIT| GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
156 glDisable(GL_LIGHTING);
157 glDisable(GL_CULL_FACE);
160 if ( proj->GetType() == TEveProjection::kPT_RPhi)
173 TEveProjection *proj =
fM->GetManager()->GetProjection();
174 float phi = phiStart;
175 while (phi < phiEnd ) {
176 TEveVector
v = v0 + v1*((float)
cos(phi)) + v2*((
float)
sin(phi));
177 proj->ProjectVector(v,
fM->fDepth);
178 glVertex3fv(v.Arr());
182 TEveVector
v = v0 + v1*((float)
cos(phiEnd)) + v2*((
float)
sin(phiEnd));
183 proj->ProjectVector(v,
fM->fDepth);
184 glVertex3fv(v.Arr());
199 TMatrixDEigen eig(xxx);
200 TVectorD xxxEig ( eig.GetEigenValuesRe());
205 TEveVector v1(eig.GetEigenVectors()(0, 0) , eig.GetEigenVectors()(0, 1), 0 );
207 TEveVector v2(eig.GetEigenVectors()(1, 0) , eig.GetEigenVectors()(1, 1), 0 );
210 TEveProjection *proj =
fM->GetManager()->GetProjection();
218 TGLUtil::LineWidth(
fE->fLineWidth);
219 TGLUtil::Color(
fE->fLineColor);
221 glBegin(GL_LINE_LOOP);
228 TEveVector
p1 = v0 - v1;
229 TEveVector
p2 = v0 + v1;
230 proj->ProjectVector(p1,
fM->fDepth);
231 proj->ProjectVector(p2,
fM->fDepth);
232 glVertex3fv(p1.Arr());
233 glVertex3fv(p2.Arr());
237 TEveVector
p1 = v0 - v2;
238 TEveVector
p2 = v0 + v2;
239 proj->ProjectVector(p1,
fM->fDepth);
240 proj->ProjectVector(p2,
fM->fDepth);
241 glVertex3fv(p1.Arr());
242 glVertex3fv(p2.Arr());
264 TMatrixDEigen eig(xxx);
265 TVectorD xxxEig ( eig.GetEigenValuesRe());
268 TEveVector v1(0, eig.GetEigenVectors()(1, 2), eig.GetEigenVectors()(2, 2));
271 TEveVector v2(0, eig.GetEigenVectors()(1, 1), eig.GetEigenVectors()(2, 1));
273 if (v1[1]*v2[2] > v1[2]*v2[1])
277 TEveProjection *proj =
fM->GetManager()->GetProjection();
280 bool splitted =
false;
286 if (proj->GetDisplaceOrigin())
287 bs = proj->fCenter[1];
289 float da = v2[1]*v2[1] + v1[1]*v1[1];
290 float db = 2 * v1[1] * (v0[1]-bs);
291 float dc = (v0[1]-bs)*(v0[1]-bs) - v2[1]*v2[1];
292 float disc = (
db*
db -4*
da*dc);
296 float cosS1 = ( -
db + disc)/(2 *
da);
297 float cosS2 = ( -
db - disc)/(2 *
da);
298 if (TMath::Abs(cosS1) < 1) {
302 double phi1 = acos(cosS1);
303 double phi2 = acos(cosS2);
304 TEveVector ps1 = v0 + v1*((float)
cos(phi1)) + v2*((
float)
sin(phi1));
305 TEveVector ps2 = v0 + v1*((float)
cos(phi2)) + v2*((
float)
sin(phi2));
310 if (TMath::Abs(ps1[1] - bs) > 1
e-5)
313 if (TMath::Abs(ps2[1] - bs) > 1
e-5)
318 double phiOffset = phiStep*0.1;
326 drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
330 drawArch(phiMax + phiOffset, phiMax +
TMath::TwoPi() - (phiMax -phiMin) - phiOffset, phiStep, v0, v1, v2);
334 TGLUtil::LineWidth(
fE->fLineWidth);
335 TGLUtil::Color(
fE->fLineColor);
337 glBegin(GL_LINE_LOOP);
338 drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
341 glBegin(GL_LINE_LOOP);
342 drawArch(phiMax + phiOffset, phiMax +
TMath::TwoPi() - (phiMax -phiMin) - phiOffset, phiStep, v0, v1, v2);
353 TGLUtil::LineWidth(
fE->fLineWidth);
354 TGLUtil::Color(
fE->fLineColor);
355 glBegin(GL_LINE_LOOP);
367 TEveProjection* proj =
fM->GetManager()->GetProjection();
370 if (proj->GetDisplaceOrigin())
371 bs = proj->fCenter[1];
373 float off = (v2[1] > v0[1] ) ? 0.01 : -0.01;
374 TEveVector alu = v0 + v2;
375 proj->ProjectVector(alu,
fM->fDepth);
376 glVertex3fv(alu.Arr());
378 if (TMath::Abs(v0[1]/v2[1]) < 1 )
380 alu = v0 - ((float) ((1-off) *(v0[1]-bs)/v2[1])) * v2;
381 proj->ProjectVector(alu,
fM->fDepth);
382 glVertex3fv(alu.Arr());
386 alu = v0 - ((float) ((1+off) * (v0[1]-bs)/v2[1])) * v2;
387 proj->ProjectVector(alu,
fM->fDepth);
388 glVertex3fv(alu.Arr());
392 proj->ProjectVector(alu,
fM->fDepth);
393 glVertex3fv(alu.Arr());
void drawArch(float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Sin< T >::type sin(const T &t)
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
void drawRhoZAxis(TEveVector &v, TEveVector &) const
Cos< T >::type cos(const T &t)
TEveEllipsoidProjectedGL()
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
TEveVector & RefExtent3D()
TEveEllipsoidProjected * fM