Calculate current_base_matrix
This commit is contained in:
parent
d8d3ebc4b8
commit
593dd3509f
1 changed files with 22 additions and 0 deletions
|
@ -115,6 +115,28 @@ void IKViewer::calculate_kinematic_chain(Bone *base, Bone *endeffector)
|
|||
current_bone = current_bone->get_parent();
|
||||
}
|
||||
|
||||
// calculate base transformation
|
||||
std::list<std::shared_ptr<Transform>> base_chain;
|
||||
|
||||
for (Bone *bone : base_tree)
|
||||
{
|
||||
for (int i = bone->dof_count() - 1; i >= 0; i--)
|
||||
{
|
||||
base_chain.emplace_front(bone->get_dof(i));
|
||||
}
|
||||
|
||||
Transform *tmp = new StaticTransform(bone->calculate_transform_prev_to_current_without_dofs());
|
||||
std::shared_ptr<Transform> transform = std::shared_ptr<Transform>(tmp);
|
||||
base_chain.emplace_front(transform);
|
||||
}
|
||||
|
||||
current_base_matrix.identity();
|
||||
|
||||
for (auto &transform : base_chain)
|
||||
{
|
||||
current_base_matrix = current_base_matrix * transform->calculate_matrix();
|
||||
}
|
||||
|
||||
// add all transform from endeffector to common ancestor and to reverse base
|
||||
|
||||
// state == 0 means, iterating through endeffector_tree
|
||||
|
|
Loading…
Reference in a new issue