00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
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
00091
00092 virtual G4GeometryType GetEntityType() const
00093 { return G4String("GLG4Ellipsoid"); }
00094
00095
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