00001 // @(#)root/g3d:$Id: TPGON.cxx 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Nenad Buncic 29/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 "TPGON.h" 00013 #include "TMath.h" 00014 00015 ClassImp(TPGON) 00016 00017 //______________________________________________________________________________ 00018 // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/pgon.gif"> </P> End_Html 00019 // PGON is a polygon. It has the following parameters: 00020 // 00021 // - name name of the shape 00022 // - title shape's title 00023 // - material (see TMaterial) 00024 // - phi1 the azimuthal angle &phi at which the volume begins (angles 00025 // are counted counterclockwise) 00026 // - dphi1 opening angle of the volume, which extends from phi1 to 00027 // phi1+dphi 00028 // - npdv number of sides of the cross section between the given 00029 // phi limits 00030 // - nz number of planes perpendicular to the z axis where 00031 // the dimension of the section is given -- this number 00032 // should be at least 2 00033 // - rmin array of dimension nz with minimum radius at a given plane 00034 // - rmax array of dimension nz with maximum radius at a given plane 00035 // - z array of dimension nz with z position of given plane 00036 00037 00038 //______________________________________________________________________________ 00039 TPGON::TPGON () 00040 { 00041 // PGON shape default constructor. 00042 } 00043 00044 00045 //______________________________________________________________________________ 00046 TPGON::TPGON (const char *name, const char *title, const char *material, Float_t phi1, 00047 Float_t dphi1, Int_t npdv, Int_t nz) 00048 : TPCON (name, title,material, phi1, dphi1, nz) 00049 { 00050 // PGON shape normal constructor. 00051 // 00052 // Parameters of the nz positions must be entered via TPCON::DefineSection. 00053 00054 SetNumberOfDivisions (npdv); 00055 } 00056 00057 00058 //______________________________________________________________________________ 00059 TPGON::~TPGON () 00060 { 00061 // PGON shape default destructor. 00062 } 00063 00064 00065 //______________________________________________________________________________ 00066 void TPGON::FillTableOfCoSin(Double_t phi, Double_t angstep,Int_t n) const 00067 { 00068 // Fill the table of cos and sin to prepare drawing 00069 00070 Double_t factor = 1./TMath::Cos(angstep/2); 00071 Double_t ph = phi-angstep; 00072 for (Int_t j = 0; j < n; j++) { 00073 ph += angstep; 00074 fCoTab[j] = factor*TMath::Cos(ph); 00075 fSiTab[j] = factor*TMath::Sin(ph); 00076 } 00077 }