Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SoTrap.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: SoTrap.h 66373 2012-12-18 09:41:34Z gcosmo $
28 //
29 /*-----------------------------Hepvis----------------------------------------*/
30 /* */
31 /* Node: SoTrap */
32 /* Description: Represents the G4Trap Geant Geometry entity */
33 /* Author: Joe Boudreau Nov 11 1996 */
34 /* */
35 /*---------------------------------------------------------------------------*/
36 #ifndef HEPVis_SoTrap_h
37 #define HEPVis_SoTrap_h
38 
39 // Inheritance :
40 #include <Inventor/nodes/SoShape.h>
41 
42 #include <Inventor/fields/SoSFNode.h>
43 #include <Inventor/fields/SoSFBool.h>
44 #include <Inventor/fields/SoSFFloat.h>
45 
46 //adding fields
47 #ifdef WIN32
48 #include <SoWinEnterScope.h>
49 #endif
50 
51 
52 // Defining Class
53 #ifdef WIN32
54 #include <SoWinLeaveScope.h>
55 #endif
56 
57 class SoSFNode;
58 
59 //! SoTrap - Inventor version of the G4Trap Geant Geometry entity
60 /*! Node: SoTrap
61  *
62  * Description: Inventor version of the G4Trap Geant Geometry entity
63  *
64  * Author: Joe Boudreau Nov 11 1996
65  *
66  * A G4Trap is a general trapezoid: The faces perpendicular to the z planes
67  * are tapezia, and their centres are not necessarily on a line parallel to
68  * the z axis.
69  *
70  * Note that of the 11 parameters desribed below, only 9 are really
71  * independent - a check for planarity is made in the calculation of the
72  * equation for each plane. If the planes are not parallel, a call to
73  * G4Exception is made.
74  *
75  * Always use Inventor Fields. This allows Inventor to detect a change to
76  * the data field and take the appropriate action; e.g., redraw the scene.
77  *
78 */
79 
80 #define SoTrap Geant4_SoTrap
81 
82 class SoTrap:public SoShape {
83 
84  // The following is required:
85  SO_NODE_HEADER(SoTrap);
86 
87 public:
88 #if defined(WIN32) && defined(BUILDING_DLL)
89  // When building the node as a DLL under Win32 we must explicitly
90  // declare this entry point as visible outside the DLL. The macro
91  // BUILDING_DLL is defined in the node's source file.
92  _declspec(dllexport)
93 #endif
94 
95  //
96  //! half-length along Z
97  //
98  SoSFFloat pDz;
99  //
100  //! Polar angle of the line joining the centres of the faces at -/+pDz
101  //
102  SoSFFloat pTheta;
103  //
104  //! Azimuthal angle of the line joing the centre of the face at -pDz
105  //! to the centre of the face at +pDz
106  //
107  SoSFFloat pPhi;
108  //
109  //! Half-length along y of the face at -pDz
110  //
111  SoSFFloat pDy1;
112  //
113  //! Half-length along x of the side at y=-pDy1 of the face at -pDz
114  //
115  SoSFFloat pDx1;
116  //
117  //! Half-length along x of the side at y=+pDy1 of the face at -pDz
118  //
119  SoSFFloat pDx2;
120  //
121  //! Half-length along y of the face at +pDz
122  //
123  SoSFFloat pDy2;
124  //
125  //! Half-length along x of the side at y=-pDy2 of the face at +pDz
126  //
127  SoSFFloat pDx3;
128  //
129  //! Half-length along x of the side at y=+pDy2 of the face at +pDz
130  //
131  SoSFFloat pDx4;
132  //
133  //! Angle with respect to the y axis from the centre of the side at
134  //! y=-pDy1 to the centre at y=+pDy1 of the face at -pDz
135  //
136  SoSFFloat pAlp1;
137  //
138  //! Angle with respect to the y axis from the centre of the side at
139  //! y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
140  //
141  SoSFFloat pAlp2;
142 
143  //
144  //! Alternate rep - required
145  //
146  SoSFNode alternateRep;
147 
148  //
149  //! Constructor, required
150  //
151  SoTrap();
152 
153  //
154  //! Class Initializer, required
155  //
156  static void initClass();
157 
158  //
159  //! Generate AlternateRep, required. Generating an alternate representation
160  //! must be done upon users request. It allows an Inventor program to read
161  //! back the file without requiring *this* code to be dynamically linked.
162  //! If the users expects that *this* code will be dynamically linked, he
163  //! need not invoke this method.
164  //
165  virtual void generateAlternateRep();
166 
167  //
168  //! We better be able to clear it, too!
169  //
170  virtual void clearAlternateRep();
171 
172 protected:
173 
174  //
175  //! compute bounding Box, required
176  //
177  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
178 
179  //
180  //! Generate Primitives, required
181  //
182  virtual void generatePrimitives(SoAction *action);
183 
184  //
185  //! GetChildList, required whenever the class has hidden children
186  //
187  virtual SoChildList *getChildren() const;
188 
189  //
190  //! Destructor, required
191  //
192  virtual ~SoTrap();
193 
194 private:
195 
196  //
197  //! Generate Children. Used to create the hidden children. Required whenever
198  //! the node has hidden children.
199  //
200  void generateChildren();
201 
202  //
203  //! Used to modify hidden children when a data field is changed. Required
204  //! whenever the class has hidden children.
205  //
206  void updateChildren();
207 
208  //
209  //! ChildList. Required whenever the class has hidden children.
210  //
211  SoChildList *children;
212 
213 };
214 
215 #ifdef WIN32
216 #include <SoWinEnterScope.h>
217 #endif
218 
219 #endif
SoSFFloat pAlp1
Definition: SoTrap.h:136
SoSFFloat pDy2
Half-length along y of the face at +pDz.
Definition: SoTrap.h:123
SoSFFloat pDz
half-length along Z
Definition: SoTrap.h:98
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
compute bounding Box, required
virtual SoChildList * getChildren() const
GetChildList, required whenever the class has hidden children.
SoSFFloat pDy1
Half-length along y of the face at -pDz.
Definition: SoTrap.h:111
virtual void generateAlternateRep()
SoSFFloat pAlp2
Definition: SoTrap.h:141
SoSFNode alternateRep
Alternate rep - required.
Definition: SoTrap.h:146
SoSFFloat pPhi
Definition: SoTrap.h:107
SoTrap()
Constructor, required.
SoSFFloat pDx3
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: SoTrap.h:127
virtual void generatePrimitives(SoAction *action)
Generate Primitives, required.
SoSFFloat pDx2
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: SoTrap.h:119
virtual ~SoTrap()
Destructor, required.
SoSFFloat pTheta
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: SoTrap.h:102
Definition: SoTrap.h:82
virtual void clearAlternateRep()
We better be able to clear it, too!
SoSFFloat pDx4
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: SoTrap.h:131
static void initClass()
Class Initializer, required.
SoSFFloat pDx1
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: SoTrap.h:115