Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TheNextWeek: Unused variables in Perlin noise #684

Closed
Krenodeno opened this issue Aug 8, 2020 · 0 comments
Closed

TheNextWeek: Unused variables in Perlin noise #684

Krenodeno opened this issue Aug 8, 2020 · 0 comments
Assignees
Milestone

Comments

@Krenodeno
Copy link

In listing 29, function noise(), we first calculate u, v and w from p.x, p.y and p.z but then do nothing with them.

        double noise(const point3& p) const {
            auto u = p.x() - floor(p.x());
            auto v = p.y() - floor(p.y());
            auto w = p.z() - floor(p.z());

            auto i = static_cast<int>(4*p.x()) & 255;
            auto j = static_cast<int>(4*p.y()) & 255;
            auto k = static_cast<int>(4*p.z()) & 255;

            return ranfloat[perm_x[i] ^ perm_y[j] ^ perm_z[k]];
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants