Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VViewer::G4Spline Class Reference

#include <G4VViewer.hh>

Public Member Functions

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

Detailed Description

Definition at line 176 of file G4VViewer.hh.

Constructor & Destructor Documentation

G4VViewer::G4Spline::G4Spline ( )

Definition at line 393 of file G4VViewer.cc.

394 : vp(), delta_t(0)
395 {
396 }
G4VViewer::G4Spline::~G4Spline ( )

Definition at line 399 of file G4VViewer.cc.

400 {}

Member Function Documentation

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

Definition at line 416 of file G4VViewer.cc.

417 {
418  vp.push_back(v);
419  delta_t = (float)1 / (float)vp.size();
420 }

Here is the caller graph for this function:

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

Definition at line 403 of file G4VViewer.cc.

404 {
405  float t2 = t * t;
406  float t3 = t2 * t;
407 
408  float b1 = .5 * ( -t3 + 2*t2 - t);
409  float b2 = .5 * ( 3*t3 - 5*t2 + 2);
410  float b3 = .5 * (-3*t3 + 4*t2 + t);
411  float b4 = .5 * ( t3 - t2 );
412 
413  return (p1*b1 + p2*b2 + p3*b3 + p4*b4);
414 }
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint ( float  t)

Definition at line 433 of file G4VViewer.cc.

434 {
435  // Find out in which interval we are on the spline
436  int p = (int)(t / delta_t);
437  // Compute local control point indices
438 #define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (int)vp.size()-1) pp = vp.size() - 1; }
439  int p0 = p - 1; BOUNDS(p0);
440  int p1 = p; BOUNDS(p1);
441  int p2 = p + 1; BOUNDS(p2);
442  int p3 = p + 2; BOUNDS(p3);
443  // Relative (local) time
444  float lt = (t - delta_t*(float)p) / delta_t;
445  // Interpolate
446  return CatmullRom_Eq(lt, vp[p0], vp[p1], vp[p2], vp[p3]);
447 }
const char * p
Definition: xmltok.h:285
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define BOUNDS(pp)
G4Vector3D CatmullRom_Eq(float t, const G4Vector3D &p1, const G4Vector3D &p2, const G4Vector3D &p3, const G4Vector3D &p4)
Definition: G4VViewer.cc:403

Here is the call graph for this function:

Here is the caller graph for this function:

int G4VViewer::G4Spline::GetNumPoints ( )

Definition at line 428 of file G4VViewer.cc.

429 {
430  return vp.size();
431 }
G4Vector3D G4VViewer::G4Spline::GetPoint ( int  a)

Definition at line 423 of file G4VViewer.cc.

424 {
425  return vp[a];
426 }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33

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