Ignition Common

API Reference

4.4.0
SkeletonNode.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_COMMON_SKELETON_NODE_HH_
18 #define IGNITION_COMMON_SKELETON_NODE_HH_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/utils/ImplPtr.hh>
25 
27 #include <ignition/common/graphics/Export.hh>
28 
29 namespace ignition
30 {
31  namespace common
32  {
35  class IGNITION_COMMON_GRAPHICS_VISIBLE SkeletonNode
36  {
38  public: enum SkeletonNodeType {NODE, JOINT};
39 
42  public: explicit SkeletonNode(SkeletonNode *_parent);
43 
49  public: SkeletonNode(SkeletonNode *_parent,
50  const std::string &_name,
51  const std::string &_id,
52  const SkeletonNodeType _type = JOINT);
53 
55  public: virtual ~SkeletonNode();
56 
59  public: void Name(const std::string &_name);
60 
63  public: std::string Name() const;
64 
67  public: void Id(const std::string &_id);
68 
71  public: std::string Id() const;
72 
75  public: void SetType(const SkeletonNodeType _type);
76 
79  public: bool IsJoint() const;
80 
85  public: void SetTransform(const math::Matrix4d &_trans,
86  const bool _updateChildren = true);
87 
92  public: void SetModelTransform(const math::Matrix4d &_trans,
93  const bool _updateChildren = true);
94 
96  public: void UpdateChildrenTransforms();
97 
100  public: void SetInitialTransform(const math::Matrix4d &_trans);
101 
105  public: void Reset(const bool _resetChildren);
106 
108  public: math::Matrix4d Transform() const;
109 
112  public: void SetParent(SkeletonNode *_parent);
113 
116  public: SkeletonNode *Parent() const;
117 
120  public: bool IsRootNode() const;
121 
124  public: void AddChild(SkeletonNode *_child);
125 
128  public: unsigned int ChildCount() const;
129 
133  public: SkeletonNode *Child(const unsigned int _index) const;
134 
138  public: SkeletonNode *ChildByName(const std::string &_name) const;
139 
143  public: SkeletonNode *ChildById(const std::string &_id) const;
144 
147  public: void Handle(const unsigned int _h);
148 
151  public: unsigned int Handle() const;
152 
155  public: void SetInverseBindTransform(const math::Matrix4d &_invBM);
156 
159  public: math::Matrix4d InverseBindTransform() const;
160 
165  public: bool HasInvBindTransform() const;
166 
169  public: math::Matrix4d ModelTransform() const;
170 
173  public: std::vector<NodeTransform> RawTransforms() const;
174 
177  public: unsigned int RawTransformCount() const;
178 
182  public: NodeTransform RawTransform(const unsigned int _i) const;
183 
186  public: void AddRawTransform(const NodeTransform &_t);
187 
190  public: std::vector<NodeTransform> Transforms() const;
191 
193  IGN_UTILS_IMPL_PTR(dataPtr)
194  };
195 
197  }
198 }
199 #endif
std::map< unsigned int, SkeletonNode * > SkeletonNodeMap
Definition: SkeletonNode.hh:196
STL class.
STL class.
A transformation node.
Definition: NodeTransform.hh:36
STL class.
SkeletonNodeType
enumeration of node types
Definition: SkeletonNode.hh:38
A skeleton node.
Definition: SkeletonNode.hh:35
Forward declarations for the common classes.