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

That magic number #2

Open
Fishrock123 opened this issue Oct 16, 2017 · 4 comments
Open

That magic number #2

Fishrock123 opened this issue Oct 16, 2017 · 4 comments

Comments

@Fishrock123
Copy link

Where's the magic number 0.70710678118654757 from?

@rreusser
Copy link
Member

1 / sqrt(2) ~ 0.70710678118

@mattdesl
Copy link
Contributor

mattdesl commented Oct 16, 2017 via email

@rreusser
Copy link
Member

rreusser commented Oct 16, 2017

I was wondering the same when I played with this. (If I understand correctly, that is,) is there a big difference in practice between sqrt(0.5) * (|dfdx| + |dfdy|) and sqrt(dfdx^2 + dfdy^2)? I guess the former just introduces a bit of directional bias in the amount of antialiasing. Of course they're rectangular pixels though, so that's not necessarily a bad thing. And the absolute value is probably faster than a sqrt.

@Fishrock123
Copy link
Author

Fishrock123 commented Nov 29, 2017

float afwidth = fwidth(dist) * 0.5;

This does appear to look a bit cleaner to me, fwiw. Edit: maybe not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants