31 lines
793 B
C++
31 lines
793 B
C++
|
/**
|
||
|
* Header file defining a ball.
|
||
|
* A ball is the kind of real object, with a physical model, and the implicit
|
||
|
* surface.
|
||
|
* The physical model is strongly inspired from
|
||
|
* http://www.physics-online.info/book1/chapt1/sect1a/problem1a-12/Problem1A-12.htm
|
||
|
**/
|
||
|
|
||
|
#include <cstddef>
|
||
|
#include "spheroid.hpp"
|
||
|
|
||
|
#define G_CTE 9.81
|
||
|
|
||
|
class Ball {
|
||
|
private:
|
||
|
Point Center;
|
||
|
Spheroid surface;
|
||
|
double init_h;
|
||
|
size_t bounce_number;
|
||
|
double crt_time;
|
||
|
double A, B, U, T; // Coefficients for the physical model.
|
||
|
void _compute_pos();
|
||
|
void _compute_A_n();
|
||
|
void _compute_B_n();
|
||
|
void _compute_U_n();
|
||
|
void _compute_T_n();
|
||
|
public:
|
||
|
Ball(Point& _center, double p, double q);
|
||
|
void update_pos(double dt);
|
||
|
};
|