-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarble.cpp
84 lines (66 loc) · 1.07 KB
/
Marble.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// Marble.cpp
// VirtualMarbleGame
//
// Created by Maximilian Weber
//
#include "Marble.h"
Marble::Marble(float x, float y, float z, float radius, float weight) {
// m_x = x;
// m_y = y;
// m_z = z;
//
// v_x=0;
// v_y=0;
// v_z=0;
m_radius = radius;
m_weight = weight;
reset();
}
float Marble::getX() {
return m_x;
}
float Marble::getY() {
return m_y;
}
float Marble::getZ() {
return m_z;
}
float Marble::getRadius() {
return m_radius;
}
float Marble::getWeight() {
return m_weight;
}
void Marble::setX(float x) {
m_x = x;
}
void Marble::setY(float y) {
m_y = y;
}
void Marble::setZ(float z) {
m_z = z;
}
void Marble::translateX(float x) {
m_x += x;
}
void Marble::translateY(float y) {
m_y += y;
}
void Marble::translateZ(float z) {
m_z += z;
}
void Marble::setRadius(float radius) {
m_radius = radius;
}
void Marble::setWeight(float weight) {
m_weight = weight;
}
void Marble::reset() {
m_z = m_radius;
m_y = 0.5;
m_x = 1.5;
v_x = 0;
v_y = 0;
v_z = 0;
}