00001 // @(#)root/eve:$Id: TEveScalableStraightLineSet.cxx 27157 2009-01-15 14:05:12Z brun $ 00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #include "TEveScalableStraightLineSet.h" 00013 #include "TEveChunkManager.h" 00014 00015 //============================================================================== 00016 //============================================================================== 00017 // TEveScalableStraightLineSet 00018 //============================================================================== 00019 00020 //______________________________________________________________________________ 00021 // 00022 // Straight-line-set with extra scaling, useful for projectables that need 00023 // to be scaled in accordance with an external object. 00024 00025 00026 ClassImp(TEveScalableStraightLineSet); 00027 00028 //______________________________________________________________________________ 00029 TEveScalableStraightLineSet::TEveScalableStraightLineSet(const char* n, const char* t): 00030 TEveStraightLineSet (n, t), 00031 fCurrentScale(1.0) 00032 { 00033 // Constructor. 00034 00035 fScaleCenter[0] = 0; 00036 fScaleCenter[1] = 0; 00037 fScaleCenter[2] = 0; 00038 } 00039 00040 //______________________________________________________________________________ 00041 void TEveScalableStraightLineSet::SetScaleCenter(Float_t x, Float_t y, Float_t z) 00042 { 00043 // Set scale center. 00044 00045 fScaleCenter[0] = x; 00046 fScaleCenter[1] = y; 00047 fScaleCenter[2] = z; 00048 } 00049 00050 //______________________________________________________________________________ 00051 Double_t TEveScalableStraightLineSet::GetScale() const 00052 { 00053 // Return current scale. 00054 00055 return fCurrentScale; 00056 } 00057 00058 //______________________________________________________________________________ 00059 void TEveScalableStraightLineSet::SetScale(Double_t scale) 00060 { 00061 // Loop over line parameters and scale coordinates. 00062 00063 TEveChunkManager::iterator li(GetLinePlex()); 00064 while (li.next()) 00065 { 00066 TEveStraightLineSet::Line_t& l = * (TEveStraightLineSet::Line_t*) li(); 00067 l.fV1[0] = fScaleCenter[0]+(l.fV1[0]-fScaleCenter[0])/fCurrentScale*scale; 00068 l.fV1[1] = fScaleCenter[1]+(l.fV1[1]-fScaleCenter[1])/fCurrentScale*scale; 00069 l.fV1[2] = fScaleCenter[2]+(l.fV1[2]-fScaleCenter[2])/fCurrentScale*scale; 00070 l.fV2[0] = fScaleCenter[0]+(l.fV2[0]-fScaleCenter[0])/fCurrentScale*scale; 00071 l.fV2[1] = fScaleCenter[1]+(l.fV2[1]-fScaleCenter[1])/fCurrentScale*scale; 00072 l.fV2[2] = fScaleCenter[2]+(l.fV2[2]-fScaleCenter[2])/fCurrentScale*scale; 00073 } 00074 fCurrentScale = scale; 00075 }