Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Util.cpp
00001 #include "Util.h" 00002 00003 int clampInt(int value, int min, int max) 00004 { 00005 if (value < min) 00006 return min; 00007 else if (value > max) 00008 return max; 00009 00010 return value; 00011 } 00012 00013 float clampFloat(float value, float min, float max) 00014 { 00015 if (value < min) 00016 return min; 00017 else if (value > max) 00018 return max; 00019 00020 return value; 00021 } 00022 /* 00023 float abs(float value) 00024 { 00025 if(value < 0) 00026 return ((-1)*value); 00027 00028 return value; 00029 } 00030 */ 00031 float norm(float val1, float val2, float val3) 00032 { 00033 return sqrt(pow(val1,2)+pow(val2,2)+pow(val3,2)); 00034 }
Generated on Tue Jul 19 2022 01:26:58 by
1.7.2