]>
Commit | Line | Data |
---|---|---|
504edcf6 | 1 | #ifndef REVE_NLTProjections |
2 | #define REVE_NLTProjections | |
3 | ||
4 | #include <Reve/PODs.h> | |
5 | ||
6 | namespace Reve { | |
7 | ||
8 | //////////////////////////////////////////////////////////////// | |
9 | // // | |
10 | // NLTProjection // | |
11 | // // | |
12 | //////////////////////////////////////////////////////////////// | |
13 | ||
14 | class NLTProjection | |
15 | { | |
16 | public: | |
17 | enum PType_e { PT_Unknown, PT_CFishEye, PT_RhoZ }; // type | |
18 | enum PProc_e { PP_Plane, PP_Distort, PP_Full }; // procedure | |
19 | enum GeoMode_e { GM_Unknown, GM_Polygons, GM_Segments }; // reconstruction of geometry | |
20 | ||
21 | protected: | |
22 | PType_e fType; // type | |
23 | GeoMode_e fGeoMode; // way of polygon reconstruction | |
24 | const char* fName; // name | |
25 | ||
26 | Vector fCenter; // center of distortion | |
27 | Vector fZeroPosVal; // projected origin (0, 0, 0) | |
28 | ||
29 | Float_t fDistortion; // distortion | |
30 | Float_t fFixedRadius; // projected radius independent of distortion | |
31 | Float_t fScale; // scale factor to keep projected radius fixed | |
32 | Vector fUpLimit; // convergence of point +infinity | |
33 | Vector fLowLimit; // convergence of point -infinity | |
34 | ||
35 | public: | |
36 | NLTProjection(Vector& center); | |
37 | virtual ~NLTProjection(){} | |
38 | ||
39 | virtual void ProjectPoint(Float_t&, Float_t&, Float_t&, PProc_e p = PP_Full ) = 0; | |
40 | virtual void ProjectPointFv(Float_t* v){ ProjectPoint(v[0], v[1], v[2]); } | |
41 | virtual void ProjectVector(Vector& v); | |
42 | ||
43 | const char* GetName(){return fName;} | |
44 | void SetName(const char* txt){ fName = txt; } | |
45 | ||
46 | virtual void SetCenter(Vector& v){ fCenter = v; UpdateLimit();} | |
47 | virtual Float_t* GetProjectedCenter() { return fCenter.c_vec(); } | |
48 | ||
49 | void SetType(PType_e t){fType = t;} | |
50 | PType_e GetType(){return fType;} | |
51 | ||
52 | void SetGeoMode(GeoMode_e m){fGeoMode = m;} | |
53 | GeoMode_e GetGeoMode(){return fGeoMode;} | |
54 | ||
55 | void UpdateLimit(); | |
56 | void SetDistortion(Float_t d); | |
57 | Float_t GetDistortion(){return fDistortion;} | |
58 | void SetFixedRadius(Float_t x); | |
59 | Float_t GetFixedRadius(){return fFixedRadius;} | |
60 | ||
61 | virtual Bool_t AcceptSegment(Vector&, Vector&, Float_t /*tolerance*/) { return kTRUE; } | |
62 | virtual void SetDirectionalVector(Int_t screenAxis, Vector& vec); | |
63 | ||
64 | // utils to draw axis | |
65 | virtual Float_t GetValForScreenPos(Int_t ax, Float_t value); | |
66 | virtual Float_t GetScreenVal(Int_t ax, Float_t value); | |
67 | Float_t GetLimit(Int_t i, Bool_t pos) { return pos ? fUpLimit[i] : fLowLimit[i]; } | |
68 | ||
69 | static Float_t fgEps; // resolution of projected points | |
70 | ||
71 | ClassDef(NLTProjection, 0); // Base-class for non-linear projection. | |
72 | }; // endclass NLTProjection | |
73 | ||
74 | //////////////////////////////////////////////////////////////// | |
75 | // // | |
76 | // NLTRhoZ // | |
77 | // // | |
78 | //////////////////////////////////////////////////////////////// | |
79 | ||
80 | class NLTRhoZ: public NLTProjection | |
81 | { | |
82 | private: | |
83 | Vector fProjectedCenter; // projected center of distortion. | |
84 | public: | |
85 | NLTRhoZ(Vector& center) : NLTProjection(center) { fType = PT_RhoZ; fName="RhoZ"; } | |
86 | virtual ~NLTRhoZ() {} | |
87 | ||
88 | virtual Bool_t AcceptSegment(Vector& v1, Vector& v2, Float_t tolerance); | |
89 | virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, PProc_e proc = PP_Full); | |
90 | virtual void SetDirectionalVector(Int_t screenAxis, Vector& vec); | |
91 | ||
92 | virtual void SetCenter(Vector& center); | |
93 | virtual Float_t* GetProjectedCenter() { return fProjectedCenter.c_vec(); } | |
94 | ClassDef(NLTRhoZ, 0); // Rho/Z non-linear projection. | |
95 | }; // endclass NLTRhoZ | |
96 | ||
97 | //////////////////////////////////////////////////////////////// | |
98 | // // | |
99 | // NLTCircularFishEye // | |
100 | // // | |
101 | //////////////////////////////////////////////////////////////// | |
102 | ||
103 | class NLTCircularFishEye : public NLTProjection | |
104 | { | |
105 | public: | |
106 | NLTCircularFishEye(Vector& center):NLTProjection(center) { fType = PT_CFishEye; fGeoMode = GM_Polygons; fName="CircularFishEye"; } | |
107 | virtual ~NLTCircularFishEye() {} | |
108 | ||
109 | virtual void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, PProc_e proc = PP_Full); | |
110 | ||
111 | ClassDef(NLTCircularFishEye, 0); // XY non-linear projection. | |
112 | }; // endclass NLTCircularFishEye | |
113 | ||
114 | } | |
115 | #endif |