Skip to content

Instantly share code, notes, and snippets.

@grkvlt
Created October 15, 2017 20:08
Show Gist options
  • Save grkvlt/f014447fc70ade8351ceef51e2f8be1a to your computer and use it in GitHub Desktop.
Save grkvlt/f014447fc70ade8351ceef51e2f8be1a to your computer and use it in GitHub Desktop.
Exploring Iterated Function Systems
// Density estimation histogram
if (render.isDensity()) {
try {
density[p] = LongMath.checkedAdd(density[p], 1l);
switch (render) {
case LOG_DENSITY_BLUR:
case LOG_DENSITY_BLUR_INVERSE:
density[p] = LongMath.checkedAdd(density[p], kernel - 1);
int q = (x / kernel) + (y / kernel) * (size.width / kernel);
blur[q] = LongMath.checkedAdd(blur[q], 1);
break;
case LOG_DENSITY_POWER:
case DENSITY_POWER:
case LOG_DENSITY_POWER_INVERSE:
density[p] = (long) Math.min(((double) density[p]) * 1.01d, Long.MAX_VALUE);
break;
default:
break;
}
max = Math.max(max, density[p]);
} catch (ArithmeticException ae) { /* ignored */ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment