#ifndef GEOMETRY_H #define GEOMETRY_H #include "simulation/coordinates.h" enum class GeometryPositioning { bottom, top, hull, inside }; class Geometry { public: virtual bool isInside(const Coordinate& position) const = 0; virtual GeometryPositioning isWhere(const Coordinate& position) const = 0; }; class Cylinder : public Geometry { public: Cylinder(double radius, double height); bool isInside(const Coordinate& position) const; GeometryPositioning isWhere(const Coordinate& position) const; private: const double radius_; const double height_; }; /* /|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\ ‾‾‾ / | | \ ^ / | | \ | / | | \ | R_cylinder / | | \ ⌄ |<-->|<------------------>|<------------------><---> --- z=0 ^ ^ | | | | H_cone H_cylinder symmetry axis The geometry will only know 3 regions, "inside", "hull", "top". Meaning the cone will always have the same boundary condition as the cylinder boundary. */ /* Geometry of a cylinder with a cone as the end with its tip at z=0. */ class HalfCylinderWithCone : public Geometry { public: HalfCylinderWithCone(double radiusCylinder, double heightCylinder, double heightCone, double zfrustum); bool isInside(const Coordinate& position) const; GeometryPositioning isWhere(const Coordinate& position) const; private: const double cylinder_radius_; const double cylinder_height_; const double cone_height_; const double z_frustum_; double localRadius(double z) const; }; #endif /* GEOMETRY_H */