-
Notifications
You must be signed in to change notification settings - Fork 0
/
Table.h
47 lines (37 loc) · 1020 Bytes
/
Table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef TABLE_H
#define TABLE_H
#include "MathStructs.h"
#include "Ball.h"
#include "Pocket.h"
#include "PhysicalObject.h"
class Table: public PhysicalObject
{
public:
// constructors
Table(Point, double, double);
Table();
static const double BORDER; // borders' thickness
double getHeight();
double getWidth();
double getLeft();
double getRight();
double getTop();
double getBottom();
// checks the position of the ball according to the table,
// and applies the proper forces
bool checkBorders(Ball &);
// applies the proper friction
void applyFriction(Ball &);
void render();
private:
static const double FRICTION_FACTOR; // friction factor
static const double RADIUS; // pockets' radius
// checks the position of the ball according to the table holes
bool checkHoles(Ball &);
// checks the position of the ball according to the table borders
bool checkCollision(Ball &);
double height;
double width;
Pocket pocket[6];
};
#endif