Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SoCons.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: SoCons.h 66373 2012-12-18 09:41:34Z gcosmo $
28 //
29 /*-----------------------------Hepvis----------------------------------------*/
30 /* */
31 /* Node: SoCons */
32 /* Description: Represents the G4Cons Geant Geometry entity */
33 /* Author: Joe Boudreau Nov 11 1996 */
34 /* */
35 /*---------------------------------------------------------------------------*/
36 #ifndef HEPVis_SoCons_h
37 #define HEPVis_SoCons_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 
44 class SoSFNode;
45 //! SoCons - Inventor version of the G4Cons Geant Geometry entity
46 /*!
47  * Node: SoCons
48  *
49  * Description: The Inventor version of the G4Cons Geant Geometry entity
50  *
51  * Author: Joe Boudreau Nov 11 1996
52  *
53  * A G4Cons is, in the general case, a Phi segment of a cone, with half-length
54  * fDz, inner and outer radii specified at -fDz and +fDz. The Phi segment is
55  * described by a starting fSPhi angle, and the +fDPhi delta angle for the shape.
56  * If the delta angle is >=2*M_PI, the shape is treated as continuous in Phi
57  *
58  * Member Data:
59  *
60  * fRmin1 inside radius at -fDz
61  * fRmin2 inside radius at +fDz
62  * fRmax1 outside radius at -fDz
63  * fRmax2 outside radius at +fDz
64  * fDz half length in z
65  *
66  * fSPhi starting angle of the segment in radians
67  * fDPhi delta angle of the segment in radians
68 */
69 
70 #define SoCons Geant4_SoCons
71 
72 class SoCons:public SoShape {
73 
74  // The following is required:
75  SO_NODE_HEADER(SoCons);
76 
77 public:
78 
79  //
80  //! Inside radius at -fDz
81  //
82  SoSFFloat fRmin1;
83  //
84  //! Inside radius at +fDz
85  //
86  SoSFFloat fRmin2;
87  //
88  //! Outside radius at -fDz
89  //
90  SoSFFloat fRmax1;
91  //
92  //! Outside radius at +fDz
93  //
94  SoSFFloat fRmax2;
95  //
96  //! Half-length along Z
97  //
98  SoSFFloat fDz;
99  //
100  //! Starting angle, in radians
101  //
102  SoSFFloat fSPhi;
103  //
104  //! Delta-angle, in radians
105  //
106  SoSFFloat fDPhi;
107  //
108  //! An Inventor option - slightly better render, worse performance
109  //
110  SoSFBool smoothDraw;
111  //
112  //! Alternate rep required - for use by users without HEPVis shared objects
113  //
114  SoSFNode alternateRep;
115 
116  //
117  //! Constructor, required
118  //
119  SoCons();
120 
121  //
122  //! Class Initializer, required
123  //
124  static void initClass();
125 
126  //
127  //! Generate AlternateRep, required. Generating an alternate representation
128  //! must be done upon users request. It allows an Inventor program to read
129  //! back the file without requiring *this* code to be dynamically linked.
130  //! If the users expects that *this* code will be dynamically linked, he
131  //! need not invoke this method.
132  //
133  virtual void generateAlternateRep();
134 
135  //
136  //! We better be able to clear it, too!
137  //
138  virtual void clearAlternateRep();
139 
140 protected:
141 
142  //
143  //! compute bounding Box, required
144  //
145  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
146 
147  //
148  //! Generate Primitives, required
149  //
150  virtual void generatePrimitives(SoAction *action);
151 
152  //
153  //! GetChildList, required whenever the class has hidden children
154  //
155  virtual SoChildList *getChildren() const;
156 
157 
158 protected:
159  //
160  //! Destructor, required
161  //
162  virtual ~SoCons();
163 
164 private:
165 
166  //
167  //! Generate Children. Used to create the hidden children. Required whenever
168  //! the node has hidden children.
169  //
170  void generateChildren();
171 
172  //
173  //! Used to modify hidden children when a data field is changed. Required
174  //! whenever the class has hidden children.
175  //
176  void updateChildren();
177 
178  //
179  //! ChildList. Required whenever the class has hidden children.
180  //
181  SoChildList *children;
182 
183  //
184  //! help with trigonometry. increments sines an cosines by an angle.
185  //
186  void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
187  double oldSin=sinPhi,oldCos=cosPhi;
188  sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
189  cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;
190  }
191 };
192 
193 #endif
Definition: SoCons.h:72
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
compute bounding Box, required
static void initClass()
Class Initializer, required.
SoSFNode alternateRep
Alternate rep required - for use by users without HEPVis shared objects.
Definition: SoCons.h:114
virtual void generatePrimitives(SoAction *action)
Generate Primitives, required.
SoSFFloat fRmin1
Inside radius at -fDz.
Definition: SoCons.h:82
SoSFFloat fRmax2
Outside radius at +fDz.
Definition: SoCons.h:94
virtual void clearAlternateRep()
We better be able to clear it, too!
SoCons()
Constructor, required.
SoSFFloat fRmin2
Inside radius at +fDz.
Definition: SoCons.h:86
virtual SoChildList * getChildren() const
GetChildList, required whenever the class has hidden children.
SoSFBool smoothDraw
An Inventor option - slightly better render, worse performance.
Definition: SoCons.h:110
virtual ~SoCons()
Destructor, required.
SoSFFloat fDPhi
Delta-angle, in radians.
Definition: SoCons.h:106
SoSFFloat fSPhi
Starting angle, in radians.
Definition: SoCons.h:102
SoSFFloat fDz
Half-length along Z.
Definition: SoCons.h:98
SoSFFloat fRmax1
Outside radius at -fDz.
Definition: SoCons.h:90
virtual void generateAlternateRep()