Skip to content

Commit

Permalink
changed definitions.hpp to enums.hpp and added utilityfunctions.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwatkins committed Aug 16, 2017
1 parent 29a4ee2 commit 741675a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/definitions/include/definitions/utilityfunctions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace AUTOCHAIR
{

// maps inVal from the range of inMin-inMax to the range of outMin-outMax
int mapRange(int inVal, int inMin, int inMax, int outMin, int outMax)
{
int outVal = outMin + ((outMax-outMin) * 100 * (inVal-inMin) / (inMax-inMin)) / 100;

if(outVal > outMax)
{
outVal = outMax;
}
else if (outVal < outMin)
{
outVal = outMin;
}

return outVal;
}

}
Binary file modified src/lib-definitions.zip
Binary file not shown.

0 comments on commit 741675a

Please sign in to comment.