Spinning Topp Logo BlackTopp Studios
inc
transformableobject.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _transformableobject_h
41 #define _transformableobject_h
42 
43 #include "enumerations.h"
44 #include "vector3.h"
45 #include "quaternion.h"
46 
47 namespace Mezzanine
48 {
49  ///////////////////////////////////////////////////////////////////////////////
50  /// @brief This is an interface for all 3D objects that can have their full transforms manipulated.
51  /// @details
52  ///////////////////////////////////////
54  {
55  public:
56  /// @brief Class Destructor.
58  { }
59 
60  /// @brief Sets the location of this object in parent space.
61  /// @param Loc A Vector3 representing the location this object is to be set to.
62  virtual void SetLocation(const Vector3& Loc) = 0;
63  /// @brief Sets the location of this object in parent space via Reals.
64  /// @param X The position on the X axis where this object is to be set.
65  /// @param Y The position on the Y axis where this object is to be set.
66  /// @param Z The position on the Z axis where this object is to be set.
67  virtual void SetLocation(const Real X, const Real Y, const Real Z) = 0;
68  /// @brief Gets this objects current location.
69  /// @return Returns Vector3 representing the current rotation of this object in parent space.
70  virtual Vector3 GetLocation() const = 0;
71  /// @brief Sets the orientation of this object in parent space.
72  /// @param Ori A Quaternion representing the rotation this object is to be set to.
73  virtual void SetOrientation(const Quaternion& Ori) = 0;
74  /// @brief Sets the orientation of this object in parent space via Reals.
75  /// @param X The X component of the Axis.
76  /// @param Y The Y component of the Axis.
77  /// @param Z The Z component of the Axis.
78  /// @param W Rotation on the Axis X, Y and Z defined.
79  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W) = 0;
80  /// @brief Gets this objects current orientation.
81  /// @return Returns a Quaternion representing the current orientation of this object in parent space.
82  virtual Quaternion GetOrientation() const = 0;
83  /// @brief Sets the scaling to be applied to this object.
84  /// @param Sc A Vector3 representing the amount of scaling to apply to this object.
85  virtual void SetScale(const Vector3& Sc) = 0;
86  /// @brief Sets the scaling to be applied to this object via Reals.
87  /// @param X The scaling factor to apply on the X axis.
88  /// @param Y The scaling factor to apply on the Y axis.
89  /// @param Z The scaling factor to apply on the Z axis.
90  virtual void SetScale(const Real X, const Real Y, const Real Z) = 0;
91  /// @brief Gets the scaling currently being applied to this object.
92  /// @return Returns a Vector3 representing the amount this object is being scaled.
93  virtual Vector3 GetScale() const = 0;
94 
95  /// @brief Moves this object from it's current location.
96  /// @note This method has an additive effect with the objects current location. Unlike "SetLocation" this method does not replace
97  /// the existing location with what you provide.
98  /// @param Trans A Vector3 representing the amount of movement to apply to this object.
99  virtual void Translate(const Vector3& Trans) = 0;
100  /// @brief Moves this object from it's current location.
101  /// @note This method has an additive effect with the objects current location. Unlike "SetLocation" this method does not replace
102  /// the existing location with what you provide.
103  /// @param X The amount of movement to apply on the X axis.
104  /// @param Y The amount of movement to apply on the Y axis.
105  /// @param Z The amount of movement to apply on the Z axis.
106  virtual void Translate(const Real X, const Real Y, const Real Z) = 0;
107  /// @brief Rotate the object around the Y axis.
108  /// @param Angle The angle to rotate this object in radians.
109  virtual void Yaw(const Real Angle) = 0;
110  /// @brief Rotate the object around the X axis.
111  /// @param Angle The angle to rotate this object in radians.
112  virtual void Pitch(const Real Angle) = 0;
113  /// @brief Rotate the object around the Z axis.
114  /// @param Angle The angle to rotate this object in radians.
115  virtual void Roll(const Real Angle) = 0;
116  /// @brief Rotates the object from it's existing rotation.
117  /// @note This method has an additive effect with the objects current rotation. Unlike "SetOrientation" this method does not replace
118  /// the existing orientation with what you provide.
119  /// @param Axis The axis on which this object will be rotated.
120  /// @param Angle The angle to rotate this object in radians.
121  virtual void Rotate(const Vector3& Axis, const Real Angle) = 0;
122  /// @brief Rotates the object from it's existing rotation.
123  /// @note This method has an additive effect with the objects current rotation. Unlike "SetOrientation" this method does not replace
124  /// the existing orientation with what you provide.
125  /// @param Rotation The rotation to apply to this object.
126  virtual void Rotate(const Quaternion& Rotation) = 0;
127  /// @brief Scales the object from it's current size.
128  /// @note This method has an additive effect with the objects' current scaling. Unlike "SetScale" this method does not replace
129  /// the existing scale with what you provide.
130  /// @param Scale A Vector3 representing the scaling to apply to this object.
131  virtual void Scale(const Vector3& Scale) = 0;
132  /// @brief Scales the object from it's current size.
133  /// @note This method has an additive effect with the objects' current scaling. Unlike "SetScale" this method does not replace
134  /// the existing scale with what you provide.
135  /// @param X The scaling factor to apply on the X axis.
136  /// @param Y The scaling factor to apply on the Y axis.
137  /// @param Z The scaling factor to apply on the Z axis.
138  virtual void Scale(const Real X, const Real Y, const Real Z) = 0;
139 
140  ///////////////////////////////////////////////////////////////////////////////
141  // Conversion Functions
142 
143  /// @brief Converts a point in local space to the same point in global space.
144  /// @param Location The point in local space to be converted.
145  /// @return Returns a Vector3 representing the point in global space corresponding to the provided local space point.
146  virtual Vector3 ConvertLocalToGlobal(const Vector3& Location) const;
147  /// @brief Converts a point in global space to the same point in local space.
148  /// @param Location The point in global space to be converted.
149  /// @return Returns a Vector3 representing the point in local space corresponding to the provided global space point.
150  virtual Vector3 ConvertGlobalToLocal(const Vector3& Location) const;
151  /// @brief Converts a rotation in local space to the same rotation in global space.
152  /// @param Orientation The rotation in local space to be converted.
153  /// @return Returns a Quaternion representing the rotation in global space corresponding to the provided local space rotation.
154  virtual Quaternion ConvertLocalToGlobal(const Quaternion& Orientation) const;
155  /// @brief Converts a rotation in global space to the same rotation in local space.
156  /// @param Orientation The rotation in global space to be converted.
157  /// @return Returns a Quaternion representing the rotation in local space corresponding to the provided global space rotation.
158  virtual Quaternion ConvertGlobalToLocal(const Quaternion& Orientation) const;
159  };//TransformableObject
160 
161  ///////////////////////////////////////////////////////////////////////////////
162  /// @brief This is an interface for all child 3D objects that can have their full transforms manipulated.
163  /// @details Unlike TransformableObject, this interface has added parameters to it's methods for defining
164  /// which transform space the operation is to occur in.
165  ///////////////////////////////////////
167  {
168  public:
169  /// @brief Class Destructor.
171  { }
172 
173  /// @brief Sets the location of this object in parent space.
174  /// @param Loc A Vector3 representing the location this object is to be set to.
175  virtual void SetLocation(const Vector3& Loc) = 0;
176  /// @brief Sets the location of this object in parent space via Reals.
177  /// @param X The position on the X axis where this object is to be set.
178  /// @param Y The position on the Y axis where this object is to be set.
179  /// @param Z The position on the Z axis where this object is to be set.
180  virtual void SetLocation(const Real X, const Real Y, const Real Z) = 0;
181  /// @brief Gets this objects current location.
182  /// @return Returns Vector3 representing the current rotation of this object in parent space.
183  virtual Vector3 GetLocation() const = 0;
184  /// @brief Sets the orientation of this object in parent space.
185  /// @param Ori A Quaternion representing the rotation this object is to be set to.
186  virtual void SetOrientation(const Quaternion& Ori) = 0;
187  /// @brief Sets the orientation of this object in parent space via Reals.
188  /// @param X The X component of the Axis.
189  /// @param Y The Y component of the Axis.
190  /// @param Z The Z component of the Axis.
191  /// @param W Rotation on the Axis X, Y and Z defined.
192  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W) = 0;
193  /// @brief Gets this objects current orientation.
194  /// @return Returns a Quaternion representing the current orientation of this object in parent space.
195  virtual Quaternion GetOrientation() const = 0;
196  /// @brief Sets the scaling to be applied to this object.
197  /// @param Sc A Vector3 representing the amount of scaling to apply to this object.
198  virtual void SetScale(const Vector3& Sc) = 0;
199  /// @brief Sets the scaling to be applied to this object via Reals.
200  /// @param X The scaling factor to apply on the X axis.
201  /// @param Y The scaling factor to apply on the Y axis.
202  /// @param Z The scaling factor to apply on the Z axis.
203  virtual void SetScale(const Real X, const Real Y, const Real Z) = 0;
204  /// @brief Gets the scaling currently being applied to this object.
205  /// @return Returns a Vector3 representing the amount this object is being scaled.
206  virtual Vector3 GetScale() const = 0;
207 
208  /// @brief Moves this object from it's current location.
209  /// @note This method has an additive effect with the objects current location. Unlike "SetLocation" this method does not replace
210  /// the existing location with what you provide.
211  /// @param Trans A Vector3 representing the amount of movement to apply to this object.
212  /// @param Space The transform space in which to apply this translation.
213  virtual void Translate(const Vector3& Trans, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
214  /// @brief Moves this object from it's current location.
215  /// @note This method has an additive effect with the objects current location. Unlike "SetLocation" this method does not replace
216  /// the existing location with what you provide.
217  /// @param X The amount of movement to apply on the X axis.
218  /// @param Y The amount of movement to apply on the Y axis.
219  /// @param Z The amount of movement to apply on the Z axis.
220  /// @param Space The transform space in which to apply this translation.
221  virtual void Translate(const Real X, const Real Y, const Real Z, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
222  /// @brief Rotate the object around the Y axis.
223  /// @param Angle The angle to rotate this object in radians.
224  /// @param Space The transform space in which to apply this rotation.
225  virtual void Yaw(const Real Angle, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
226  /// @brief Rotate the object around the X axis.
227  /// @param Angle The angle to rotate this object in radians.
228  /// @param Space The transform space in which to apply this rotation.
229  virtual void Pitch(const Real Angle, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
230  /// @brief Rotate the object around the Z axis.
231  /// @param Angle The angle to rotate this object in radians.
232  /// @param Space The transform space in which to apply this rotation.
233  virtual void Roll(const Real Angle, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
234  /// @brief Rotates the object from it's existing rotation.
235  /// @note This method has an additive effect with the objects current rotation. Unlike "SetOrientation" this method does not replace
236  /// the existing orientation with what you provide.
237  /// @param Axis The axis on which this object will be rotated.
238  /// @param Angle The angle to rotate this object in radians.
239  /// @param Space The transform space in which to apply this rotation.
240  virtual void Rotate(const Vector3& Axis, const Real Angle, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
241  /// @brief Rotates the object from it's existing rotation.
242  /// @note This method has an additive effect with the objects current rotation. Unlike "SetOrientation" this method does not replace
243  /// the existing orientation with what you provide.
244  /// @param Rotation The rotation to apply to this object.
245  /// @param Space The transform space in which to apply this rotation.
246  virtual void Rotate(const Quaternion& Rotation, const Mezzanine::TransformSpace Space = Mezzanine::TS_Parent) = 0;
247  /// @brief Scales the object from it's current size.
248  /// @note This method has an additive effect with the objects' current scaling. Unlike "SetScale" this method does not replace
249  /// the existing scale with what you provide.
250  /// @param Scale A Vector3 representing the scaling to apply to this object.
251  virtual void Scale(const Vector3& Scale) = 0;
252  /// @brief Scales the object from it's current size.
253  /// @note This method has an additive effect with the objects' current scaling. Unlike "SetScale" this method does not replace
254  /// the existing scale with what you provide.
255  /// @param X The scaling factor to apply on the X axis.
256  /// @param Y The scaling factor to apply on the Y axis.
257  /// @param Z The scaling factor to apply on the Z axis.
258  virtual void Scale(const Real X, const Real Y, const Real Z) = 0;
259  };//TransformableChildObject
260 }//Mezzanine
261 
262 #endif
This is an interface for all child 3D objects that can have their full transforms manipulated...
This is an interface for all 3D objects that can have their full transforms manipulated.
virtual ~TransformableChildObject()
Class Destructor.
Any global enumerations shared between multiple classes is to be declared here.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
virtual ~TransformableObject()
Class Destructor.
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
Mostly reserved for rotations, means a rotation to occur around the parent instead of self...
Definition: enumerations.h:141
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
TransformSpace
Used to define what frame of reference is to be used when positioning or rotating objects...
Definition: enumerations.h:138
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68