IAP GITLAB

Helix.hpp 2.12 KB
Newer Older
Ralf Ulrich's avatar
style  
Ralf Ulrich committed
1
/*
Ralf Ulrich's avatar
Ralf Ulrich committed
2
 * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3 4 5 6 7 8 9 10 11
 *
 * This software is distributed under the terms of the GNU General Public
 * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
 * the license.
 */

#pragma once

#include <corsika/framework/core/PhysicalUnits.hpp>
Ralf Ulrich's avatar
Ralf Ulrich committed
12
#include <corsika/framework/core/PhysicalGeometry.hpp>
13 14 15
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/Vector.hpp>

Ralf Ulrich's avatar
Ralf Ulrich committed
16 17
#include <cmath>

18
namespace corsika {
Ralf Ulrich's avatar
Ralf Ulrich committed
19

20
  /*!
Ralf Ulrich's avatar
Ralf Ulrich committed
21
   * Defines a helical path
Ralf Ulrich's avatar
Ralf Ulrich committed
22
   *
23 24 25 26 27 28 29 30 31 32 33 34 35 36
   * A Helix is defined by the cyclotron frequency \f$ \omega_c \f$, the initial
   * Point r0 and
   * the velocity vectors \f$ \vec{v}_{\parallel} \f$ and \f$ \vec{v}_{\perp} \f$
   * denoting the projections of the initial velocity \f$ \vec{v}_0 \f$ parallel
   * and perpendicular to the axis \f$ \vec{B} \f$, respectively, i.e.
   * \f{align*}{
        \vec{v}_{\parallel} &= \frac{\vec{v}_0 \cdot \vec{B}}{\vec{B}^2} \vec{B} \\
        \vec{v}_{\perp} &= \vec{v}_0 - \vec{v}_{\parallel}
     \f}
   */

  class Helix {

  public:
Ralf Ulrich's avatar
Ralf Ulrich committed
37 38
    Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVector const& pvPar,
          VelocityVector const& pvPerp)
Ralf Ulrich's avatar
Ralf Ulrich committed
39 40 41 42 43
        : r0_(pR0)
        , omegaC_(pOmegaC)
        , vPar_(pvPar)
        , vPerp_(pvPerp)
        , uPerp_(vPerp_.cross(vPar_.normalized()))
44
        , radius_(pvPar.getNorm() / abs(pOmegaC)) {}
45

46
    LengthType getRadius() const;
47

48
    Point getPosition(TimeType const t) const;
49

Ralf Ulrich's avatar
Ralf Ulrich committed
50
    VelocityVector getVelocity(TimeType const t) const;
51

52
    Point getPositionFromArclength(LengthType const l) const;
53

54
    LengthType getArcLength(TimeType const t1, TimeType const t2) const;
55

56
    TimeType getTimeFromArclength(LengthType const l) const;
57

Ralf Ulrich's avatar
Ralf Ulrich committed
58 59 60 61
  private:
    Point r0_;             ///! origin of helix, but this is in the center of the
                           ///! "cylinder" on which the helix rotates
    FrequencyType omegaC_; ///! speed of angular rotation
Ralf Ulrich's avatar
Ralf Ulrich committed
62 63
    VelocityVector vPar_;  ///! speed along direction of "cylinder"
    VelocityVector vPerp_, uPerp_;
Ralf Ulrich's avatar
Ralf Ulrich committed
64
    LengthType radius_;
65 66 67 68 69
  };

} // namespace corsika

#include <corsika/detail/framework/geometry/Helix.inl>