#include <G4EnclosingCylinder.hh>
Public Member Functions | |
G4EnclosingCylinder (const G4ReduciblePolygon *rz, G4bool phiIsOpen, G4double startPhi, G4double totalPhi) | |
~G4EnclosingCylinder () | |
G4bool | MustBeOutside (const G4ThreeVector &p) const |
G4bool | ShouldMiss (const G4ThreeVector &p, const G4ThreeVector &v) const |
G4EnclosingCylinder (__void__ &) | |
Protected Attributes | |
G4double | radius |
G4double | zLo |
G4double | zHi |
G4bool | phiIsOpen |
G4double | startPhi |
G4double | totalPhi |
G4double | rx1 |
G4double | ry1 |
G4double | dx1 |
G4double | dy1 |
G4double | rx2 |
G4double | ry2 |
G4double | dx2 |
G4double | dy2 |
G4bool | concave |
Definition at line 53 of file G4EnclosingCylinder.hh.
G4EnclosingCylinder::G4EnclosingCylinder | ( | const G4ReduciblePolygon * | rz, | |
G4bool | phiIsOpen, | |||
G4double | startPhi, | |||
G4double | totalPhi | |||
) |
Definition at line 48 of file G4EnclosingCylinder.cc.
References G4ReduciblePolygon::Amax(), G4ReduciblePolygon::Bmax(), G4ReduciblePolygon::Bmin(), dx1, dx2, dy1, dy2, G4GeometryTolerance::GetInstance(), G4GeometryTolerance::GetSurfaceTolerance(), phiIsOpen, radius, rx1, rx2, ry1, ry2, startPhi, totalPhi, zHi, and zLo.
00052 : startPhi(theStartPhi), totalPhi(theTotalPhi), 00053 rx1(0.), ry1(0.), dx1(0.), dy1(0.), 00054 rx2(0.), ry2(0.), dx2(0.), dy2(0.), 00055 concave(theTotalPhi > pi) 00056 { 00057 // 00058 // Obtain largest r and smallest and largest z 00059 // 00060 radius = rz->Amax(); 00061 zHi = rz->Bmax(); 00062 zLo = rz->Bmin(); 00063 00064 G4double kCarTolerance = G4GeometryTolerance::GetInstance() 00065 ->GetSurfaceTolerance(); 00066 // 00067 // Save phi info 00068 // 00069 phiIsOpen = thePhiIsOpen; 00070 if ( phiIsOpen ) 00071 { 00072 rx1 = std::cos(startPhi); 00073 ry1 = std::sin(startPhi); 00074 dx1 = +ry1*10*kCarTolerance; 00075 dy1 = -rx1*10*kCarTolerance; 00076 00077 rx2 = std::cos(startPhi+totalPhi); 00078 ry2 = std::sin(startPhi+totalPhi); 00079 dx2 = -ry2*10*kCarTolerance; 00080 dy2 = +rx2*10*kCarTolerance; 00081 } 00082 00083 // 00084 // Add safety 00085 // 00086 radius += 10*kCarTolerance; 00087 zLo -= 10*kCarTolerance; 00088 zHi += 10*kCarTolerance; 00089 }
G4EnclosingCylinder::~G4EnclosingCylinder | ( | ) |
G4EnclosingCylinder::G4EnclosingCylinder | ( | __void__ & | ) |
G4bool G4EnclosingCylinder::MustBeOutside | ( | const G4ThreeVector & | p | ) | const |
Definition at line 117 of file G4EnclosingCylinder.cc.
References concave, dx1, dx2, dy1, dy2, phiIsOpen, radius, rx1, rx2, ry1, ry2, zHi, and zLo.
Referenced by G4Polyhedra::Inside(), G4Polycone::Inside(), and ShouldMiss().
00118 { 00119 if (p.perp() > radius) return true; 00120 if (p.z() < zLo) return true; 00121 if (p.z() > zHi) return true; 00122 00123 if (phiIsOpen) 00124 { 00125 if (concave) 00126 { 00127 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) < 0) return false; 00128 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) > 0) return false; 00129 } 00130 else 00131 { 00132 if ( ((p.x()-dx1)*ry1 - (p.y()-dy1)*rx1) > 0) return true; 00133 if ( ((p.x()-dx2)*ry2 - (p.y()-dy2)*rx2) < 0) return true; 00134 } 00135 } 00136 00137 return false; 00138 }
G4bool G4EnclosingCylinder::ShouldMiss | ( | const G4ThreeVector & | p, | |
const G4ThreeVector & | v | |||
) | const |
Definition at line 148 of file G4EnclosingCylinder.cc.
References MustBeOutside(), and radius.
Referenced by G4Polyhedra::DistanceToIn(), and G4Polycone::DistanceToIn().
00150 { 00151 if (!MustBeOutside(p)) return false; 00152 00153 G4double cross = p.x()*v.y() - p.y()*v.x(); 00154 if (cross > radius) return true; 00155 00156 if (p.perp() > radius) 00157 { 00158 G4double dot = p.x()*v.x() + p.y()*v.y(); 00159 if (dot > 0) return true; 00160 } 00161 00162 return false; 00163 }
G4bool G4EnclosingCylinder::concave [protected] |
G4double G4EnclosingCylinder::dx1 [protected] |
Definition at line 86 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::dx2 [protected] |
Definition at line 88 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::dy1 [protected] |
Definition at line 86 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::dy2 [protected] |
Definition at line 88 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4bool G4EnclosingCylinder::phiIsOpen [protected] |
Definition at line 82 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::radius [protected] |
Definition at line 79 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), MustBeOutside(), and ShouldMiss().
G4double G4EnclosingCylinder::rx1 [protected] |
Definition at line 86 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::rx2 [protected] |
Definition at line 88 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::ry1 [protected] |
Definition at line 86 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::ry2 [protected] |
Definition at line 88 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::startPhi [protected] |
G4double G4EnclosingCylinder::totalPhi [protected] |
G4double G4EnclosingCylinder::zHi [protected] |
Definition at line 80 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().
G4double G4EnclosingCylinder::zLo [protected] |
Definition at line 80 of file G4EnclosingCylinder.hh.
Referenced by G4EnclosingCylinder(), and MustBeOutside().