CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
Path.hpp
1 /*
2  * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
11 #include <deque>
12 
14 #include <corsika/framework/geometry/Point.hpp>
15 
16 namespace corsika {
17 
22  class Path {
23 
24  protected:
25  std::deque<Point> points_;
27 
28  using iterator = std::deque<Point>::iterator;
29  using const_iterator = std::deque<Point>::const_iterator;
30 
31  public:
35  Path(Point const& point);
36 
40  Path(std::deque<Point> const& points);
41 
45  inline void addToEnd(Point const& point);
46 
50  inline void removeFromEnd();
51 
55  inline LengthType getLength() const;
56 
60  inline Point const& getStart() const;
61 
65  inline Point const& getEnd() const;
66 
70  inline Point const& getPoint(std::size_t const index) const;
71 
75  inline const_iterator begin() const;
76 
80  inline const_iterator end() const;
81 
85  inline iterator begin();
86 
90  inline iterator end();
91 
97  inline int getNSegments() const;
98 
99  }; // class Path
100 
101 } // namespace corsika
102 
103 #include <corsika/detail/framework/geometry/Path.inl>
int getNSegments() const
Get the number of steps in the path.
void addToEnd(Point const &point)
Add a new Point to the end of the path.
void removeFromEnd()
Remove a point from the end of the path.
Import and extend the phys::units package.
LengthType getLength() const
Get the total length of the path.
Point const & getPoint(std::size_t const index) const
Get a specific point of the path.
Path(Point const &point)
Create a Path with a given starting Point.
const_iterator end() const
Return an iterator to the end of the Path.
`, since they are used everywhere as integral part of the framework.
static constexpr quantity zero()
We need a "zero" of each type – for comparisons, to initialize running totals, etc.
Definition: quantity.hpp:359
const_iterator begin() const
Return an iterator to the start of the Path.
std::deque< Point > points_
The points that make up this path.
Definition: Path.hpp:25
Point const & getEnd() const
Get the end point of the path.
LengthType length_
The length of the path.
Definition: Path.hpp:26
Point const & getStart() const
Get the starting point of the path.
This class represents a (potentially) curved path between two points using N >= 1 straight-line segme...
Definition: Path.hpp:22