Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4TwistTrapFlatSide.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: G4TwistTrapFlatSide.hh 66356 2012-12-18 09:02:32Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4FlatTrapSurface
35 //
36 // Class description:
37 //
38 // Class describing a flat boundary surface for a trapezoid.
39 
40 // Author:
41 //
42 // 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
43 //
44 // --------------------------------------------------------------------
45 #ifndef __G4TWISTTRAPFLATSIDE__
46 #define __G4TWISTTRAPFLATSIDE__
47 
48 #include "G4VTwistSurface.hh"
49 
51 {
52  public: // with description
53 
55  G4double PhiTwist,
56  G4double pDx1,
57  G4double pDx2,
58  G4double pDy,
59  G4double pDz,
60  G4double pAlpha,
61  G4double pPhi,
62  G4double pTheta,
63  G4int handedness );
64  virtual ~G4TwistTrapFlatSide();
65 
66  virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
67  G4bool isGlobal = false);
68  virtual G4int DistanceToSurface(const G4ThreeVector &gp,
69  const G4ThreeVector &gv,
70  G4ThreeVector gxx[],
71  G4double distance[],
72  G4int areacode[],
73  G4bool isvalid[],
74  EValidate validate = kValidateWithTol);
75 
76  virtual G4int DistanceToSurface(const G4ThreeVector &gp,
77  G4ThreeVector gxx[],
78  G4double distance[],
79  G4int areacode[]);
80 
81 
83  G4bool isGlobal = false);
84  virtual G4double GetBoundaryMin(G4double u);
85  virtual G4double GetBoundaryMax(G4double u);
86  virtual G4double GetSurfaceArea();
87  virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
88  G4int faces[][4], G4int iside );
89 
90  public: // without description
91 
92  G4TwistTrapFlatSide(__void__&);
93  // Fake default constructor for usage restricted to direct object
94  // persistency for clients requiring preallocation of memory for
95  // persistifiable objects.
96 
97  protected: // with description
98 
99  virtual G4int GetAreaCode(const G4ThreeVector &xx,
100  G4bool withTol = true);
101 
102  private:
103 
104  virtual void SetCorners();
105  virtual void SetBoundaries();
106 
107  inline double xAxisMax(G4double u, G4double fTanAlpha) const;
108 
109  private:
110 
111  G4double fDx1;
112  G4double fDx2;
113  G4double fDy;
114  G4double fDz;
115  G4double fPhiTwist;
116  G4double fAlpha;
117  G4double fTAlph;
118  G4double fPhi;
119  G4double fTheta;
120  G4double fdeltaX;
121  G4double fdeltaY;
122 };
123 
124 //========================================================
125 // inline functions
126 //========================================================
127 
128 inline
129 G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const
130 {
131  return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha ) ;
132 }
133 
134 inline G4ThreeVector
136 {
137  G4ThreeVector SurfPoint ( x,y,0);
138 
139  if (isGlobal) { return (fRot*SurfPoint + fTrans); }
140  return SurfPoint;
141 }
142 
143 inline
145 {
146  return -xAxisMax(y, -fTAlph ) ;
147 }
148 
149 inline
151 {
152  return xAxisMax(y, fTAlph ) ;
153 }
154 
155 inline
157 {
158  return 2*(fDx1 + fDx2)*fDy ;
159 }
160 
161 #endif
virtual G4ThreeVector SurfacePoint(G4double x, G4double y, G4bool isGlobal=false)
const XML_Char * name
Definition: expat.h:151
virtual G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol)
int G4int
Definition: G4Types.hh:78
G4RotationMatrix fRot
G4ThreeVector fTrans
virtual G4ThreeVector GetNormal(const G4ThreeVector &, G4bool isGlobal=false)
virtual G4double GetSurfaceArea()
static constexpr double m
Definition: G4SIunits.hh:129
bool G4bool
Definition: G4Types.hh:79
virtual G4int GetAreaCode(const G4ThreeVector &xx, G4bool withTol=true)
G4TwistTrapFlatSide(const G4String &name, G4double PhiTwist, G4double pDx1, G4double pDx2, G4double pDy, G4double pDz, G4double pAlpha, G4double pPhi, G4double pTheta, G4int handedness)
virtual G4double GetBoundaryMin(G4double u)
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)
virtual G4double GetBoundaryMax(G4double u)
double G4double
Definition: G4Types.hh:76