source: trunk/source/geometry/solids/BREPS/src/G4BREPSolidCylinder.cc @ 1358

Last change on this file since 1358 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.4 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// $Id: G4BREPSolidCylinder.cc,v 1.11 2006/06/29 18:41:18 gunter Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29// ----------------------------------------------------------------------
30// GEANT 4 class source file
31//
32// G4BREPSolidCylinder.cc
33//
34// ----------------------------------------------------------------------
35
36#include "G4BREPSolidCylinder.hh"
37#include "G4CircularCurve.hh"
38#include "G4FPlane.hh"
39#include "G4FCylindricalSurface.hh"
40
41G4BREPSolidCylinder::G4BREPSolidCylinder(const G4String& name,
42                                         const G4ThreeVector& origin,
43                                         const G4ThreeVector& axis,
44                                         const G4ThreeVector& direction,
45                                         G4double radius,
46                                         G4double length)
47  : G4BREPSolid(name)
48{
49  SurfaceVec = new G4Surface*[3];
50  G4CurveVector cv;
51  G4CircularCurve* tmp;
52
53
54
55  // Creation of the cylindrical surface
56  SurfaceVec[0] = new G4FCylindricalSurface(origin, axis, radius , length);
57  //SurfaceVec[0]->SetBoundaries(&cv);
58  //cv.clear();
59
60
61  // Creation of the first circular surface, which origin is origin
62  G4Point3D  ArcStart1 = G4Point3D( origin + ( radius*direction ) );
63  G4Vector3D axis1     = G4Vector3D( axis.cross( direction ) );
64
65  tmp = new G4CircularCurve;
66  tmp->Init( G4Axis2Placement3D(direction, axis1, origin), radius );
67  tmp->SetBounds(ArcStart1, ArcStart1);
68  cv.push_back(tmp);
69
70  SurfaceVec[1] = new G4FPlane(direction, axis1, origin);
71  SurfaceVec[1]->SetBoundaries(&cv);
72  cv.clear();
73 
74
75  // Creation of the second circular surface
76  G4Point3D  origin2   = G4Point3D( origin  + ( length*axis ) ); 
77  G4Point3D  ArcStart2 = origin2 + G4Point3D( radius*direction );
78  G4Vector3D axis2     = axis1;
79
80  tmp = new G4CircularCurve;
81  tmp->Init( G4Axis2Placement3D(direction, axis2, origin2), radius);
82  tmp->SetBounds(ArcStart2, ArcStart2);
83  cv.push_back(tmp);
84
85  SurfaceVec[2] = new G4FPlane(direction, axis2, origin2);
86  SurfaceVec[2]->SetBoundaries(&cv);
87  cv.clear();
88
89
90  nb_of_surfaces = 3;
91  active=1;
92 
93  // Save constructor parameters
94  constructorParams.origin       = origin;
95  constructorParams.axis         = axis;
96  constructorParams.direction    = direction;
97  constructorParams.length       = length;
98  constructorParams.radius       = radius;
99 
100  Initialize();
101}
102
103G4BREPSolidCylinder::G4BREPSolidCylinder( __void__& a )
104  : G4BREPSolid(a)
105{
106}
107
108G4BREPSolidCylinder::~G4BREPSolidCylinder()
109{
110}
111
112// Streams solid contents to output stream.
113std::ostream& G4BREPSolidCylinder::StreamInfo(std::ostream& os) const
114{
115  G4BREPSolid::StreamInfo( os )
116  << "\n origin:       " << constructorParams.origin
117  << "\n axis:         " << constructorParams.axis
118  << "\n direction:    " << constructorParams.direction
119  << "\n length:       " << constructorParams.length
120  << "\n radius:       " << constructorParams.radius
121  << "\n-----------------------------------------------------------\n";
122
123  return os;
124}
125
Note: See TracBrowser for help on using the repository browser.