CMS 3D CMS Logo

TEveEllipsoid.cc
Go to the documentation of this file.
2 #include "TEveTrans.h"
3 #include "TEveProjectionManager.h"
4 #include "TMath.h"
5 
6 //______________________________________________________________________________
7 TEveEllipsoid::TEveEllipsoid(const Text_t* n, const Text_t* t) :
8  TEveShape(n, t)
9 {
10  // Constructor.
11 }
12 
13 //______________________________________________________________________________
15 {
16  // Compute bounding-box of the data.
17 
18  BBoxInit();
19 
21 
22  fBBox[0] = -a +fPos[0];
23  fBBox[1] = a +fPos[0];
24 
25  fBBox[2] = -a +fPos[1];
26  fBBox[3] = a +fPos[1];
27 
28  fBBox[4] = -a +fPos[2];
29  fBBox[5] = a +fPos[2];
30 }
31 
32 //______________________________________________________________________________
33 TClass* TEveEllipsoid::ProjectedClass(const TEveProjection*) const
34 {
35  // Virtual from TEveProjectable, returns TEveEllipsoidProjected class.
36 
38 }
39 
40 //==============================================================================
41 // TEveEllipsoidProjected
42 //==============================================================================
43 
44 //______________________________________________________________________________
45 //
46 // Projection of TEveEllipsoid.
47 
48 //______________________________________________________________________________
50  TEveShape(n, t)
51 {
52  // Constructor.
53 }
54 
55 //______________________________________________________________________________
57 {
58  // Destructor.
59 }
60 
61 //______________________________________________________________________________
63 {
64  // Compute bounding-box, virtual from TAttBBox.
65 
66  BBoxInit();
67 
68 
69  TEveEllipsoid *e3d = dynamic_cast<TEveEllipsoid*>(fProjectable);
70 
71  //printf("project bbox %p\n", (void*)e3d->GetBBox());
72  if ( e3d ) {
73  TEveProjection *proj = GetManager()->GetProjection();
74  Float_t a = TMath::Max(TMath::Max(TMath::Abs(e3d->RefExtent3D()[0]), TMath::Abs(e3d->RefExtent3D()[1])), TMath::Abs(e3d->RefExtent3D()[2]));
75  float* p = e3d->RefPos().Arr();
76  float b[] = {-a + p[0], a + p[0], -a + p[1], a + p[1], -a + p[2], a + p[2] };
77  TEveVector v;
78  v.Set(b[0],b[2], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
79  v.Set(b[1],b[2], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
80  v.Set(b[0],b[3], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
81  v.Set(b[1],b[3], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
82  v.Set(b[0],b[2], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
83  v.Set(b[1],b[2], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
84  v.Set(b[0],b[3], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
85  v.Set(b[1],b[3], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
86 
87  // for Z dimesion
88  fBBox[4] -= a;
89  fBBox[5] += a;
90 
91  }
92  // printf("(%f, %f) (%f, %f) (%f, %f)\n",fBBox[0],fBBox[1],fBBox[2],fBBox[3],fBBox[4],fBBox[5] );
93 }
94 
95 //______________________________________________________________________________
97 {
98  // This is virtual method from base-class TEveProjected.
99 
100  SetDepthCommon(d, this, fBBox);
101 }
102 
103 //______________________________________________________________________________
104 void TEveEllipsoidProjected::SetProjection(TEveProjectionManager* mng, TEveProjectable* model)
105 {
106  // This is virtual method from base-class TEveProjected.
107 
108  TEveProjected::SetProjection(mng, model);
109  CopyVizParams(dynamic_cast<TEveElement*>(model));
110 }
111 
112 //______________________________________________________________________________
114 {
115  // Override from abstract function.
116 }
TEveVector & RefPos()
Definition: TEveEllipsoid.h:38
TEveVector fExtent3D
Definition: TEveEllipsoid.h:26
void ComputeBBox() override
void SetDepthLocal(Float_t d) override
~TEveEllipsoidProjected() override
void UpdateProjection() override
void ComputeBBox() override
TEveVector fPos
Definition: TEveEllipsoid.h:25
T Abs(T a)
Definition: MathUtil.h:49
T Max(T a, T b)
Definition: MathUtil.h:44
TEveVector & RefExtent3D()
Definition: TEveEllipsoid.h:39
double b
Definition: hdecay.h:120
void SetProjection(TEveProjectionManager *mng, TEveProjectable *model) override
TEveEllipsoidProjected(const TEveEllipsoidProjected &)
double a
Definition: hdecay.h:121
TClass * ProjectedClass(const TEveProjection *p) const override
TEveEllipsoid(const TEveEllipsoid &)