1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Prerequisites/BsPrerequisitesUtil.h"
4#include "Math/BsDegree.h"
5#include "Math/BsMath.h"
6
7namespace bs
8{
9 Degree::Degree(const Radian& r)
10 :mDeg(r.valueDegrees())
11 { }
12
13 Degree Degree::wrap()
14 {
15 mDeg = fmod(mDeg, 360.0f);
16
17 if (mDeg < 0)
18 mDeg += 360.0f;
19
20 return *this;
21 }
22
23 Degree& Degree::operator= (const Radian& r)
24 {
25 mDeg = r.valueDegrees(); return *this;
26 }
27
28 Degree Degree::operator+ (const Radian& r) const
29 {
30 return Degree (mDeg + r.valueDegrees());
31 }
32
33 Degree& Degree::operator+= (const Radian& r)
34 {
35 mDeg += r.valueDegrees(); return *this;
36 }
37
38 Degree Degree::operator- (const Radian& r) const
39 {
40 return Degree (mDeg - r.valueDegrees());
41 }
42
43 Degree& Degree::operator-= (const Radian& r)
44 {
45 mDeg -= r.valueDegrees(); return *this;
46 }
47
48 float Degree::valueRadians() const
49 {
50 return mDeg * Math::DEG2RAD;
51 }
52}
53