source: trunk/source/graphics_reps/test/testG4Polyhedron.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 10.2 KB
Line 
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: testG4Polyhedron.cc,v 1.4 2006/06/29 19:07:40 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31
32// Create polyhedron for different shapes
33
34#include "G4ios.hh"
35#include "G4Polyhedron.hh"
36
37int main() {
38
39  G4Polyhedron polyhedron;
40
41//   B O X
42
43  G4cout << "=== G4PolyhedronBox" << G4endl;
44  polyhedron = G4PolyhedronBox(100., 200., 400.);
45
46//   T R D 1
47
48  G4cout << "=== G4PolyhedronTrd1" << G4endl;
49  polyhedron = G4PolyhedronTrd1(100., 150., 200., 400.);
50
51//   T R D 2
52
53  G4cout << "=== G4PolyhedronTrd2" << G4endl;
54  polyhedron = G4PolyhedronTrd2(2., 3., 4., 5., 6.);
55
56//   P A R A
57
58  G4cout << "=== G4PolyhedronPara" << G4endl;
59  polyhedron = G4PolyhedronPara(100., 200., 400., 15.*deg, 30.*deg, 30.*deg);
60
61//   T R A P
62
63  G4cout << "=== G4PolyhedronTrap" << G4endl;
64  polyhedron = G4PolyhedronTrap(390., 0.*deg, 0.*deg,
65                                60., 40., 90., 15.*deg,
66                                120., 80., 180., 15.*deg);
67
68//   T U B E
69
70  G4cout << "=== G4PolyhedronTube" << G4endl;
71  polyhedron = G4PolyhedronTube(100., 200., 400.);
72
73  G4cout << "=== G4PolyhedronTube(Rmin = 0)" << G4endl;
74  polyhedron = G4PolyhedronTube(0., 200., 400.);
75
76//   T U B S
77
78  G4cout << "=== G4PolyhedronTubs" << G4endl;
79  polyhedron = G4PolyhedronTubs(0., 200., 400., 200.*deg, 140.*deg);
80
81  G4cout << "=== G4PolyhedronTubs(Rmin = 0, Dphi=180)" << G4endl;
82  polyhedron = G4PolyhedronTubs(0., 200., 400., 200.*deg, 180.*deg);
83
84//   C O N E
85
86  G4cout << "=== G4PolyhedronCone" << G4endl;
87  polyhedron = G4PolyhedronCone(50., 100., 150., 200., 400.);
88
89  G4cout << "=== G4PolyhedronCone(Rmin1 = Rmin2 = 0)" << G4endl;
90  polyhedron = G4PolyhedronCone(0., 100., 0., 200., 400.);
91
92  G4cout << "=== G4PolyhedronCone(Rmin1 = Rmax1 = 0)" << G4endl;
93  polyhedron = G4PolyhedronCone(0., 0., 150., 200., 400.);
94
95  G4cout << "=== G4PolyhedronCone(Rmin1 = Rmax1)" << G4endl;
96  polyhedron = G4PolyhedronCone(100., 100., 150., 200., 400.);
97
98  G4cout << "=== G4PolyhedronCone(Rmin2 = Rmax2 = 0.)" << G4endl;
99  polyhedron = G4PolyhedronCone(50., 100., 0., 0., 400.);
100
101  G4cout << "=== G4PolyhedronCone(Rmin2 = Rmax2)" << G4endl;
102  polyhedron = G4PolyhedronCone(50., 100., 200., 200., 400.);
103
104//   C O N S
105
106  G4cout << "=== G4PolyhedronCons" << G4endl;
107  polyhedron = G4PolyhedronCons(50.,100.,150.,200.,400.,200.*deg,140.*deg);
108
109  G4cout << "=== G4PolyhedronCons(Rmin1 = Rmin2 = 0)" << G4endl;
110  polyhedron = G4PolyhedronCons(0.,100.,0.,200.,400.,200.*deg,140.*deg);
111
112  G4cout << "=== G4PolyhedronCons(Rmin1 = Rmin2 = 0, Dphi=180)" << G4endl;
113  polyhedron = G4PolyhedronCons(0.,100.,0.,200.,400.,200.*deg,180.*deg);
114
115  G4cout << "=== G4PolyhedronCons(Rmin1 = Rmax1 = 0)" << G4endl;
116  polyhedron = G4PolyhedronCons(0.,0.,150.,200.,400.,200.*deg,180.*deg);
117
118  G4cout << "=== G4PolyhedronCons(Rmin1 = Rmax1)" << G4endl;
119  polyhedron = G4PolyhedronCons(100.,100.,150.,200.,400.,200.*deg,180.*deg);
120
121  G4cout << "=== G4PolyhedronCons(Rmin2 = Rmax2 = 0.)" << G4endl;
122  polyhedron = G4PolyhedronCons(50.,100.,0.,0.,400.,200.*deg,180.*deg);
123
124  G4cout << "=== G4PolyhedronCons(Rmin2 = Rmax2)" << G4endl;
125  polyhedron = G4PolyhedronCons(50.,100.,200.,200.,400.,200.*deg,180.*deg);
126
127//   S P H E R E
128
129  G4cout << "=== G4PolyhedronSphere" << G4endl;
130  polyhedron = G4PolyhedronSphere(100.,200.,0.*deg,360.*deg,0.*deg,180.*deg);
131
132  G4cout << "=== G4PolyhedronSphere(Rmin=0)" << G4endl;
133  polyhedron = G4PolyhedronSphere(0.,200.,0.*deg,360.*deg,0.*deg,180.*deg);
134
135  G4cout << "=== G4PolyhedronSphere(Dphi=180)" << G4endl;
136  polyhedron = G4PolyhedronSphere(100.,200.,0.*deg,180.*deg,0.*deg,180.*deg);
137
138  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dphi=180)" << G4endl;
139  polyhedron = G4PolyhedronSphere(0.,200.,5.*deg,180.*deg,0.*deg,180.*deg);
140
141  G4cout << "=== G4PolyhedronSphere(Dthe=0-90)" << G4endl;
142  polyhedron = G4PolyhedronSphere(100.,200.,0.*deg,360.*deg,0.*deg,90.*deg);
143
144  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dthe=0-90)" << G4endl;
145  polyhedron = G4PolyhedronSphere(0.,200.,5.*deg,360.*deg,0.*deg,90.*deg);
146
147  G4cout << "=== G4PolyhedronSphere(Dthe=90-180)" << G4endl;
148  polyhedron = G4PolyhedronSphere(100.,200.,0.*deg,360.*deg,90.*deg,90.*deg);
149
150  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dthe=90-180)" << G4endl;
151  polyhedron = G4PolyhedronSphere(0.,200.,5.*deg,360.*deg,90.*deg,90.*deg);
152
153  G4cout << "=== G4PolyhedronSphere(Dphi=180, Dthe=0-90)" << G4endl;
154  polyhedron = G4PolyhedronSphere(100.,200.,5.*deg,180.*deg,0.*deg,90.*deg);
155
156  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dphi=180, Dthe=0-900)" << G4endl;
157  polyhedron = G4PolyhedronSphere(0.,200.,5.*deg,180.*deg,0.*deg,90.*deg);
158
159  G4cout << "=== G4PolyhedronSphere(Dphi=180, Dthe=90-180)" << G4endl;
160  polyhedron = G4PolyhedronSphere(100.,200.,5.*deg,180.*deg,90.*deg,90.*deg);
161
162  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dphi=180, Dthe=90-180)" << G4endl;
163  polyhedron = G4PolyhedronSphere(0.,200.,5.*deg,180.*deg,90.*deg,90.*deg);
164
165  G4cout << "=== G4PolyhedronSphere(Dphi=45-135, Dthe=45-135)" << G4endl;
166  polyhedron = G4PolyhedronSphere(100.,200.,45.*deg,90.*deg,45.*deg,90.*deg);
167
168  G4cout << "=== G4PolyhedronSphere(Rmin=0, Dphi=30-120, Dthe=30-120)" << G4endl;
169  polyhedron = G4PolyhedronSphere(0.,200.,30.*deg,90.*deg,30.*deg,90.*deg);
170
171//   T O R U S
172
173  G4cout << "=== G4PolyhedronTorus" << G4endl;
174  polyhedron = G4PolyhedronTorus(100.,200.,400.,0.*deg,360.*deg);
175 
176  G4cout << "=== G4PolyhedronTorus(Rmin=0)" << G4endl;
177  polyhedron = G4PolyhedronTorus(0.,200.,400.,0.*deg,360.*deg);
178 
179  G4cout << "=== G4PolyhedronTorus(Dphi=180)" << G4endl;
180  polyhedron = G4PolyhedronTorus(100.,200.,400.,5.*deg,180.*deg);
181 
182  G4cout << "=== G4PolyhedronTorus(Rmin=0, Dphi=180)" << G4endl;
183  polyhedron = G4PolyhedronTorus(0.,200.,400.,5.*deg,180.*deg);
184 
185//   P G O N
186
187  G4cout << "=== G4PolyhedronPgon(Nz=4)" << G4endl;
188  G4double rmax01[4] = {  150.,  200., 200., 150.};
189  G4double rmin01[4] = {   50.,  100., 100.,  50.};
190  G4double z01[4]    = { -200., -100., 100., 200.};
191  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 2, 4, z01, rmin01, rmax01);
192
193  G4cout << "=== G4PolyhedronPgon(Nz=4, N=1)" << G4endl;
194  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 1, 4, z01, rmin01, rmax01);
195
196  G4cout << "=== G4PolyhedronPgon(Nz=4, Rmin=Rmax)" << G4endl;
197  G4double rmax02[4] = {  150.,  200., 200., 150.};
198  G4double rmin02[4] = {  150.,  100., 100., 150.};
199  G4double z02[4]    = { -200., -100., 100., 200.};
200  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 2, 4, z02, rmin02, rmax02);
201
202  G4cout << "=== G4PolyhedronPgon(Nz=4, N=1, Rmin=Rmax)" << G4endl;
203  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 1, 4, z02, rmin02, rmax02);
204
205  G4cout << "=== G4PolyhedronPgon(Nz=4, Rmin=Rmax=0)" << G4endl;
206  G4double rmax03[4] = {  0.,  200., 200., 0.};
207  G4double rmin03[4] = {  0.,  100., 100., 0.};
208  G4double z03[4]    = { -200., -100., 100., 200.};
209  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 2, 4, z03, rmin03, rmax03);
210
211  G4cout << "=== G4PolyhedronPgon(Nz=4, N=1, Rmin=Rmax=0)" << G4endl;
212  polyhedron = G4PolyhedronPgon(5.*deg, 45.*deg, 1, 4, z03, rmin03, rmax03);
213
214  G4cout << "=== G4PolyhedronPgon(Nz=4, Rmin=100)" << G4endl;
215  G4double rmax04[4] = {  150.,  200., 200., 150.};
216  G4double rmin04[4] = {  100.,  100., 100., 100.};
217  G4double z04[4]    = { -200., -100., 100., 200.};
218  polyhedron = G4PolyhedronPgon(5.*deg, 120.*deg, 6, 4, z04, rmin04, rmax04);
219
220  G4cout << "=== G4PolyhedronPgon(Nz=4, Rmin=0, Dphi=180)" << G4endl;
221  G4double rmax05[4] = {  150.,  200., 200., 150.};
222  G4double rmin05[4] = {    0.,    0.,   0.,   0.};
223  G4double z05[4]    = { -200., -100., 100., 200.};
224  polyhedron = G4PolyhedronPgon(5.*deg, 180.*deg, 6, 4, z05, rmin05, rmax05);
225
226  G4cout << "=== G4PolyhedronPgon(Nz=3, Rmin=Rmax)" << G4endl;
227  G4double rmax06[3] = {  100.,  200., 200.};
228  G4double rmin06[3] = {  100.,  100., 100.};
229  G4double z06[3]    = { -200., -100., 100.};
230  polyhedron = G4PolyhedronPgon(5.*deg, 120.*deg, 6, 3, z06, rmin06, rmax06);
231
232//   P C O N
233
234  G4cout << "=== G4PolyhedronPcon(Nz=4)" << G4endl;
235  polyhedron = G4PolyhedronPcon(5.*deg, 45.*deg, 4, z01, rmin01, rmax01);
236
237  G4cout << "=== G4PolyhedronPcon(Nz=4, Rmin=Rmax)" << G4endl;
238  polyhedron = G4PolyhedronPcon(5.*deg, 45.*deg, 4, z02, rmin02, rmax02);
239
240  G4cout << "=== G4PolyhedronPcon(NZ=4, Rmin=Rmax=0)" << G4endl;
241  polyhedron = G4PolyhedronPcon(5.*deg, 45.*deg, 4, z03, rmin03, rmax03);
242
243  G4cout << "=== G4PolyhedronPcon(Nz=4, Rmin=100)" << G4endl;
244  polyhedron = G4PolyhedronPcon(5.*deg, 120.*deg, 4, z04, rmin04, rmax04);
245
246  G4cout << "=== G4PolyhedronPcon(Nz=4, Rmin=0, Dphi=180)" << G4endl;
247  polyhedron = G4PolyhedronPcon(5.*deg, 180.*deg, 4, z05, rmin05, rmax05);
248
249  G4cout << "=== G4PolyhedronPcon(Nz=3, Rmin=Rmax)" << G4endl;
250  polyhedron = G4PolyhedronPcon(5.*deg, 120.*deg, 3, z06, rmin06, rmax06);
251
252  return 0;
253}
254     
255     
Note: See TracBrowser for help on using the repository browser.