#include <G4Parabola.hh>
Inheritance diagram for G4Parabola:
Public Member Functions | |
G4Parabola () | |
virtual | ~G4Parabola () |
G4Parabola (const G4Parabola &right) | |
G4Parabola & | operator= (const G4Parabola &right) |
G4Curve * | Project (const G4Transform3D &tr=G4Transform3D::Identity) |
G4bool | Tangent (G4CurvePoint &cp, G4Vector3D &v) |
G4double | GetPMax () const |
G4Point3D | GetPoint (G4double param) const |
G4double | GetPPoint (const G4Point3D &p) const |
G4double | GetFocalDist () const |
void | Init (const G4Axis2Placement3D &position0, G4double focalDist0) |
G4int | IntersectRay2D (const G4Ray &ray) |
Protected Member Functions | |
void | InitBounded () |
Definition at line 44 of file G4Parabola.hh.
G4Parabola::G4Parabola | ( | ) |
G4Parabola::~G4Parabola | ( | ) | [virtual] |
G4Parabola::G4Parabola | ( | const G4Parabola & | right | ) |
Definition at line 43 of file G4Parabola.cc.
References G4Curve::bBox, G4Curve::bounded, G4Curve::end, G4Curve::pEnd, G4Conic::position, G4Curve::pRange, G4Conic::pShift, G4Curve::pStart, G4Curve::sameSense, and G4Curve::start.
00044 : G4Conic(), focalDist(right.focalDist), F(right.F), L0(right.L0) 00045 { 00046 pShift = right.pShift; 00047 position = right.position; 00048 bBox = right.bBox; 00049 start = right.start; 00050 end = right.end; 00051 pStart = right.pStart; 00052 pEnd = right.pEnd; 00053 pRange = right.pRange; 00054 bounded = right.bounded; 00055 sameSense = right.sameSense; 00056 }
G4double G4Parabola::GetFocalDist | ( | ) | const [inline] |
G4double G4Parabola::GetPMax | ( | ) | const [inline, virtual] |
Implements G4Curve.
Definition at line 66 of file G4Parabola.icc.
References G4Axis2Placement3D::GetLocation(), G4Axis2Placement3D::GetPX(), G4Axis2Placement3D::GetPY(), and G4Conic::position.
Referenced by InitBounded().
00067 { 00068 return G4Point3D( position.GetLocation() 00069 + focalDist* (param*param*position.GetPX() 00070 + 2*param*position.GetPY()) ); 00071 }
Implements G4Curve.
Definition at line 74 of file G4Parabola.icc.
References G4Axis2Placement3D::GetToPlacementCoordinates(), and G4Conic::position.
00075 { 00076 G4Point3D ptLocal= position.GetToPlacementCoordinates()*pt; 00077 return ptLocal.y()/(2*focalDist); 00078 }
void G4Parabola::Init | ( | const G4Axis2Placement3D & | position0, | |
G4double | focalDist0 | |||
) | [inline] |
Definition at line 38 of file G4Parabola.icc.
References G4Axis2Placement3D::GetLocation(), G4Axis2Placement3D::GetPX(), and G4Conic::position.
Referenced by Project().
00040 { 00041 position= position0; 00042 focalDist= focalDist0; 00043 00044 // focus 00045 F= position.GetLocation()+focalDist*position.GetPX(); 00046 // line 00047 L0= position.GetLocation()-focalDist*position.GetPX(); 00048 //l= position.GetPY(); 00049 }
void G4Parabola::InitBounded | ( | ) | [protected, virtual] |
Implements G4Curve.
Definition at line 119 of file G4Parabola.cc.
References G4Curve::bBox, G4BoundingBox3D::Extend(), G4Curve::GetEnd(), G4GeometryTolerance::GetInstance(), GetPoint(), G4Axis2Placement3D::GetPX(), G4Axis2Placement3D::GetPY(), G4Curve::GetStart(), G4BoundingBox3D::Init(), G4Curve::IsPOn(), and G4Conic::position.
00120 { 00121 // the bbox must include the start and endpoints as well as the 00122 // extreme points if they lie on the curve 00123 bBox.Init(GetStart(), GetEnd()); 00124 00125 // the parameter values 00126 // belonging to the points with an extreme x, y and z coordinate 00127 for (G4int i=0; i<3; i++) 00128 { 00129 G4double x_i= position.GetPX()(i); 00130 00131 if (std::abs(x_i) <= 00132 G4GeometryTolerance::GetInstance()->GetAngularTolerance()) 00133 { 00134 G4double u= - position.GetPY()(i) / x_i; 00135 if (IsPOn(u)) 00136 bBox.Extend(GetPoint(u)); 00137 } 00138 } 00139 }
Implements G4Curve.
Definition at line 123 of file G4Parabola.icc.
References G4Ray::GetDir(), G4Axis2Placement3D::GetPY(), G4Ray::GetStart(), G4Curve::kCarTolerance, and G4Conic::position.
00124 { 00125 // NOT VERIFIED 00126 00127 const G4Point3D& S= ray.GetStart(); 00128 const G4Vector3D& d= ray.GetDir(); 00129 const G4Vector3D& l= position.GetPY(); 00130 00131 // a == 1 00132 G4Vector3D SMinusF= G4Vector3D( S-F ); 00133 G4double bHalf= SMinusF*d - (d.x()*l.y()-d.y()*l.x()); 00134 G4double c= SMinusF.mag2() + ( (S.x()-L0.x())*l.y() - (S.y()-L0.y())*l.x() ); 00135 00136 G4int nbinter = 0; 00137 00138 G4double discr= bHalf*bHalf-c; 00139 if (discr >= 0) 00140 { 00141 // 2 intersections (maybe 1, but this case is rare) 00142 G4double sqrtdiscr= std::sqrt(discr); 00143 00144 G4double i= -bHalf-sqrtdiscr; 00145 if (i>kCarTolerance) 00146 nbinter++; 00147 00148 i= -bHalf+sqrtdiscr; 00149 if (i>kCarTolerance) 00150 nbinter++; 00151 } 00152 00153 return nbinter++; 00154 }
G4Parabola & G4Parabola::operator= | ( | const G4Parabola & | right | ) |
Definition at line 58 of file G4Parabola.cc.
References G4Curve::bBox, G4Curve::bounded, G4Curve::end, F, focalDist, L0, G4Curve::pEnd, G4Conic::position, G4Curve::pRange, G4Conic::pShift, G4Curve::pStart, G4Curve::sameSense, and G4Curve::start.
00059 { 00060 if (&right == this) return *this; 00061 00062 F = right.F; 00063 L0 = right.L0; 00064 focalDist = right.focalDist; 00065 pShift = right.pShift; 00066 position = right.position; 00067 bBox = right.bBox; 00068 start = right.start; 00069 end = right.end; 00070 pStart = right.pStart; 00071 pEnd = right.pEnd; 00072 pRange = right.pRange; 00073 bounded = right.bounded; 00074 sameSense = right.sameSense; 00075 00076 return *this; 00077 }
G4Curve * G4Parabola::Project | ( | const G4Transform3D & | tr = G4Transform3D::Identity |
) | [virtual] |
Implements G4Curve.
Definition at line 79 of file G4Parabola.cc.
References G4GeometryTolerance::GetInstance(), G4Axis2Placement3D::GetLocation(), G4Curve::GetPEnd(), G4Curve::GetPStart(), G4Axis2Placement3D::GetPX(), G4Axis2Placement3D::GetPY(), G4Axis2Placement3D::GetPZ(), Init(), G4Axis2Placement3D::Init(), G4Curve::IsBounded(), G4Conic::position, G4Curve::SetBounds(), and G4Conic::SetPShift().
00080 { 00081 G4double axisZ= (tr*position.GetPZ()).unit().z(); 00082 00083 if (std::abs(axisZ)<G4GeometryTolerance::GetInstance()->GetAngularTolerance()) 00084 { return 0; } 00085 00086 00087 G4Vector3D newAxis(0, 0, axisZ>0? +1: -1); 00088 00089 G4Vector3D xPrime= tr*position.GetPX(); 00090 xPrime.setZ(0); 00091 G4Vector3D yPrime= tr*position.GetPY(); 00092 yPrime.setZ(0); 00093 G4double u= -(xPrime*yPrime)/xPrime.mag2(); 00094 00095 G4Point3D newLocation= G4Point3D( tr*position.GetLocation()+ 00096 focalDist*(u*u*xPrime+2*u*yPrime) ); 00097 newLocation.setZ(0); 00098 G4Vector3D newRefDirection= xPrime; 00099 G4double newFocalDist= (focalDist*((2*u+1)*xPrime+2*yPrime)).mag()/std::sqrt(5.); 00100 00101 // create the new parabola 00102 G4Axis2Placement3D newPosition; 00103 newPosition.Init(newRefDirection, newAxis, newLocation); 00104 G4Parabola* r= new G4Parabola; 00105 r->Init(newPosition, newFocalDist); 00106 00107 // introduce the shift in the parametrization 00108 // maybe the Sign must be changed? 00109 r->SetPShift(u); 00110 00111 // set the bounds when necessary 00112 if (IsBounded()) 00113 r->SetBounds(GetPStart(), GetPEnd()); 00114 00115 return r; 00116 }
G4bool G4Parabola::Tangent | ( | G4CurvePoint & | cp, | |
G4Vector3D & | v | |||
) | [virtual] |
Implements G4Curve.
Definition at line 142 of file G4Parabola.cc.
References G4CurvePoint::GetPoint(), G4Conic::GetPosition(), G4Axis2Placement3D::GetPX(), G4Axis2Placement3D::GetPY(), and G4Axis2Placement3D::GetToPlacementCoordinates().
00143 { 00144 // The tangent is computed from the 3D point representation 00145 // for all conics. An alternaive implementation (based on 00146 // the parametric point) might be worthwhile adding 00147 // for efficiency. 00148 00149 const G4Axis2Placement3D& pos= *(GetPosition()); 00150 G4Point3D p= pos.GetToPlacementCoordinates() * cp.GetPoint(); 00151 00152 v= p.y()*pos.GetPX() + (2*focalDist)*pos.GetPY(); 00153 return true; 00154 }