Hi everyone,
Is there a way to generate multiple random walkers with trace (separate polylines) who starts from the same point but going separate random directions, with grasshopper python script?
Thanks
Hi everyone,
Is there a way to generate multiple random walkers with trace (separate polylines) who starts from the same point but going separate random directions, with grasshopper python script?
Thanks
yes
use class
and set up agents
import random as rnd
from Rhino.Geometry import Point3d as Point
class Walker():
self.vertices = []
def __init___(self,position = Point(0,0,0)):
self.position = position
def Walk(self,delta):
self.vertices.append(self.position)
self.position += self.GetDelta()
def GetDelta(self):
x,y,z = rnd.random(),rnd.random(),rnd.random()
return Point(x,y,z)
of course you’ll need to tailor the random()
calls to your need, and set up your loop to run the Walk()