Clamp result

This commit is contained in:
hodasemi 2018-06-09 13:57:08 +02:00
parent 3a1e42dbbd
commit 032df8fb3a
2 changed files with 3 additions and 1 deletions

View file

@ -97,6 +97,8 @@ void AtomicRotationTransform::optimize_value(const Vec3 &local_vector, const Vec
if (inverse)
result = -result;
result = std::clamp(result, lower_limit, upper_limit);
set_value(result);
}

View file

@ -125,7 +125,7 @@ void IKViewer::optimize()
{
for (auto it = kinematic_chain.rbegin(); it != kinematic_chain.rend(); i++)
{
//it->optimize_value(TODO: local_vector, target, inverse);
it->optimize_value(/*local_vector*/, target_position);
}
current_endeffector_matrix.identity();