Starbeamrainbowlabs
6dbb6c3b87
Also, we don't have any code that actually does the training itself either yet.
16 lines
366 B
JavaScript
16 lines
366 B
JavaScript
"use strict";
|
|
|
|
function normalise(value, { min : input_min, max: input_max }, { min : output_min, max: output_max }) {
|
|
return (
|
|
((value - input_min) / (input_max - input_min)) * (output_max - output_min)
|
|
) + output_min
|
|
}
|
|
|
|
function clamp(value, min, max) {
|
|
if(value > max) return max;
|
|
if(value < min) return min;
|
|
return value;
|
|
}
|
|
|
|
|
|
export { normalise, clamp };
|