30Float_t REveProjection::fgEps = 0.005f;
31Float_t REveProjection::fgEpsSqr = 0.000025f;
36REveProjection::REveProjection() :
38 fGeoMode (kGM_Unknown),
44 fFixR (300), fFixZ (400),
45 fPastFixRFac (0), fPastFixZFac (0),
46 fScaleR (1), fScaleZ (1),
47 fPastFixRScale (1), fPastFixZScale (1),
68 v[0] =
x;
v[1] =
y;
v[2] = z;
85 v[0] = p[0];
v[1] = p[1];
v[2] = p[2];
104 x =
v[0];
y =
v[1]; z =
v[2];
108 x = p[0];
y = p[1]; z = p[2];
111 v[0] =
x;
v[1] =
y;
v[2] = z;
142 v = i->fOffset + (
v - i->fMin)*i->fScale;
182 static const REveException eh(
"REveProjection::AddPreScaleEntry ");
184 if (coord < 0 || coord > 2)
185 throw (eh +
"coordinate out of range.");
187 const Float_t infty = std::numeric_limits<Float_t>::infinity();
195 vec.emplace_back(0, infty, 0, scale);
199 vec.emplace_back(0, value, 0, 1);
200 vec.emplace_back(value, infty, value, scale);
206 if (value <= prev.
fMin)
207 throw (eh +
"minimum value not larger than previous one.");
211 vec.emplace_back(value, infty, offset, scale);
225 static const REveException eh(
"REveProjection::ChangePreScaleEntry ");
227 if (coord < 0 || coord > 2)
228 throw (eh +
"coordinate out of range.");
231 Int_t vs = vec.size();
232 if (entry < 0 || entry >= vs)
233 throw (eh +
"entry out of range.");
235 vec[entry].fScale = new_scale;
236 Int_t i0 = entry, i1 = entry + 1;
343 Warning(
"BisectBreakPoint",
"call with eps_sqr argument is obsolete - please use the new signature.");
360 while (--n_loops >= 0)
362 vM.
Mult(vL + vR, 0.5f);
395 for (
Int_t i=0; i<3; i++)
397 vec[i] = (i==screenAxis) ? 1.0f : 0.0f;
411 centerOO =
fCenter - dirCenter;
422 static const REveException eH(
"REveProjection::GetValForScreenPos ");
424 static const int kMaxSteps = 5000;
425 static const int kMaxVal = 10;
440 if (sv > zeroProjected[axisIdx])
446 while (cnt < kMaxSteps)
448 vec.
Mult(dirVec, xR);
452 if (vec[axisIdx] >= sv)
break;
455 if (++cnt >= kMaxSteps)
456 throw eH +
Form(
"positive projected %f, value %f,xL, xR ( %f, %f)\n", vec[axisIdx], sv, xL, xR);
459 else if (sv < zeroProjected[axisIdx])
465 while (cnt < kMaxSteps)
467 vec.
Mult(dirVec, xL);
471 if (vec[axisIdx] <= sv)
break;
473 if (++cnt >= kMaxSteps)
474 throw eH +
Form(
"negative projected %f, value %f,xL, xR ( %f, %f)\n", vec[axisIdx], sv, xL, xR);
487 xM = 0.5f * (xL + xR);
488 vec.
Mult(dirVec, xM);
491 if (vec[axisIdx] > sv)
495 if (++cnt >= kMaxSteps)
496 throw eH +
Form(
"can't converge %f %f, l/r %f/%f, idx=%d\n", vec[axisIdx], sv, xL, xR, axisIdx);
553 using namespace TMath;
629 vec.
Set(0.0f, 0.0f, 1.0f);
630 else if (screenAxis == 1)
631 vec.
Set(0.0f, 1.0f, 0.0f);
646 if ((
v1.fY <
a &&
v2.fY >
a) || (
v1.fY >
a &&
v2.fY <
a))
654 if (a1 < tolerance) {
v1.fY =
a; val =
kTRUE; }
658 if (a2 < tolerance) {
v2.fY =
a; val =
kTRUE; }
705 using namespace TMath;
720 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
733 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
776 using namespace TMath;
797 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
810 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
857 vec.
Set(1.0f, 0.0f, 0.0f);
858 else if (screenAxis == 1)
859 vec.
Set(0.0f, 0.0f, 1.0f);
885 using namespace TMath;
907 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
920 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
967 vec.
Set(0.0f, 1.0f, 0.0f);
968 else if (screenAxis == 1)
969 vec.
Set(0.0f, 0.0f, 1.0f);
994 using namespace TMath;
1015 r = Sqrt(
x*
x +
y*
y);
1016 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1028 r = Sqrt(
x*
x +
y*
y);
1029 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1075 if (screenAxis == 0)
1076 vec.
Set(0.0f, 0.0f, 1.0f);
1077 else if (screenAxis == 1)
1078 vec.
Set(1.0f, 0.0f, 0.0f);
1104 using namespace TMath;
1124 r = Sqrt(
x*
x +
y*
y);
1125 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1137 r = Sqrt(
x*
x +
y*
y);
1138 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1184 if (screenAxis == 0)
1185 vec.
Set(0.0f, 0.0f, 1.0f);
1186 else if (screenAxis == 1)
1187 vec.
Set(0.0f, 1.0f, 0.0f);
1212 using namespace TMath;
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
char * Form(const char *fmt,...)
REve3DProjection()
Constructor.
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
REveException Exception-type thrown by Eve classes.
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.
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)
void SetDistortion(Float_t d)
Set distortion.
vPreScale_t fPreScales[3]
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.
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.
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.
REveRPhiProjection()
Constructor.
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.
REveRhoZProjection()
Constructor.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
REveVector fProjectedCenter
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 SetCenter(REveVector &v) override
Set center of distortion (virtual method).
void MultiplyIP(TVector3 &v, Double_t w=1) const
Multiply vector in-place.
TVector3 Multiply(const TVector3 &v, Double_t w=1) const
Multiply vector and return it.
REveVectorT & Mult(const REveVectorT &a, TT af)
void Set(const Float_t *v)
TT Dot(const REveVectorT &a) const
REveVector fProjectedCenter
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).
REveXZProjection()
Constructor.
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.
REveYZProjection()
Constructor.
REveVector fProjectedCenter
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.
REveVector fProjectedCenter
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
REveZXProjection()
Constructor.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
void SetCenter(REveVector &v) override
Set center of distortion (virtual method).
REveVector fProjectedCenter
void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e proc=kPP_Full) override
Project point.
REveZYProjection()
Constructor.
void SetDirectionalVector(Int_t screenAxis, REveVector &vec) override
Get direction in the unprojected space for axis index in the projected space.
Double_t Log2(Double_t x)
Double_t Sqrt(Double_t x)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Int_t CeilNint(Double_t x)