binviz
binviz copied to clipboard
logarithic scale inefficiency and visualization techniques
This code
float max = 0;
for (size_t y = 0; y < MAP_SIZE; ++y) {
for (size_t x = 0; x < MAP_SIZE; ++x) {
float f = 0.0f;
if (map[y][x] > 0) f = logf(map[y][x]);
if (f > max) max = f;
}
}
is equivalent of taking the logarithm of max(map) since the logarithm is a monotonic increasing function. So the equivalent code would be:
float logmax = 0.0;
size_t max = 0;
for (size_t y = 0; y < MAP_SIZE; ++y) {
for (size_t x = 0; x < MAP_SIZE; ++x) {
if (map[y][x] > max) max = map[y][x];
}
}
if(max > 0) logmax = logf(max);
Also I'm researching better scales to be used for example https://en.wikipedia.org/wiki/Histogram_equalization to see better the details of the digraph, it would be a good starting point for another tsoding session