Atoms Crowd  7.0.0
Joint.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsCore/Globals.h>
11 #include <AtomsCore/AtomsMath.h>
12 #include <AtomsCore/JointPose.h>
13 #include <string>
14 #include <vector>
15 
16 namespace AtomsCore
17 {
18  class Joint;
19 
20  typedef Joint* JointPtr;
21 
22  typedef const Joint * JointCPtr;
23 
24  typedef std::vector<JointPtr> JointPtrArray;
25 
27  /*
28  */
29  class ATOMSCORE_EXPORT Joint
30  {
31 
32  public:
33 
35  Joint();
36 
38  Joint(const Joint& rhs);
39 
41  ~Joint();
42 
44  Joint& operator=(const Joint& ptr);
45 
47 
50  inline const std::string& name() const;
51 
53 
56  inline void setName(const std::string& name);
57 
59 
62  inline unsigned short id() const;
63 
65 
68  inline void setId(unsigned short id);
69 
71 
74  inline const Quaternion& rotation() const;
75 
77 
80  inline void setRotation(const Quaternion& rotation);
81 
83 
86  inline const Vector3& scale() const;
87 
89 
92  inline void setScale(const Vector3& scale);
93 
95 
98  inline const Vector3& translation() const;
99 
101 
104  inline void setTranslation(const Vector3& translation);
105 
107 
110  Matrix matrix() const;
111 
113 
116  void setMatrix(const Matrix& matrix);
117 
119 
122  inline JointCPtr parent() const;
123 
125 
128  inline JointPtr parent();
129 
131 
134  inline void setParent(JointPtr parent);
135 
137 
140  inline unsigned short numChildren() const;
141 
143 
147  JointPtr child(unsigned short i);
148 
150 
154  JointCPtr child(unsigned short i) const;
155 
157 
160  bool addChild(JointPtr joint);
161 
163 
166  bool removeChild(unsigned short index);
167 
170 
172  bool isChildOf(unsigned short index) const;
173 
174  private:
175 
177  JointPose m_pose;
178 
180  JointPtr m_parent;
181 
183  JointPtrArray m_children;
184 
186  std::string m_name;
187 
189  unsigned short m_id;
190 
191  };
192 
193 
194 }
195 
197 ATOMSCORE_EXPORT std::ostream& operator<<(std::ostream& os, const AtomsCore::Joint& joint);
198 
199 #include "Joint.impl.h"
Joint class.
Definition: Joint.h:30
void setMatrix(const Matrix &matrix)
Sets the joint matrix.
Joint()
Constructor.
Joint & operator=(const Joint &ptr)
Assign operator.
JointCPtr child(unsigned short i) const
Gets a child joint.
bool isChildOf(unsigned short index) const
Check if this joint is a child of index.
~Joint()
Destructor.
Matrix matrix() const
Gets the joint matrix.
bool removeChild(unsigned short index)
Removes a child joint.
void removeChildren()
Removes children.
bool addChild(JointPtr joint)
Adds a child joint.
JointPtr child(unsigned short i)
Gets a child joint.
Joint(const Joint &rhs)
Copy constructor.
Joint pose.
Definition: JointPose.h:20
AtomsCore namespace.
Definition: Agent.h:344
Joint * JointPtr
Joint pointer.
Definition: Joint.h:18
AtomsMath::Quaternion Quaternion
Quaternion class.
Definition: AtomsMath.h:67
const Joint * JointCPtr
Joint const pointer.
Definition: Joint.h:22
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
AtomsMath::Matrix Matrix
Matrix class.
Definition: AtomsMath.h:63
std::vector< JointPtr > JointPtrArray
Vector fo joint pointers.
Definition: Joint.h:24