Program Listing for File Geometry.h

Return to documentation for file (include/crpropa/Geometry.h)

#ifndef CRPROPA_GEOMETRY_H
#define CRPROPA_GEOMETRY_H

#include <vector>
#include <string>

#include "crpropa/Candidate.h"
#include "crpropa/Vector3.h"
#include "crpropa/Referenced.h"

namespace crpropa {
class Surface : public Referenced {
public:
        virtual double distance(const Vector3d& point) const = 0;
        virtual Vector3d normal(const Vector3d& point) const = 0;
        virtual std::string getDescription() const {return "Surface without description.";};
};


class Plane: public Surface {
private:
        Vector3d x0, n;
public:
        Plane(const Vector3d& x0, const Vector3d& v1,const Vector3d& v2);
        Plane(const Vector3d& x0, const Vector3d& n);
        virtual double distance(const Vector3d &x) const;
        virtual Vector3d normal(const Vector3d& point) const;
        virtual std::string getDescription() const;
};


class Sphere: public Surface {
private:
        Vector3d center;
        double radius;
public:
        Sphere(const Vector3d& center, double radius);
        virtual double distance(const Vector3d &point) const;
        virtual Vector3d normal(const Vector3d& point) const;
        virtual std::string getDescription() const;
};


class ParaxialBox: public Surface {
private:
        Vector3d corner, size;
public:
        ParaxialBox(const Vector3d& corner, const Vector3d& size);
        virtual double distance(const Vector3d &point) const;
        virtual Vector3d normal(const Vector3d& point) const;
        virtual std::string getDescription() const;
};


} // namespace crpropa

#endif // CRPROPA_GEOMETRY_H