CODE 1.0 — 4-HOUSE TRIANGLES

Sharvi Jain
Data Mining the City
2 min readSep 12, 2018

Guidelines:

  1. Divide the art board into two major blocks, with primary roads and secondary roads
  2. A common setback on either side of the secondary road, and one side of the primary road determines the position of the residences and the parks.
  3. The length of the diagonal of the triangular park determines the plot size of the residences along it.
def setup():
#canvas size
size(700, 700)
background(216,209,967)



def draw():
#grid
stroke(255)
strokeWeight(2)
line(50,10,50,680)
line(100,10,100,320)
line(100,360,100,680)
line(100,320,680,320)
line(100,360,680,360)
fill(255)

global houseX,houseY,i

houseX=110
houseY=310
i=70
rect(houseX,houseY,60,-60)
rect(houseX+i,houseY,60,-60)
line(houseX+2*i,houseY+10,houseX+2*i,houseY-65)

#parking lot
pushMatrix()
translate(houseX+2*i,houseY-65)
rotate(radians(-45))
line(0,0,70,0)
popMatrix()

#parks
fill(204,255,229)
stroke(204,255,229)
triangle(houseX,houseY-i,houseX+2*i-10,houseY-i,houseX,houseY-3*i+10)

#houses along the diagonal
fill(255)
stroke(255)

pushMatrix()
translate(houseX+2*i-3,houseY-i-7)
rotate(radians(-45))
rect(0,0,60,-89)
rect(0,-99,60,-89)
popMatrix()

#Lower colony code
pushMatrix()

translate(100,360)
rect(10,10,60,60)
rect(80,10,60,60)
fill(204,255,229)
stroke(204,255,229)
triangle(10,80,140,80,10,210)

#along the diagonal part2
pushMatrix()
translate(147,87)
rotate(radians(45))
fill(255)
stroke(255)
rect(0,0,60,89)
rect(0,99,60,89)
popMatrix()

line(150,0,150,75)
pushMatrix()
translate(150,75)
rotate(radians(45))
line(0,0,70,0)
popMatrix()

popMatrix()


f=createFont("Corbel",20,True)
textFont(f,15)
fill(120)
text("PARKING LOT",280,300)
text("RESIDENCES",200,100)
text("PARK",135,210)

--

--