1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #pragma once |
---|
3 | |
---|
4 | #include <vrmath/vrLinmath.h> |
---|
5 | |
---|
6 | class vrVector3f; |
---|
7 | class vrQuaternion; |
---|
8 | |
---|
9 | class LmExport vrRotation { |
---|
10 | public : |
---|
11 | float x, y, z, angle; |
---|
12 | |
---|
13 | public : |
---|
14 | |
---|
15 | vrRotation() : x(0.0f), y(1.0f), z(0.0f), angle(0.0f) {} |
---|
16 | vrRotation(float x1, float y1, float z1, float angle1) |
---|
17 | : x(x1), y(y1), z(z1), angle(angle1) {} |
---|
18 | |
---|
19 | vrRotation(const vrRotation& rotation) |
---|
20 | : x(rotation.x), y(rotation.y), z(rotation.z), angle(rotation.angle) {} |
---|
21 | |
---|
22 | float getX() const; |
---|
23 | float getY() const; |
---|
24 | float getZ() const; |
---|
25 | float getAngle() const; |
---|
26 | |
---|
27 | void set(float x, float y, float z, float angle); |
---|
28 | void set(const vrVector3f &vec1, const vrVector3f &vec2); |
---|
29 | void set(const vrQuaternion& quat); |
---|
30 | void set(const vrRotation& rot); |
---|
31 | void setAxis(float x, float y, float z); |
---|
32 | void setAngle(float angle); |
---|
33 | |
---|
34 | friend bool operator!=(const vrRotation& rot1, const vrRotation& rot2); |
---|
35 | friend bool operator==(const vrRotation& rot1, const vrRotation& rot2); |
---|
36 | |
---|
37 | }; |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | inline float vrRotation::getX() const |
---|
42 | { |
---|
43 | return x; |
---|
44 | } |
---|
45 | |
---|
46 | inline float vrRotation::getY() const |
---|
47 | { |
---|
48 | return y; |
---|
49 | } |
---|
50 | |
---|
51 | inline float vrRotation::getZ() const |
---|
52 | { |
---|
53 | return z; |
---|
54 | } |
---|
55 | |
---|
56 | inline float vrRotation::getAngle() const |
---|
57 | { |
---|
58 | return angle; |
---|
59 | } |
---|
60 | |
---|
61 | inline void vrRotation::set(float x, float y, float z, float angle) |
---|
62 | { |
---|
63 | this->x = x; this->y = y; this->z = z; this->angle = angle; |
---|
64 | } |
---|
65 | |
---|
66 | inline void vrRotation::set(const vrRotation& rot) |
---|
67 | { |
---|
68 | this->x = rot.x; this->y = rot.y; this->z = rot.z; this->angle = rot.angle; |
---|
69 | } |
---|
70 | |
---|
71 | inline void vrRotation::setAxis(float x, float y, float z) |
---|
72 | { |
---|
73 | this->x = x; this->y = y; this->z = z; |
---|
74 | } |
---|
75 | |
---|
76 | inline void vrRotation::setAngle(float angle) |
---|
77 | { |
---|
78 | this->angle = angle; |
---|
79 | } |
---|
80 | |
---|
81 | inline bool operator==(const vrRotation& rot1, const vrRotation& rot2) |
---|
82 | { |
---|
83 | return ((rot1.x == rot2.x) && (rot1.y == rot2.y) && (rot1.z == rot2.z) && (rot1.angle == rot2.angle)); |
---|
84 | } |
---|
85 | |
---|
86 | inline bool operator!=(const vrRotation& rot1, const vrRotation& rot2) |
---|
87 | { |
---|
88 | return ((rot1.x != rot2.x) || (rot1.y != rot2.y) || (rot1.z != rot2.z) || (rot1.angle != rot2.angle)); |
---|
89 | } |
---|
90 | |
---|