/** * Defines a spheroid, which is a basic interpretaion of the ball when it is * bouncing. **/ #include #include #include "Implicit.hpp" #include "common_structures.hpp" const double PI = 3.141592653589793; class Spheroid : public ImplicitSurface { public: Spheroid(const Point& _center, double _p, double _q); void update_center_pos(Point& _center); void update_radius(); void update_height(); void set_stiffness(size_t _stiffness); void check_horizontal_plan_collision(double& height); void check_vertical_plan_collision(double& abscissa); double operator() (double _x, double _y, double _z) const { return (pow(_x, 2) / pow(q, 2) + pow(_y, 2) / pow(q, 2) + pow(_z, 2) / pow(p, 2) -1); } private: /** * p corresponds to the half-height of the ball, * q to the radius of the ball, * V is the volume. Extremely useful to have a constant volume in the * ball **/ double init_p, p, q; size_t stiffness; double V; void _compute_volume(); };