From bc53f674a972ce6cb71631359b64da3fbdc3c9ef Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Wed, 22 Aug 2018 17:33:22 +0200 Subject: [PATCH] added LineTrajectory --- Framework/Geometry/Helix.h | 4 ++-- Framework/Geometry/LineTrajectory.h | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Framework/Geometry/LineTrajectory.h diff --git a/Framework/Geometry/Helix.h b/Framework/Geometry/Helix.h index d64df5446..3453971c1 100644 --- a/Framework/Geometry/Helix.h +++ b/Framework/Geometry/Helix.h @@ -19,8 +19,8 @@ class Helix // TODO: inherit from to-be-implemented "Trajectory" Length const radius; public: - Helix(Point const pR0, phys::units::quantity<phys::units::frequency_d> pOmegaC, - SpeedVec const pvPar, SpeedVec const pvPerp) : + Helix(Point const& pR0, phys::units::quantity<phys::units::frequency_d> pOmegaC, + SpeedVec const& pvPar, SpeedVec const& pvPerp) : r0(pR0), omegaC(pOmegaC), vPar(pvPar), vPerp(pvPerp), uPerp(vPerp.cross(vPar.normalized())), radius(pvPar.norm() / abs(pOmegaC)) { diff --git a/Framework/Geometry/LineTrajectory.h b/Framework/Geometry/LineTrajectory.h new file mode 100644 index 000000000..ec026e065 --- /dev/null +++ b/Framework/Geometry/LineTrajectory.h @@ -0,0 +1,26 @@ +#ifndef _include_LINETRAJECTORY_H +#define _include_LINETRAJECTORY_H + +#include <Framework/Geometry/Point.h> +#include <Framework/Geometry/Vector.h> +#include <Units/PhysicalUnits.h> + +class LineTrajectory // TODO: inherit from Trajectory +{ + using SpeedVec = Vector<Speed::dimension_type>; + + Point const r0; + SpeedVec const v0; + + LineTrajectory(Point const& pR0, SpeedVec const& pV0) : + r0(r0), v0(pV0) + { + } + + auto getPosition(Time t) const + { + return r0 + v0 * t; + } +}; + +#endif -- GitLab