summaryrefslogtreecommitdiff
path: root/include/egg/math/eggRotation.h
blob: b1e1e075f7d338527a6d3fb797b45950340b7566 (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
#ifndef EGG_ROTATION_H
#define EGG_ROTATION_H

#include "egg/math/eggMath.h"

namespace EGG {

template <typename T>
struct Rotation {
    Rotation() {}
    Rotation(T val) : mRot(val) {}
    Rotation(const Rotation &other) {
        mRot = other.mRot;
    }
    Rotation &operator=(const Rotation &other) {
        mRot = other.mRot;
        return *this;
    }
    Rotation &operator=(T val) {
        mRot = val;
        return *this;
    }

    operator T() const {
        return mRot;
    }

    Rotation &operator-=(T val) {
        mRot -= val;
        return *this;
    }
    Rotation &operator+=(T val) {
        mRot -= val;
        return *this;
    }

    const T cos() const {
        return Math<T>::cos(*this);
    }
    const T sin() const {
        return Math<T>::sin(*this);
    }

protected:
    T mRot;
};

} // namespace EGG

#endif