#include <G4BoundingBox3D.hh>
Public Member Functions | |
G4BoundingBox3D () | |
G4BoundingBox3D (const G4Point3D &) | |
G4BoundingBox3D (const G4Point3D &, const G4Point3D &) | |
~G4BoundingBox3D () | |
G4BoundingBox3D (const G4BoundingBox3D &right) | |
G4BoundingBox3D & | operator= (const G4BoundingBox3D &right) |
void | Init (const G4Point3D &) |
void | Init (const G4Point3D &, const G4Point3D &) |
void | Extend (const G4Point3D &) |
G4Point3D | GetBoxMin () const |
G4Point3D | GetBoxMax () const |
G4double | GetDistance () const |
void | SetDistance (G4double distance0) |
G4int | Inside (const G4Point3D &) const |
G4int | GetTestResult () const |
G4int | Test (const G4Ray &) |
Static Public Attributes | |
static const G4BoundingBox3D | space |
Definition at line 46 of file G4BoundingBox3D.hh.
G4BoundingBox3D::G4BoundingBox3D | ( | ) |
Definition at line 46 of file G4BoundingBox3D.cc.
References G4GeometryTolerance::GetInstance(), and G4GeometryTolerance::GetSurfaceTolerance().
00047 { 00048 distance = 0; 00049 test_result = 0; 00050 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 00051 }
G4BoundingBox3D::G4BoundingBox3D | ( | const G4Point3D & | ) |
Definition at line 53 of file G4BoundingBox3D.cc.
References Init().
00054 { 00055 Init(p1, p2); 00056 }
G4BoundingBox3D::~G4BoundingBox3D | ( | ) |
G4BoundingBox3D::G4BoundingBox3D | ( | const G4BoundingBox3D & | right | ) |
Definition at line 67 of file G4BoundingBox3D.cc.
00068 : box_min(right.box_min), box_max(right.box_max), 00069 distance(right.distance), test_result(right.test_result), 00070 MiddlePoint(right.MiddlePoint), GeantBox(right.GeantBox), 00071 kCarTolerance(right.kCarTolerance) 00072 { 00073 }
void G4BoundingBox3D::Extend | ( | const G4Point3D & | ) |
Definition at line 125 of file G4BoundingBox3D.cc.
Referenced by G4FCylindricalSurface::CalcBBox(), G4FConicalSurface::CalcBBox(), G4SurfaceBoundary::Init(), G4Parabola::InitBounded(), G4Hyperbola::InitBounded(), G4Ellipse::InitBounded(), G4CompositeCurve::InitBounded(), G4CircularCurve::InitBounded(), and G4BSplineCurve::InitBounded().
00126 { 00127 00128 // L. Broglia 00129 // Maybe temporary 00130 // Create a BBox bigger than the reality 00131 00132 if (p.x() < box_min.x()) 00133 box_min.setX( p.x() - kCarTolerance ); 00134 else if (p.x() > box_max.x()) 00135 box_max.setX( p.x() + kCarTolerance ); 00136 00137 if (p.y() < box_min.y()) 00138 box_min.setY( p.y() - kCarTolerance ); 00139 else if (p.y() > box_max.y()) 00140 box_max.setY( p.y() + kCarTolerance ); 00141 00142 if (p.z() < box_min.z()) 00143 box_min.setZ( p.z() - kCarTolerance ); 00144 else if (p.z() > box_max.z()) 00145 box_max.setZ( p.z() + kCarTolerance ); 00146 00147 // L. Broglia 00148 // Now re-calculate GeantBox and MiddlePoint 00149 GeantBox = (box_max - box_min)*0.5; 00150 MiddlePoint = (box_min + box_max)*0.5; 00151 00152 }
G4Point3D G4BoundingBox3D::GetBoxMax | ( | ) | const [inline] |
Definition at line 43 of file G4BoundingBox3D.icc.
Referenced by G4Surface::CalcBBox(), G4FPlane::CalcBBox(), G4ConicalSurface::CalcBBox(), G4BREPSolid::CalcBBoxes(), G4BREPSolid::CalculateExtent(), G4BREPSolid::CreateNURBS(), G4BREPSolid::CreatePolyhedron(), G4BREPSolid::CreateRotatedVertices(), G4SurfaceBoundary::Init(), G4CompositeCurve::InitBounded(), G4BREPSolidBox::Inside(), G4ToroidalSurface::Intersect(), and G4BREPSolid::Scope().
G4Point3D G4BoundingBox3D::GetBoxMin | ( | ) | const [inline] |
Definition at line 37 of file G4BoundingBox3D.icc.
Referenced by G4Surface::CalcBBox(), G4FPlane::CalcBBox(), G4ConicalSurface::CalcBBox(), G4BREPSolid::CalcBBoxes(), G4BREPSolid::CalculateExtent(), G4BREPSolid::CreateNURBS(), G4BREPSolid::CreatePolyhedron(), G4BREPSolid::CreateRotatedVertices(), G4SurfaceBoundary::Init(), G4CompositeCurve::InitBounded(), G4BREPSolidBox::Inside(), G4ToroidalSurface::Intersect(), and G4BREPSolid::Scope().
G4double G4BoundingBox3D::GetDistance | ( | ) | const [inline] |
G4int G4BoundingBox3D::GetTestResult | ( | ) | const [inline] |
Definition at line 89 of file G4BoundingBox3D.cc.
References G4GeometryTolerance::GetInstance(), and G4GeometryTolerance::GetSurfaceTolerance().
00090 { 00091 // L. Broglia 00092 // Maybe temporary 00093 // Create a BBox bigger than the reality 00094 00095 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 00096 00097 box_min.setX( std::min(p1.x(), p2.x()) - kCarTolerance ); 00098 box_min.setY( std::min(p1.y(), p2.y()) - kCarTolerance ); 00099 box_min.setZ( std::min(p1.z(), p2.z()) - kCarTolerance ); 00100 box_max.setX( std::max(p1.x(), p2.x()) + kCarTolerance ); 00101 box_max.setY( std::max(p1.y(), p2.y()) + kCarTolerance ); 00102 box_max.setZ( std::max(p1.z(), p2.z()) + kCarTolerance ); 00103 00104 // Calc half spaces 00105 GeantBox = (box_max - box_min)*0.5; 00106 MiddlePoint = (box_min + box_max)*0.5; 00107 00108 test_result = 0; 00109 distance = 0; 00110 }
void G4BoundingBox3D::Init | ( | const G4Point3D & | ) |
Definition at line 113 of file G4BoundingBox3D.cc.
References G4GeometryTolerance::GetInstance(), and G4GeometryTolerance::GetSurfaceTolerance().
Referenced by G4FCylindricalSurface::CalcBBox(), G4FConicalSurface::CalcBBox(), G4BoundingBox3D(), G4SurfaceBoundary::Init(), G4Parabola::InitBounded(), G4Line::InitBounded(), G4Hyperbola::InitBounded(), G4Ellipse::InitBounded(), G4CompositeCurve::InitBounded(), G4CircularCurve::InitBounded(), and G4BSplineCurve::InitBounded().
00114 { 00115 box_min= box_max= MiddlePoint= p; 00116 GeantBox= G4Point3D(0, 0, 0); 00117 test_result = 0; 00118 distance= 0; 00119 kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 00120 }
Definition at line 383 of file G4BoundingBox3D.cc.
00384 { 00385 if( ( Pt.x() >= box_min.x() && Pt.x() <= box_max.x() ) && 00386 ( Pt.y() >= box_min.y() && Pt.y() <= box_max.y() ) && 00387 ( Pt.z() >= box_min.z() && Pt.z() <= box_max.z() ) ) 00388 return 1; 00389 else 00390 return 0; 00391 }
G4BoundingBox3D & G4BoundingBox3D::operator= | ( | const G4BoundingBox3D & | right | ) |
Definition at line 75 of file G4BoundingBox3D.cc.
References box_max, box_min, distance, GeantBox, kCarTolerance, MiddlePoint, and test_result.
00076 { 00077 if (&right == this) return *this; 00078 box_min = right.box_min; 00079 box_max = right.box_max; 00080 distance = right.distance; 00081 test_result = right.test_result; 00082 MiddlePoint = right.MiddlePoint; 00083 GeantBox = right.GeantBox; 00084 kCarTolerance = right.kCarTolerance; 00085 00086 return *this; 00087 }
void G4BoundingBox3D::SetDistance | ( | G4double | distance0 | ) | [inline] |
Definition at line 157 of file G4BoundingBox3D.cc.
References G4Ray::GetDir(), and G4Ray::GetStart().
Referenced by G4BREPSolid::TestSurfaceBBoxes().
00158 { 00159 const G4Point3D& tmp_ray_start = rayref.GetStart(); 00160 const G4Vector3D& tmp_ray_dir = rayref.GetDir(); 00161 00162 G4Point3D ray_start = tmp_ray_start ; 00163 G4Vector3D ray_dir = tmp_ray_dir ; 00164 00165 G4double rayx,rayy,rayz; 00166 rayx = ray_start.x(); 00167 rayy = ray_start.y(); 00168 rayz = ray_start.z(); 00169 00170 // Test if ray starting point is in the bbox or not 00171 if((rayx < box_min.x()) || (rayx > box_max.x()) || 00172 (rayy < box_min.y()) || (rayy > box_max.y()) || 00173 (rayz < box_min.z()) || (rayz > box_max.z()) ) 00174 { 00175 // Outside, check for intersection with bbox 00176 00177 // Adapt ray_starting point to box 00178 00179 const G4Point3D ray_start2 = G4Point3D( ray_start - MiddlePoint ); 00180 distance = DistanceToIn(ray_start2, ray_dir); 00181 00182 if(!distance) 00183 test_result = 0; // Miss 00184 else 00185 test_result = 1; // Starting point outside box & hits box 00186 } 00187 else 00188 { 00189 // Inside 00190 // G4cout << "\nRay starting point Inside bbox."; 00191 test_result = 1; 00192 distance = 0; 00193 } 00194 00195 return test_result; 00196 }
const G4BoundingBox3D G4BoundingBox3D::space [static] |
Definition at line 81 of file G4BoundingBox3D.hh.