31Float_t REveProjection::fgEps = 0.005f;
32Float_t REveProjection::fgEpsSqr = 0.000025f;
37REveProjection::REveProjection() :
39 fGeoMode (kGM_Unknown),
45 fFixR (300), fFixZ (400),
46 fPastFixRFac (0), fPastFixZFac (0),
47 fScaleR (1), fScaleZ (1),
48 fPastFixRScale (1), fPastFixZScale (1),
69 v[0] =
x;
v[1] =
y;
v[2] = z;
86 v[0] =
p[0];
v[1] =
p[1];
v[2] =
p[2];
105 x =
v[0];
y =
v[1]; z =
v[2];
109 x =
p[0];
y =
p[1]; z =
p[2];
112 v[0] =
x;
v[1] =
y;
v[2] = z;
143 v = i->fOffset + (
v - i->fMin)*i->fScale;
183 static const REveException eh(
"REveProjection::AddPreScaleEntry ");
185 if (coord < 0 || coord > 2)
186 throw (eh +
"coordinate out of range.");
188 const Float_t infty = std::numeric_limits<Float_t>::infinity();
196 vec.emplace_back(0, infty, 0, scale);
200 vec.emplace_back(0,
value, 0, 1);
208 throw (eh +
"minimum value not larger than previous one.");
226 static const REveException eh(
"REveProjection::ChangePreScaleEntry ");
228 if (coord < 0 || coord > 2)
229 throw (eh +
"coordinate out of range.");
232 Int_t vs = vec.size();
233 if (entry < 0 || entry >= vs)
234 throw (eh +
"entry out of range.");
236 vec[entry].fScale = new_scale;
237 Int_t i0 = entry, i1 = entry + 1;
344 Warning(
"BisectBreakPoint",
"call with eps_sqr argument is obsolete - please use the new signature.");
361 while (--n_loops >= 0)
363 vM.
Mult(vL + vR, 0.5f);
396 for (
Int_t i=0; i<3; i++)
398 vec[i] = (i==screenAxis) ? 1.0f : 0.0f;
412 centerOO =
fCenter - dirCenter;
423 static const REveException eH(
"REveProjection::GetValForScreenPos ");
425 static const int kMaxSteps = 5000;
426 static const int kMaxVal = 10;
441 if (sv > zeroProjected[axisIdx])
447 while (cnt < kMaxSteps)
449 vec.
Mult(dirVec, xR);
453 if (vec[axisIdx] >= sv)
break;
456 if (++cnt >= kMaxSteps)
457 throw eH +
Form(
"positive projected %f, value %f,xL, xR ( %f, %f)\n", vec[axisIdx], sv, xL, xR);
460 else if (sv < zeroProjected[axisIdx])
466 while (cnt < kMaxSteps)
468 vec.
Mult(dirVec, xL);
472 if (vec[axisIdx] <= sv)
break;
474 if (++cnt >= kMaxSteps)
475 throw eH +
Form(
"negative projected %f, value %f,xL, xR ( %f, %f)\n", vec[axisIdx], sv, xL, xR);
488 xM = 0.5f * (xL + xR);
489 vec.
Mult(dirVec, xM);
492 if (vec[axisIdx] > sv)
496 if (++cnt >= kMaxSteps)
497 throw eH +
Form(
"can't converge %f %f, l/r %f/%f, idx=%d\n", vec[axisIdx], sv, xL, xR, axisIdx);
555 using namespace TMath;
635 vec.
Set(0.0f, 0.0f, 1.0f);
636 else if (screenAxis == 1)
637 vec.
Set(0.0f, 1.0f, 0.0f);
655 if ((
v1.fY <
a &&
v2.fY >
a) || (
v1.fY >
a &&
v2.fY <
a))
663 if (a1 < tolerance) {
v1.fY =
a; val =
kTRUE; }
667 if (a2 < tolerance) {
v2.fY =
a; val =
kTRUE; }
688 if ((d1 < 0 && d2 > 0) || (d1 > 0 && d2 < 0))
702 const Float_t t = d1 / (d1 - d2);
713 const Float_t t = d1 / (d1 - d2);
779 using namespace TMath;
794 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
807 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
850 using namespace TMath;
871 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
884 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
931 vec.
Set(1.0f, 0.0f, 0.0f);
932 else if (screenAxis == 1)
933 vec.
Set(0.0f, 0.0f, 1.0f);
959 using namespace TMath;
981 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
994 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1040 if (screenAxis == 0)
1041 vec.
Set(0.0f, 1.0f, 0.0f);
1042 else if (screenAxis == 1)
1043 vec.
Set(0.0f, 0.0f, 1.0f);
1068 using namespace TMath;
1089 r = Sqrt(
x*
x +
y*
y);
1090 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1102 r = Sqrt(
x*
x +
y*
y);
1103 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1149 if (screenAxis == 0)
1150 vec.
Set(0.0f, 0.0f, 1.0f);
1151 else if (screenAxis == 1)
1152 vec.
Set(1.0f, 0.0f, 0.0f);
1178 using namespace TMath;
1198 r = Sqrt(
x*
x +
y*
y);
1199 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1211 r = Sqrt(
x*
x +
y*
y);
1212 phi = (
x == 0.0f &&
y == 0.0f) ? 0.0f : ATan2(
y,
x);
1258 if (screenAxis == 0)
1259 vec.
Set(0.0f, 0.0f, 1.0f);
1260 else if (screenAxis == 1)
1261 vec.
Set(0.0f, 1.0f, 0.0f);
1286 using namespace TMath;
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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 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 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.
Namespace for ROOT features in testing.
Double_t Log2(Double_t x)
Returns the binary (base-2) logarithm of x.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.