Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Transform.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright and trademark 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
43 #ifndef __TRANSFORM_H__
44 #define __TRANSFORM_H__
45 
46 #include "CoreConfig.h"
47 #include "GLNode.h"
48 #include "XformMatrix.h"
49 
50 namespace Menge {
51 
52  namespace SceneGraph {
59  class MENGE_API Transform : public GLDagNode {
60  public:
67  Transform( GLDagNode * parent=0x0 );
68 
74  inline void setTranslation( const Vector3 & vec ) { _xform.setTranslation( vec ) ; }
75 
81  inline void addTranslation( const Vector3 & vec ) { _xform.addTranslation( vec ); }
82 
88  inline void setScale( const Vector3 & vec ) { _xform.setScale( vec ); }
89 
99  inline void setRotationDeg( const Vector3 & vec ) { _xform.setRotationDeg( vec ); }
100 
110  inline void setRotationRad( const Vector3 & vec ) { _xform.setRotationRad( vec ); }
111 
123  inline void addRotationDeg( const Vector3 & vec ) { _xform.addRotationDeg( vec ); }
124 
136  inline void addRotationRad( const Vector3 & vec ) { _xform.addRotationRad( vec ); }
137 
147  inline void setRotAxisDeg( const Vector3 & vec ) { _xform.setRotAxisDeg( vec ); }
148 
158  inline void setRotAxisRad( const Vector3 & vec ) { _xform.setRotAxisRad( vec ); }
159 
165  const Vector3 & translation() const { return _xform._trans; }
166 
172  const Vector3 & rotation() const { return _xform._rot; }
173 
179  const Vector3 & scale() const { return _xform._scale; }
180 
188  void setDirty() { _xform.setDirty(); }
189 
195  inline void getMatrix( Matrix4x4 & mat ) { _xform.getMatrix( mat ); }
196 
202  inline void getInverseMatrix( Matrix4x4 & mat ) { _xform.getInverseMatrix( mat ); }
203 
210  void getWorldMatrix( Matrix4x4 & mat );
211 
218  void getWorldInverseMatrix( Matrix4x4 & mat );
219 
225  void getParentMatrix( Matrix4x4 & mat );
226 
232  void getParentInverseMatrix( Matrix4x4 & mat );
233 
242  virtual void drawGL( bool select=false );
243 
244  protected:
249  };
250  } // namespace SceneGraph
251 } // namespace Menge
252 #endif // __TRANSFORM_H__
void setRotAxisDeg(const Vector3 &vec)
Set the orientation of this node's rotation axis.
Definition: Transform.h:147
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Scene graph node which applies transforms to nodes.
Definition: Transform.h:59
Basic 4x4 matrix of floats.
Definition: Matrix.h:70
void getMatrix(Matrix4x4 &mat)
Returns the transform matrix created by this transform node.
Definition: Transform.h:195
The node that provides the basis for a "hierarchy" in the scene graph.
Definition: GLNode.h:169
Sets up the proper compiler directives for platform and dll export/import.
void addRotationDeg(const Vector3 &vec)
Offsets the orientation of this node.
Definition: Transform.h:123
void getInverseMatrix(Matrix4x4 &mat)
Writes the transform's inverse matrix created by this transform node.
Definition: Transform.h:202
void setDirty()
Sets the transformation to be dirty.
Definition: Transform.h:188
XformMatrix _xform
The underlyilng transformation matrix associated with this transform node.
Definition: Transform.h:248
The basic scene graph node. Any object which can be placed into the scene graph is an instance or sub...
The transformation matrix.
Definition: XformMatrix.h:69
void setTranslation(const Vector3 &vec)
Set the translation of this node.
Definition: Transform.h:74
void addTranslation(const Vector3 &vec)
Offset the translation of this node.
Definition: Transform.h:81
The SceneGraph (SceneGraph) name space, containing all elements to use in a SceneGraph.
void addRotationRad(const Vector3 &vec)
Offsets the orientation of this node.
Definition: Transform.h:136
void setRotAxisRad(const Vector3 &vec)
Set the orientation of this node's rotation axis.
Definition: Transform.h:158
const Vector3 & translation() const
Reports the transform's translation value.
Definition: Transform.h:165
const Vector3 & scale() const
Reports the transform's scale value.
Definition: Transform.h:179
void setRotationDeg(const Vector3 &vec)
Set the orientation of this node.
Definition: Transform.h:99
const Vector3 & rotation() const
Reports the transform's orientation value.
Definition: Transform.h:172
void setScale(const Vector3 &vec)
Set the scale of this node.
Definition: Transform.h:88
Defines the math of performing 3D transformation using a 4x4 homgeneous matrix.
void setRotationRad(const Vector3 &vec)
Set the orientation of this node.
Definition: Transform.h:110