We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
grad()
I either found a mistake in the code or there's something I don't understand here:
static float grad(int32_t hash, float x, float y) { const int32_t h = hash & 0x3F; // Convert low 3 bits of hash code const float u = h < 4 ? x : y; // into 8 simple gradient directions, const float v = h < 4 ? y : x; return ((h & 1) ? -u : u) + ((h & 2) ? -2.0f * v : 2.0f * v); // and compute the dot product with (x,y). }
in this case isn't h the low 6 bits of hash, and isn't h < 4 false most of the time?
h
hash
h < 4
The text was updated successfully, but these errors were encountered:
Yes, it has been years but I see that the code isn't in sync with the comment so I'll have to fix and test, and also read back thé reference code
Sorry, something went wrong.
Any update?
SRombauts
No branches or pull requests
I either found a mistake in the code or there's something I don't understand here:
in this case isn't
h
the low 6 bits ofhash
, and isn'th < 4
false most of the time?The text was updated successfully, but these errors were encountered: