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