/* Marla Mayerson */ #include "rmannotes.sl" displacement rectd(float freq = 9, Km = 0.05) { float magnitude, layer_mag; float fuzz = 0.15; float left, right, top, bottom; float d; point center; float radius; float ss, tt; /* init */ magnitude = 0; /* layer 1 - the rect */ /* rotate 45 degrees and repeat pattern 'freq" times horz,vert */ rotate2d(s, t, radians(45), .5, .5, ss, tt); ss = repeat(ss, 9); tt = repeat(tt, 9); left = 0.05; right = 0.75; /* rectangle sides */ top = 0.1; bottom = 0.7; layer_mag = pulse(left, right, fuzz, ss) * pulse(top, bottom, fuzz, tt); magnitude += layer_mag; /* layer 2 - disk */ ss = repeat(s, 3); tt = repeat(t, 3); fuzz = 0.015; center = (0.5, 0.5, 0); /* location of center of disk */ radius = 0.25; /* radius of disk */ d = distance(center, (ss, tt, 0)); layer_mag = 1 - smoothstep(radius - fuzz, radius + fuzz, d); magnitude += layer_mag; /* displace */ P += -Km * magnitude * normalize(N); N = calculatenormal(P); }