Parallel Ulam Spiral
This fancy spiral is a mathematical doodle discovered by Stanislaw Ulam (who was bored during math class.) It demonstrates an apparent ordering within the primes (the white dots) in relation to quadratic polynomials. It also relates to other spirally things like the Droste Effect and Mobius Transformations which have recently demonstrated up and coming hipness. I could not find any code for rendering it in parallel, so I wrote my own. Live Demo with Sourcecodefloat ulam_spiral(vec2 p) { float x = abs(p.x); float y = abs(p.y); bool q = x > y; x = q ? x : y; y = q ? p.x + p.y : p.x - p.y; y = abs(y) + 4. * x * x + 1.; x *= 2.; return q ? (p.x > 0. ? y - x - x : y) : (p.y > 0. ? y - x : y + x); } |