Skip to content
Snippets Groups Projects
Commit 76b24b82 authored by armar4-demo's avatar armar4-demo
Browse files

added limitTo function for vectors

parent 9b27d2cd
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,16 @@ namespace armarx
return sign * std::min<double>(fabs(value), absThreshold);
}
static Eigen::Vector3f LimitTo(Eigen::Vector3f val, float maxNorm)
{
float norm = val.norm();
if (norm > maxNorm)
{
return val / norm * maxNorm;
}
return val;
}
static bool CheckMinMax(int min, int max, int value)
{
return value >= min && value <= max;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment