Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

GLG4Ellipsoid.hh

00001 // This file is part of the GenericLAND software library.
00002 // $Id: GLG4Ellipsoid.hh,v 1.1.1.1 2004/12/21 22:29:48 GLG4sim Exp $
00003 //
00004 // This code implementation is derived from intellectual property of
00005 // the RD44 GEANT4 collaboration.
00006 //
00007 // By copying, distributing or modifying the Program (or any work
00008 // based on the Program) you indicate your acceptance of this statement,
00009 // and all its terms.
00010 //
00011 // class GLG4Ellipsoid
00012 //
00013 // A GLG4Ellipsoid is an ellipsoidal solid, optionally cut at a given z.
00014 //
00015 // Member Data:
00016 //
00017 //      fRx     semi-axis, x
00018 //      fRy     semi-axis, y
00019 //      fRz     semi-axis, z
00020 //      fZCut1  lower cut plane level, z (solid lies above this plane)
00021 //      fZCut2  upper cut plane level, z (solid lies below this plane)
00022 //
00023 // First writing:  G. Horton-Smith, 10-Nov-1999
00024 
00025 #ifndef GLG4Ellipsoid_HH
00026 #define GLG4Ellipsoid_HH
00027 
00028 #include "G4CSGSolid.hh"
00029 
00030 class GLG4Ellipsoid : public G4CSGSolid {
00031 public:
00032           GLG4Ellipsoid(const G4String& pName,
00033                    G4double pRx,
00034                    G4double pRy,
00035                    G4double pRz,
00036                    G4double pZCut1,
00037                    G4double pZCut2);
00038                    
00039           virtual ~GLG4Ellipsoid() ;
00040           
00041           // Access functions
00042                    
00043           G4double    GetRadius (int i) const  { return (i==0) ? fRx
00044                                                    : (i==1) ? fRy
00045                                                    : fRz; }
00046           G4double    GetZCut1() const { return fZCut1; }
00047           G4double    GetZCut2() const { return fZCut2; }
00048 
00049           void   SetRadii    (G4double newRx,
00050                               G4double newRy,
00051                               G4double newRz)
00052                    { fRx= newRx; fRy= newRy; fRz= newRz;
00053                      fRmax= fRx > fRy ? fRx : fRy;
00054                      if (fRz > fRmax) fRmax= fRz;
00055                      if (fZCut1 < -fRz) fZCut1= -fRz;
00056                      if (fZCut2 > +fRz) fZCut2= +fRz;
00057                    }
00058           void   SetZCuts (G4double newZ1, G4double newZ2)
00059                    { fZCut1= newZ1; fZCut2= newZ2;
00060                      if (fZCut1 < -fRz) fZCut1= -fRz;
00061                      if (fZCut2 > +fRz) fZCut2= +fRz;
00062                    }
00063 
00064           void ComputeDimensions(G4VPVParameterisation* p,
00065                                  const G4int n,
00066                                  const G4VPhysicalVolume* pRep);
00067 
00068           G4bool CalculateExtent(const EAxis pAxis,
00069                                  const G4VoxelLimits& pVoxelLimit,
00070                                  const G4AffineTransform& pTransform,
00071                                  G4double& pmin, G4double& pmax) const;
00072                                  
00073           EInside Inside(const G4ThreeVector& p) const;
00074 
00075           G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
00076 
00077           G4double DistanceToIn(const G4ThreeVector& p,
00078                                 const G4ThreeVector& v) const;
00079           
00080           G4double DistanceToIn(const G4ThreeVector& p) const;
00081           
00082           G4double DistanceToOut(const G4ThreeVector& p,
00083                                  const G4ThreeVector& v,
00084                                  const G4bool calcNorm=G4bool(false),
00085                                  G4bool *validNorm=0,
00086                                  G4ThreeVector *n=0) const;
00087                                  
00088           G4double DistanceToOut(const G4ThreeVector& p) const;
00089 
00090              // Naming method (pseudo-RTTI : run-time type identification)
00091 
00092           virtual G4GeometryType  GetEntityType() const
00093                     { return G4String("GLG4Ellipsoid"); }
00094 
00095               // Visualisation functions
00096   
00097           void   DescribeYourselfTo(G4VGraphicsScene& scene) const;
00098        
00099           G4VisExtent GetExtent() const;
00100        
00101           G4Polyhedron* CreatePolyhedron() const;
00102        
00103           G4NURBS*      CreateNURBS() const;
00104        
00105 protected:
00106  
00107           G4ThreeVectorList*
00108           CreateRotatedVertices(const G4AffineTransform& pTransform,
00109                                 G4int& noPolygonVertices) const;
00110         
00111 private:
00112 
00113     G4double fRx,
00114              fRy,
00115              fRz,
00116              fRmax,
00117              fZCut1,
00118              fZCut2;
00119 };
00120         
00121 #endif

Generated on Fri Jul 6 13:31:46 2007 for GLG4sim by  doxygen 1.3.9.1