G4NURBScylinder.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // Olivier Crumeyrolle  12 September 1996
00031 
00032 // Cylinder builder implementation
00033 // OC 090796
00034 
00035 #include "G4NURBScylinder.hh"
00036 
00037 // the cylinder constructor use the first G4NURBS constructor
00038 // look in G4NURBStube if you want to see how to use the second one.
00039 
00040 G4NURBScylinder::G4NURBScylinder(G4double R, G4double DZ)
00041   : G4NURBS  ( 2, 3,  // linear along U, quadratic along V
00042                4, 9,  // half rectangle along U, circle along V
00043                (new t_CtrlPt [ 4 * 9 ]),  // the array for CtrlPts
00044                0,     // the knot vector along U will be generated
00045                (new t_Knot [ 3 + 9 ]) )   // knot vector for the circle
00046 {
00047   // define the V knot vector
00048   m[V].pKnots[ 0] = 0;
00049   m[V].pKnots[ 1] = 0;
00050   m[V].pKnots[ 2] = 0;
00051   m[V].pKnots[ 3] = 0.25;
00052   m[V].pKnots[ 4] = 0.25;
00053   m[V].pKnots[ 5] = 0.5;
00054   m[V].pKnots[ 6] = 0.5;
00055   m[V].pKnots[ 7] = 0.75;
00056   m[V].pKnots[ 8] = 0.75;
00057   m[V].pKnots[ 9] = 1;
00058   m[V].pKnots[10] = 1;
00059   m[V].pKnots[11] = 1;
00060 
00061   // define control points
00062 
00063   const G4double sr2o2 = std::sqrt(2.)/2. ;
00064 
00065   CP(mpCtrlPts[ 0] ,  0,  0,  DZ, 1 );
00066   CP(mpCtrlPts[ 1] ,  R, 0,  DZ, 1 );
00067   CP(mpCtrlPts[ 2] ,  R, 0, -DZ, 1 );
00068   CP(mpCtrlPts[ 3] ,  0,  0, -DZ, 1 );
00069 
00070   CP(mpCtrlPts[ 4] ,  0,  0,  DZ, 1 );
00071   CP(mpCtrlPts[ 5] ,  R, R, DZ, 1 , sr2o2);
00072   CP(mpCtrlPts[ 6] ,  R, R,-DZ, 1 , sr2o2);
00073   CP(mpCtrlPts[ 7] ,  0,  0, -DZ, 1 );
00074 
00075   CP(mpCtrlPts[ 8] ,  0,  0,  DZ, 1 );
00076   CP(mpCtrlPts[ 9] ,  0, R,  DZ, 1 );
00077   CP(mpCtrlPts[10] ,  0, R, -DZ, 1 );
00078   CP(mpCtrlPts[11] ,  0,  0, -DZ, 1 );
00079 
00080   CP(mpCtrlPts[12] ,  0,  0,  DZ, 1 );
00081   CP(mpCtrlPts[13] , -R, R, DZ, 1 , sr2o2);
00082   CP(mpCtrlPts[14] , -R, R,-DZ, 1 , sr2o2);
00083   CP(mpCtrlPts[15] ,  0,  0, -DZ, 1 );
00084 
00085   CP(mpCtrlPts[16] ,  0,  0,  DZ, 1 );
00086   CP(mpCtrlPts[17] , -R, 0,  DZ, 1 );
00087   CP(mpCtrlPts[18] , -R, 0, -DZ, 1 );
00088   CP(mpCtrlPts[19] ,  0,  0, -DZ, 1 );
00089 
00090   CP(mpCtrlPts[20] ,  0,  0,  DZ, 1 );
00091   CP(mpCtrlPts[21] , -R,-R, DZ, 1 , sr2o2);
00092   CP(mpCtrlPts[22] , -R,-R,-DZ, 1 , sr2o2);
00093   CP(mpCtrlPts[23] ,  0,  0, -DZ, 1 );
00094 
00095   CP(mpCtrlPts[24] ,  0,  0,  DZ, 1 );
00096   CP(mpCtrlPts[25] ,  0, -R, DZ, 1 );
00097   CP(mpCtrlPts[26] ,  0, -R,-DZ, 1 );
00098   CP(mpCtrlPts[27] ,  0,  0, -DZ, 1 );
00099 
00100   CP(mpCtrlPts[28] ,  0,  0,  DZ, 1 );
00101   CP(mpCtrlPts[29] ,  R,-R, DZ, 1 , sr2o2);
00102   CP(mpCtrlPts[30] ,  R,-R,-DZ, 1 , sr2o2);
00103   CP(mpCtrlPts[31] ,  0,  0, -DZ, 1 );
00104 
00105   CP(mpCtrlPts[32] ,  0,  0,  DZ, 1 );
00106   CP(mpCtrlPts[33] ,  R, 0,  DZ, 1 );
00107   CP(mpCtrlPts[34] ,  R, 0, -DZ, 1 );
00108   CP(mpCtrlPts[35] ,  0,  0, -DZ, 1 );
00109 }
00110 
00111 const char* G4NURBScylinder::Whoami() const
00112 {
00113   return "Cylinder";
00114 }

Generated on Mon May 27 17:49:08 2013 for Geant4 by  doxygen 1.4.7