Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
29const Int_t kDivNum = 20; //default number of divisions
30
31
32class TTUBE : public TShape {
33protected:
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
54public:
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
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
float Float_t
Definition RtypesCore.h:57
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
const Int_t kDivNum
Definition TTUBE.h:29
point * points
Definition X3DBuffer.c:22
Generic 3D primitive description class.
Definition TBuffer3D.h:18
This is the base class for all geometry shapes.
Definition TShape.h:35
A tube.
Definition TTUBE.h:32
Double_t * fCoTab
Table of sin(fPhi1) .... sin(fPhil+fDphi1)
Definition TTUBE.h:45
Double_t * fSiTab
Definition TTUBE.h:44
Float_t fRmax
Definition TTUBE.h:36
virtual Int_t GetNumberOfDivisions() const
Definition TTUBE.h:67
virtual void MakeTableOfCoSin() const
Make table of sine and cosine.
Definition TTUBE.cxx:128
Float_t fAspectRatio
Definition TTUBE.h:41
TTUBE & operator=(const TTUBE &)
assignment operator
Definition TTUBE.cxx:110
Float_t fRmin
Definition TTUBE.h:35
Int_t fNdiv
Definition TTUBE.h:39
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections) const
Get buffer 3d.
Definition TTUBE.cxx:344
virtual void SetNumberOfDivisions(Int_t ndiv)
Set number of divisions used to draw this tube.
Definition TTUBE.cxx:185
virtual void SetPoints(Double_t *points) const
Create TUBE points.
Definition TTUBE.cxx:194
virtual Float_t GetAspectRatio() const
Definition TTUBE.h:66
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a TUBE.
Definition TTUBE.cxx:175
Float_t fDz
Definition TTUBE.h:38
virtual Float_t GetDz() const
Definition TTUBE.h:64
virtual Float_t GetRmax() const
Definition TTUBE.h:63
virtual ~TTUBE()
TUBE shape default destructor.
Definition TTUBE.cxx:163
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Set segments and polygons.
Definition TTUBE.cxx:227
TTUBE()
TUBE shape default constructor.
Definition TTUBE.cxx:41
virtual void Sizeof3D() const
Return total X3D needed by TNode::ls (when called with option "x")
Definition TTUBE.cxx:306
virtual Float_t GetRmin() const
Definition TTUBE.h:62
virtual void SetAspectRatio(Float_t factor=1)
Definition TTUBE.h:69
virtual Int_t GetNdiv() const
Definition TTUBE.h:65