G4PolyconeSide.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4PolyconeSide.hh 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 // 
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 //
00034 // G4PolyconeSide
00035 //
00036 // Class description:
00037 //
00038 //   Class implmenting a face that represents one conical side
00039 //   of a polycone:
00040 //
00041 //   G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
00042 //                   const G4PolyconeSideRZ *tail,
00043 //                   const G4PolyconeSideRZ *head,
00044 //                   const G4PolyconeSideRZ *nextRZ,
00045 //                         G4double phiStart, G4double deltaPhi, 
00046 //                         G4bool phiIsOpen, G4bool isAllBehind=false )
00047 //
00048 //   Values for r1,z1 and r2,z2 should be specified in clockwise
00049 //   order in (r,z).
00050 
00051 // Author: 
00052 //   David C. Williams (davidw@scipp.ucsc.edu)
00053 // --------------------------------------------------------------------
00054 
00055 #ifndef G4PolyconeSide_hh
00056 #define G4PolyconeSide_hh
00057 
00058 #include "G4VCSGface.hh"
00059 
00060 class G4IntersectingCone;
00061 
00062 struct G4PolyconeSideRZ
00063 {
00064   G4double r, z;  // start of vector
00065 };
00066  
00067 class G4PolyconeSide : public G4VCSGface
00068 {
00069   public:
00070 
00071     G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
00072                     const G4PolyconeSideRZ *tail,
00073                     const G4PolyconeSideRZ *head,
00074                     const G4PolyconeSideRZ *nextRZ,
00075                           G4double phiStart, G4double deltaPhi, 
00076                           G4bool phiIsOpen, G4bool isAllBehind=false );
00077     virtual ~G4PolyconeSide();
00078   
00079     G4PolyconeSide( const G4PolyconeSide &source );
00080     G4PolyconeSide& operator=( const G4PolyconeSide &source );
00081   
00082     G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,  
00083                             G4bool outgoing, G4double surfTolerance,
00084                             G4double &distance, G4double &distFromSurface,
00085                             G4ThreeVector &normal, G4bool &isAllBehind );
00086 
00087     G4double Distance( const G4ThreeVector &p, G4bool outgoing );
00088   
00089     EInside Inside( const G4ThreeVector &p, G4double tolerance, 
00090                           G4double *bestDistance );
00091   
00092     G4ThreeVector Normal( const G4ThreeVector &p,  G4double *bestDistance );
00093 
00094     G4double Extent( const G4ThreeVector axis );
00095 
00096     void CalculateExtent( const EAxis axis, 
00097                           const G4VoxelLimits &voxelLimit,
00098                           const G4AffineTransform &tranform,
00099                                 G4SolidExtentList &extentList       );
00100 
00101     G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
00102 
00103     G4double SurfaceArea();
00104     G4ThreeVector GetPointOnFace();
00105   
00106   public:  // without description
00107 
00108     G4PolyconeSide(__void__&);
00109       // Fake default constructor for usage restricted to direct object
00110       // persistency for clients requiring preallocation of memory for
00111       // persistifiable objects.
00112 
00113   protected:
00114 
00115     G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
00116                                  G4double &distOutside2, G4double *rzNorm=0 );
00117       
00118     G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
00119                         const G4ThreeVector &p,
00120                         const G4ThreeVector &v, G4ThreeVector &normal );
00121 
00122     void CopyStuff( const G4PolyconeSide &source );
00123   
00124     static void FindLineIntersect( G4double x1, G4double y1,
00125                                    G4double tx1, G4double ty1,
00126                                    G4double x2, G4double y2,
00127                                  G4double tx2, G4double ty2,
00128                                  G4double &x, G4double &y );
00129 
00130     G4double GetPhi( const G4ThreeVector& p );
00131 
00132   protected:
00133 
00134     G4double r[2], z[2]; // r, z parameters, in specified order
00135     G4double startPhi,   // Start phi (0 to 2pi), if phiIsOpen
00136              deltaPhi;   // Delta phi (0 to 2pi), if phiIsOpen
00137     G4bool   phiIsOpen;  // True if there is a phi slice
00138     G4bool   allBehind;  // True if the entire solid is "behind" this face
00139   
00140     G4IntersectingCone *cone;  // Our intersecting utility class
00141   
00142     G4double rNorm, zNorm;  // Normal to surface in r,z space
00143     G4double rS, zS;        // Unit vector along surface in r,z space
00144     G4double length;        // Length of face in r,z space
00145     G4double prevRS,
00146              prevZS;        // Unit vector along previous polyconeSide
00147     G4double nextRS,
00148              nextZS;        // Unit vector along next polyconeSide
00149   
00150     G4double rNormEdge[2],
00151              zNormEdge[2];  // Normal to edges
00152 
00153     G4int ncorners;
00154     G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
00155 
00156   private:
00157 
00158     std::pair<G4ThreeVector, G4double> fPhi;  // Cached value for phi
00159     G4double kCarTolerance; // Geometrical surface thickness
00160     G4double fSurfaceArea;  // Used for surface calculation 
00161 };
00162 
00163 #endif

Generated on Mon May 27 17:49:23 2013 for Geant4 by  doxygen 1.4.7