-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrientation.cpp
56 lines (43 loc) · 1.01 KB
/
Orientation.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
#include "Orientation.h"
#include <math.h>
Orientation::Orientation() : myX_(0), myY_(0), myAngle_(0) {
}
Orientation::Orientation(double initX, double initY, double angle)
: myX_(initX), myY_(initY), myAngle_(angle) {
}
Orientation::Orientation(const Orientation& o) {
myX_ = o.getX();
myY_ = o.getY();
myAngle_ = o.getAngle();
}
Orientation::~Orientation() {
}
double Orientation::getX() const {
return myX_;
}
double Orientation::getY() const {
return myY_;
}
double Orientation::getAngle() const {
return myAngle_;
}
void Orientation::setX(double newX) {
myX_ = newX;
}
void Orientation::setY(double newY) {
myY_ = newY;
}
void Orientation::setAngle(double newAngle) {
myAngle_ = newAngle;
}
void Orientation::addToX(double increment) {
myX_ += increment;
}
void Orientation::addToY(double increment) {
myY_ += increment;
}
void Orientation::addToAngle(double increment) {
myAngle_ += increment;
while (myAngle_ > 2*M_PI) myAngle_ -= 2*M_PI;
while (myAngle_ < 0) myAngle_ += 2*M_PI;
}