long to float variables
Fork of reScale by
reScale.cpp@2:1715e312322b, 2018-05-16 (annotated)
- Committer:
- Marcelocostanzo
- Date:
- Wed May 16 19:48:12 2018 +0000
- Revision:
- 2:1715e312322b
- Parent:
- 1:ebb951147122
funcionando
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
c0ax | 0:04d95412bcd3 | 1 | #include "reScale.h" |
c0ax | 0:04d95412bcd3 | 2 | |
Marcelocostanzo | 2:1715e312322b | 3 | reScale::reScale(float in_min, float in_max, float out_min, float out_max) : |
c0ax | 0:04d95412bcd3 | 4 | _inMin (in_min),_inMax(in_max),_outMin (out_min),_outMax (out_max) |
c0ax | 0:04d95412bcd3 | 5 | { |
c0ax | 0:04d95412bcd3 | 6 | |
c0ax | 0:04d95412bcd3 | 7 | } |
c0ax | 1:ebb951147122 | 8 | |
Marcelocostanzo | 2:1715e312322b | 9 | float reScale::from(float value) |
c0ax | 0:04d95412bcd3 | 10 | { |
c0ax | 0:04d95412bcd3 | 11 | return (value - _inMin) * (_outMax - _outMin) / (_inMax - _inMin) + _outMin; |
c0ax | 0:04d95412bcd3 | 12 | } |