Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveGridStepper.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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#include "TEveGridStepper.h"
13#include "TEveTrans.h"
14
15/** \class TEveGridStepper
16\ingroup TEve
17Provide discrete position coordinates for placement of objects on
18regular grids.
19*/
20
22
23////////////////////////////////////////////////////////////////////////////////
24/// Constructor.
25
27 fMode(EStepMode_e(sm)),
28 fCx(0), fCy(0), fCz(0), fNx(0), fNy(0), fNz(0),
29 fDx(0), fDy(0), fDz(0), fOx(0), fOy(0), fOz(0)
30{
31 switch(fMode) {
32 default:
33 case kSM_XYZ:
34 fLimitArr[0] = &fNx; fLimitArr[1] = &fNy; fLimitArr[2] = &fNz;
35 fValueArr[0] = &fCx; fValueArr[1] = &fCy; fValueArr[2] = &fCz;
36 break;
37 case kSM_YXZ:
38 fLimitArr[0] = &fNy; fLimitArr[1] = &fNx; fLimitArr[2] = &fNz;
39 fValueArr[0] = &fCy; fValueArr[1] = &fCx; fValueArr[2] = &fCz;
40 break;
41 case kSM_XZY:
42 fLimitArr[0] = &fNx; fLimitArr[1] = &fNz; fLimitArr[2] = &fNy;
43 fValueArr[0] = &fCx; fValueArr[1] = &fCz; fValueArr[2] = &fCy;
44 break;
45 }
46
47 fCx = fCy = fCz = 0;
48 fNx = fNy = fNz = 16;
49 fDx = fDy = fDz = 1;
50 fOx = fOy = fOz = 0;
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Reset position to origin.
55
57{
58 fCx = fCy = fCz = 0;
59}
60
61////////////////////////////////////////////////////////////////////////////////
62/// Subtract current position of 's' from origin of this.
63
65{
66 fOx = -(s.fOx + s.fCx*s.fDx);
67 fOy = -(s.fOy + s.fCy*s.fDy);
68 fOz = -(s.fOz + s.fCz*s.fDz);
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Move to the next grid position.
73
75{
76 (*fValueArr[0])++;
77 if (*fValueArr[0] >= *fLimitArr[0]) {
78 *fValueArr[0] = 0; (*fValueArr[1])++;
79 if (*fValueArr[1] >= *fLimitArr[1]) {
80 *fValueArr[1] = 0; (*fValueArr[2])++;
81 if (*fValueArr[2] >= *fLimitArr[2]) {
82 return kFALSE;
83 }
84 }
85 }
86 return kTRUE;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Get current position.
91
93{
94 p[0] = fOx + fCx*fDx;
95 p[1] = fOy + fCy*fDy;
96 p[2] = fOz + fCz*fDz;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Set position into the translation part of mx.
101
103{
104 mx->SetPos(fOx + fCx*fDx, fOy + fCy*fDy, fOz + fCz*fDz);
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Set position into the translation part of mx and advance to the
109/// next grid position.
110
112{
113 SetTrans(mx);
114 Step();
115}
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:382
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 mx
Provide discrete position coordinates for placement of objects on regular grids.
Bool_t Step()
Move to the next grid position.
EStepMode_e fMode
TEveGridStepper(const TEveGridStepper &)
Internal traversal variables.
void GetPosition(Float_t *p)
Get current position.
void SetTransAdvance(TEveTrans *mx)
Set position into the translation part of mx and advance to the next grid position.
Int_t * fValueArr[3]
Int_t * fLimitArr[3]
void Subtract(TEveGridStepper &s)
Subtract current position of 's' from origin of this.
void Reset()
Reset position to origin.
void SetTrans(TEveTrans *mx)
Set position into the translation part of mx.
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27