Logo ROOT  
Reference Guide
REveProjections.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveProjections
13#define ROOT7_REveProjections
14
15#include <ROOT/REveVector.hxx>
16
17#include <vector>
18#include <string>
19
20namespace ROOT {
21namespace Experimental {
22
23class REveTrans;
24
25///////////////////////////////////////////////////////////////////////////////
26/// REveProjection
27/// Base for specific classes that implement non-linear projections.
28///////////////////////////////////////////////////////////////////////////////
29
31public:
33 kPT_XZ, kPT_YZ, kPT_ZX, kPT_ZY, kPT_3D, kPT_End }; // projection type
34 enum EPProc_e { kPP_Plane, kPP_Distort, kPP_Full }; // projection procedure
35 enum EGeoMode_e { kGM_Unknown, kGM_Polygons, kGM_Segments }; // strategy for geometry projections
36
41
42 PreScaleEntry_t() = default;
43
45 : fMin(min), fMax(max), fOffset(off), fScale(scale)
46 {
47 }
48 };
49
50 typedef std::vector<PreScaleEntry_t> vPreScale_t;
51
52protected:
53 EPType_e fType; // type
54 EGeoMode_e fGeoMode; // strategy of polygon projection (what to try first)
55 std::string fName; // name
56
57 REveVector fCenter; // center of distortion
58
59 bool fDisplaceOrigin; // displace point before projection
60
61 Bool_t fUsePreScale; // use pre-scaling
62 vPreScale_t fPreScales[3]; // scaling before the distortion
63
64 Float_t fDistortion; // distortion
65 Float_t fFixR; // radius from which scaling remains constant
66 Float_t fFixZ; // z-coordinate from which scaling remains constant
67 Float_t fPastFixRFac; // relative scaling factor beyond fFixR as 10^x
68 Float_t fPastFixZFac; // relative scaling factor beyond fFixZ as 10^x
69 Float_t fScaleR; // scale factor to keep projected radius at fFixR fixed
70 Float_t fScaleZ; // scale factor to keep projected z-coordinate at fFixZ fixed
71 Float_t fPastFixRScale; // relative scaling beyond fFixR
72 Float_t fPastFixZScale; // relative scaling beyond fFixZ
73 Float_t fMaxTrackStep; // maximum distance between two points on a track
74
75 void PreScaleVariable(Int_t dim, Float_t &v);
76
77public:
79 virtual ~REveProjection() {}
80
81 virtual Bool_t Is2D() const = 0;
82 virtual Bool_t Is3D() const = 0;
83
84 virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p = kPP_Full) = 0;
85
89
90 void ProjectPointfv(const REveTrans *t, const Float_t *p, Float_t *v, Float_t d);
91 void ProjectPointdv(const REveTrans *t, const Double_t *p, Double_t *v, Float_t d);
92 void ProjectVector(const REveTrans *t, REveVector &v, Float_t d);
93
94 const char *GetName() const { return fName.c_str(); }
95 void SetName(const char *txt) { fName = txt; }
96
97 const REveVector &RefCenter() const { return fCenter; }
98 virtual void SetCenter(REveVector &v) { fCenter = v; }
99 virtual Float_t *GetProjectedCenter();
100
101 void SetDisplaceOrigin(bool);
103
104 void SetType(EPType_e t) { fType = t; }
105 EPType_e GetType() const { return fType; }
106
108 EGeoMode_e GetGeoMode() const { return fGeoMode; }
109
112
114 void PreScalePoint(Float_t &x, Float_t &y, Float_t &z);
115 void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale);
116 void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale);
117 void ClearPreScales();
118
119 void SetDistortion(Float_t d);
121 Float_t GetFixR() const { return fFixR; }
122 Float_t GetFixZ() const { return fFixZ; }
123 void SetFixR(Float_t x);
124 void SetFixZ(Float_t x);
131
132 virtual Bool_t HasSeveralSubSpaces() const { return kFALSE; }
133 virtual Bool_t AcceptSegment(REveVector &, REveVector &, Float_t /*tolerance*/) const { return kTRUE; }
134 virtual Int_t SubSpaceId(const REveVector &) const { return 0; }
135 virtual Bool_t IsOnSubSpaceBoundrary(const REveVector &) const { return kFALSE; }
136 virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Float_t eps_sqr);
137 virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Bool_t project_result = kFALSE, Float_t depth = 0);
138 virtual void SetDirectionalVector(Int_t screenAxis, REveVector &vec);
139
140 // utils to draw axis
142 virtual Float_t GetValForScreenPos(Int_t ax, Float_t value);
143 virtual Float_t GetScreenVal(Int_t ax, Float_t value);
144 Float_t GetScreenVal(Int_t i, Float_t x, REveVector &dirVec, REveVector &oCenter);
146
147 static Float_t fgEps; // resolution of projected points
148 static Float_t fgEpsSqr; // square of resolution of projected points
149};
150
151//==============================================================================
152// REveRhoZProjection
153// Rho/Z non-linear projection.
154//==============================================================================
155
157private:
158 REveVector fProjectedCenter; // projected center of distortion.
159
160public:
163
164 Bool_t Is2D() const override { return kTRUE; }
165 Bool_t Is3D() const override { return kFALSE; }
166
167 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
168
169 void SetCenter(REveVector &v) override;
171
172 Bool_t HasSeveralSubSpaces() const override { return kTRUE; }
173 Bool_t AcceptSegment(REveVector &v1, REveVector &v2, Float_t tolerance) const override;
174 Int_t SubSpaceId(const REveVector &v) const override;
175 Bool_t IsOnSubSpaceBoundrary(const REveVector &v) const override;
176 void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override;
177};
178
179//==============================================================================
180// REveRPhiProjection
181// XY non-linear projection.
182//==============================================================================
183
185public:
188
189 Bool_t Is2D() const override { return kTRUE; }
190 Bool_t Is3D() const override { return kFALSE; }
191
192 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
193};
194
195//==============================================================================
196// REveXZProjection
197// XZ non-linear projection.
198//==============================================================================
199
201private:
202 REveVector fProjectedCenter; // projected center of distortion.
203
204public:
206 virtual ~REveXZProjection() {}
207
208 Bool_t Is2D() const override { return kTRUE; }
209 Bool_t Is3D() const override { return kFALSE; }
210
211 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
212
213 void SetCenter(REveVector& v) override;
215
216 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
217};
218
219//==============================================================================
220// REveYZProjection
221// YZ non-linear projection.
222//==============================================================================
223
225private:
226 REveVector fProjectedCenter; // projected center of distortion.
227
228public:
230 virtual ~REveYZProjection() {}
231
232 Bool_t Is2D() const override { return kTRUE; }
233 Bool_t Is3D() const override { return kFALSE; }
234
235 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
236
237 void SetCenter(REveVector& v) override;
239
240 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
241};
242
243//==============================================================================
244// REveZXProjection
245// ZX non-linear projection.
246//==============================================================================
247
249private:
250 REveVector fProjectedCenter; // projected center of distortion.
251
252public:
254 virtual ~REveZXProjection() {}
255
256 Bool_t Is2D() const override { return kTRUE; }
257 Bool_t Is3D() const override { return kFALSE; }
258
259 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
260
261 void SetCenter(REveVector& v) override;
263
264 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
265};
266
267//==============================================================================
268// REveZYProjection
269// ZY non-linear projection.
270//==============================================================================
271
273private:
274 REveVector fProjectedCenter; // projected center of distortion.
275
276public:
278 virtual ~REveZYProjection() {}
279
280 Bool_t Is2D() const override { return kTRUE; }
281 Bool_t Is3D() const override { return kFALSE; }
282
283 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
284
285 void SetCenter(REveVector& v) override;
287
288 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
289};
290
291//==============================================================================
292// REve3DProjection
293// 3D scaling "projection"
294//==============================================================================
295
297public:
299 virtual ~REve3DProjection() {}
300
301 Bool_t Is2D() const override { return kFALSE; }
302 Bool_t Is3D() const override { return kTRUE; }
303
304 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
305};
306
307} // namespace Experimental
308} // namespace ROOT
309
310#endif
#define d(i)
Definition: RSha256.hxx:102
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
REveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
REveProjection Base for specific classes that implement non-linear projections.
virtual Float_t GetValForScreenPos(Int_t ax, Float_t value)
Inverse projection.
virtual Float_t GetScreenVal(Int_t ax, Float_t value)
Project point on given axis and return projected value.
std::vector< PreScaleEntry_t > vPreScale_t
REveVector GetOrthogonalCenter(int idx, REveVector &out)
Get center ortogonal to given axis index.
void ProjectPointfv(Float_t *v, Float_t d)
Project float array.
virtual Bool_t Is3D() const =0
void ProjectPointdv(Double_t *v, Float_t d)
Project double array.
void ProjectVector(REveVector &v, Float_t d)
Project REveVector.
void PreScaleVariable(Int_t dim, Float_t &v)
Pre-scale single variable with pre-scale entry dim.
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p=kPP_Full)=0
virtual void SetCenter(REveVector &v)
Float_t GetLimit(Int_t i, Bool_t pos)
virtual Bool_t Is2D() const =0
void SetDistortion(Float_t d)
Set distortion.
const REveVector & RefCenter() const
virtual void SetDirectionalVector(Int_t screenAxis, REveVector &vec)
Get vector for axis in a projected space.
void ChangePreScaleEntry(Int_t coord, Int_t entry, Float_t new_scale)
Change scale for given entry and coordinate.
virtual Bool_t HasSeveralSubSpaces() const
void PreScalePoint(Float_t &x, Float_t &y)
Pre-scale point (x, y) in projected coordinates for 2D projections:
void SetPastFixRFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixR.
void AddPreScaleEntry(Int_t coord, Float_t max_val, Float_t scale)
Add new scaling range for given coordinate.
virtual Int_t SubSpaceId(const REveVector &) const
void SetFixZ(Float_t x)
Set fixed radius.
virtual Bool_t AcceptSegment(REveVector &, REveVector &, Float_t) const
void SetDisplaceOrigin(bool)
Set flag to displace for center.
virtual void BisectBreakPoint(REveVector &vL, REveVector &vR, Float_t eps_sqr)
Find break-point on both sides of the discontinuity.
virtual Float_t * GetProjectedCenter()
Get projected center.
virtual Bool_t IsOnSubSpaceBoundrary(const REveVector &) const
void SetPastFixZFac(Float_t x)
Set 2's-exponent for relative scaling beyond FixZ.
void SetFixR(Float_t x)
Set fixed radius.
void ClearPreScales()
Clear all pre-scaling information.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Bool_t IsOnSubSpaceBoundrary(const REveVector &v) const override
Checks if point is on sub-space boundary.
Float_t * GetProjectedCenter() override
Get projected center.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Int_t SubSpaceId(const REveVector &v) const override
Return sub-space id for the point.
Bool_t HasSeveralSubSpaces() const override
Bool_t AcceptSegment(REveVector &v1, REveVector &v2, Float_t tolerance) const override
Check if segment of two projected points is valid.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Float_t * GetProjectedCenter() override
Get projected center.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Float_t * GetProjectedCenter() override
Get projected center.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Float_t * GetProjectedCenter() override
Get projected center.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
Float_t * GetProjectedCenter() override
Get projected center.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:208
PreScaleEntry_t(Float_t min, Float_t max, Float_t off, Float_t scale)
Definition: civetweb.c:2228
auto * m
Definition: textangle.C:8