pulse
This function uses two steps to form a pulse. Output is high (true) when the given value t is between a and b.
- pulse(a, b, x)
- Returns 1 when (a <= x <= b), 0 otherwise.
COPY/// @func pulse(a, b, x)
///
/// @desc Returns 1 when (a <= x <= b), 0 otherwise.
///
/// @param {real} a lower bound
/// @param {real} b upper bound
/// @param {real} x value
///
/// @return {real} 0 or 1
///
/// GMLscripts.com/license
function pulse(a, b, x)
{
if (a <= x && x <= b) return 1;
return 0;
}
Contributors: xot
GitHub: View · Commits · Blame · Raw