Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveSMorph.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Matevz Tadel
3
4/*************************************************************************
5 * Copyright (C) 1995-2025, 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_REveSMorph
13#define ROOT7_REveSMorph
14
15#include <ROOT/REveElement.hxx>
16
17#include <algorithm>
18#include <string>
19
20namespace ROOT {
21namespace Experimental {
22
23class REveSMorph : public REveElement {
24private:
25 REveSMorph(const REveSMorph &) = delete;
26 REveSMorph &operator=(const REveSMorph &) = delete;
27
28protected:
29 // Tessellation. GUI range [2, 100] / [3, 100], step 1.
30 // clang-format off
31 Int_t fTLevel{24}; ///< divisions in theta
32 Int_t fPLevel{32}; ///< divisions in phi
33
34 // Morph. All zero is a plain sphere. GUI range [-2, 2], step 0.01; the
35 // shape stops being informative well before the ends.
36 Float_t fTx{0.f}; ///< twist of phi, proportional to cos(theta)
37 Float_t fCx{0.f}; ///< radial convergence, proportional to cos(theta)
38 Float_t fRz{0.f}; ///< shear about z, proportional to x
39
40 // Extent, as fractions of the full ranges. GUI range [0, 1], step 0.001.
41 Float_t fThetaMin{0.f}; ///< theta from fThetaMin * pi
42 Float_t fThetaMax{1.f}; ///< theta to fThetaMax * pi
43 Float_t fPhiMean{0.5f}; ///< phi centred on fPhiMean * 2pi
44 Float_t fPhiRange{1.f}; ///< phi spanning fPhiRange * 2pi; 1 closes the seam
45
46 /// Space the theta rings by equal surface area rather than by equal angle,
47 /// which keeps the quads near the poles from collapsing.
49
50 /// Surface colour, multiplied by the texture where there is one. Must be a
51 /// member with SetMainColorPtr() pointing at it, or SetMainColor() is a
52 /// silent no-op.
54
55 /// File name under ui5/eve7/textures/. Empty draws in the main colour.
56 std::string fTexture;
57
58 Float_t fTexX0{0.f}; ///< u offset
59 Float_t fTexY0{1.f}; ///< v offset
60 Float_t fTexXC{1.f}; ///< u wraps per turn in phi
61 Float_t fTexYC{-1.f}; ///< v wraps per sweep in theta
62 Float_t fTexYOff{0.f}; ///< u shift per whole v, for a brick bond
63 // clang-format on
64
65public:
66 REveSMorph(const std::string &n = "REveSMorph", const std::string &t = "");
67 ~REveSMorph() override = default;
68
69 /// Shape and texture parameters; each setter clamps and stamps kCBObjProps.
70 /// Size is in the transformation, see SetRadius().
71 /// @{
72 // clang-format off
73 Int_t GetTLevel() const { return fTLevel; }
74 Int_t GetPLevel() const { return fPLevel; }
75 void SetTLevel(Int_t l) { fTLevel = std::clamp(l, 2, 200); StampObjProps(); }
76 void SetPLevel(Int_t l) { fPLevel = std::clamp(l, 3, 200); StampObjProps(); }
77
78 Float_t GetTx() const { return fTx; }
79 Float_t GetCx() const { return fCx; }
80 Float_t GetRz() const { return fRz; }
81 void SetTx(Float_t v) { fTx = std::clamp(v, -2.f, 2.f); StampObjProps(); }
82 void SetCx(Float_t v) { fCx = std::clamp(v, -2.f, 2.f); StampObjProps(); }
83 void SetRz(Float_t v) { fRz = std::clamp(v, -2.f, 2.f); StampObjProps(); }
84
85 Float_t GetThetaMin() const { return fThetaMin; }
86 Float_t GetThetaMax() const { return fThetaMax; }
87 Float_t GetPhiMean() const { return fPhiMean; }
88 Float_t GetPhiRange() const { return fPhiRange; }
89 void SetThetaMin(Float_t v) { fThetaMin = std::clamp(v, 0.f, 1.f); StampObjProps(); }
90 void SetThetaMax(Float_t v) { fThetaMax = std::clamp(v, 0.f, 1.f); StampObjProps(); }
91 void SetPhiMean(Float_t v) { fPhiMean = std::clamp(v, 0.f, 1.f); StampObjProps(); }
92 void SetPhiRange(Float_t v) { fPhiRange = std::clamp(v, 0.f, 1.f); StampObjProps(); }
93
94 Bool_t GetEquiSurf() const { return fEquiSurf; }
96
97 const std::string &GetTexture() const { return fTexture; }
98 void SetTexture(const std::string &f) { fTexture = f; StampObjProps(); }
99
100 Float_t GetTexX0() const { return fTexX0; }
101 Float_t GetTexY0() const { return fTexY0; }
102 Float_t GetTexXC() const { return fTexXC; }
103 Float_t GetTexYC() const { return fTexYC; }
104 Float_t GetTexYOff() const { return fTexYOff; }
105 void SetTexX0(Float_t v) { fTexX0 = std::clamp(v, -1e3f, 1e3f); StampObjProps(); }
106 void SetTexY0(Float_t v) { fTexY0 = std::clamp(v, -1e3f, 1e3f); StampObjProps(); }
107 void SetTexXC(Float_t v) { fTexXC = std::clamp(v, -1e3f, 1e3f); StampObjProps(); }
108 void SetTexYC(Float_t v) { fTexYC = std::clamp(v, -1e3f, 1e3f); StampObjProps(); }
109 void SetTexYOff(Float_t v) { fTexYOff = std::clamp(v, -1e3f, 1e3f); StampObjProps(); }
110 // clang-format on
111 /// @}
112
113 void SetRadius(Float_t r);
114
115 void ComputeBBox() override;
116
117 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
118 void BuildRenderData() override;
119};
120
121} // namespace Experimental
122} // namespace ROOT
123
124#endif
#define f(i)
Definition RSha256.hxx:104
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
@ kWhite
Definition Rtypes.h:65
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
Float_t fThetaMax
theta to fThetaMax * pi
Float_t fCx
radial convergence, proportional to cos(theta)
Float_t fPhiMean
phi centred on fPhiMean * 2pi
void SetTexture(const std::string &f)
Bool_t fEquiSurf
Space the theta rings by equal surface area rather than by equal angle, which keeps the quads near th...
Float_t fRz
shear about z, proportional to x
Color_t fColor
Surface colour, multiplied by the texture where there is one.
Float_t fPhiRange
phi spanning fPhiRange * 2pi; 1 closes the seam
Float_t fTx
twist of phi, proportional to cos(theta)
REveSMorph(const REveSMorph &)=delete
void SetRadius(Float_t r)
Uniform scale on the main transformation.
~REveSMorph() override=default
std::string fTexture
File name under ui5/eve7/textures/. Empty draws in the main colour.
void BuildRenderData() override
Name the client factory makeSMorph.
REveSMorph & operator=(const REveSMorph &)=delete
Float_t fTexYOff
u shift per whole v, for a brick bond
Int_t GetTLevel() const
Shape and texture parameters; each setter clamps and stamps kCBObjProps.
void ComputeBBox() override
Bounding box: the unit cube in the element's own frame.
Float_t fTexXC
u wraps per turn in phi
const std::string & GetTexture() const
Int_t fPLevel
divisions in phi
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Stream the shape and texture parameters and the bounding box.
Int_t fTLevel
divisions in theta
Float_t fThetaMin
theta from fThetaMin * pi
Float_t fTexYC
v wraps per sweep in theta
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TLine l
Definition textangle.C:4