Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Hyperbola Class Reference

#include <G4Hyperbola.hh>

+ Inheritance diagram for G4Hyperbola:

Public Member Functions

 G4Hyperbola ()
 
virtual ~G4Hyperbola ()
 
 G4Hyperbola (const G4Hyperbola &right)
 
G4Hyperbolaoperator= (const G4Hyperbola &right)
 
G4CurveProject (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 GetSemiAxis () const
 
G4double GetSemiImagAxis () const
 
void Init (const G4Axis2Placement3D &position0, G4double semiAxis0, G4double semiImagAxis0)
 
G4int IntersectRay2D (const G4Ray &ray)
 
- Public Member Functions inherited from G4Conic
 G4Conic ()
 
virtual ~G4Conic ()
 
 G4Conic (const G4Conic &right)
 
G4Conicoperator= (const G4Conic &right)
 
const G4Axis2Placement3DGetPosition () const
 
G4double GetPShift () const
 
void SetPShift (G4double pShift0)
 
- Public Member Functions inherited from G4Curve
 G4Curve ()
 
virtual ~G4Curve ()
 
 G4Curve (const G4Curve &c)
 
G4Curveoperator= (const G4Curve &c)
 
G4bool operator== (const G4Curve &right) const
 
virtual G4String GetEntityType () const
 
virtual G4CurveProject (const G4Transform3D &tr=G4Transform3D::Identity)=0
 
virtual G4bool Tangent (G4CurvePoint &cp, G4Vector3D &v)=0
 
virtual G4int IntersectRay2D (const G4Ray &ray)=0
 
const G4Point3DGetStart () const
 
const G4Point3DGetEnd () const
 
G4double GetPStart () const
 
G4double GetPEnd () const
 
void SetBounds (G4double p1, G4double p2)
 
void SetBounds (G4double p1, const G4Point3D &p2)
 
void SetBounds (const G4Point3D &p1, G4double p2)
 
void SetBounds (const G4Point3D &p1, const G4Point3D &p2)
 
G4bool IsBounded () const
 
G4bool IsPOn (G4double param) const
 
void SetSameSense (G4int sameSense0)
 
G4int GetSameSense () const
 
virtual G4double GetPMax () const =0
 
virtual G4Point3D GetPoint (G4double param) const =0
 
virtual G4double GetPPoint (const G4Point3D &p) const =0
 
const G4BoundingBox3DBBox () const
 
virtual const char * Name () const
 
virtual void SetParentSrfPtr (const G4Surface *)
 

Protected Member Functions

void InitBounded ()
 
virtual void InitBounded ()=0
 

Additional Inherited Members

- Protected Attributes inherited from G4Conic
G4Axis2Placement3D position
 
G4double pShift
 
- Protected Attributes inherited from G4Curve
G4BoundingBox3D bBox
 
G4Point3D start
 
G4Point3D end
 
G4double pStart
 
G4double pEnd
 
G4double pRange
 
G4bool bounded
 
G4int sameSense
 
G4double kCarTolerance
 

Detailed Description

Definition at line 44 of file G4Hyperbola.hh.

Constructor & Destructor Documentation

◆ G4Hyperbola() [1/2]

G4Hyperbola::G4Hyperbola ( )

Definition at line 41 of file G4Hyperbola.cc.

42 : semiAxis(0.), semiImagAxis(0.), ratioAxisImagAxis(0.), forTangent(0.)
43{
44}

Referenced by Project().

◆ ~G4Hyperbola()

G4Hyperbola::~G4Hyperbola ( )
virtual

Definition at line 46 of file G4Hyperbola.cc.

47{
48}

◆ G4Hyperbola() [2/2]

G4Hyperbola::G4Hyperbola ( const G4Hyperbola right)

Definition at line 50 of file G4Hyperbola.cc.

51 : G4Conic(), Focus1(right.Focus1), Focus2(right.Focus2),
52 ProjFocus1(right.ProjFocus1), ProjFocus2(right.ProjFocus2),
53 semiAxis(right.semiAxis), semiImagAxis(right.semiImagAxis),
54 ratioAxisImagAxis(right.ratioAxisImagAxis),
55 toUnitHyperbola(right.toUnitHyperbola), forTangent(right.forTangent)
56{
57 pShift = right.pShift;
58 position = right.position;
59 bBox = right.bBox;
60 start = right.start;
61 end = right.end;
62 pStart = right.pStart;
63 pEnd = right.pEnd;
64 pRange = right.pRange;
65 bounded = right.bounded;
66 sameSense = right.sameSense;
67}
G4Axis2Placement3D position
Definition: G4Conic.hh:74
G4double pShift
Definition: G4Conic.hh:77
G4Conic()
Definition: G4Conic.cc:38
G4bool bounded
Definition: G4Curve.hh:166
G4double pStart
Definition: G4Curve.hh:163
G4int sameSense
Definition: G4Curve.hh:167
G4Point3D end
Definition: G4Curve.hh:162
G4BoundingBox3D bBox
Definition: G4Curve.hh:160
G4double pRange
Definition: G4Curve.hh:165
G4Point3D start
Definition: G4Curve.hh:161
G4double pEnd
Definition: G4Curve.hh:164

Member Function Documentation

◆ GetPMax()

G4double G4Hyperbola::GetPMax ( ) const
inlinevirtual

Implements G4Curve.

◆ GetPoint()

G4Point3D G4Hyperbola::GetPoint ( G4double  param) const
inlinevirtual

Implements G4Curve.

Referenced by InitBounded().

◆ GetPPoint()

G4double G4Hyperbola::GetPPoint ( const G4Point3D p) const
inlinevirtual

Implements G4Curve.

◆ GetSemiAxis()

G4double G4Hyperbola::GetSemiAxis ( ) const
inline

◆ GetSemiImagAxis()

G4double G4Hyperbola::GetSemiImagAxis ( ) const
inline

◆ Init()

void G4Hyperbola::Init ( const G4Axis2Placement3D position0,
G4double  semiAxis0,
G4double  semiImagAxis0 
)
inline

Referenced by Project().

◆ InitBounded()

void G4Hyperbola::InitBounded ( )
protectedvirtual

Implements G4Curve.

Definition at line 157 of file G4Hyperbola.cc.

158{
159 // the bbox must include the start and endpoints as well as the
160 // extreme points if they lie on the curve
161 bBox.Init(GetStart(), GetEnd());
162
163 // the parameter values
164 // belonging to the points with an extreme x, y and z coordinate
165 for (G4int i=0; i<3; i++)
166 {
167 G4double x_i= position.GetPX()(i);
168
169 if (std::abs(x_i) <=
171 {
172 G4double tanhu= - (semiImagAxis*position.GetPY()(i)) / (semiAxis*x_i);
173
174 if (std::abs(tanhu)<=1)
175 {
176 G4double u= 0.5*std::log((1+tanhu)/(1-tanhu)); // atanh(tanhu)
177 if (IsPOn(u))
178 bBox.Extend(GetPoint(u));
179 }
180 }
181 }
182}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
void Init(const G4Point3D &)
void Extend(const G4Point3D &)
G4bool IsPOn(G4double param) const
const G4Point3D & GetStart() const
const G4Point3D & GetEnd() const
static G4GeometryTolerance * GetInstance()
G4double GetAngularTolerance() const
G4Point3D GetPoint(G4double param) const

◆ IntersectRay2D()

G4int G4Hyperbola::IntersectRay2D ( const G4Ray ray)
inlinevirtual

Implements G4Curve.

◆ operator=()

G4Hyperbola & G4Hyperbola::operator= ( const G4Hyperbola right)

Definition at line 69 of file G4Hyperbola.cc.

70{
71 if (&right == this) return *this;
72
73 Focus1 = right.Focus1;
74 Focus2 = right.Focus2;
75 ProjFocus1 = right.ProjFocus1;
76 ProjFocus2 = right.ProjFocus2;
77 semiAxis = right.semiAxis;
78 semiImagAxis = right.semiImagAxis;
79 ratioAxisImagAxis = right.ratioAxisImagAxis;
80 toUnitHyperbola = right.toUnitHyperbola;
81 forTangent = right.forTangent;
82 pShift = right.pShift;
83 position = right.position;
84 bBox = right.bBox;
85 start = right.start;
86 end = right.end;
87 pStart = right.pStart;
88 pEnd = right.pEnd;
89 pRange = right.pRange;
90 bounded = right.bounded;
91 sameSense = right.sameSense;
92
93 return *this;
94}

◆ Project()

G4Curve * G4Hyperbola::Project ( const G4Transform3D tr = G4Transform3D::Identity)
virtual

!!!!!!!!!!!

!!!!!!!!!!!

Implements G4Curve.

Definition at line 96 of file G4Hyperbola.cc.

97{
98 G4Exception("G4Hyperbola::Project()", "GeomSolids0001",
99 FatalException, "Sorry, not yet implemented.");
100
101 G4Point3D newLocation= tr*position.GetLocation();
102 newLocation.setZ(0);
103 G4double axisZ= (tr*position.GetPZ()).unit().z();
104
106 {
107 return 0;
108 }
109
110 G4Vector3D newAxis(0, 0, axisZ>0? +1: -1);
111
112 // get the parameter of an endpoint of an axis
113 // (this is a point the distance of which from the center is extreme)
114 G4Vector3D xPrime = tr*position.GetPX();
115 xPrime.setZ(0);
116
117 G4Vector3D yPrime = tr*position.GetPY();
118 yPrime.setZ(0);
119
120 G4Vector3D a = G4Vector3D( semiAxis*xPrime );
121 G4Vector3D b = G4Vector3D( semiImagAxis*yPrime );
122
123 G4double xval = -2*a*b/(a.mag2()+b.mag2());
124
125 G4double u= (0.5*std::log((1+xval)/(1-xval)))/2; // atanh(xval)/2
126
127 // get the coordinate axis directions and the semiaxis lengths
128 G4Vector3D sAxis= G4Vector3D( a*std::cosh(u)+b*std::sinh(u) );
129
130 //!!!!!!!!!!!!
131 G4Vector3D sImagAxis= G4Vector3D( a*std::cosh(u+pi/2)+b*std::sinh(u+pi/2) );
132
133 //!!!!!!!!!!!!
134 G4double newSemiAxis = sAxis.mag();
135 G4double newSemiImagAxis = sImagAxis.mag();
136 G4Vector3D newRefDirection = sAxis;
137
138 // create the new hyperbola
139 G4Axis2Placement3D newPosition;
140 newPosition.Init(newRefDirection, newAxis, newLocation);
141
142 G4Hyperbola* r= new G4Hyperbola;
143 r->Init(newPosition, newSemiAxis, newSemiImagAxis);
144
145 // introduce the shift in the parametrization
146 // maybe the Sign must be changed?
147 r->SetPShift(u);
148
149 // set the bounds when necessary
150 if (IsBounded())
151 r->SetBounds(GetPStart(), GetPEnd());
152
153 return r;
154}
@ FatalException
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35
void Init(const G4Vector3D &refDirection0, const G4Vector3D &axis0, const G4Point3D &location0)
void SetPShift(G4double pShift0)
G4bool IsBounded() const
void SetBounds(G4double p1, G4double p2)
G4double GetPEnd() const
G4double GetPStart() const
void Init(const G4Axis2Placement3D &position0, G4double semiAxis0, G4double semiImagAxis0)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ Tangent()

G4bool G4Hyperbola::Tangent ( G4CurvePoint cp,
G4Vector3D v 
)
virtual

Implements G4Curve.

Definition at line 184 of file G4Hyperbola.cc.

185{
186 // The tangent is computed from the 3D point representation
187 // for all conics. An alternaive implementation (based on
188 // the parametric point) might be worthwhile adding
189 // for efficiency.
190
191 const G4Axis2Placement3D& pos= *(GetPosition());
193
194 v= forTangent*p.y()*pos.GetPX() + p.x()*pos.GetPY();
195
196 return true;
197}
G4Vector3D GetPY() const
G4Vector3D GetPX() const
const G4Transform3D & GetToPlacementCoordinates() const
const G4Axis2Placement3D * GetPosition() const
const G4Point3D & GetPoint()

The documentation for this class was generated from the following files: