Logo ROOT   6.07/09
Reference Guide
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 #ifndef ROOT_TShape
27 #include "TShape.h"
28 #endif
29 
30 
31 const Int_t kDivNum = 20; //default number of divisions
32 
33 
34 class TTUBE : public TShape {
35 protected:
36 
37  Float_t fRmin; // ellipse semi-axis in X inside
38  Float_t fRmax; // ellipse semi-axis in X outside
39 
40  Float_t fDz; // half length in z
41  Int_t fNdiv; // number of segments (precision)
42 
43  Float_t fAspectRatio; // defines (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
44 
45  // Internal cache
46  mutable Double_t *fSiTab; //! Table of sin(fPhi1) .... sin(fPhil+fDphi1)
47  mutable Double_t *fCoTab; //! Table of cos(fPhi1) .... cos(fPhil+fDphi1)
48 
49  TTUBE(const TTUBE&);
50  TTUBE& operator=(const TTUBE&);
51 
52  virtual void MakeTableOfCoSin() const; // Create the table of the fSiTab; fCoTab
53  virtual void SetPoints(Double_t *points) const;
54  virtual void SetSegsAndPols(TBuffer3D & buffer) const;
55 
56 public:
57  TTUBE();
58  TTUBE(const char *name, const char *title, const char *material, Float_t rmin, Float_t rmax, Float_t dz, Float_t aspect=1);
59  TTUBE(const char *name, const char *title, const char *material, Float_t rmax, Float_t dz);
60  virtual ~TTUBE();
61 
62  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
63  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections) const;
64  virtual Float_t GetRmin() const {return fRmin;}
65  virtual Float_t GetRmax() const {return fRmax;}
66  virtual Float_t GetDz() const {return fDz;}
67  virtual Int_t GetNdiv() const {return fNdiv;}
68  virtual Float_t GetAspectRatio() const {return fAspectRatio;}
69  virtual Int_t GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return kDivNum;}
70  virtual void SetNumberOfDivisions (Int_t ndiv);
71  virtual void SetAspectRatio(Float_t factor=1){fAspectRatio = factor;}
72  virtual void Sizeof3D() const;
73 
74  ClassDef(TTUBE,3) //TUBE shape
75 };
76 
77 #endif
TTUBE()
TUBE shape default constructor.
Definition: TTUBE.cxx:43
const Int_t kDivNum
Definition: TTUBE.h:31
float Float_t
Definition: RtypesCore.h:53
virtual Int_t GetNdiv() const
Definition: TTUBE.h:67
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections) const
Get buffer 3d.
Definition: TTUBE.cxx:346
int Int_t
Definition: RtypesCore.h:41
virtual void SetAspectRatio(Float_t factor=1)
Definition: TTUBE.h:71
Float_t fDz
Definition: TTUBE.h:40
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void SetNumberOfDivisions(Int_t ndiv)
Set number of divisions used to draw this tube.
Definition: TTUBE.cxx:187
virtual Float_t GetAspectRatio() const
Definition: TTUBE.h:68
virtual void MakeTableOfCoSin() const
Make table of sine and cosine.
Definition: TTUBE.cxx:130
point * points
Definition: X3DBuffer.c:20
This is the base class for all geometry shapes.
Definition: TShape.h:47
virtual ~TTUBE()
TUBE shape default destructor.
Definition: TTUBE.cxx:165
virtual void SetPoints(Double_t *points) const
Create TUBE points.
Definition: TTUBE.cxx:196
Float_t fRmax
Definition: TTUBE.h:38
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Set segments and polygons.
Definition: TTUBE.cxx:229
Float_t fRmin
Definition: TTUBE.h:37
virtual Float_t GetDz() const
Definition: TTUBE.h:66
double Double_t
Definition: RtypesCore.h:55
Float_t fAspectRatio
Definition: TTUBE.h:43
virtual Float_t GetRmax() const
Definition: TTUBE.h:65
virtual void Sizeof3D() const
Return total X3D needed by TNode::ls (when called with option "x")
Definition: TTUBE.cxx:308
A tube.
Definition: TTUBE.h:34
TTUBE & operator=(const TTUBE &)
assignment operator
Definition: TTUBE.cxx:112
virtual Float_t GetRmin() const
Definition: TTUBE.h:64
Int_t fNdiv
Definition: TTUBE.h:41
Double_t * fSiTab
Definition: TTUBE.h:46
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a TUBE.
Definition: TTUBE.cxx:177
virtual Int_t GetNumberOfDivisions() const
Definition: TTUBE.h:69
char name[80]
Definition: TGX11.cxx:109
Double_t * fCoTab
Table of sin(fPhi1) .... sin(fPhil+fDphi1)
Definition: TTUBE.h:47