Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NURBScylinder.cc
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 //
30 // Olivier Crumeyrolle 12 September 1996
31 
32 // Cylinder builder implementation
33 // OC 090796
34 
35 #include "G4NURBScylinder.hh"
36 
37 // the cylinder constructor use the first G4NURBS constructor
38 // look in G4NURBStube if you want to see how to use the second one.
39 
41  : G4NURBS ( 2, 3, // linear along U, quadratic along V
42  4, 9, // half rectangle along U, circle along V
43  (new t_CtrlPt [ 4 * 9 ]), // the array for CtrlPts
44  0, // the knot vector along U will be generated
45  (new t_Knot [ 3 + 9 ]) ) // knot vector for the circle
46 {
47  // define the V knot vector
48  m[V].pKnots[ 0] = 0;
49  m[V].pKnots[ 1] = 0;
50  m[V].pKnots[ 2] = 0;
51  m[V].pKnots[ 3] = 0.25;
52  m[V].pKnots[ 4] = 0.25;
53  m[V].pKnots[ 5] = 0.5;
54  m[V].pKnots[ 6] = 0.5;
55  m[V].pKnots[ 7] = 0.75;
56  m[V].pKnots[ 8] = 0.75;
57  m[V].pKnots[ 9] = 1;
58  m[V].pKnots[10] = 1;
59  m[V].pKnots[11] = 1;
60 
61  // define control points
62 
63  const G4double sr2o2 = std::sqrt(2.)/2. ;
64 
65  CP(mpCtrlPts[ 0] , 0, 0, DZ, 1 );
66  CP(mpCtrlPts[ 1] , R, 0, DZ, 1 );
67  CP(mpCtrlPts[ 2] , R, 0, -DZ, 1 );
68  CP(mpCtrlPts[ 3] , 0, 0, -DZ, 1 );
69 
70  CP(mpCtrlPts[ 4] , 0, 0, DZ, 1 );
71  CP(mpCtrlPts[ 5] , R, R, DZ, 1 , sr2o2);
72  CP(mpCtrlPts[ 6] , R, R,-DZ, 1 , sr2o2);
73  CP(mpCtrlPts[ 7] , 0, 0, -DZ, 1 );
74 
75  CP(mpCtrlPts[ 8] , 0, 0, DZ, 1 );
76  CP(mpCtrlPts[ 9] , 0, R, DZ, 1 );
77  CP(mpCtrlPts[10] , 0, R, -DZ, 1 );
78  CP(mpCtrlPts[11] , 0, 0, -DZ, 1 );
79 
80  CP(mpCtrlPts[12] , 0, 0, DZ, 1 );
81  CP(mpCtrlPts[13] , -R, R, DZ, 1 , sr2o2);
82  CP(mpCtrlPts[14] , -R, R,-DZ, 1 , sr2o2);
83  CP(mpCtrlPts[15] , 0, 0, -DZ, 1 );
84 
85  CP(mpCtrlPts[16] , 0, 0, DZ, 1 );
86  CP(mpCtrlPts[17] , -R, 0, DZ, 1 );
87  CP(mpCtrlPts[18] , -R, 0, -DZ, 1 );
88  CP(mpCtrlPts[19] , 0, 0, -DZ, 1 );
89 
90  CP(mpCtrlPts[20] , 0, 0, DZ, 1 );
91  CP(mpCtrlPts[21] , -R,-R, DZ, 1 , sr2o2);
92  CP(mpCtrlPts[22] , -R,-R,-DZ, 1 , sr2o2);
93  CP(mpCtrlPts[23] , 0, 0, -DZ, 1 );
94 
95  CP(mpCtrlPts[24] , 0, 0, DZ, 1 );
96  CP(mpCtrlPts[25] , 0, -R, DZ, 1 );
97  CP(mpCtrlPts[26] , 0, -R,-DZ, 1 );
98  CP(mpCtrlPts[27] , 0, 0, -DZ, 1 );
99 
100  CP(mpCtrlPts[28] , 0, 0, DZ, 1 );
101  CP(mpCtrlPts[29] , R,-R, DZ, 1 , sr2o2);
102  CP(mpCtrlPts[30] , R,-R,-DZ, 1 , sr2o2);
103  CP(mpCtrlPts[31] , 0, 0, -DZ, 1 );
104 
105  CP(mpCtrlPts[32] , 0, 0, DZ, 1 );
106  CP(mpCtrlPts[33] , R, 0, DZ, 1 );
107  CP(mpCtrlPts[34] , R, 0, -DZ, 1 );
108  CP(mpCtrlPts[35] , 0, 0, -DZ, 1 );
109 }
110 
111 const char* G4NURBScylinder::Whoami() const
112 {
113  return "Cylinder";
114 }