Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TView3D.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Rene Brun 19/02/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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
13#ifndef ROOT_TView3D
14#define ROOT_TView3D
15
16
17/////////////////////////////////////////////////////////////////////////
18// //
19// TView3D //
20// //
21/////////////////////////////////////////////////////////////////////////
22
23
24#include "TView.h"
25
26class TSeqCollection;
27class TVirtualPad;
28
29class TView3D : public TView {
30
31protected:
32 Double_t fLatitude; //View angle latitude
33 Double_t fLongitude; //View angle longitude
34 Double_t fPsi; //View angle psi
35 Double_t fDview; //Distance from COP to COV
36 Double_t fDproj; //Distance from COP to projection plane
37 Double_t fUpix; // pad X size in pixels
38 Double_t fVpix; // pad Y size in pixels
39 Double_t fTN[16]; //
40 Double_t fTB[16]; //
41 Double_t fRmax[3]; //Upper limits of object
42 Double_t fRmin[3]; //Lower limits of object
43 Double_t fUVcoord[4]; //Viewing window limits
44 Double_t fTnorm[16]; //Transformation matrix
45 Double_t fTback[16]; //Back transformation matrix
46 Double_t fX1[3]; //First coordinate of X axis
47 Double_t fX2[3]; //Second coordinate of X axis
48 Double_t fY1[3]; //First coordinate of Y axis
49 Double_t fY2[3]; //Second coordinate of Y axis
50 Double_t fZ1[3]; //First coordinate of Z axis
51 Double_t fZ2[3]; //Second coordinate of Z axis
52 Int_t fSystem; //Coordinate system
53 TSeqCollection *fOutline; //Collection of outline's objects
54 Bool_t fDefaultOutline; //Set to TRUE if outline is default cube
55 Bool_t fAutoRange; //Set to TRUE if range computed automatically
56 Bool_t fChanged; //! Set to TRUE after ExecuteRotateView
57
58 TView3D(const TView3D&); // Not implemented
59 TView3D& operator=(const TView3D&); // Not implemented
60
61 void ResetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep);
62
63
64public:
65 // TView3D status bits
66 enum {
67 kPerspective = BIT(6)
68 };
69
70 TView3D();
71 TView3D(Int_t system, const Double_t *rmin, const Double_t *rmax);
72 ~TView3D() override;
73
74 void AxisVertex(Double_t ang, Double_t *av, Int_t &ix1, Int_t &ix2, Int_t &iy1, Int_t &iy2, Int_t &iz1, Int_t &iz2) override;
75 void DefinePerspectiveView() override;
76 void DefineViewDirection(const Double_t *s, const Double_t *c,
77 Double_t cosphi, Double_t sinphi,
78 Double_t costhe, Double_t sinthe,
79 Double_t cospsi, Double_t sinpsi,
80 Double_t *tnorm, Double_t *tback) override;
81 void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax) override;
82 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
83 void ExecuteRotateView(Int_t event, Int_t px, Int_t py) override;
84 void FindScope(Double_t *scale, Double_t *center, Int_t &irep) override;
85 Int_t GetDistancetoAxis(Int_t axis, Int_t px, Int_t py, Double_t &ratio) override;
86 Double_t GetDview() const override {return fDview;}
87 Double_t GetDproj() const override {return fDproj;}
88 Double_t GetExtent() const override;
89 Bool_t GetAutoRange() override {return fAutoRange;}
90 Double_t GetLatitude() override {return fLatitude;}
91 Double_t GetLongitude() override {return fLongitude;}
92 Double_t GetPsi() override {return fPsi;}
93 void GetRange (Float_t *min, Float_t *max) override;
94 void GetRange (Double_t *min, Double_t *max) override;
95 Double_t *GetRmax() override {return fRmax;}
96 Double_t *GetRmin() override {return fRmin;}
97 TSeqCollection *GetOutline() override {return fOutline; }
98 Double_t *GetTback() override {return fTback;}
99 Double_t *GetTN() override {return fTN;}
100 Double_t *GetTnorm() override {return fTnorm;}
101 Int_t GetSystem() override {return fSystem;}
102 void GetWindow(Double_t &u0, Double_t &v0, Double_t &du, Double_t &dv) const override;
103 Double_t GetWindowWidth() const override {return 0.5*(fUVcoord[1]-fUVcoord[0]);}
104 Double_t GetWindowHeight() const override {return 0.5*(fUVcoord[3]-fUVcoord[2]);}
105 void FindNormal(Double_t x, Double_t y, Double_t z, Double_t &zn) override;
106 void FindPhiSectors(Int_t iopt, Int_t &kphi, Double_t *aphi, Int_t &iphi1, Int_t &iphi2) override;
107 void FindThetaSectors(Int_t iopt, Double_t phi, Int_t &kth, Double_t *ath, Int_t &ith1, Int_t &ith2) override;
108 Bool_t IsClippedNDC(Double_t *p) const override;
109 Bool_t IsPerspective() const override {return TestBit(kPerspective);}
110 Bool_t IsViewChanged() const override {return fChanged;}
111 void NDCtoWC(const Float_t *pn, Float_t *pw) override;
112 void NDCtoWC(const Double_t *pn, Double_t *pw) override;
113 void NormalWCtoNDC(const Float_t *pw, Float_t *pn) override;
114 void NormalWCtoNDC(const Double_t *pw, Double_t *pn) override;
115 void PadRange(Int_t rback) override;
116 void ResizePad() override;
117 void SetAutoRange(Bool_t autorange=kTRUE) override {fAutoRange=autorange;}
118 void SetAxisNDC(const Double_t *x1, const Double_t *x2, const Double_t *y1, const Double_t *y2, const Double_t *z1, const Double_t *z2) override;
119 void SetDefaultWindow() override;
120 void SetDview(Double_t dview) override {fDview=dview;}
121 void SetDproj(Double_t dproj) override {fDproj=dproj;}
122 void SetLatitude(Double_t latitude) override {fLatitude = latitude;}
123 void SetLongitude(Double_t longitude) override {fLongitude = longitude;}
124 void SetPsi(Double_t psi) override {fPsi = psi;}
125 void SetOutlineToCube() override;
126 void SetParallel() override; // *MENU*
127 void SetPerspective() override; // *MENU*
128 void SetRange(const Double_t *min, const Double_t *max) override;
129 void SetRange(Double_t x0, Double_t y0, Double_t z0, Double_t x1, Double_t y1, Double_t z1, Int_t flag=0) override;
130 void SetSystem(Int_t system) override {fSystem = system;}
131 void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep) override;
132 void SetViewChanged(Bool_t flag=kTRUE) override {fChanged = flag;}
133 void SetWindow(Double_t u0, Double_t v0, Double_t du, Double_t dv) override;
134 void WCtoNDC(const Float_t *pw, Float_t *pn) override;
135 void WCtoNDC(const Double_t *pw, Double_t *pn) override;
136
137//--
138 void MoveFocus(Double_t *center, Double_t dx, Double_t dy, Double_t dz, Int_t nsteps=10,
139 Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0) override;
140 void MoveViewCommand(Char_t chCode, Int_t count=1) override;
141 void MoveWindow(Char_t option) override;
142
143 void AdjustScales(TVirtualPad *pad = nullptr) override;
144 void Centered3DImages(TVirtualPad *pad = nullptr) override;
145 void Centered() override; // *MENU*
146 void FrontView(TVirtualPad *pad = nullptr) override;
147 void Front() override; // *MENU*
148
149 void ZoomIn() override; // *MENU*
150 void ZoomOut() override; // *MENU*
151 void ZoomView(TVirtualPad *pad = nullptr, Double_t zoomFactor = 1.25 ) override;
152 void UnzoomView(TVirtualPad *pad = nullptr,Double_t unZoomFactor = 1.25) override;
153
154 void RotateView(Double_t phi, Double_t theta, TVirtualPad *pad = nullptr) override;
155 void SideView(TVirtualPad *pad = nullptr) override;
156 void Side() override; // *MENU*
157 void TopView(TVirtualPad *pad = nullptr) override;
158 void Top() override; // *MENU*
159
160 void ToggleRulers(TVirtualPad *pad = nullptr) override;
161 void ShowAxis() override; // *MENU*
162 void ToggleZoom(TVirtualPad *pad = nullptr) override;
163 void ZoomMove() override; // *MENU*
164 void Zoom() override; // *MENU*
165 void UnZoom() override; // *MENU*
166
167 static void AdjustPad(TVirtualPad *pad = nullptr);
168
170};
171
172#endif
173
#define c(i)
Definition RSha256.hxx:101
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define BIT(n)
Definition Rtypes.h:85
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
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 MoveWindow
Option_t Option_t TPoint TPoint const char y1
A doubly linked list.
Definition TList.h:38
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
Sequenceable collection abstract base class.
The 3D view class.
Definition TView3D.h:29
Double_t fDproj
Definition TView3D.h:36
Bool_t fDefaultOutline
Definition TView3D.h:54
Double_t fTB[16]
Definition TView3D.h:40
ClassDefOverride(TView3D, 3)
void ZoomMove() override
Definition TView3D.cxx:1935
TView3D()
Default constructor.
Definition TView3D.cxx:109
void NDCtoWC(const Float_t *pn, Float_t *pw) override
Transfer point from normalized to world coordinates.
Definition TView3D.cxx:1070
Double_t fUpix
Definition TView3D.h:37
void ToggleRulers(TVirtualPad *pad=nullptr) override
Turn on /off 3D axis.
Definition TView3D.cxx:1600
void SetLatitude(Double_t latitude) override
Definition TView3D.h:122
Double_t fX2[3]
Definition TView3D.h:47
Bool_t fChanged
Definition TView3D.h:56
Double_t fPsi
Definition TView3D.h:34
void FindPhiSectors(Int_t iopt, Int_t &kphi, Double_t *aphi, Int_t &iphi1, Int_t &iphi2) override
Find critical PHI sectors.
Definition TView3D.cxx:806
void ZoomIn() override
Zoom in.
Definition TView3D.cxx:1822
Double_t fLongitude
Definition TView3D.h:33
Double_t fZ1[3]
Definition TView3D.h:50
Double_t * GetTN() override
Definition TView3D.h:99
Int_t GetSystem() override
Definition TView3D.h:101
Double_t GetWindowHeight() const override
Definition TView3D.h:104
Double_t fUVcoord[4]
Definition TView3D.h:43
void ZoomOut() override
Zoom out.
Definition TView3D.cxx:1842
void FindNormal(Double_t x, Double_t y, Double_t z, Double_t &zn) override
Find Z component of NORMAL in normalized coordinates.
Definition TView3D.cxx:786
Double_t fZ2[3]
Definition TView3D.h:51
TView3D & operator=(const TView3D &)
Assignment operator.
Definition TView3D.cxx:235
Double_t fY1[3]
Definition TView3D.h:48
void UnZoom() override
Definition TView3D.cxx:1937
void ExecuteRotateView(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TView3D.cxx:642
void SetPerspective() override
Set perspective option.
Definition TView3D.cxx:1315
Double_t GetDview() const override
Definition TView3D.h:86
Double_t * GetTnorm() override
Definition TView3D.h:100
Double_t GetPsi() override
Definition TView3D.h:92
Double_t fTback[16]
Definition TView3D.h:45
void SetParallel() override
Set the parallel option (default).
Definition TView3D.cxx:1304
Double_t * GetRmax() override
Definition TView3D.h:95
void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax) override
Draw the outline of a cube while rotating a 3-d object in the pad.
Definition TView3D.cxx:620
Int_t GetDistancetoAxis(Int_t axis, Int_t px, Int_t py, Double_t &ratio) override
Return distance to axis from point px,py.
Definition TView3D.cxx:971
Double_t * GetTback() override
Definition TView3D.h:98
Double_t fTnorm[16]
Definition TView3D.h:44
void ResetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
Set view direction (in spherical coordinates).
Definition TView3D.cxx:1437
Double_t fLatitude
Definition TView3D.h:32
void FrontView(TVirtualPad *pad=nullptr) override
Set to front view.
Definition TView3D.cxx:1584
void MoveFocus(Double_t *center, Double_t dx, Double_t dy, Double_t dz, Int_t nsteps=10, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0) override
Move focus to a different box position and extent in nsteps.
Definition TView3D.cxx:1683
Bool_t IsPerspective() const override
Definition TView3D.h:109
void SetRange(const Double_t *min, const Double_t *max) override
Set Range function.
Definition TView3D.cxx:1327
void Centered3DImages(TVirtualPad *pad=nullptr) override
Move view into the center of the scene.
Definition TView3D.cxx:1635
void NormalWCtoNDC(const Float_t *pw, Float_t *pn) override
Transfer vector of NORMAL from word to normalized coordinates.
Definition TView3D.cxx:1100
void FindScope(Double_t *scale, Double_t *center, Int_t &irep) override
Find centre of a MIN-MAX scope and scale factors.
Definition TView3D.cxx:933
void GetWindow(Double_t &u0, Double_t &v0, Double_t &du, Double_t &dv) const override
Get current window extent.
Definition TView3D.cxx:1045
void Centered() override
Definition TView3D.cxx:1930
void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep) override
Set view parameters.
Definition TView3D.cxx:1397
void SetWindow(Double_t u0, Double_t v0, Double_t du, Double_t dv) override
Set viewing window.
Definition TView3D.cxx:1386
void SetAutoRange(Bool_t autorange=kTRUE) override
Definition TView3D.h:117
Double_t * GetRmin() override
Definition TView3D.h:96
void GetRange(Float_t *min, Float_t *max) override
Get Range function.
Definition TView3D.cxx:1029
Bool_t GetAutoRange() override
Definition TView3D.h:89
void SetPsi(Double_t psi) override
Definition TView3D.h:124
void DefinePerspectiveView() override
Define perspective view.
Definition TView3D.cxx:400
Double_t fY2[3]
Definition TView3D.h:49
Double_t GetLongitude() override
Definition TView3D.h:91
void Top() override
Definition TView3D.cxx:1934
void MoveViewCommand(Char_t chCode, Int_t count=1) override
Definition TView3D.cxx:1739
void ToggleZoom(TVirtualPad *pad=nullptr) override
Turn on /off the interactive option to Zoom / Move / Change attributes of 3D axis correspond this vie...
Definition TView3D.cxx:1609
~TView3D() override
TView3D default destructor.
Definition TView3D.cxx:276
Double_t GetExtent() const override
Get maximum view extent.
Definition TView3D.cxx:1017
Double_t fX1[3]
Definition TView3D.h:46
void AdjustScales(TVirtualPad *pad=nullptr) override
Adjust all sides of view in respect of the biggest one.
Definition TView3D.cxx:1617
void ZoomView(TVirtualPad *pad=nullptr, Double_t zoomFactor=1.25) override
ZOOM this view.
Definition TView3D.cxx:1660
void UnzoomView(TVirtualPad *pad=nullptr, Double_t unZoomFactor=1.25) override
unZOOM this view.
Definition TView3D.cxx:1651
void SetDview(Double_t dview) override
Definition TView3D.h:120
void Zoom() override
Definition TView3D.cxx:1936
Double_t fTN[16]
Definition TView3D.h:39
Bool_t fAutoRange
Definition TView3D.h:55
static void AdjustPad(TVirtualPad *pad=nullptr)
Force the current pad to be updated.
Definition TView3D.cxx:1539
void WCtoNDC(const Float_t *pw, Float_t *pn) override
Transfer point from world to normalized coordinates.
Definition TView3D.cxx:1479
Bool_t IsClippedNDC(Double_t *p) const override
Check if point is clipped in perspective view.
Definition TView3D.cxx:1056
void SetAxisNDC(const Double_t *x1, const Double_t *x2, const Double_t *y1, const Double_t *y2, const Double_t *z1, const Double_t *z2) override
Store axis coordinates in the NDC system.
Definition TView3D.cxx:1237
void PadRange(Int_t rback) override
Set the correct window size for lego and surface plots.
Definition TView3D.cxx:1158
Bool_t IsViewChanged() const override
Definition TView3D.h:110
Double_t GetLatitude() override
Definition TView3D.h:90
Double_t GetDproj() const override
Definition TView3D.h:87
void SetLongitude(Double_t longitude) override
Definition TView3D.h:123
Double_t fRmin[3]
Definition TView3D.h:42
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TView3D.cxx:628
void FindThetaSectors(Int_t iopt, Double_t phi, Int_t &kth, Double_t *ath, Int_t &ith1, Int_t &ith2) override
Find critical THETA sectors for given PHI sector.
Definition TView3D.cxx:872
void TopView(TVirtualPad *pad=nullptr) override
Set to top view.
Definition TView3D.cxx:1592
Double_t fRmax[3]
Definition TView3D.h:41
void SetOutlineToCube() override
This is a function which creates default outline.
Definition TView3D.cxx:1292
TSeqCollection * GetOutline() override
Definition TView3D.h:97
void SetViewChanged(Bool_t flag=kTRUE) override
Definition TView3D.h:132
void ShowAxis() override
Definition TView3D.cxx:1932
Double_t fDview
Definition TView3D.h:35
Double_t GetWindowWidth() const override
Definition TView3D.h:103
void SetSystem(Int_t system) override
Definition TView3D.h:130
TSeqCollection * fOutline
Definition TView3D.h:53
void RotateView(Double_t phi, Double_t theta, TVirtualPad *pad=nullptr) override
API to rotate view and adjust the pad provided it the current one.
Definition TView3D.cxx:1555
@ kPerspective
Definition TView3D.h:67
void SetDproj(Double_t dproj) override
Definition TView3D.h:121
void ResizePad() override
Recompute window for perspective view.
Definition TView3D.cxx:1405
void DefineViewDirection(const Double_t *s, const Double_t *c, Double_t cosphi, Double_t sinphi, Double_t costhe, Double_t sinthe, Double_t cospsi, Double_t sinpsi, Double_t *tnorm, Double_t *tback) override
Define view direction (in spherical coordinates)
Definition TView3D.cxx:514
void SideView(TVirtualPad *pad=nullptr) override
Set to side view.
Definition TView3D.cxx:1576
Int_t fSystem
Definition TView3D.h:52
void Front() override
Definition TView3D.cxx:1931
void AxisVertex(Double_t ang, Double_t *av, Int_t &ix1, Int_t &ix2, Int_t &iy1, Int_t &iy2, Int_t &iz1, Int_t &iz2) override
Define axis vertices.
Definition TView3D.cxx:298
void SetDefaultWindow() override
Set default viewing window.
Definition TView3D.cxx:1252
Double_t fVpix
Definition TView3D.h:38
void Side() override
Definition TView3D.cxx:1933
See TView3D.
Definition TView.h:25
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17