G4BREPSolidSphere Class Reference

#include <G4BREPSolidSphere.hh>

Inheritance diagram for G4BREPSolidSphere:

G4BREPSolid G4VSolid

Public Member Functions

 G4BREPSolidSphere (const G4String &name, const G4Vector3D &origin, const G4Vector3D &xhat, const G4Vector3D &zhat, G4double radius)
 ~G4BREPSolidSphere ()
EInside Inside (register const G4ThreeVector &Pt) const
G4ThreeVector SurfaceNormal (const G4ThreeVector &) const
G4double DistanceToIn (const G4ThreeVector &) const
G4double DistanceToIn (register const G4ThreeVector &Pt, register const G4ThreeVector &V) const
G4double DistanceToOut (register const G4ThreeVector &Pt, register const G4ThreeVector &V, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
G4double DistanceToOut (const G4ThreeVector &) const
G4VSolidClone () const
std::ostream & StreamInfo (std::ostream &os) const
 G4BREPSolidSphere (__void__ &)
void SphReset ()
 G4BREPSolidSphere (const G4BREPSolidSphere &rhs)
G4BREPSolidSphereoperator= (const G4BREPSolidSphere &rhs)

Data Structures

struct  G4BREPSphereParams

Detailed Description

Definition at line 50 of file G4BREPSolidSphere.hh.


Constructor & Destructor Documentation

G4BREPSolidSphere::G4BREPSolidSphere ( const G4String name,
const G4Vector3D origin,
const G4Vector3D xhat,
const G4Vector3D zhat,
G4double  radius 
)

Definition at line 40 of file G4BREPSolidSphere.cc.

References G4BREPSolid::active.

Referenced by Clone().

00045   : G4BREPSolid(name)
00046 {  
00047   constructorParams.origin = origin;
00048   constructorParams.xhat   = xhat;
00049   constructorParams.zhat   = zhat;
00050   constructorParams.radius = radius;
00051   
00052   active=1;
00053   InitializeSphere();
00054 }

G4BREPSolidSphere::~G4BREPSolidSphere (  ) 

Definition at line 61 of file G4BREPSolidSphere.cc.

00062 {
00063 }

G4BREPSolidSphere::G4BREPSolidSphere ( __void__ &   ) 

Definition at line 56 of file G4BREPSolidSphere.cc.

00057   : G4BREPSolid(a)
00058 {
00059 }

G4BREPSolidSphere::G4BREPSolidSphere ( const G4BREPSolidSphere rhs  ) 

Definition at line 65 of file G4BREPSolidSphere.cc.

References constructorParams.

00066   : G4BREPSolid(rhs)
00067 {
00068   constructorParams.origin = rhs.constructorParams.origin;
00069   constructorParams.xhat   = rhs.constructorParams.xhat;
00070   constructorParams.zhat   = rhs.constructorParams.zhat;
00071   constructorParams.radius = rhs.constructorParams.radius;
00072   
00073   InitializeSphere();
00074 }


Member Function Documentation

G4VSolid * G4BREPSolidSphere::Clone (  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 188 of file G4BREPSolidSphere.cc.

References G4BREPSolidSphere().

00189 {
00190   return new G4BREPSolidSphere(*this);
00191 }

G4double G4BREPSolidSphere::DistanceToIn ( register const G4ThreeVector Pt,
register const G4ThreeVector V 
) const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 138 of file G4BREPSolidSphere.cc.

References G4Surface::GetDistance(), G4Surface::Intersect(), G4BREPSolid::ShortestDistance, and G4BREPSolid::SurfaceVec.

00140 {
00141   // SphReset();  
00142   G4Vector3D Pttmp(Pt);
00143   G4Vector3D Vtmp(V);   
00144   G4Ray      r(Pttmp, Vtmp);
00145   G4int      Result = SurfaceVec[0]->Intersect( r );
00146 
00147   if(Result>0)
00148   {
00149     ShortestDistance = SurfaceVec[0]->GetDistance();
00150     return std::sqrt(ShortestDistance);
00151   }
00152   return kInfinity; 
00153 }

G4double G4BREPSolidSphere::DistanceToIn ( const G4ThreeVector  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 132 of file G4BREPSolidSphere.cc.

References G4BREPSolid::SurfaceVec.

00133 {
00134   return  std::fabs(SurfaceVec[0]->HowNear(Pt));
00135 }

G4double G4BREPSolidSphere::DistanceToOut ( const G4ThreeVector  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 183 of file G4BREPSolidSphere.cc.

References G4BREPSolid::SurfaceVec.

00184 {
00185   return  std::fabs(SurfaceVec[0]->HowNear(Pt));
00186 }

G4double G4BREPSolidSphere::DistanceToOut ( register const G4ThreeVector Pt,
register const G4ThreeVector V,
const G4bool  calcNorm = false,
G4bool validNorm = 0,
G4ThreeVector n = 0 
) const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 156 of file G4BREPSolidSphere.cc.

References G4Surface::GetDistance(), G4BREPSolid::Intersect(), G4BREPSolid::ShortestDistance, SurfaceNormal(), and G4BREPSolid::SurfaceVec.

00161 {
00162   if(validNorm) *validNorm = false;
00163   // SphReset();  
00164   G4Vector3D Pttmp(Pt);
00165   G4Vector3D Vtmp(V);   
00166   G4Ray      r(Pttmp, Vtmp);
00167 
00168   if(SurfaceVec[0]->Intersect( r ))
00169   {
00170     if(calcNorm)
00171     {
00172       if(validNorm) *validNorm = true;
00173       *n = SurfaceNormal(Pt);
00174     }
00175 
00176     ShortestDistance = SurfaceVec[0]->GetDistance();
00177     return std::sqrt(ShortestDistance);
00178   }
00179   return kInfinity; 
00180 }

EInside G4BREPSolidSphere::Inside ( register const G4ThreeVector Pt  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 115 of file G4BREPSolidSphere.cc.

References G4Surface::HowNear(), G4VSolid::kCarTolerance, kInside, kOutside, kSurface, and G4BREPSolid::SurfaceVec.

00116 {
00117   G4double Dist = SurfaceVec[0]->HowNear(Pt);
00118   if(Dist > 0+kCarTolerance) return kInside;
00119   if(Dist < 0-kCarTolerance) return kOutside;
00120   return kSurface;
00121 }

G4BREPSolidSphere & G4BREPSolidSphere::operator= ( const G4BREPSolidSphere rhs  ) 

Definition at line 77 of file G4BREPSolidSphere.cc.

References constructorParams, and G4BREPSolid::operator=().

00078 {
00079   // Check assignment to self
00080   //
00081   if (this == &rhs)  { return *this; }
00082 
00083   // Copy base class data
00084   //
00085   G4BREPSolid::operator=(rhs);
00086 
00087   // Copy data
00088   //
00089   constructorParams.origin = rhs.constructorParams.origin;
00090   constructorParams.xhat   = rhs.constructorParams.xhat;
00091   constructorParams.zhat   = rhs.constructorParams.zhat;
00092   constructorParams.radius = rhs.constructorParams.radius;
00093 
00094   InitializeSphere();
00095 
00096   return *this;
00097 }  

void G4BREPSolidSphere::SphReset (  )  [inline]

Definition at line 114 of file G4BREPSolidSphere.hh.

References G4BREPSolid::active.

00114 { active=1; }

std::ostream & G4BREPSolidSphere::StreamInfo ( std::ostream &  os  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 193 of file G4BREPSolidSphere.cc.

References G4BREPSolid::StreamInfo().

00194 {
00195   // Streams solid contents to output stream.
00196 
00197   G4BREPSolid::StreamInfo( os )
00198   << "\n origin: " << constructorParams.origin
00199   << "\n xhat:   " << constructorParams.xhat
00200   << "\n zhat:   " << constructorParams.zhat
00201   << "\n radius: " << constructorParams.radius
00202   << "\n-----------------------------------------------------------\n";
00203 
00204   return os;
00205 }

G4ThreeVector G4BREPSolidSphere::SurfaceNormal ( const G4ThreeVector  )  const [virtual]

Reimplemented from G4BREPSolid.

Definition at line 124 of file G4BREPSolidSphere.cc.

References CLHEP::detail::n, G4Surface::Normal(), and G4BREPSolid::SurfaceVec.

Referenced by DistanceToOut().

00125 {
00126   G4Vector3D n =  SurfaceVec[0]->Normal(Pt);
00127   G4ThreeVector norm(n.x(), n.y(), n.z());
00128   return norm;
00129 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:34 2013 for Geant4 by  doxygen 1.4.7