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