TPARA.cxx

Go to the documentation of this file.
00001 // @(#)root/g3d:$Id: TPARA.cxx 31635 2009-12-08 10:35:17Z couet $
00002 // Author: Nenad Buncic   19/09/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, 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 "TPARA.h"
00013 #include "TNode.h"
00014 #include "TMath.h"
00015 
00016 ClassImp(TPARA)
00017 
00018 
00019 //______________________________________________________________________________
00020 // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/para.gif"> </P> End_Html
00021 // PARA is a parallelepiped. It has 9 parameters:
00022 //
00023 //     - name       name of the shape
00024 //     - title      shape's title
00025 //     - material  (see TMaterial)
00026 //     - dx         half-length in x
00027 //     - dy         half-length in y
00028 //     - dz         half-length in z
00029 //     - alpha      angle formed by the y axis and by the plane joining the
00030 //                  centre of the faces parallel to the z-x plane at -DY and +DY
00031 //     - theta      polar angle of the line joining the centres of the faces
00032 //                  at -DZ and +DZ in z
00033 //     - phi        azimuthal angle of the line joining the centres of the
00034 //                  faces at -DZ and +DZ in z
00035 
00036 
00037 //______________________________________________________________________________
00038 TPARA::TPARA()
00039 {
00040    // PARA shape default constructor
00041 
00042    fAlpha = 0.;
00043    fTheta = 0.;
00044    fPhi   = 0.;
00045 }
00046 
00047 
00048 //______________________________________________________________________________
00049 TPARA::TPARA(const char *name, const char *title, const char *material, Float_t dx, Float_t dy, Float_t dz,
00050              Float_t alpha, Float_t theta, Float_t phi) : TBRIK(name, title,material, dx, dy, dz)
00051 {
00052    // PARA shape normal constructor
00053 
00054    fAlpha = alpha;
00055    fTheta = theta;
00056    fPhi   = phi;
00057 }
00058 
00059 
00060 //______________________________________________________________________________
00061 TPARA::~TPARA()
00062 {
00063    // PARA shape default destructor
00064 }
00065 
00066 
00067 //______________________________________________________________________________
00068 void TPARA::SetPoints(Double_t *points) const
00069 {
00070    // Create PARA points
00071 
00072    if (!points) return;
00073    Float_t dx, dy, dz, theta, phi, alpha;
00074    const Float_t pi = Float_t (TMath::Pi());
00075 
00076    alpha = fAlpha * pi/180.0;
00077    theta = fTheta * pi/180.0;
00078    phi   = fPhi   * pi/180.0;
00079 
00080    dx = TBRIK::fDx;
00081    dy = TBRIK::fDy;
00082    dz = TBRIK::fDz;
00083 
00084    // Parallelepiped change angles to tangents (by Pavel Nevski 12/04/99)
00085    Double_t txy = TMath::Tan(alpha);
00086    Double_t tth = TMath::Tan(theta);
00087    Double_t txz = tth*TMath::Cos(phi);
00088    Double_t tyz = tth*TMath::Sin(phi);
00089 
00090    *points++ = -dz*txz-txy*dy-dx ; *points++ = -dy-dz*tyz ; *points++ = -dz;
00091    *points++ = -dz*txz+txy*dy-dx ; *points++ = +dy-dz*tyz ; *points++ = -dz; //3
00092    *points++ = -dz*txz+txy*dy+dx ; *points++ = +dy-dz*tyz ; *points++ = -dz;
00093    *points++ = -dz*txz-txy*dy+dx ; *points++ = -dy-dz*tyz ; *points++ = -dz;//1
00094    *points++ = +dz*txz-txy*dy-dx ; *points++ = -dy+dz*tyz ; *points++ = +dz;
00095    *points++ = +dz*txz+txy*dy-dx ; *points++ = +dy+dz*tyz ; *points++ = +dz;//7
00096    *points++ = +dz*txz+txy*dy+dx ; *points++ = +dy+dz*tyz ; *points++ = +dz;
00097    *points++ = +dz*txz-txy*dy+dx ; *points++ = -dy+dz*tyz ; *points++ = +dz;//5
00098 }

Generated on Tue Jul 5 14:16:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1