mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-21 16:00:27 +00:00
fixed numerical artifacts in Nil
This commit is contained in:
parent
6ab7535088
commit
5a3a408831
@ -408,7 +408,8 @@ namespace nilv {
|
|||||||
|
|
||||||
"for(int it=0; it<50; it++) {"
|
"for(int it=0; it<50; it++) {"
|
||||||
"float w = (wmin + wmax) / 2.;"
|
"float w = (wmin + wmax) / 2.;"
|
||||||
"float z = b * b * (s + (sin(w) - w)/(cos(w) - 1.)) + w;"
|
// the formula after ':' produces visible numerical artifacts for w~0
|
||||||
|
"float z = b * b * (s + (abs(w) < .1 ? w/3. + w*w*w/90. + w*w*w*w*w/2520.: (sin(w) - w)/(cos(w) - 1.))) + w;"
|
||||||
"if(h[2] > z) wmin = w;"
|
"if(h[2] > z) wmin = w;"
|
||||||
"else wmax = w;"
|
"else wmax = w;"
|
||||||
"}"
|
"}"
|
||||||
|
Loading…
Reference in New Issue
Block a user