source: trunk/source/geometry/solids/CSG/include/G4Para.hh@ 1155

Last change on this file since 1155 was 1058, checked in by garnier, 17 years ago

file release beta

File size: 6.6 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: G4Para.hh,v 1.18 2006/10/19 15:33:37 gcosmo Exp $
[1058]28// GEANT4 tag $Name: geant4-09-02-ref-02 $
[831]29//
30//
31// --------------------------------------------------------------------
32// GEANT 4 class header file
33//
34// G4Para
35//
36// Class description:
37//
38// A G4Parallepiped, essentially a box with half lengths dx,dy,dz
39// `skewed' so that there are angles theta & phi of the polar line
40// joining the faces at +-dz in z, and alpha formed by the y axis
41// and the plane joinng the centre of the faces G4Parallel to the
42// z-x plane at -dy and +dy.
43//
44// A G4Para is defined by:
45// dx,dy,dz - Half-length in x,y,z
46// alpha - Angle formed by the y axis and by the plane joining
47// the centre of the faces G4Parallel to the z-x plane
48// at -dy and +dy
49// theta - Polar angle of the line joining the centres of the
50// faces at -dz and +dz in z
51// phi - Azimuthal angle of the line joining the centres of the
52// faces at -dz and +dz in z
53// Member data:
54//
55// Note that the angles parameters are not stored - precomputed trig is
56// stored instead.
57//
58// fDx Half-length in x
59// fDy Half-length in y
60// fDz Half-length in z
61//
62// fTalpha Tan of alpha
63// fTthetaCphi Tan theta * Cos phi
64// fTthetaSphi Tan theta * Sin phi
65
66// History:
67// 21.3.94 P.Kent Old C++ code converted to tolerant geometry
68// 31.10.96 V.Grichine Modifications according G4Box/Tubs before to commit
69// 18.11.99 V.Grichine , kUndefined was added to ESide
70// --------------------------------------------------------------------
71
72#ifndef G4Para_HH
73#define G4Para_HH
74
75#include "G4CSGSolid.hh"
76
77class G4Para : public G4CSGSolid
78{
79 public: // with description
80
81 G4Para(const G4String& pName,
82 G4double pDx, G4double pDy, G4double pDz,
83 G4double pAlpha, G4double pTheta, G4double pPhi);
84
85 G4Para(const G4String& pName,
86 const G4ThreeVector pt[8]);
87
88 virtual ~G4Para();
89
90 // Accessors
91
92 inline G4double GetZHalfLength() const;
93 inline G4ThreeVector GetSymAxis() const;
94 inline G4double GetYHalfLength() const;
95 inline G4double GetXHalfLength() const;
96 inline G4double GetTanAlpha() const;
97
98 // Modifiers
99
100 inline void SetXHalfLength(G4double val);
101 inline void SetYHalfLength(G4double val);
102 inline void SetZHalfLength(G4double val);
103 inline void SetAlpha(G4double alpha);
104 inline void SetTanAlpha(G4double val);
105 inline void SetThetaAndPhi(double pTheta, double pPhi);
106
107 void SetAllParameters(G4double pDx, G4double pDy, G4double pDz,
108 G4double pAlpha, G4double pTheta, G4double pPhi);
109
110 // Other methods of solid
111
112 inline G4double GetCubicVolume();
113 inline G4double GetSurfaceArea();
114
115 void ComputeDimensions(G4VPVParameterisation* p,
116 const G4int n,
117 const G4VPhysicalVolume* pRep);
118
119 G4bool CalculateExtent(const EAxis pAxis,
120 const G4VoxelLimits& pVoxelLimit,
121 const G4AffineTransform& pTransform,
122 G4double& pMin, G4double& pMax) const;
123
124 EInside Inside(const G4ThreeVector& p) const;
125
126 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
127
128 G4double DistanceToIn(const G4ThreeVector& p,
129 const G4ThreeVector& v) const;
130 G4double DistanceToIn(const G4ThreeVector& p) const;
131
132 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
133 const G4bool calcNorm=G4bool(false),
134 G4bool *validNorm=0, G4ThreeVector *n=0) const;
135 G4double DistanceToOut(const G4ThreeVector& p) const;
136
137 G4GeometryType GetEntityType() const;
138
139 G4ThreeVector GetPointOnSurface() const;
140
141 std::ostream& StreamInfo(std::ostream& os) const;
142
143 // Visualisation functions
144
145 void DescribeYourselfTo (G4VGraphicsScene& scene) const;
146 G4Polyhedron* CreatePolyhedron () const;
147 G4NURBS* CreateNURBS () const;
148
149 public: // without description
150
151 G4Para(__void__&);
152 // Fake default constructor for usage restricted to direct object
153 // persistency for clients requiring preallocation of memory for
154 // persistifiable objects.
155
156 protected: // without description
157
158 G4ThreeVectorList*
159 CreateRotatedVertices(const G4AffineTransform& pTransform) const;
160
161 private:
162
163 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
164 // Algorithm for SurfaceNormal() following the original
165 // specification for points not on the surface
166
167 G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
168 G4ThreeVector p2, G4ThreeVector p3,
169 G4double& area) const;
170 // Returns a random point on the surface of one of the faces.
171
172 private:
173
174 G4double fDx,fDy,fDz;
175 G4double fTalpha,fTthetaCphi,fTthetaSphi;
176};
177
178#include "G4Para.icc"
179
180#endif
Note: See TracBrowser for help on using the repository browser.