MCPcopy Create free account
hub / github.com/VCVRack/Rack / rescale

Function rescale

include/math.hpp:151–153  ·  view source on GitHub ↗

Rescales `x` from the range `[xMin, xMax]` to `[yMin, yMax]`. */

Source from the content-addressed store, hash-verified

149/** Rescales `x` from the range `[xMin, xMax]` to `[yMin, yMax]`.
150*/
151inline float rescale(float x, float xMin, float xMax, float yMin, float yMax) {
152 return yMin + (x - xMin) / (xMax - xMin) * (yMax - yMin);
153}
154
155/** Linearly interpolates between `a` and `b`, from `p = 0` to `p = 1`.
156*/

Callers 8

rescalefFunction · 0.70
toScaledMethod · 0.50
fromScaledMethod · 0.50
randomizeMethod · 0.50
onChangeMethod · 0.50
onDragMoveMethod · 0.50
onButtonMethod · 0.50
minBlepImpulseFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected