Skip to content

logarithic scale inefficiency and visualization techniques #2

@FattiMei

Description

@FattiMei

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions