hrhwilliams / noisy

c++ implementation of 2D perlin and simplex noise + a PDF writer
1 stars 0 forks source link

Rename variables in noise generator functions #2

Open hrhwilliams opened 5 years ago

hrhwilliams commented 5 years ago

these names are from the original algorithms, and aren't very clear:

    int bx0, bx1, by0, by1, b00, b10, b01, b11;
    float rx0, rx1, ry0, ry1, sx, sy, a, b, t, u, v;
    int i, j, k;
    float u, v, w, U, V, W, Hi, Lo;

names that express intention like this would be preferable:

for (int i = 0; i < octaves; i++) {
    float sample_x = (x / scale) * frequency;
    float sample_y = (y / scale) * frequency;
    float noise = this->generator(sample_x, sample_y);
    noise_height += noise * amplitude;

    amplitude *= persistence;
    frequency *= lacunarity;
}
neilrush commented 5 years ago

ill do my best