\nCodon

Cell-f assembly

Posted in examples, tutorials by pierre forissier on December 20, 2011

Inspired by the reading of AN EVOLUTIONARY ARCHITECTURE by John Frazer and the generative toolbox.

Structure generations based on John Orton Conway’s Game of Life.  The goal is to explore the emerging resulting patterns of the genetic algorithm whilst stacking all generations. The automation requires an initial finite array of cells and a maximum number of generations. Their initial state (life or death) is randomly assigned based on an arbitrary threshold. The script calls a recursive routine that decides the state of each cell (life or death) depending on the state of their neighbours (8 in total) at the end of each iteration. In order to best approximate an infinite game board, the automation wraps at the edges.

The stacking generates unexpected & elaborate patterns in xyz directions. The search for emergent behaviours is on.

The initial script has been developed in Python for Rhino5. This version is not optimized but presents a clear function split. The sumNeighbours function is inspired from an elegant solution by algorithmicdesign.net

Code:

import rhinoscriptsyntax as rs
import math
import random

def RandomGenesis(intGridi,intGridj):
arrPt=[]
for i in range(intGridi):
arrj=[]
for j in range(intGridj):
rnd = random.random()
if rnd>0.97:# density threshold for initial cells
arrj.append(1)
else:
arrj.append(0)
arrPt.append(arrj)
return arrPt # arrPt is a list of i no. lists _ each list contains j no. elements (1s or 0s)

(more…)

Tagged with: , , ,

Cell[f] Automaton Habitat

Posted in examples by pierre forissier on December 16, 2011

A [near] perfect mathematic structure affected by a chaotic process

The variety of forms in nature seems endless. Patterns can derive from mathematical rules. Habitats can derive from patterns. The pavilion is a temporary proposal for a historic hall. It reflects new built orders and hidden rules in contrast with those of its classical backdrop. Of course, a genetic algorithm is no guarantee of beauty but the outcomes can be striking. The matrix of self assembling timber cubes expresses the invisible forces of life and death that affect each brick… each of us.


Free-form & flat quads with Rhino.Python

Posted in examples, tutorials by pierre forissier on October 5, 2011

Fossile-like structures made of flat quad panels. Panels can be assembled along their folded sides. The script works with free from surfaces (trimmed or not_see conditional minimum distance between any point evaluated within surface domain and the base surface_as per Python Primer example)

CODE:
import rhinoscriptsyntax as rs
import random #import  random module

def SurfaceQuad():
    idSurface=rs.GetObject("Select Surface",8,True,False)
    if not idSurface:return
    intCountU = rs.GetInteger("Number of panels in U direction",20,10)
    if not intCountU:return
    intCountV = rs.GetInteger("Number of panels in V direction",7,5)
    if not intCountV:return
    uDomain=rs.SurfaceDomain(idSurface,0)
    vDomain=rs.SurfaceDomain(idSurface,1)
    uStep=uDomain[1] - uDomain[0]
    uStep=uStep / intCountU
    vStep=vDomain[1] - vDomain[0]
    vStep=vStep / intCountV

    #Tolerance in between panels
    dblTolU = uStep/100
    dblTolV = dblTolU*intCountU/intCountV

    rs.EnableRedraw(False)

    for v in rs.frange(vDomain[0],vDomain[1]-vStep-vDomain[0],vStep):
        for u in rs.frange (uDomain[0],uDomain[1]-uStep-uDomain[0],uStep):
            #Evaluate panel coordinates on idSurface

(more…)

Tagged with: , ,
Follow

Get every new post delivered to your Inbox.

Join 25 other followers