Use alternate behavior in presence of NaNs

This commit is contained in:
Steven Robertson 2012-03-18 17:29:02 -07:00
parent ea43e312e4
commit 460387ef91

View File

@ -206,16 +206,28 @@ iter(uint64_t out_ptr, uint64_t atom_ptr,
bool fuse = false; bool fuse = false;
int last_xf_used = 0; int last_xf_used = 0;
// This condition checks for large numbers, Infs, and NaNs. // If there is a NaN at the start of this set of iterations, it's usually
if (!(-(fabsf(x) + fabsf(y)) > -1.0e6f)) { // the signal that this is the first iter to use this point data, so reset
// and run without writeback to stabilize the trajectory.
if (!isfinite(fabsf(x) + fabsf(y))) {
x = mwc_next_11(rctx); x = mwc_next_11(rctx);
y = mwc_next_11(rctx); y = mwc_next_11(rctx);
color = mwc_next_01(rctx); color = mwc_next_01(rctx);
fuse = true; fuse = true;
} }
// TODO: link up with FUSE, etc
for (int round = 0; round < 256; round++) { for (int round = 0; round < 256; round++) {
// If we're still getting NaNs, the flame is probably divergent. The
// correct action would be to allow the NaNs to be filtered out.
// However, this deviates from flam3 behavior, and makes it difficult
// to correct a flame (manually or programmatically) by editing
// splines, since incremental improvements won't be visible until the
// system is sufficiently convergent. We reset but do *not* set fuse.
if (!isfinite(fabsf(x) + fabsf(y))) {
x = mwc_next_11(rctx);
y = mwc_next_11(rctx);
color = mwc_next_01(rctx);
}
{{if chaos_used}} {{if chaos_used}}