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 virtual ~TView3D();
73
74 virtual 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);
75 virtual void DefinePerspectiveView();
76 virtual 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);
81 virtual void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax);
82 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
83 virtual void ExecuteRotateView(Int_t event, Int_t px, Int_t py);
84 virtual void FindScope(Double_t *scale, Double_t *center, Int_t &irep);
85 virtual Int_t GetDistancetoAxis(Int_t axis, Int_t px, Int_t py, Double_t &ratio);
86 virtual Double_t GetDview() const {return fDview;}
87 virtual Double_t GetDproj() const {return fDproj;}
88 virtual Double_t GetExtent() const;
89 virtual Bool_t GetAutoRange() {return fAutoRange;}
90 virtual Double_t GetLatitude() {return fLatitude;}
91 virtual Double_t GetLongitude() {return fLongitude;}
92 virtual Double_t GetPsi() {return fPsi;}
93 virtual void GetRange (Float_t *min, Float_t *max);
94 virtual void GetRange (Double_t *min, Double_t *max);
95 virtual Double_t *GetRmax() {return fRmax;}
96 virtual Double_t *GetRmin() {return fRmin;}
97 virtual TSeqCollection *GetOutline() {return fOutline; }
98 virtual Double_t *GetTback() {return fTback;}
99 virtual Double_t *GetTN() {return fTN;}
100 virtual Double_t *GetTnorm() {return fTnorm;}
101 virtual Int_t GetSystem() {return fSystem;}
102 virtual void GetWindow(Double_t &u0, Double_t &v0, Double_t &du, Double_t &dv) const;
103 virtual Double_t GetWindowWidth() const {return 0.5*(fUVcoord[1]-fUVcoord[0]);}
104 virtual Double_t GetWindowHeight() const {return 0.5*(fUVcoord[3]-fUVcoord[2]);}
105 virtual void FindNormal(Double_t x, Double_t y, Double_t z, Double_t &zn);
106 virtual void FindPhiSectors(Int_t iopt, Int_t &kphi, Double_t *aphi, Int_t &iphi1, Int_t &iphi2);
107 virtual void FindThetaSectors(Int_t iopt, Double_t phi, Int_t &kth, Double_t *ath, Int_t &ith1, Int_t &ith2);
108 virtual Bool_t IsClippedNDC(Double_t *p) const;
109 virtual Bool_t IsPerspective() const {return TestBit(kPerspective);}
110 virtual Bool_t IsViewChanged() const {return fChanged;}
111 virtual void NDCtoWC(const Float_t *pn, Float_t *pw);
112 virtual void NDCtoWC(const Double_t *pn, Double_t *pw);
113 virtual void NormalWCtoNDC(const Float_t *pw, Float_t *pn);
114 virtual void NormalWCtoNDC(const Double_t *pw, Double_t *pn);
115 virtual void PadRange(Int_t rback);
116 virtual void ResizePad();
117 virtual void SetAutoRange(Bool_t autorange=kTRUE) {fAutoRange=autorange;}
118 virtual 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);
119 virtual void SetDefaultWindow();
120 virtual void SetDview(Double_t dview) {fDview=dview;}
121 virtual void SetDproj(Double_t dproj) {fDproj=dproj;}
122 virtual void SetLatitude(Double_t latitude) {fLatitude = latitude;}
123 virtual void SetLongitude(Double_t longitude) {fLongitude = longitude;}
124 virtual void SetPsi(Double_t psi) {fPsi = psi;}
125 virtual void SetOutlineToCube();
126 virtual void SetParallel(); // *MENU*
127 virtual void SetPerspective(); // *MENU*
128 virtual void SetRange(const Double_t *min, const Double_t *max);
129 virtual void SetRange(Double_t x0, Double_t y0, Double_t z0, Double_t x1, Double_t y1, Double_t z1, Int_t flag=0);
130 virtual void SetSystem(Int_t system) {fSystem = system;}
131 virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep);
132 virtual void SetViewChanged(Bool_t flag=kTRUE) {fChanged = flag;}
133 virtual void SetWindow(Double_t u0, Double_t v0, Double_t du, Double_t dv);
134 virtual void WCtoNDC(const Float_t *pw, Float_t *pn);
135 virtual void WCtoNDC(const Double_t *pw, Double_t *pn);
136
137//--
138 virtual 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);
140 virtual void MoveViewCommand(Char_t chCode, Int_t count=1);
141 virtual void MoveWindow(Char_t option);
142
143 virtual void AdjustScales(TVirtualPad *pad = nullptr);
144 virtual void Centered3DImages(TVirtualPad *pad = nullptr);
145 virtual void Centered(); // *MENU*
146 virtual void FrontView(TVirtualPad *pad = nullptr);
147 virtual void Front(); // *MENU*
148
149 virtual void ZoomIn(); // *MENU*
150 virtual void ZoomOut(); // *MENU*
151 virtual void ZoomView(TVirtualPad *pad = nullptr, Double_t zoomFactor = 1.25 );
152 virtual void UnzoomView(TVirtualPad *pad = nullptr,Double_t unZoomFactor = 1.25);
153
154 virtual void RotateView(Double_t phi, Double_t theta, TVirtualPad *pad = nullptr);
155 virtual void SideView(TVirtualPad *pad = nullptr);
156 virtual void Side(); // *MENU*
157 virtual void TopView(TVirtualPad *pad = nullptr);
158 virtual void Top(); // *MENU*
159
160 virtual void ToggleRulers(TVirtualPad *pad = nullptr);
161 virtual void ShowAxis(); // *MENU*
162 virtual void ToggleZoom(TVirtualPad *pad = nullptr);
163 virtual void ZoomMove(); // *MENU*
164 virtual void Zoom(); // *MENU*
165 virtual void UnZoom(); // *MENU*
166
167 static void AdjustPad(TVirtualPad *pad = nullptr);
168
169 ClassDef(TView3D,3); //3-D View
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:201
Sequenceable collection abstract base class.
The 3D view class.
Definition TView3D.h:29
virtual void Zoom()
Definition TView3D.cxx:1936
Double_t fDproj
Definition TView3D.h:36
virtual Bool_t IsViewChanged() const
Definition TView3D.h:110
Bool_t fDefaultOutline
Definition TView3D.h:54
Double_t fTB[16]
Definition TView3D.h:40
virtual void SetViewChanged(Bool_t flag=kTRUE)
Definition TView3D.h:132
TView3D()
Default constructor.
Definition TView3D.cxx:109
virtual void FrontView(TVirtualPad *pad=nullptr)
Set to front view.
Definition TView3D.cxx:1584
Double_t fUpix
Definition TView3D.h:37
virtual void Side()
Definition TView3D.cxx:1933
Double_t fX2[3]
Definition TView3D.h:47
virtual void ToggleRulers(TVirtualPad *pad=nullptr)
Turn on /off 3D axis.
Definition TView3D.cxx:1600
Bool_t fChanged
Definition TView3D.h:56
virtual void SetPerspective()
Set perspective option.
Definition TView3D.cxx:1315
Double_t fPsi
Definition TView3D.h:34
virtual ~TView3D()
TView3D default destructor.
Definition TView3D.cxx:276
virtual TSeqCollection * GetOutline()
Definition TView3D.h:97
virtual Int_t GetSystem()
Definition TView3D.h:101
virtual void SetParallel()
Set the parallel option (default).
Definition TView3D.cxx:1304
Double_t fLongitude
Definition TView3D.h:33
Double_t fZ1[3]
Definition TView3D.h:50
Double_t fUVcoord[4]
Definition TView3D.h:43
virtual void FindPhiSectors(Int_t iopt, Int_t &kphi, Double_t *aphi, Int_t &iphi1, Int_t &iphi2)
Find critical PHI sectors.
Definition TView3D.cxx:806
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
virtual void PadRange(Int_t rback)
Set the correct window size for lego and surface plots.
Definition TView3D.cxx:1158
virtual void SetAutoRange(Bool_t autorange=kTRUE)
Definition TView3D.h:117
virtual Double_t GetWindowWidth() const
Definition TView3D.h:103
virtual void TopView(TVirtualPad *pad=nullptr)
Set to top view.
Definition TView3D.cxx:1592
virtual Int_t GetDistancetoAxis(Int_t axis, Int_t px, Int_t py, Double_t &ratio)
Return distance to axis from point px,py.
Definition TView3D.cxx:971
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
Transfer point from world to normalized coordinates.
Definition TView3D.cxx:1479
Double_t fTback[16]
Definition TView3D.h:45
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
virtual void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
Draw the outline of a cube while rotating a 3-d object in the pad.
Definition TView3D.cxx:620
virtual void SetSystem(Int_t system)
Definition TView3D.h:130
Double_t fLatitude
Definition TView3D.h:32
virtual void NormalWCtoNDC(const Float_t *pw, Float_t *pn)
Transfer vector of NORMAL from word to normalized coordinates.
Definition TView3D.cxx:1100
virtual 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)
Move focus to a different box position and extent in nsteps.
Definition TView3D.cxx:1683
virtual void ToggleZoom(TVirtualPad *pad=nullptr)
Turn on /off the interactive option to Zoom / Move / Change attributes of 3D axis correspond this vie...
Definition TView3D.cxx:1609
virtual void DefinePerspectiveView()
Define perspective view.
Definition TView3D.cxx:400
virtual Double_t GetPsi()
Definition TView3D.h:92
virtual Bool_t GetAutoRange()
Definition TView3D.h:89
virtual 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)
Store axis coordinates in the NDC system.
Definition TView3D.cxx:1237
virtual void SetWindow(Double_t u0, Double_t v0, Double_t du, Double_t dv)
Set viewing window.
Definition TView3D.cxx:1386
virtual void ZoomView(TVirtualPad *pad=nullptr, Double_t zoomFactor=1.25)
ZOOM this view.
Definition TView3D.cxx:1660
virtual void SetLongitude(Double_t longitude)
Definition TView3D.h:123
virtual Double_t * GetTN()
Definition TView3D.h:99
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
Set view parameters.
Definition TView3D.cxx:1397
virtual void FindScope(Double_t *scale, Double_t *center, Int_t &irep)
Find centre of a MIN-MAX scope and scale factors.
Definition TView3D.cxx:933
virtual Double_t GetLatitude()
Definition TView3D.h:90
virtual void SetRange(const Double_t *min, const Double_t *max)
Set Range function.
Definition TView3D.cxx:1327
virtual Bool_t IsClippedNDC(Double_t *p) const
Check if point is clipped in perspective view.
Definition TView3D.cxx:1056
virtual void SideView(TVirtualPad *pad=nullptr)
Set to side view.
Definition TView3D.cxx:1576
virtual void Top()
Definition TView3D.cxx:1934
virtual void SetDview(Double_t dview)
Definition TView3D.h:120
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
Transfer point from normalized to world coordinates.
Definition TView3D.cxx:1070
virtual Double_t GetWindowHeight() const
Definition TView3D.h:104
virtual void ResizePad()
Recompute window for perspective view.
Definition TView3D.cxx:1405
Double_t fY2[3]
Definition TView3D.h:49
virtual void SetDefaultWindow()
Set default viewing window.
Definition TView3D.cxx:1252
virtual void Front()
Definition TView3D.cxx:1931
Double_t fX1[3]
Definition TView3D.h:46
virtual void GetWindow(Double_t &u0, Double_t &v0, Double_t &du, Double_t &dv) const
Get current window extent.
Definition TView3D.cxx:1045
virtual void ExecuteRotateView(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition TView3D.cxx:642
virtual void FindNormal(Double_t x, Double_t y, Double_t z, Double_t &zn)
Find Z component of NORMAL in normalized coordinates.
Definition TView3D.cxx:786
Double_t fTN[16]
Definition TView3D.h:39
virtual void UnZoom()
Definition TView3D.cxx:1937
virtual Bool_t IsPerspective() const
Definition TView3D.h:109
Bool_t fAutoRange
Definition TView3D.h:55
static void AdjustPad(TVirtualPad *pad=nullptr)
Force the current pad to be updated.
Definition TView3D.cxx:1539
virtual void ZoomMove()
Definition TView3D.cxx:1935
virtual Double_t GetDview() const
Definition TView3D.h:86
@ kPerspective
Definition TView3D.h:67
Double_t fRmin[3]
Definition TView3D.h:42
Double_t fRmax[3]
Definition TView3D.h:41
virtual Double_t GetLongitude()
Definition TView3D.h:91
virtual void MoveViewCommand(Char_t chCode, Int_t count=1)
Definition TView3D.cxx:1739
virtual void ZoomOut()
Zoom out.
Definition TView3D.cxx:1842
virtual void SetPsi(Double_t psi)
Definition TView3D.h:124
virtual Double_t * GetTnorm()
Definition TView3D.h:100
virtual Double_t * GetTback()
Definition TView3D.h:98
virtual Double_t * GetRmax()
Definition TView3D.h:95
virtual void UnzoomView(TVirtualPad *pad=nullptr, Double_t unZoomFactor=1.25)
unZOOM this view.
Definition TView3D.cxx:1651
Double_t fDview
Definition TView3D.h:35
virtual void Centered()
Definition TView3D.cxx:1930
ClassDef(TView3D, 3)
virtual Double_t * GetRmin()
Definition TView3D.h:96
virtual void SetLatitude(Double_t latitude)
Definition TView3D.h:122
virtual void RotateView(Double_t phi, Double_t theta, TVirtualPad *pad=nullptr)
API to rotate view and adjust the pad provided it the current one.
Definition TView3D.cxx:1555
virtual Double_t GetDproj() const
Definition TView3D.h:87
virtual Double_t GetExtent() const
Get maximum view extent.
Definition TView3D.cxx:1017
TSeqCollection * fOutline
Definition TView3D.h:53
virtual void AdjustScales(TVirtualPad *pad=nullptr)
Adjust all sides of view in respect of the biggest one.
Definition TView3D.cxx:1617
virtual 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)
Define view direction (in spherical coordinates)
Definition TView3D.cxx:514
virtual void GetRange(Float_t *min, Float_t *max)
Get Range function.
Definition TView3D.cxx:1029
virtual void Centered3DImages(TVirtualPad *pad=nullptr)
Move view into the center of the scene.
Definition TView3D.cxx:1635
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition TView3D.cxx:628
virtual void ZoomIn()
Zoom in.
Definition TView3D.cxx:1822
virtual void FindThetaSectors(Int_t iopt, Double_t phi, Int_t &kth, Double_t *ath, Int_t &ith1, Int_t &ith2)
Find critical THETA sectors for given PHI sector.
Definition TView3D.cxx:872
Int_t fSystem
Definition TView3D.h:52
virtual void SetOutlineToCube()
This is a function which creates default outline.
Definition TView3D.cxx:1292
virtual void SetDproj(Double_t dproj)
Definition TView3D.h:121
Double_t fVpix
Definition TView3D.h:38
virtual 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)
Define axis vertices.
Definition TView3D.cxx:298
virtual void ShowAxis()
Definition TView3D.cxx:1932
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