MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / logMap

Function logMap

src/DisplayManager.cpp:1942–1958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1940}
1941
1942float logMap(float x, float in_min, float in_max, float out_min, float out_max, float mid_point_out)
1943{
1944 if (x < in_min)
1945 return out_min;
1946 if (x > in_max)
1947 return out_max;
1948 float scale = (mid_point_out - out_min) / log(in_max - in_min + 1);
1949 if (x <= (in_max + in_min) / 2.0)
1950 {
1951 return scale * log(x - in_min + 1) + out_min;
1952 }
1953 else
1954 {
1955 float upper_scale = (out_max - mid_point_out) / log(in_max - (in_max + in_min) / 2.0 + 1);
1956 return upper_scale * log(x - (in_max + in_min) / 2.0 + 1) + mid_point_out;
1957 }
1958}
1959
1960void DisplayManager_::gammaCorrection()
1961{

Callers 1

gammaCorrectionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected