Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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:
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
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);
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; }
139
140 // utils to draw axis
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 REveVector fPlaneNormal; // normal vector of projection plane
160 bool fYAxis{true}; // cached flag to mark if plane normal has been rotated
162
163public:
166
167 Bool_t Is2D() const override { return kTRUE; }
168 Bool_t Is3D() const override { return kFALSE; }
169
170 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
171
172 void SetCenter(REveVector &v) override;
174
177
178 Bool_t HasSeveralSubSpaces() const override { return kTRUE; }
180 Int_t SubSpaceId(const REveVector &v) const override;
181 Bool_t IsOnSubSpaceBoundrary(const REveVector &v) const override;
182 void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override;
183};
184
185//==============================================================================
186// REveRPhiProjection
187// XY non-linear projection.
188//==============================================================================
189
191public:
194
195 Bool_t Is2D() const override { return kTRUE; }
196 Bool_t Is3D() const override { return kFALSE; }
197
198 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
199};
200
201//==============================================================================
202// REveXZProjection
203// XZ non-linear projection.
204//==============================================================================
205
207private:
208 REveVector fProjectedCenter; // projected center of distortion.
209
210public:
212 ~REveXZProjection() override {}
213
214 Bool_t Is2D() const override { return kTRUE; }
215 Bool_t Is3D() const override { return kFALSE; }
216
217 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
218
219 void SetCenter(REveVector& v) override;
221
222 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
223};
224
225//==============================================================================
226// REveYZProjection
227// YZ non-linear projection.
228//==============================================================================
229
231private:
232 REveVector fProjectedCenter; // projected center of distortion.
233
234public:
236 ~REveYZProjection() override {}
237
238 Bool_t Is2D() const override { return kTRUE; }
239 Bool_t Is3D() const override { return kFALSE; }
240
241 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
242
243 void SetCenter(REveVector& v) override;
245
246 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
247};
248
249//==============================================================================
250// REveZXProjection
251// ZX non-linear projection.
252//==============================================================================
253
255private:
256 REveVector fProjectedCenter; // projected center of distortion.
257
258public:
260 ~REveZXProjection() override {}
261
262 Bool_t Is2D() const override { return kTRUE; }
263 Bool_t Is3D() const override { return kFALSE; }
264
265 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
266
267 void SetCenter(REveVector& v) override;
269
270 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
271};
272
273//==============================================================================
274// REveZYProjection
275// ZY non-linear projection.
276//==============================================================================
277
279private:
280 REveVector fProjectedCenter; // projected center of distortion.
281
282public:
284 ~REveZYProjection() override {}
285
286 Bool_t Is2D() const override { return kTRUE; }
287 Bool_t Is3D() const override { return kFALSE; }
288
289 void ProjectPoint(Float_t& x, Float_t& y, Float_t& z, Float_t d, EPProc_e proc = kPP_Full) override;
290
291 void SetCenter(REveVector& v) override;
293
294 void SetDirectionalVector(Int_t screenAxis, REveVector& vec) override;
295};
296
297//==============================================================================
298// REve3DProjection
299// 3D scaling "projection"
300//==============================================================================
301
303public:
305 ~REve3DProjection() override {}
306
307 Bool_t Is2D() const override { return kFALSE; }
308 Bool_t Is3D() const override { return kTRUE; }
309
310 void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc = kPP_Full) override;
311};
312
313} // namespace Experimental
314} // namespace ROOT
315
316#endif
#define d(i)
Definition RSha256.hxx:102
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 AcceptSegment(REveVector &v1, REveVector &v2, Float_t tolerance) const override
Check if segment of two projected points is valid.
void SetPlaneNormal(REveVector &v)
Set normal of the projection plane Projection center must be on the plane The default plane normal va...
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
Bool_t AcceptSegmentRotatedPlane(REveVector &v1, REveVector &v2, Float_t tolerance) const
Check if segment of two projected points is valid on a rotated plane.
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
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
PreScaleEntry_t(Float_t min, Float_t max, Float_t off, Float_t scale)
TMarker m
Definition textangle.C:8