My LoRaWAN Signal Mapping MSc summer project. This is a copy of the actual repository with personal information removed.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
647 B

"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
}
/**
* Clamps a value to fit within the specified bounds.
* @param {number} value The number to clamp.
* @param {number} min The minimum value the number can be.
* @param {number} max The maximum value the number can be.
* @return {number} The clamped number.
*/
function clamp(value, min, max) {
if(value > max) return max;
if(value < min) return min;
return value;
}
export { normalise, clamp };