DFGH

Dependents:   Trancieverdror

Files at this revision

API Documentation at this revision

Comitter:
noamnahum
Date:
Tue Jan 07 08:59:06 2020 +0000
Parent:
1:dad975e2e150
Commit message:
mP

Changed in this revision

Map.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r dad975e2e150 -r 895b3a247932 Map.cpp
--- a/Map.cpp	Wed Sep 28 04:02:59 2016 +0200
+++ b/Map.cpp	Tue Jan 07 08:59:06 2020 +0000
@@ -10,5 +10,12 @@
 
 float Map::Calculate(float inVal)
 {
-  return ( (inVal - _inMin)*(_outMax - _outMin)/(_inMax - _inMin) + _outMin );
+    float rval = (inVal - _inMin)*(_outMax - _outMin)/(_inMax - _inMin) + _outMin;
+    if (rval <_outMin) {
+        rval = _outMin;
+        }
+    if (rval > _outMax) {
+        rval = _outMax;
+        }
+  return rval;
 }