// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveScalableStraightLineSet.h"
#include "TEveChunkManager.h"

//==============================================================================
//==============================================================================
// TEveScalableStraightLineSet
//==============================================================================

//______________________________________________________________________________
//
// Straight-line-set with extra scaling, useful for projectables that need
// to be scaled in accordance with an external object.


ClassImp(TEveScalableStraightLineSet);

//______________________________________________________________________________
TEveScalableStraightLineSet::TEveScalableStraightLineSet(const char* n, const char* t):
   TEveStraightLineSet (n, t),
   fCurrentScale(1.0)
{
   // Constructor.

   fScaleCenter[0] = 0;
   fScaleCenter[1] = 0;
   fScaleCenter[2] = 0;
}

//______________________________________________________________________________
void TEveScalableStraightLineSet::SetScaleCenter(Float_t x, Float_t y, Float_t z)
{
   // Set scale center.

   fScaleCenter[0] = x;
   fScaleCenter[1] = y;
   fScaleCenter[2] = z;
}

//______________________________________________________________________________
Double_t TEveScalableStraightLineSet::GetScale() const
{
   // Return current scale.

   return fCurrentScale;
}

//______________________________________________________________________________
void TEveScalableStraightLineSet::SetScale(Double_t scale)
{
   // Loop over line parameters and scale coordinates.

   TEveChunkManager::iterator li(GetLinePlex());
   while (li.next())
   {
      TEveStraightLineSet::Line_t& l = * (TEveStraightLineSet::Line_t*) li();
      l.fV1[0] = fScaleCenter[0]+(l.fV1[0]-fScaleCenter[0])/fCurrentScale*scale;
      l.fV1[1] = fScaleCenter[1]+(l.fV1[1]-fScaleCenter[1])/fCurrentScale*scale;
      l.fV1[2] = fScaleCenter[2]+(l.fV1[2]-fScaleCenter[2])/fCurrentScale*scale;
      l.fV2[0] = fScaleCenter[0]+(l.fV2[0]-fScaleCenter[0])/fCurrentScale*scale;
      l.fV2[1] = fScaleCenter[1]+(l.fV2[1]-fScaleCenter[1])/fCurrentScale*scale;
      l.fV2[2] = fScaleCenter[2]+(l.fV2[2]-fScaleCenter[2])/fCurrentScale*scale;
   }
   fCurrentScale = scale;
}
 TEveScalableStraightLineSet.cxx:1
 TEveScalableStraightLineSet.cxx:2
 TEveScalableStraightLineSet.cxx:3
 TEveScalableStraightLineSet.cxx:4
 TEveScalableStraightLineSet.cxx:5
 TEveScalableStraightLineSet.cxx:6
 TEveScalableStraightLineSet.cxx:7
 TEveScalableStraightLineSet.cxx:8
 TEveScalableStraightLineSet.cxx:9
 TEveScalableStraightLineSet.cxx:10
 TEveScalableStraightLineSet.cxx:11
 TEveScalableStraightLineSet.cxx:12
 TEveScalableStraightLineSet.cxx:13
 TEveScalableStraightLineSet.cxx:14
 TEveScalableStraightLineSet.cxx:15
 TEveScalableStraightLineSet.cxx:16
 TEveScalableStraightLineSet.cxx:17
 TEveScalableStraightLineSet.cxx:18
 TEveScalableStraightLineSet.cxx:19
 TEveScalableStraightLineSet.cxx:20
 TEveScalableStraightLineSet.cxx:21
 TEveScalableStraightLineSet.cxx:22
 TEveScalableStraightLineSet.cxx:23
 TEveScalableStraightLineSet.cxx:24
 TEveScalableStraightLineSet.cxx:25
 TEveScalableStraightLineSet.cxx:26
 TEveScalableStraightLineSet.cxx:27
 TEveScalableStraightLineSet.cxx:28
 TEveScalableStraightLineSet.cxx:29
 TEveScalableStraightLineSet.cxx:30
 TEveScalableStraightLineSet.cxx:31
 TEveScalableStraightLineSet.cxx:32
 TEveScalableStraightLineSet.cxx:33
 TEveScalableStraightLineSet.cxx:34
 TEveScalableStraightLineSet.cxx:35
 TEveScalableStraightLineSet.cxx:36
 TEveScalableStraightLineSet.cxx:37
 TEveScalableStraightLineSet.cxx:38
 TEveScalableStraightLineSet.cxx:39
 TEveScalableStraightLineSet.cxx:40
 TEveScalableStraightLineSet.cxx:41
 TEveScalableStraightLineSet.cxx:42
 TEveScalableStraightLineSet.cxx:43
 TEveScalableStraightLineSet.cxx:44
 TEveScalableStraightLineSet.cxx:45
 TEveScalableStraightLineSet.cxx:46
 TEveScalableStraightLineSet.cxx:47
 TEveScalableStraightLineSet.cxx:48
 TEveScalableStraightLineSet.cxx:49
 TEveScalableStraightLineSet.cxx:50
 TEveScalableStraightLineSet.cxx:51
 TEveScalableStraightLineSet.cxx:52
 TEveScalableStraightLineSet.cxx:53
 TEveScalableStraightLineSet.cxx:54
 TEveScalableStraightLineSet.cxx:55
 TEveScalableStraightLineSet.cxx:56
 TEveScalableStraightLineSet.cxx:57
 TEveScalableStraightLineSet.cxx:58
 TEveScalableStraightLineSet.cxx:59
 TEveScalableStraightLineSet.cxx:60
 TEveScalableStraightLineSet.cxx:61
 TEveScalableStraightLineSet.cxx:62
 TEveScalableStraightLineSet.cxx:63
 TEveScalableStraightLineSet.cxx:64
 TEveScalableStraightLineSet.cxx:65
 TEveScalableStraightLineSet.cxx:66
 TEveScalableStraightLineSet.cxx:67
 TEveScalableStraightLineSet.cxx:68
 TEveScalableStraightLineSet.cxx:69
 TEveScalableStraightLineSet.cxx:70
 TEveScalableStraightLineSet.cxx:71
 TEveScalableStraightLineSet.cxx:72
 TEveScalableStraightLineSet.cxx:73
 TEveScalableStraightLineSet.cxx:74
 TEveScalableStraightLineSet.cxx:75