/** * Defines a spheroid, which is a basic interpretaion of the ball when it is * bouncing. **/ #include #include #include "Implicit.hpp" #include "common_structures.hpp" #include "PerlinNoise.hpp" const double PI = 3.141592653589793; class Spheroid : public ImplicitSurface { public: Spheroid(Point& _center, double _min_p, double _p, double _q); void update_center_pos(Point& _center); void update_radius(); void update_height(); void check_horizontal_plan_collision(double& height); void check_vertical_plan_collision(double& abscissa); Cuboid max_bounding_box() const; void check_perlin_collision(PerlinNoise perlin); Point getNormalVector() const { return normal_vector;} double operator() (double _x, double _y, double _z) const; 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 **/ Point normal_vector; double min_p, init_p, p, q; size_t stiffness; double V; void _compute_volume(); };