LCOV - code coverage report
Current view: top level - include/crpropa - Geometry.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 3 4 75.0 %
Date: 2024-04-29 14:43:01 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #ifndef CRPROPA_GEOMETRY_H
       2             : #define CRPROPA_GEOMETRY_H
       3             : 
       4             : #include <vector>
       5             : #include <string>
       6             : 
       7             : #include "crpropa/Candidate.h"
       8             : #include "crpropa/Vector3.h"
       9             : #include "crpropa/Referenced.h"
      10             : 
      11             : namespace crpropa {
      12             : /**
      13             :  * \addtogroup Core
      14             :  * @{
      15             :  */
      16             : 
      17             : /**
      18             :  @class Surface
      19             :  @brief A geometrical surface
      20             : 
      21             :  Defines a surface. Can be queried if the candidate has crossed the surface in the last step.
      22             :  */
      23             : class Surface : public Referenced {
      24             : public:
      25             :         /** Returns the distance of a point to the surface. Negative on the one side,
      26             :          positive on the other. For closed surfaces it is negative on the inside.
      27             :          @param point   vector corresponding to the point to which compute the distance
      28             :          */
      29             :         virtual double distance(const Vector3d& point) const = 0;
      30             :         /**  Returns the normal to the surface at a point. Negative on the one side,
      31             :          positive on the other. For closed surfaces it is negative on the inside.
      32             :          @param point   vector corresponding to the point to which compute the normal vector
      33             :          */
      34             :         virtual Vector3d normal(const Vector3d& point) const = 0;
      35           0 :         virtual std::string getDescription() const {return "Surface without description.";};
      36             : };
      37             : 
      38             : 
      39             : /**
      40             :  @class Plane
      41             :  @brief A plane given by a point x0 and two axes v1 and v2 with normal n = v1.cross(v2) or the normal n. Note that distance is negative on one side of the plane and positive on the other, depending on the orientation of the normal vector.
      42             :  */
      43           1 : class Plane: public Surface {
      44             : private:
      45             :         Vector3d x0, n;
      46             : public:
      47             :         Plane(const Vector3d& x0, const Vector3d& v1,const Vector3d& v2);
      48             :         Plane(const Vector3d& x0, const Vector3d& n);
      49             :         virtual double distance(const Vector3d &x) const;
      50             :         virtual Vector3d normal(const Vector3d& point) const;
      51             :         virtual std::string getDescription() const;
      52             : };
      53             : 
      54             : 
      55             : /**
      56             :  @class Sphere
      57             :  @brief A sphere around point _center with radius _radius.
      58             :  */
      59           1 : class Sphere: public Surface {
      60             : private:
      61             :         Vector3d center;
      62             :         double radius;
      63             : public:
      64             :         Sphere(const Vector3d& center, double radius);
      65             :         virtual double distance(const Vector3d &point) const;
      66             :         virtual Vector3d normal(const Vector3d& point) const;
      67             :         virtual std::string getDescription() const;
      68             : };
      69             : 
      70             : 
      71             : /**
      72             :  @class ParaxialBox
      73             :  @brief A box with perpendicular surfaces aligned to the x,y,z-axes.
      74             :  */
      75           1 : class ParaxialBox: public Surface {
      76             : private:
      77             :         Vector3d corner, size;
      78             : public:
      79             :         ParaxialBox(const Vector3d& corner, const Vector3d& size);
      80             :         virtual double distance(const Vector3d &point) const;
      81             :         virtual Vector3d normal(const Vector3d& point) const;
      82             :         virtual std::string getDescription() const;
      83             : };
      84             : 
      85             : 
      86             : /** @}*/
      87             : } // namespace crpropa
      88             : 
      89             : #endif // CRPROPA_GEOMETRY_H

Generated by: LCOV version 1.14