ergetgetagt

Page 132

Chapter 8: Base modules

v[i][j]=rgb(0.5*(1+sin(i*ninv)),0.5*(1+cos(j*ninv)),0); image(v,(0,0),(1,1));

import palette; size(200); real fracpart(real x) {return (x-floor(x));} pair pws(pair z) { pair w=(z+exp(pi*I/5)/0.9)/(1+z/0.9*exp(-pi*I/5)); return exp(w)*(w^3-0.5*I); } int N=512; pair pair real real

a=(-1,-1); b=(0.5,0.5); dx=(b-a).x/N; dy=(b-a).y/N;

pen f(int u, int v) { pair z=a+(u*dx,v*dy); pair w=pws(z); real phase=degrees(w,warn=false); real modulus=w == 0 ? 0: fracpart(log(abs(w))); return hsv(phase,1,sqrt(modulus)); }

127


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.