Rémi Oudin
dae55f5eab
In an extremely simple model, the ball will deform as an ellipsoid during the bounce process.
30 lines
807 B
C++
30 lines
807 B
C++
/**
|
|
* Defines an ellispoid, which is a basic interpretaion of the ball when it is
|
|
* bouncing.
|
|
**/
|
|
|
|
#include <cstddef>
|
|
#include "Implicit.hpp"
|
|
#include "common_structures.hpp"
|
|
|
|
const double PI = 3.141592653589793;
|
|
|
|
class Ellipsoid : public ImplicitSurface {
|
|
public:
|
|
Ellipsoid(Point& _center, size_t _p, size_t _q);
|
|
void update_center_pos(size_t dt);
|
|
void set_stiffness(size_t _stiffness);
|
|
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
|
|
**/
|
|
size_t stiffness;
|
|
size_t p, q;
|
|
double V;
|
|
Point& center;
|
|
void _compute_volume();
|
|
void _compute_pos(size_t t);
|
|
};
|