Bela
|
Functions | |
static float | map (float x, float in_min, float in_max, float out_min, float out_max) |
Linearly rescale a number from one range of values to another. More... | |
static float | constrain (float x, float min_val, float max_val) |
Constrain a number to stay within a given range. More... | |
static float | min (float x, float y) |
Returns the maximum of two numbers. More... | |
static float | max (float x, float y) |
Returns the minimum of two numbers. More... | |
Detailed Description
These are functions found in the Wiring (Arduino) language which are not directly related to I/O but are provided as a convenience.
Function Documentation
|
inlinestatic |
Linearly rescale a number from one range of values to another.
This function linearly scales values of x
such that the range in_min to in_max at the input corresponds to the range out_min to out_max at the output. Values outside this range are extrapolated.
This function behaves identically to the function of the same name in Processing. It is also similar to the corresponding function in Arduino, except that it supports floating point values.
- Parameters
-
x Input value to be mapped. in_min Lower bound of the input range. in_max Upper bound of the input range. out_min Lower bound of the output range. out_max Upper bound of the output range.
- Returns
- Rescaled value.
|
inlinestatic |
Constrain a number to stay within a given range.
This function constrains x
to remain within the range min_val to max_val. Values of x
outside this range are clipped to the edges of the range.
This function behaves identically to the function of the same name in Processing. It is also similar to the corresponding function in Arduino, except that it supports floating point values.
- Parameters
-
x Input value to be constrained. min_val Minimum possible value. max_val Maximum possible value.
- Returns
- Constrained value.
|
inlinestatic |
Returns the maximum of two numbers.
Returns the maximum of two numbers
|
inlinestatic |
Returns the minimum of two numbers.
Returns the minimum of two numbers
Generated on Fri Nov 22 2024 06:27:57 for Bela by 1.8.11