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
21
22////////////////////////////////////////////////////////////////////////////////
23/// Constructor.
24
26 fMode(EStepMode_e(sm)),
27 fCx(0), fCy(0), fCz(0), fNx(0), fNy(0), fNz(0),
28 fDx(0), fDy(0), fDz(0), fOx(0), fOy(0), fOz(0)
29{
30 switch(fMode) {
31 default:
32 case kSM_XYZ:
33 fLimitArr[0] = &fNx; fLimitArr[1] = &fNy; fLimitArr[2] = &fNz;
34 fValueArr[0] = &fCx; fValueArr[1] = &fCy; fValueArr[2] = &fCz;
35 break;
36 case kSM_YXZ:
37 fLimitArr[0] = &fNy; fLimitArr[1] = &fNx; fLimitArr[2] = &fNz;
38 fValueArr[0] = &fCy; fValueArr[1] = &fCx; fValueArr[2] = &fCz;
39 break;
40 case kSM_XZY:
41 fLimitArr[0] = &fNx; fLimitArr[1] = &fNz; fLimitArr[2] = &fNy;
42 fValueArr[0] = &fCx; fValueArr[1] = &fCz; fValueArr[2] = &fCy;
43 break;
44 }
45
46 fCx = fCy = fCz = 0;
47 fNx = fNy = fNz = 16;
48 fDx = fDy = fDz = 1;
49 fOx = fOy = fOz = 0;
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Reset position to origin.
54
56{
57 fCx = fCy = fCz = 0;
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Subtract current position of 's' from origin of this.
62
64{
65 fOx = -(s.fOx + s.fCx*s.fDx);
66 fOy = -(s.fOy + s.fCy*s.fDy);
67 fOz = -(s.fOz + s.fCz*s.fDz);
68}
69
70////////////////////////////////////////////////////////////////////////////////
71/// Move to the next grid position.
72
74{
75 (*fValueArr[0])++;
76 if (*fValueArr[0] >= *fLimitArr[0]) {
77 *fValueArr[0] = 0; (*fValueArr[1])++;
78 if (*fValueArr[1] >= *fLimitArr[1]) {
79 *fValueArr[1] = 0; (*fValueArr[2])++;
80 if (*fValueArr[2] >= *fLimitArr[2]) {
81 return kFALSE;
82 }
83 }
84 }
85 return kTRUE;
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Get current position.
90
92{
93 p[0] = fOx + fCx*fDx;
94 p[1] = fOy + fCy*fDy;
95 p[2] = fOz + fCz*fDz;
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Set position into the translation part of mx.
100
102{
103 mx->SetPos(fOx + fCx*fDx, fOy + fCy*fDy, fOz + fCz*fDz);
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Set position into the translation part of mx and advance to the
108/// next grid position.
109
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
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