# Intro to Python Scripting: 17 Simple Growth 01

Software:
Tag:
Video Duration:
15 minutes
Author:
Zach Downey

In this tutorial we will be taking a look at a simple growth algorithm. We begin with a starting point and then create a random point within a specific range. we then find a vector from the first point and the newly created point. We take that vector and unitize it and create a new vector that is the result of the original vector minus the unitized version of the vector. This new vector becomes our translation vector which we use to move the last point within 1 unit of the closest point in our set of points. We then add this new point to the points to search from and begin the process over again. Whew! That sounds complicated but it's really not. I created a few diagrams that hopefully help explain it a bit better, and I walk through them before we do any code so that we know where to begin.

```import rhinoscriptsyntax as rs
import random

def placePt(x_range,y_range,z_range):
x = random.uniform(0,x_range)
y = random.uniform(0,y_range)
z = random.uniform(0,z_range)
pt = [x,y,z]
return pt

ptZero = [50,50,0]
pts = []
pts.append(ptZero)

for i in range(0,100):
index = rs.PointArrayClosestPoint(pts,pt)
cp = pts[index]
vect = rs.VectorCreate(cp,pt)
unitVect = rs.VectorUnitize(vect)
subVect = vect - unitVect
newPt = rs.MoveObject(pt,subVect)