source: trunk/packages/vizservers/nanovis/vrmath/include/vrmath/vrRotation.h @ 2798

Last change on this file since 2798 was 2798, checked in by ldelgass, 13 years ago

Add emacs mode magic line in preparation for indentation cleanup

File size: 2.0 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#pragma once
3
4#include <vrmath/vrLinmath.h>
5
6class vrVector3f;
7class vrQuaternion;
8
9class LmExport vrRotation {
10public :
11        float x, y, z, angle;
12
13public :
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
41inline float vrRotation::getX() const
42{
43        return x;
44}
45
46inline float vrRotation::getY() const
47{
48        return y;
49}
50
51inline float vrRotation::getZ() const
52{
53        return z;
54}
55
56inline float vrRotation::getAngle() const
57{
58        return angle;
59}
60
61inline 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
66inline 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
71inline void vrRotation::setAxis(float x, float y, float z)
72{
73        this->x = x; this->y = y; this->z = z;
74}
75
76inline void vrRotation::setAngle(float angle)
77{
78        this->angle = angle;
79}
80
81inline 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
86inline 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
Note: See TracBrowser for help on using the repository browser.