result = 0; point stspace = point((scale*s)+offset,(scale*(1-t))+offset,0); uniform float i; float x[100],y[100],dx,dy,line[100],defuzz,newlength,dist; point p[100]; defuzz = 0; //initialize first variables x[0] = x1; x[1] = x2; y[0] = y1; y[1] = y2; p[0] = point(x[0],y[0],0); p[1] = point(x[1],y[1],0); line[0] = ptlined(p[0],p[1],stspace); for (i = 1; i <= 98; i += 1) { newlength = cellnoise(i); dx = x[i]-x[i-1]; dy = y[i]-y[i-1]; dist = sqrt(pow(dx,2)+pow(dy,2)); dx /= dist; dy /= dist; //perpendicular points, left and right x[i+1] = x[i] - (newlength/2)*dy; y[i+1] = y[i] + (newlength/2)*dx; p[i+1] = point(x[i+1],y[i+1],0); line[0] = ptlined(p[0],p[1],stspace); line[i] = ptlined(p[i],p[i+1],stspace); defuzz += 1-smoothstep(width-fuzz,width+fuzz,line[i]); result = defuzz; }
Monday, May 3, 2010
substrate in rsl, version 1
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment