source: trunk/source/geometry/solids/BREPS/src/G4PlacedSolid.cc@ 1350

Last change on this file since 1350 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.2 KB
RevLine 
[831]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: G4PlacedSolid.cc,v 1.6 2007/05/11 13:49:32 gcosmo Exp $
[1337]28// GEANT4 tag $Name: geant4-09-04-beta-01 $
[831]29//
30// ----------------------------------------------------------------------
31// GEANT 4 class source file
32//
33// G4PlacedSolid.cc
34//
35// ----------------------------------------------------------------------
36
37#include "G4PlacedSolid.hh"
38#include "G4GeometryTolerance.hh"
39
40G4PlacedSolid::G4PlacedSolid()
41{
42 solid =0;
43 solidRotation =0;
44 solidTranslation =0;
45}
46
47
48G4PlacedSolid::G4PlacedSolid(G4BREPSolid* s, G4Axis2Placement3D* p)
49{
50 solid =s;
51 if(p)
52 {
53 G4double x,y,z;
54 G4Point3D srfpoint = p->GetLocation();
55
56 x = srfpoint.x();
57 y = srfpoint.y();
58 z = srfpoint.z();
59 solidTranslation = new G4ThreeVector(x,y,z);
60
61 G4Vector3D tmpvec = p->GetAxis();
62 x = tmpvec.x();
63 y = tmpvec.y();
64 z = tmpvec.z();
65 G4ThreeVector x_axis(x,y,z);
66
67 G4double kCarTolerance = G4GeometryTolerance::GetInstance()
68 ->GetSurfaceTolerance();
69 if( (x<kCarTolerance)&&
70 (y<kCarTolerance)&&
71 (z<kCarTolerance) )
72 solidRotation=0;
73 else
74 {
75 tmpvec = p->GetRefDirection();
76 x = tmpvec.x();
77 y = tmpvec.y();
78 z = tmpvec.z();
79
80 G4ThreeVector y_axis(x,y,z);
81 solidRotation = new G4RotationMatrix();
82 solidRotation->rotateAxes(x_axis, y_axis, x_axis.cross(y_axis));
83 }
84 }
85 else
86 {
87 solidTranslation=0;
88 solidRotation=0;
89 }
90}
91
92
93G4PlacedSolid::~G4PlacedSolid()
94{
95 //delete solid;
96 if(solidRotation)
97 delete solidRotation;
98
99 if(solidTranslation)
100 delete solidTranslation;
101}
Note: See TracBrowser for help on using the repository browser.