Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4PolyconeSide.hh
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// --------------------------------------------------------------------
31// GEANT 4 class header file
32//
33//
34// G4PolyconeSide
35//
36// Class description:
37//
38// Class implmenting a face that represents one conical side
39// of a polycone:
40//
41// G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
42// const G4PolyconeSideRZ *tail,
43// const G4PolyconeSideRZ *head,
44// const G4PolyconeSideRZ *nextRZ,
45// G4double phiStart, G4double deltaPhi,
46// G4bool phiIsOpen, G4bool isAllBehind=false )
47//
48// Values for r1,z1 and r2,z2 should be specified in clockwise
49// order in (r,z).
50
51// Author:
52// David C. Williams (davidw@scipp.ucsc.edu)
53// --------------------------------------------------------------------
54
55#ifndef G4PolyconeSide_hh
56#define G4PolyconeSide_hh
57
58#include "G4VCSGface.hh"
59
61
63{
64 G4double r, z; // start of vector
65};
66
68{
69 public:
70
71 G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
72 const G4PolyconeSideRZ *tail,
73 const G4PolyconeSideRZ *head,
74 const G4PolyconeSideRZ *nextRZ,
75 G4double phiStart, G4double deltaPhi,
76 G4bool phiIsOpen, G4bool isAllBehind=false );
77 virtual ~G4PolyconeSide();
78
79 G4PolyconeSide( const G4PolyconeSide &source );
80 G4PolyconeSide& operator=( const G4PolyconeSide &source );
81
82 G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
83 G4bool outgoing, G4double surfTolerance,
84 G4double &distance, G4double &distFromSurface,
85 G4ThreeVector &normal, G4bool &isAllBehind );
86
87 G4double Distance( const G4ThreeVector &p, G4bool outgoing );
88
89 EInside Inside( const G4ThreeVector &p, G4double tolerance,
90 G4double *bestDistance );
91
92 G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
93
94 G4double Extent( const G4ThreeVector axis );
95
96 void CalculateExtent( const EAxis axis,
97 const G4VoxelLimits &voxelLimit,
98 const G4AffineTransform &tranform,
99 G4SolidExtentList &extentList );
100
101 G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
102
105
106 public: // without description
107
108 G4PolyconeSide(__void__&);
109 // Fake default constructor for usage restricted to direct object
110 // persistency for clients requiring preallocation of memory for
111 // persistifiable objects.
112
113 protected:
114
115 G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
116 G4double &distOutside2, G4double *rzNorm=0 );
117
118 G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
119 const G4ThreeVector &p,
120 const G4ThreeVector &v, G4ThreeVector &normal );
121
122 void CopyStuff( const G4PolyconeSide &source );
123
124 static void FindLineIntersect( G4double x1, G4double y1,
125 G4double tx1, G4double ty1,
126 G4double x2, G4double y2,
127 G4double tx2, G4double ty2,
128 G4double &x, G4double &y );
129
130 G4double GetPhi( const G4ThreeVector& p );
131
132 protected:
133
134 G4double r[2], z[2]; // r, z parameters, in specified order
135 G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
136 deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
137 G4bool phiIsOpen; // True if there is a phi slice
138 G4bool allBehind; // True if the entire solid is "behind" this face
139
140 G4IntersectingCone *cone; // Our intersecting utility class
141
142 G4double rNorm, zNorm; // Normal to surface in r,z space
143 G4double rS, zS; // Unit vector along surface in r,z space
144 G4double length; // Length of face in r,z space
146 prevZS; // Unit vector along previous polyconeSide
148 nextZS; // Unit vector along next polyconeSide
149
151 zNormEdge[2]; // Normal to edges
152
154 G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
155
156 private:
157
158 std::pair<G4ThreeVector, G4double> fPhi; // Cached value for phi
159 G4double kCarTolerance; // Geometrical surface thickness
160 G4double fSurfaceArea; // Used for surface calculation
161};
162
163#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4double Extent(const G4ThreeVector axis)
G4double zNormEdge[2]
G4ThreeVector GetPointOnFace()
G4ThreeVector Normal(const G4ThreeVector &p, G4double *bestDistance)
G4ThreeVector * corners
G4double GetPhi(const G4ThreeVector &p)
G4double SurfaceArea()
static void FindLineIntersect(G4double x1, G4double y1, G4double tx1, G4double ty1, G4double x2, G4double y2, G4double tx2, G4double ty2, G4double &x, G4double &y)
virtual ~G4PolyconeSide()
void CopyStuff(const G4PolyconeSide &source)
void CalculateExtent(const EAxis axis, const G4VoxelLimits &voxelLimit, const G4AffineTransform &tranform, G4SolidExtentList &extentList)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &isAllBehind)
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
G4IntersectingCone * cone
G4double DistanceAway(const G4ThreeVector &p, G4bool opposite, G4double &distOutside2, G4double *rzNorm=0)
G4bool PointOnCone(const G4ThreeVector &hit, G4double normSign, const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector &normal)
G4VCSGface * Clone()
G4double rNormEdge[2]
G4PolyconeSide & operator=(const G4PolyconeSide &source)
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
EAxis
Definition: geomdefs.hh:54
EInside
Definition: geomdefs.hh:58