- Cal3D 0.11 API Reference -

transform.h
1//****************************************************************************//
2// coordsys.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_TRANSFORM_H
12#define CAL_TRANSFORM_H
13
14#include "cal3d/global.h"
15#include "cal3d/vector.h"
16#include "cal3d/quaternion.h"
17
18 namespace cal3d
19{
24 class CAL3D_API Transform
25 {
26 public:
27 Transform() { }
28
29 Transform(const CalVector& translation, const CalQuaternion& rotation)
30 : m_translation(translation)
31 , m_rotation(rotation)
32 {
33 }
34
35 ~Transform() { }
36
37 const CalVector& getTranslation() const
38 {
39 return m_translation;
40 }
41
42 CalVector& getTranslation()
43 {
44 return m_translation;
45 }
46
47 const CalQuaternion& getRotation() const
48 {
49 return m_rotation;
50 }
51
52 CalQuaternion& getRotation()
53 {
54 return m_rotation;
55 }
56
57 void setTranslation(const CalVector& translation)
58 {
59 m_translation = translation;
60 }
61
62 void setRotation(const CalQuaternion& rotation)
63 {
64 m_rotation = rotation;
65 }
66
68 void setIdentity()
69 {
70 m_translation.clear();
71 m_rotation.clear();
72 }
73
74 void blend(float t, const Transform& end)
75 {
76 m_translation.blend(t, end.getTranslation());
77 m_rotation.blend(t, end.getRotation());
78 }
79
80 bool operator==(const Transform& rhs) const
81 {
82 return m_translation == rhs.m_translation &&
83 m_rotation == rhs.m_rotation;
84 }
85
86 bool operator!=(const Transform& rhs) const
87 {
88 return !operator==(rhs);
89 }
90
91 private:
92 CalVector m_translation;
93 CalQuaternion m_rotation;
94 };
95}
96
97 typedef cal3d::Transform CalTransform;
98
99#endif
CalQuaternion
The quaternion class.
Definition quaternion.h:36
CalVector
The vector class.
Definition vector.h:37
cal3d::Transform
Contains a translation and rotation that describe a coordinate system or transform.
Definition transform.h:25
cal3d::Transform::setIdentity
void setIdentity()
Sets this coordinate system to the identity rotation and translation.
Definition transform.h:68

Generated by The Cal3D Team with Doxygen 1.15.0