Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SoTubs.h
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29/*-----------------------------Hepvis----------------------------------------*/
30/* */
31/* Node: SoTubs */
32/* Description: Represents the G4Tubs Geant Geometry entity */
33/* Author: Joe Boudreau Nov 11 1996 */
34/* */
35/*---------------------------------------------------------------------------*/
36#ifndef HEPVis_SoTubs_h
37#define HEPVis_SoTubs_h
38
39#include <Inventor/fields/SoSFFloat.h>
40#include <Inventor/fields/SoSFNode.h>
41#include <Inventor/fields/SoSFBool.h>
42#include <Inventor/nodes/SoShape.h>
43
44class SoSFNode;
45
46//! SoTubs - Inventor version of the G4Tubs Geant Geometry entity
47/*!
48 * Node: SoTubs
49 *
50 * Description: The Inventor version of the G4Tubs Geant Geometry entity
51 *
52 * Author: Joe Boudreau Nov 11 1996
53 *
54 * class G4Tubs
55 *
56 * A tube or tube segment with curved sides parallel to
57 * the z-axis. The tube has a specified half-length along
58 * the z axis, about which it is centred, and a given
59 * minimum and maximum radius. A minimum radius of 0
60 * signifies a filled tube /cylinder. The tube segment is
61 * specified by starting and delta
62 * angles for phi, with 0 being the +x axis, PI/2
63 * the +y axis. A delta angle of 2PI signifies a
64 * complete, unsegmented tube/cylinder
65 *
66 * Always use Inventor Fields. This allows Inventor to detect a change to
67 * the data field and take the appropriate action; e.g., redraw the scene.
68*/
69
70#define SoTubs Geant4_SoTubs
71
72class SoTubs:public SoShape {
73
74 // The following is required:
75 SO_NODE_HEADER(SoTubs);
76
77public:
78
79 //
80 //! Inside radius of the tube
81 //
82 SoSFFloat pRMin;
83 //
84 //! Outside radius of the tube
85 //
86 SoSFFloat pRMax;
87 //
88 //! Half-length in Z
89 //
90 SoSFFloat pDz;
91 //
92 //! Starting angle, in radians
93 //
94 SoSFFloat pSPhi;
95 //
96 //! Delta-angle, in radians
97 //
98 SoSFFloat pDPhi;
99 //
100 //! Alternate rep - required
101 //
102 SoSFNode alternateRep;
103
104 //
105 //! Constructor, required
106 //
108
109 //
110 //! Class Initializer, required
111 //
112 static void initClass();
113
114 //
115 //! Generate AlternateRep, required. Generating an alternate representation
116 //! must be done upon users request. It allows an Inventor program to read
117 //! back the file without requiring *this* code to be dynamically linked.
118 //! If the users expects that *this* code will be dynamically linked, he
119 //! need not invoke this method.
120 //
121 virtual void generateAlternateRep();
122
123 //
124 //! We better be able to clear it, too!
125 //
126 virtual void clearAlternateRep();
127
128protected:
129
130 //
131 //! compute bounding Box, required
132 //
133 virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
134
135 //
136 //! Generate Primitives, required
137 //
138 virtual void generatePrimitives(SoAction *action);
139
140 //
141 //! GetChildList, required whenever the class has hidden children
142 //
143 virtual SoChildList *getChildren() const;
144
145
146protected:
147 //
148 //! Destructor, required
149 //
150 virtual ~SoTubs();
151
152private:
153
154 //
155 //! Generate Children. Used to create the hidden children. Required whenever
156 //! the node has hidden children.
157 //
158 void generateChildren();
159
160 //
161 //! Used to modify hidden children when a data field is changed. Required
162 //! whenever the class has hidden children.
163 //
164 void updateChildren();
165
166 //
167 //! ChildList. Required whenever the class has hidden children.
168 //
169 SoChildList *children;
170
171 //
172 //! help with trigonometry. increments sines an cosines by an angle.
173 //
174 void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
175 double oldSin=sinPhi,oldCos=cosPhi;
176 sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
177 cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;
178 }
179
180};
181
182#endif
Definition: SoTubs.h:72
virtual ~SoTubs()
Destructor, required.
virtual SoChildList * getChildren() const
GetChildList, required whenever the class has hidden children.
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
compute bounding Box, required
virtual void generateAlternateRep()
SoSFFloat pDz
Half-length in Z.
Definition: SoTubs.h:90
SoSFNode alternateRep
Alternate rep - required.
Definition: SoTubs.h:102
virtual void generatePrimitives(SoAction *action)
Generate Primitives, required.
static void initClass()
Class Initializer, required.
virtual void clearAlternateRep()
We better be able to clear it, too!
SoSFFloat pDPhi
Delta-angle, in radians.
Definition: SoTubs.h:98
SoSFFloat pSPhi
Starting angle, in radians.
Definition: SoTubs.h:94
SoTubs()
Constructor, required.
SoSFFloat pRMin
Inside radius of the tube.
Definition: SoTubs.h:82
SoSFFloat pRMax
Outside radius of the tube.
Definition: SoTubs.h:86