MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / norm

Function norm

app/rcc/scripts/painter/default_template.js:93–96  ·  view source on GitHub ↗
(v, lo, hi)

Source from the content-addressed store, hash-verified

91 }
92
93 function norm(v, lo, hi) {
94 if (!Number.isFinite(v) || hi <= lo) return 0.5;
95 return Math.max(0, Math.min(1, (v - lo) / (hi - lo)));
96 }
97
98 const nx = norm(dsX.value, dsX.min, dsX.max);
99 const ny = norm(dsY.value, dsY.min, dsY.max);

Callers 2

dotestFunction · 0.85
paintFunction · 0.85

Calls

no outgoing calls

Tested by 1

dotestFunction · 0.68