Go to the documentation of this file.00001 #include "Fireworks/Vertices/interface/TEveEllipsoid.h"
00002 #include "TEveTrans.h"
00003 #include "TEveProjectionManager.h"
00004 #include "TMath.h"
00005
00006
00007 TEveEllipsoid::TEveEllipsoid(const Text_t* n, const Text_t* t) :
00008 TEveShape(n, t)
00009 {
00010
00011 }
00012
00013
00014 void TEveEllipsoid::ComputeBBox()
00015 {
00016
00017
00018 BBoxInit();
00019
00020 Float_t a = TMath::Max(TMath::Max(TMath::Abs(fExtent3D[0]), TMath::Abs(fExtent3D[1])), TMath::Abs(fExtent3D[2]));
00021
00022 fBBox[0] = -a +fPos[0];
00023 fBBox[1] = a +fPos[0];
00024
00025 fBBox[2] = -a +fPos[1];
00026 fBBox[3] = a +fPos[1];
00027
00028 fBBox[4] = -a +fPos[2];
00029 fBBox[5] = a +fPos[2];
00030 }
00031
00032
00033 TClass* TEveEllipsoid::ProjectedClass(const TEveProjection*) const
00034 {
00035
00036
00037 return TEveEllipsoidProjected::Class();
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 TEveEllipsoidProjected::TEveEllipsoidProjected(const char* n, const char* t) :
00050 TEveShape(n, t)
00051 {
00052
00053 }
00054
00055
00056 TEveEllipsoidProjected::~TEveEllipsoidProjected()
00057 {
00058
00059 }
00060
00061
00062 void TEveEllipsoidProjected::ComputeBBox()
00063 {
00064
00065
00066 BBoxInit();
00067
00068
00069 TEveEllipsoid *e3d = dynamic_cast<TEveEllipsoid*>(fProjectable);
00070
00071
00072 if ( e3d ) {
00073 TEveProjection *proj = GetManager()->GetProjection();
00074 Float_t a = TMath::Max(TMath::Max(TMath::Abs(e3d->RefExtent3D()[0]), TMath::Abs(e3d->RefExtent3D()[1])), TMath::Abs(e3d->RefExtent3D()[2]));
00075 float* p = e3d->RefPos().Arr();
00076 float b[] = {-a + p[0], a + p[0], -a + p[1], a + p[1], -a + p[2], a + p[2] };
00077 TEveVector v;
00078 v.Set(b[0],b[2], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00079 v.Set(b[1],b[2], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00080 v.Set(b[0],b[3], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00081 v.Set(b[1],b[3], b[4]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00082 v.Set(b[0],b[2], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00083 v.Set(b[1],b[2], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00084 v.Set(b[0],b[3], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00085 v.Set(b[1],b[3], b[5]); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
00086
00087
00088 fBBox[4] -= a;
00089 fBBox[5] += a;
00090
00091 }
00092
00093 }
00094
00095
00096 void TEveEllipsoidProjected::SetDepthLocal(Float_t d)
00097 {
00098
00099
00100 SetDepthCommon(d, this, fBBox);
00101 }
00102
00103
00104 void TEveEllipsoidProjected::SetProjection(TEveProjectionManager* mng, TEveProjectable* model)
00105 {
00106
00107
00108 TEveProjected::SetProjection(mng, model);
00109 CopyVizParams(dynamic_cast<TEveElement*>(model));
00110 }
00111
00112
00113 void TEveEllipsoidProjected::UpdateProjection()
00114 {
00115
00116 }