Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TTUBE.h
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Nenad Buncic 18/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 #ifndef ROOT_TTUBE
13 #define ROOT_TTUBE
14 
15 
16 ////////////////////////////////////////////////////////////////////////////
17 // //
18 // TTUBE //
19 // //
20 // This tube has 3 parameters, the inside radius, the outside radius, and //
21 // the half length in z. Optional parameter is number of segments, also //
22 // known as precision (default value is 20). //
23 // //
24 ////////////////////////////////////////////////////////////////////////////
25 
26 #include "TShape.h"
27 
28 
29 const Int_t kDivNum = 20; //default number of divisions
30 
31 
32 class TTUBE : public TShape {
33 protected:
34 
35  Float_t fRmin; // ellipse semi-axis in X inside
36  Float_t fRmax; // ellipse semi-axis in X outside
37 
38  Float_t fDz; // half length in z
39  Int_t fNdiv; // number of segments (precision)
40 
41  Float_t fAspectRatio; // defines (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
42 
43  // Internal cache
44  mutable Double_t *fSiTab; //! Table of sin(fPhi1) .... sin(fPhil+fDphi1)
45  mutable Double_t *fCoTab; //! Table of cos(fPhi1) .... cos(fPhil+fDphi1)
46 
47  TTUBE(const TTUBE&);
48  TTUBE& operator=(const TTUBE&);
49 
50  virtual void MakeTableOfCoSin() const; // Create the table of the fSiTab; fCoTab
51  virtual void SetPoints(Double_t *points) const;
52  virtual void SetSegsAndPols(TBuffer3D & buffer) const;
53 
54 public:
55  TTUBE();
56  TTUBE(const char *name, const char *title, const char *material, Float_t rmin, Float_t rmax, Float_t dz, Float_t aspect=1);
57  TTUBE(const char *name, const char *title, const char *material, Float_t rmax, Float_t dz);
58  virtual ~TTUBE();
59 
60  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
61  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections) const;
62  virtual Float_t GetRmin() const {return fRmin;}
63  virtual Float_t GetRmax() const {return fRmax;}
64  virtual Float_t GetDz() const {return fDz;}
65  virtual Int_t GetNdiv() const {return fNdiv;}
66  virtual Float_t GetAspectRatio() const {return fAspectRatio;}
67  virtual Int_t GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return kDivNum;}
68  virtual void SetNumberOfDivisions (Int_t ndiv);
69  virtual void SetAspectRatio(Float_t factor=1){fAspectRatio = factor;}
70  virtual void Sizeof3D() const;
71 
72  ClassDef(TTUBE,3) //TUBE shape
73 };
74 
75 #endif