This is a super easy script that fakes the turing pattern that guy did
### Super Easy Fake Turing Pattern
### Dennis Goff, 2012.04.26
### Please reference properly when using (parts of) this script :P
import rhinoscriptsyntax as rs
import math
import random
srf = rs.GetObject('select srf')
uDom = rs.SurfaceDomain(srf,0)
vDom = rs.SurfaceDomain(srf,1)
rs.EnableRedraw(False)
uStep = 30
vStep = 30
srfPts = []
normPts = []
for i in rs.frange(uDom[0],uDom[1],(uDom[1]-uDom[0])/uStep):
for j in rs.frange(vDom[0],vDom[1],(vDom[1]-vDom[0])/vStep):
pt = rs.EvaluateSurface(srf,i,j)
norm = rs.SurfaceNormal(srf,(i,j))
norm = rs.VectorUnitize(norm)
norm = rs.VectorScale(norm,random.random()*15)
norm = rs.VectorAdd(norm,pt)
normPt = rs.AddPoint(norm)
normPts.append(normPt)
srfPts.append(pt)
rs.AddPoints(srfPts)
print len(normPts)
count = uStep, vStep+1
rs.AddSrfPtGrid(count,normPts)
rs.EnableRedraw(True)
No comments:
Post a Comment