blob: ec64cf3c6148d4c868c0a4e4b74b40d1c3ed4f3d (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "../include/velocity.h"
// Default velocity constructor
Velocity :: Velocity ()
{
setDx ( 0.0 );
setDy ( 0.0 );
}
// Velocity constructor with data
Velocity :: Velocity ( float dx , float dy )
{
setDx ( dx );
setDy ( dy );
}
// Get Velocity dx
float Velocity :: getDx() const
{
return dx;
}
// Get Velocity dy
float Velocity :: getDy() const
{
return dy;
}
// Set Velocity dx
void Velocity :: setDx( float dx )
{
this->dx = dx;
}
// Set Velocity dy
void Velocity :: setDy( float dy )
{
this->dy = dy;
}
// Add dy Velocity
void Velocity :: addDy ( const float dy )
{
this->dy += dy;
}
// Add dx Velocity
void Velocity :: addDx ( const float dx )
{
this->dx += dx;
}
// Update a point
Point Velocity :: updatePoint ( Point &point )
{
point.addX ( dx );
point.addY ( dy );
return point;
}
|