This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <math.h> | |
| const float POW_CBRT = 1.0f / 3.0f; | |
| const float R_MAX = pow(0.01f, POW_CBRT); | |
| float calcR(int value) { | |
| // I = r^-3 | |
| // r = cbrt(1 / I) | |
| float I = (value / 1023.0f - 0.5f) * 2.0f; // [-1..1] | |
| float r = pow(abs(I), -POW_CBRT); |