Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VViewer::G4Spline Class Reference

#include <G4VViewer.hh>

Public Member Functions

 G4Spline ()
 
 ~G4Spline ()
 
void AddSplinePoint (const G4Vector3D &v)
 
G4Vector3D GetInterpolatedSplinePoint (G4float t)
 
G4int GetNumPoints ()
 
G4Vector3D GetPoint (int)
 
G4Vector3D CatmullRom_Eq (G4float t, const G4Vector3D &p1, const G4Vector3D &p2, const G4Vector3D &p3, const G4Vector3D &p4)
 

Detailed Description

Definition at line 191 of file G4VViewer.hh.

Constructor & Destructor Documentation

◆ G4Spline()

G4VViewer::G4Spline::G4Spline ( )

Definition at line 389 of file G4VViewer.cc.

390: vp(), delta_t(0)
391{
392}

◆ ~G4Spline()

G4VViewer::G4Spline::~G4Spline ( )

Definition at line 395 of file G4VViewer.cc.

396{}

Member Function Documentation

◆ AddSplinePoint()

void G4VViewer::G4Spline::AddSplinePoint ( const G4Vector3D v)

Definition at line 412 of file G4VViewer.cc.

413{
414 vp.push_back(v);
415 delta_t = (G4float)1 / (G4float)vp.size();
416}
float G4float
Definition: G4Types.hh:84

Referenced by G4VViewer::ComputeFlyThrough().

◆ CatmullRom_Eq()

G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq ( G4float  t,
const G4Vector3D p1,
const G4Vector3D p2,
const G4Vector3D p3,
const G4Vector3D p4 
)

Definition at line 399 of file G4VViewer.cc.

400{
401 G4float t2 = t * t;
402 G4float t3 = t2 * t;
403
404 G4float b1 = .5 * ( -t3 + 2*t2 - t);
405 G4float b2 = .5 * ( 3*t3 - 5*t2 + 2);
406 G4float b3 = .5 * (-3*t3 + 4*t2 + t);
407 G4float b4 = .5 * ( t3 - t2 );
408
409 return (p1*b1 + p2*b2 + p3*b3 + p4*b4);
410}

◆ GetInterpolatedSplinePoint()

G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint ( G4float  t)

Definition at line 429 of file G4VViewer.cc.

430{
431 // Find out in which interval we are on the spline
432 G4int p = (G4int)(t / delta_t);
433 // Compute local control point indices
434#define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (G4int)vp.size()-1) pp = (G4int)vp.size() - 1; }
435 G4int p0 = p - 1; BOUNDS(p0);
436 G4int p1 = p; BOUNDS(p1);
437 G4int p2 = p + 1; BOUNDS(p2);
438 G4int p3 = p + 2; BOUNDS(p3);
439 // Relative (local) time
440 G4float lt = (t - delta_t*p) / delta_t;
441 // Interpolate
442 return CatmullRom_Eq(lt, vp[p0], vp[p1], vp[p2], vp[p3]);
443}
int G4int
Definition: G4Types.hh:85
#define BOUNDS(pp)
G4Vector3D CatmullRom_Eq(G4float t, const G4Vector3D &p1, const G4Vector3D &p2, const G4Vector3D &p3, const G4Vector3D &p4)
Definition: G4VViewer.cc:399

Referenced by G4VViewer::ComputeFlyThrough().

◆ GetNumPoints()

G4int G4VViewer::G4Spline::GetNumPoints ( )

Definition at line 424 of file G4VViewer.cc.

425{
426 return (G4int)vp.size();
427}

◆ GetPoint()

G4Vector3D G4VViewer::G4Spline::GetPoint ( int  a)

Definition at line 419 of file G4VViewer.cc.

420{
421 return vp[a];
422}

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