Alec Arce
/
PROJECT
Yo here you go kemal
Map.cpp@0:0dd4a69da379, 2020-12-05 (annotated)
- Committer:
- xalec
- Date:
- Sat Dec 05 06:19:45 2020 +0000
- Revision:
- 0:0dd4a69da379
CS 435
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xalec | 0:0dd4a69da379 | 1 | #include "Map.hpp" |
xalec | 0:0dd4a69da379 | 2 | |
xalec | 0:0dd4a69da379 | 3 | Map::Map(int inMin, int inMax, int outMin, int outMax) |
xalec | 0:0dd4a69da379 | 4 | { |
xalec | 0:0dd4a69da379 | 5 | _inMin = inMin; |
xalec | 0:0dd4a69da379 | 6 | _inMax = inMax; |
xalec | 0:0dd4a69da379 | 7 | _outMin = outMin; |
xalec | 0:0dd4a69da379 | 8 | _outMax = outMax; |
xalec | 0:0dd4a69da379 | 9 | } |
xalec | 0:0dd4a69da379 | 10 | |
xalec | 0:0dd4a69da379 | 11 | int Map::Calculate(int inVal) |
xalec | 0:0dd4a69da379 | 12 | { |
xalec | 0:0dd4a69da379 | 13 | return ((inVal - _inMin)*(_outMax - _outMin)/(_inMax - _inMin) + _outMin ); |
xalec | 0:0dd4a69da379 | 14 | } |