result = 0; point stspace = point((scale*s)+offset,(scale*(1-t))+offset,0); uniform float i,j; float x[100],y[100],x1[100],y1[100],dx,dy,dx1,dy1,line[100],line1[100],defuzz,newlength,dist,dist1; point p[100],p1[100]; defuzz = 0; //initialize first variables x[0] = vx1; x[1] = vx2; y[0] = vy1; y[1] = vy2; p[0] = point(x[0],y[0],0); p[1] = point(x[1],y[1],0); line[0] = ptlined(p[0],p[1],stspace); j = 0; for (i = 1; i <= 1; i += 1) { newlength = cellnoise(i)/2; 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 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[i] = ptlined(p[i],p[i+1],stspace); defuzz += 1-smoothstep(width-fuzz,width+fuzz,line[i]); for (j = 1; j <= 5; j += 1) { newlength = cellnoise(j*i)/2; x1[0] = x[i-1]; x1[1] = x[i]; y1[0] = y[i-1]; y1[1] = y[i]; p1[0] = point(x1[0],y1[0],0); p1[1] = point(x1[1],y1[1],0); dx1 = x1[j]-x1[j-1]; dy1 = y1[j]-y1[j-1]; dist1 = sqrt(pow(dx1,2)+pow(dy1,2)); dx1 /= dist1; dy1 /= dist1; //perpendicular points, left x1[j+1] = x1[j] + (newlength/2)*dy1; y1[j+1] = y1[j] - (newlength/2)*dx1; p1[j+1] = point(x1[j+1],y1[j+1],0); line1[j] = ptlined(p1[j],p1[j+1],stspace); defuzz += 1-smoothstep(width-fuzz,width+fuzz,line1[j]); } } result = defuzz;
Tuesday, May 4, 2010
substrate in rsl, version 2
one main branch to the left, with branching to the right at every point on the main branch. Need to add branching at EVERY iteration.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment