ROOT  6.06/09
Reference Guide
TPGON.cxx
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Nenad Buncic 29/09/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TPGON.h"
13 #include "TMath.h"
14 
16 
17 /** \class TPGON
18 \ingroup g3d
19 A polygon.
20 
21 \image html g3d_pgon.png
22 
23 It has the following parameters:
24 
25  - name: name of the shape
26  - title: shape's title
27  - material: (see TMaterial)
28  - phi1: the azimuthal angle &phi at which the volume begins (angles
29  are counted counterclockwise)
30  - dphi1: opening angle of the volume, which extends from phi1 to
31  phi1+dphi
32  - npdv: number of sides of the cross section between the given
33  phi limits
34  - nz: number of planes perpendicular to the z axis where
35  the dimension of the section is given -- this number
36  should be at least 2
37  - rmin: array of dimension nz with minimum radius at a given plane
38  - rmax: array of dimension nz with maximum radius at a given plane
39  - z: array of dimension nz with z position of given plane
40 */
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// PGON shape default constructor.
44 
45 TPGON::TPGON ()
46 {
47 }
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// PGON shape normal constructor.
51 ///
52 /// Parameters of the nz positions must be entered via TPCON::DefineSection.
53 
54 TPGON::TPGON (const char *name, const char *title, const char *material, Float_t phi1,
55  Float_t dphi1, Int_t npdv, Int_t nz)
56  : TPCON (name, title,material, phi1, dphi1, nz)
57 {
58  SetNumberOfDivisions (npdv);
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// PGON shape default destructor.
63 
65 {
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Fill the table of cos and sin to prepare drawing
70 
72 {
73  Double_t factor = 1./TMath::Cos(angstep/2);
74  Double_t ph = phi-angstep;
75  for (Int_t j = 0; j < n; j++) {
76  ph += angstep;
77  fCoTab[j] = factor*TMath::Cos(ph);
78  fSiTab[j] = factor*TMath::Sin(ph);
79  }
80 }
virtual void FillTableOfCoSin(Double_t phi, Double_t angstep, Int_t n) const
Fill the table of cos and sin to prepare drawing.
Definition: TPGON.cxx:71
float Float_t
Definition: RtypesCore.h:53
int Int_t
Definition: RtypesCore.h:41
virtual ~TPGON()
PGON shape default destructor.
Definition: TPGON.cxx:64
Double_t * fCoTab
Table of sin(fPhi1) .... sin(fPhil+fDphi1)
Definition: TPCON.h:39
Double_t Cos(Double_t)
Definition: TMath.h:424
A polycone.
Definition: TPCON.h:35
A polygon.
Definition: TPGON.h:32
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void SetNumberOfDivisions(Int_t p)
Set number of divisions.
Definition: TPCON.cxx:213
Double_t * fSiTab
Definition: TPCON.h:38
double Double_t
Definition: RtypesCore.h:55
#define name(a, b)
Definition: linkTestLib0.cpp:5
Double_t Sin(Double_t)
Definition: TMath.h:421
const Int_t n
Definition: legend1.C:16