A Typical Planning Pattern via Processing

Jay Zhengzhe Jia
Data Mining the City
3 min readSep 17, 2018
# Datamining the City 
# Assignment 1

The story starts with a phenomenon in China where recently rapid development leads to the vast need to build new residential areas as quick as possible. Take into consideration people’s preference, local regulations and the construction level, planning and design companies have all formed their own commonly used plans.

This my original sketch:

This design consists of basic residential units, road grids and central greenlands, all of which are typical design features used in China.

The key word of this design is the pattern. It should be useful and can be quickly duplicated. So I use variables to control the size.

It should be like this:

the process of spread

The rules are simple:

1) create n*n residential blocks of equal size and creat central lands at the corner of every four blocks

2) build houses of different sizes within blocks

3) the organization of houses should depend on its block’s shape and the combination of houses should show some variations

4) the scale of the whole residential area can be easily changed

code:

def setup():
size(1000, 1000)
background(0)

global blocksPerSide, roadW, blockSize, houseSize, L, C

blocksPerSide = 10
roadW = 1000 / (11 * blocksPerSide + 1) # assuming that block size is 10 times of the road wedith
blockSize = roadW * 10
houseSize = blockSize / 4
L = []
C = []

for n in range(blocksPerSide) :
item = (n +1) * roadW + n * blockSize
center = (1.5 + n) * roadW + (n + 1) * blockSize
L.append(item)
if n < blocksPerSide - 1 :
C.append(center)
def draw():
background(255)
stroke(0)
strokeWeight(1)
blocksPerSide = mouseX // blockSize

# build street blocks
for n in range(blocksPerSide) :
xCor = L[n]
for m in range(blocksPerSide) :
fill(155, 255, 155)
yCor = L[m]
rect(xCor, yCor, blockSize, blockSize)

# build housed within this block
fill(0)

#build the middle row
r = random(3)
if r < 1:
rect(xCor+houseSize/4, yCor+(blockSize-houseSize)/2, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+(blockSize-houseSize)/2, houseSize, houseSize)
rect(xCor+houseSize*2.75, yCor+(blockSize-houseSize)/2, houseSize, houseSize)
elif r < 2:
rect(xCor+houseSize/4, yCor+(blockSize-houseSize)/2, houseSize*2.25, houseSize)
rect(xCor+houseSize*2.75, yCor+(blockSize-houseSize)/2, houseSize, houseSize)
else:
rect(xCor+houseSize/4, yCor+(blockSize-houseSize)/2, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+(blockSize-houseSize)/2, houseSize*2.25, houseSize)

#build the upper row
if m == 0 :
r = random(3)
if r < 1:
rect(xCor+houseSize/4, yCor+houseSize/4, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize/4, houseSize, houseSize)
elif r < 2:
rect(xCor+houseSize/4, yCor+houseSize/4, houseSize*2.25, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize/4, houseSize, houseSize)
else:
rect(xCor+houseSize/4, yCor+houseSize/4, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize*2.25, houseSize)
elif n == 0:
r = random(2)
if r < 1:
rect(xCor+houseSize/4, yCor+houseSize/4, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize, houseSize)
else:
rect(xCor+houseSize/4, yCor+houseSize/4, houseSize*2.25, houseSize)
elif n == blocksPerSide-1:
r = random(2)
if r < 1:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize/4, houseSize, houseSize)
else:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize*2.25, houseSize)
else:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize/4, houseSize, houseSize)

#build the last row
if m == blocksPerSide-1:
r = random(3)
if r < 1:
rect(xCor+houseSize/4, yCor+houseSize*2.75, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize*2.75, houseSize, houseSize)
elif r < 2:
rect(xCor+houseSize/4, yCor+houseSize*2.75, houseSize*2.25, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize*2.75, houseSize, houseSize)
else:
rect(xCor+houseSize/4, yCor+houseSize*2.75, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize*2.25, houseSize)
elif n == 0:
r = random(2)
if r < 1:
rect(xCor+houseSize/4, yCor+houseSize*2.75, houseSize, houseSize)
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize, houseSize)
else:
rect(xCor+houseSize/4, yCor+houseSize*2.75, houseSize*2.25, houseSize)
elif n == blocksPerSide-1:
r = random(2)
if r < 1:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize, houseSize)
rect(xCor+houseSize*2.75, yCor+houseSize*2.75, houseSize, houseSize)
else:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize*2.25, houseSize)
else:
rect(xCor+(blockSize-houseSize)/2, yCor+houseSize*2.75, houseSize, houseSize)


# build public greenlands
for n in range(blocksPerSide - 1) :
xCorCircle = C[n]
for m in range(blocksPerSide - 1) :
yCorCircle = C[m]
fill(255)
ellipse(xCorCircle, yCorCircle, blockSize - 3*roadW,blockSize - 3*roadW)
fill(70, 200, 70)
ellipse(xCorCircle, yCorCircle, blockSize/2, blockSize/2)

Variables are defined at the beginning, making changing the scale an easy thing. However, the drawing part of the code should be simplified.

--

--