Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
REveScalableStraightLineSet.cxx
Go to the documentation of this file.
3 
4 /** \class REveScalableStraightLineSet
5 \ingroup REve
6 Straight-line-set with extra scaling, useful for projectables that need
7 to be scaled in accordance with an external object.
8 */
9 
10 using namespace ROOT::Experimental;
11 namespace REX = ROOT::Experimental;
12 
13 ////////////////////////////////////////////////////////////////////////////////
14 /// Constructor.
15 
16 REveScalableStraightLineSet::REveScalableStraightLineSet(const std::string &n, const std::string &t):
17  REveStraightLineSet (n, t),
18  fCurrentScale(1.0)
19 {
20  fScaleCenter[0] = 0;
21  fScaleCenter[1] = 0;
22  fScaleCenter[2] = 0;
23 }
24 
25 ////////////////////////////////////////////////////////////////////////////////
26 /// Set scale center.
27 
28 void REveScalableStraightLineSet::SetScaleCenter(Float_t x, Float_t y, Float_t z)
29 {
30  fScaleCenter[0] = x;
31  fScaleCenter[1] = y;
32  fScaleCenter[2] = z;
33 }
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Return current scale.
37 
38 Double_t REveScalableStraightLineSet::GetScale() const
39 {
40  return fCurrentScale;
41 }
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Loop over line parameters and scale coordinates.
45 
46 void REveScalableStraightLineSet::SetScale(Double_t scale)
47 {
48  REveChunkManager::iterator li(GetLinePlex());
49  while (li.next())
50  {
51  REveStraightLineSet::Line_t& l = * (REveStraightLineSet::Line_t*) li();
52  l.fV1[0] = fScaleCenter[0]+(l.fV1[0]-fScaleCenter[0])/fCurrentScale*scale;
53  l.fV1[1] = fScaleCenter[1]+(l.fV1[1]-fScaleCenter[1])/fCurrentScale*scale;
54  l.fV1[2] = fScaleCenter[2]+(l.fV1[2]-fScaleCenter[2])/fCurrentScale*scale;
55  l.fV2[0] = fScaleCenter[0]+(l.fV2[0]-fScaleCenter[0])/fCurrentScale*scale;
56  l.fV2[1] = fScaleCenter[1]+(l.fV2[1]-fScaleCenter[1])/fCurrentScale*scale;
57  l.fV2[2] = fScaleCenter[2]+(l.fV2[2]-fScaleCenter[2])/fCurrentScale*scale;
58  }
59  fCurrentScale = scale;
60 }