Atoms Crowd  7.0.0
JointChain.impl.h
1 // ===========================================================================
2 // Copyright (c) 2020 Toolchefs Ltd. All rights reserved.
3 //
4 // Use of this software is subject to the terms of the Toolchefs license
5 // agreement provided at the time of installation or download, or which
6 // otherwise accompanies this software in either electronic or hard copy form.
7 // ===========================================================================
8 namespace AtomsCore
9 {
10  const std::string& JointChain::name() const
11  {
12  return m_name;
13  }
14 
15  void JointChain::setName(const std::string& name)
16  {
17  m_name = name;
18  }
19 
20  const std::string& JointChain::fullName() const
21  {
22  return m_fullName;
23  }
24 
25  void JointChain::setFullName(const std::string& fullName)
26  {
27  m_fullName = fullName;
28  }
29 
30  unsigned short JointChain::id() const
31  {
32  return m_id;
33  }
34 
35  void JointChain::setId(unsigned short id)
36  {
37  m_id = id;
38  }
39 
40  unsigned short JointChain::jointId(unsigned short i) const
41  {
42  return m_joints[i].id();
43  }
44 
45  const std::vector<unsigned short>& JointChain::ikJointIds() const
46  {
47  return m_ikJointIds;
48  }
49 
50  const std::vector<unsigned short>& JointChain::skeletalJointIds() const
51  {
52  return m_skeletalJointIds;
53  }
54 
55  const JointChain::BindData& JointChain::bindData(unsigned short i) const
56  {
57  return m_jointBindData[i];
58  }
59 
60  void JointChain::setJoint(const Joint& joint, unsigned short i)
61  {
62  m_joints[i] = joint;
63  }
64 
65  void JointChain::setJointId(unsigned short id, unsigned short i)
66  {
67  m_jointIds[i] = id;
68  }
69 
70  void JointChain::setIkJointIds(std::vector<unsigned short> ikIds)
71  {
72  m_ikJointIds = ikIds;
73  }
74 
75  unsigned short JointChain::numJoints() const
76  {
77  return m_numJoints;
78  }
79 
80  unsigned short JointChain::numIkJoints() const
81  {
82  return static_cast<unsigned short>(m_ikJointIds.size());
83  }
84 
85  unsigned short JointChain::numSkeletalJointIds() const
86  {
87  return static_cast<unsigned short>(m_skeletalJointIds.size());
88  }
89 
90  const std::vector<unsigned short>& JointChain::jointIds() const
91  {
92  return m_jointIds;
93  }
94 
96  {
97  return m_parent;
98  }
99 
101  {
102  m_parent = &parent;
103  }
104 
106  {
107  return m_start;
108  }
109 
110  const JointPtr JointChain::end() const
111  {
112  return m_end;
113  }
114 
116  {
117  return m_isConnectedToParent;
118  }
119 
120  void JointChain::setIsConnectedToParent(bool isConnected)
121  {
122  m_isConnectedToParent = isConnected;
123  }
124 
125  bool JointChain::isRoot() const
126  {
127  return m_isRoot;
128  }
129 
130  void JointChain::setIsRoot(bool isRoot)
131  {
132  m_isRoot = isRoot;
133  }
134 
135  bool JointChain::isSpine() const
136  {
137  return m_isSpine;
138  }
139 
140  void JointChain::setIsSpine(bool isSpine)
141  {
142  m_isSpine = isSpine;
143  }
144 
145  bool JointChain::isLimb() const
146  {
147  return m_isLimb;
148  }
149 
150  void JointChain::setIsLimb(bool isLimb)
151  {
152  m_isLimb = isLimb;
153  }
154 
156  {
157  return m_isEffector;
158  }
159 
160  void JointChain::setIsEffector(bool isEffector)
161  {
162  m_isEffector = isEffector;
163  }
164 
165  bool JointChain::isCenter() const
166  {
167  return m_isCenter;
168  }
169 
170  void JointChain::setIsCenter(bool isCenter)
171  {
172  m_isCenter = isCenter;
173  }
174 
176  {
177  return m_forceUseFabrik;
178  }
179 
180  void JointChain::setForceUseFabrik(bool useFabrik)
181  {
182  m_forceUseFabrik = useFabrik;
183  }
184 
186  {
187  return m_forceOrientEnd;
188  }
189 
190  void JointChain::setForceOrientEnd(bool orientEnd)
191  {
192  m_forceOrientEnd = orientEnd;
193  }
194 
196  {
197  return m_hasFootTip;
198  }
199 
200  void JointChain::setHasFootTip(bool hasFootTip)
201  {
202  m_hasFootTip = hasFootTip;
203  }
204 
206  {
207  return m_hasFootIk;
208  }
209 
210  void JointChain::setHasFootIk(bool hasFootIk)
211  {
212  m_hasFootIk = hasFootIk;
213  }
214 
216  {
217  return m_hasPelvis;
218  }
219 
220  void JointChain::setHasPelvis(bool hasPelvis)
221  {
222  m_hasPelvis = hasPelvis;
223  }
224 
226  {
227  return m_hasPoleVector;
228  }
229 
230  void JointChain::setHasPoleVector(bool hasPoleVector)
231  {
232  m_hasPoleVector = hasPoleVector;
233  }
234 
236  {
237  return m_poleVector;
238  }
239 
241  {
242  m_poleVector = poleVector;
243  }
244 
245  unsigned short JointChain::footTip() const
246  {
247  return m_footTip;
248  }
249 
250  void JointChain::setFootTip(unsigned short footTip)
251  {
252  m_footTip = footTip;
253  }
254 
255  unsigned short JointChain::footIk() const
256  {
257  return m_footIk;
258  }
259 
260  void JointChain::setFootIk(unsigned short footIk)
261  {
262  m_footIk = footIk;
263  }
264 
265  unsigned short JointChain::pelvisId() const
266  {
267  return m_pelvisId;
268  }
269 
270  void JointChain::setPelvisId(unsigned short pelvisId)
271  {
272  m_pelvisId = pelvisId;
273  }
274 
275  double JointChain::length() const
276  {
277  return m_length;
278  }
279 
280  void JointChain::setLength(double len)
281  {
282  m_length = len;
283  }
284 
286  {
287  return m_start2endBindVector;
288  }
289 
291  {
292  return m_start2endBindDistance;
293  }
294 
295  void JointChain::setParentSpine(unsigned short spineId, const AtomsCore::Vector3& planeNormal, double baseSize)
296  {
297  m_spineId = spineId;
298  m_spinePlaneNormal = planeNormal;
299  m_spineBaseSize = baseSize;
300  }
301 
303  {
304  return m_spinePlaneNormal;
305  }
306 
307  const unsigned int JointChain::spineJointId() const
308  {
309  return m_spineId;
310  }
311 
312  const double JointChain::spineBaseSize() const
313  {
314  return m_spineBaseSize;
315  }
316 }
JointChain class.
Definition: JointChain.h:31
const std::string & name() const
Gets the jointChain name.
Definition: JointChain.impl.h:10
const unsigned int spineJointId() const
Get spine joint id.
Definition: JointChain.impl.h:307
void setIsEffector(bool isEffector)
Sets if this chain is effector.
Definition: JointChain.impl.h:160
unsigned short numSkeletalJointIds() const
Gets the number of joints in the skeleton between start and end (both included)
Definition: JointChain.impl.h:85
void setForceUseFabrik(bool useFabrik)
Sets if this chain computes forced fabrik.
Definition: JointChain.impl.h:180
double start2endBindDistance() const
Gets distance from start to end in bind pose.
Definition: JointChain.impl.h:290
void setForceOrientEnd(bool orientEnd)
Sets if this chain orients the end joint after IK solver.
Definition: JointChain.impl.h:190
unsigned short pelvisId() const
Gets the pelvis id.
Definition: JointChain.impl.h:265
unsigned short footTip() const
Gets the footTip.
Definition: JointChain.impl.h:245
unsigned short footIk() const
Gets the foot ik.
Definition: JointChain.impl.h:255
bool isConnectedToParent() const
Gets if this chain is directly connected to parent joint chain.
Definition: JointChain.impl.h:115
const JointChain * parent() const
Gets the parent joint chain.
Definition: JointChain.impl.h:95
void setHasFootTip(bool hasFoot)
Sets if this chain contains foot ik.
Definition: JointChain.impl.h:200
void setIsConnectedToParent(bool isConnected)
Sets if this chain is directly connected to parent joint chain.
Definition: JointChain.impl.h:120
void setJoint(const Joint &joint, unsigned short i)
Sets the joint at index i.
Definition: JointChain.impl.h:60
const JointPtr start() const
Gets the start joint.
Definition: JointChain.impl.h:105
void setHasFootIk(bool hasFootIk)
Sets if this chain contains foot tip.
Definition: JointChain.impl.h:210
void setIsCenter(bool isCenter)
Sets if this chain is centered.
Definition: JointChain.impl.h:170
bool isSpine() const
Gets if this chain is a spine.
Definition: JointChain.impl.h:135
unsigned short id() const
Gets the jointChain id.
Definition: JointChain.impl.h:30
bool isLimb() const
Gets if this chain is a limb.
Definition: JointChain.impl.h:145
double length() const
Gets length of the chain.
Definition: JointChain.impl.h:275
AtomsCore::Vector3 start2endBindVector() const
Gets distance vector from start to end in bind pose.
Definition: JointChain.impl.h:285
bool isEffector() const
Gets if this chain is a effector.
Definition: JointChain.impl.h:155
Joint & joint(unsigned short i)
Gets a joint.
bool hasFootIk() const
Gets if this chain contains foot ik.
Definition: JointChain.impl.h:205
AtomsCore::Vector3 poleVector() const
Gets this chain pole vector.
Definition: JointChain.impl.h:235
const double spineBaseSize() const
Get spine joint id.
Definition: JointChain.impl.h:312
const JointPtr end() const
Gets the end joint.
Definition: JointChain.impl.h:110
void setParentSpine(unsigned short spineJointId, const AtomsCore::Vector3 &planeNormal, double baseSize)
Set parent spine information.
Definition: JointChain.impl.h:295
void setPoleVector(AtomsCore::Vector3 poleVector)
Sets this chain pole vector.
Definition: JointChain.impl.h:240
void setHasPelvis(bool hasPelvis)
Sets if this chain contains pelvis.
Definition: JointChain.impl.h:220
bool isRoot() const
Gets if this chain is root.
Definition: JointChain.impl.h:125
bool hasPoleVector() const
Gets if this chain has pole vector.
Definition: JointChain.impl.h:225
void setId(unsigned short id)
Sets the jointChain id.
Definition: JointChain.impl.h:35
bool hasFootTip() const
Gets if this chain contains foot tip.
Definition: JointChain.impl.h:195
void setJointId(unsigned short id, unsigned short i)
Sets the joint at index i.
Definition: JointChain.impl.h:65
unsigned short numIkJoints() const
Gets the number of joints available for IK solvers.
Definition: JointChain.impl.h:80
const std::vector< unsigned short > & ikJointIds() const
Gets the vector of joint ids in skeleton which are available for IK solvers.
Definition: JointChain.impl.h:45
void setIsSpine(bool isSpine)
Sets if this chain is spine.
Definition: JointChain.impl.h:140
void setFootTip(unsigned short footTip)
Sets the footTip.
Definition: JointChain.impl.h:250
const std::string & fullName() const
Gets the jointChain full name.
Definition: JointChain.impl.h:20
void setIkJointIds(std::vector< unsigned short > ikIds)
Sets the joint ids vector.
Definition: JointChain.impl.h:70
bool hasPelvis() const
Gets if this chain contains pelvis.
Definition: JointChain.impl.h:215
void setPelvisId(unsigned short pelvisId)
Sets the pelvis id.
Definition: JointChain.impl.h:270
const std::vector< unsigned short > & skeletalJointIds() const
Gets the vector of joint ids in skeleton between start and end (both included)
Definition: JointChain.impl.h:50
bool forceOrientEnd() const
Gets if this chain orients the end joint after IK solver.
Definition: JointChain.impl.h:185
void setFullName(const std::string &fullName)
Sets the jointChain full name.
Definition: JointChain.impl.h:25
unsigned short numJoints() const
Gets the number of joints.
Definition: JointChain.impl.h:75
void setIsRoot(bool isRoot)
Sets if this chain is root.
Definition: JointChain.impl.h:130
void setIsLimb(bool isLimb)
Sets if this chain is limb.
Definition: JointChain.impl.h:150
void setParent(JointChain &parent)
Refresh pointer to the parent joint chain.
Definition: JointChain.impl.h:100
void setFootIk(unsigned short footIk)
Sets the foot ik.
Definition: JointChain.impl.h:260
const std::vector< unsigned short > & jointIds() const
Gets the joint ids in skeleton.
Definition: JointChain.impl.h:90
unsigned short jointId(unsigned short i) const
Gets the id in skeleton of the joint at index i.
Definition: JointChain.impl.h:40
bool forceUseFabrik() const
Gets if this chain computes forced fabrik.
Definition: JointChain.impl.h:175
void setName(const std::string &name)
Sets the jointChain name.
Definition: JointChain.impl.h:15
const AtomsCore::Vector3 & spinePlaneNormal() const
Get spine plane normal.
Definition: JointChain.impl.h:302
const BindData & bindData(unsigned short i) const
Gets the bind data of the joint at index i.
Definition: JointChain.impl.h:55
void setLength(double len)
Set length of the chain.
Definition: JointChain.impl.h:280
void setHasPoleVector(bool hasPoleVector)
Sets if this chain has pole vector.
Definition: JointChain.impl.h:230
bool isCenter() const
Gets if this chain is centered.
Definition: JointChain.impl.h:165
Joint class.
Definition: Joint.h:30
unsigned short id() const
Gets the joint id.
Definition: Joint.impl.h:20
AtomsCore namespace.
Definition: Agent.h:344
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Definition: JointChain.h:36