Pages

Saturday, 17 July 2010

Dissertation-3 (Sunlight test in meta-Cellular automata)



a snapshot showing the colliding mechanism between particles and tested cubes

The basic logic is to simulating process of sunlight particles colliding the selected tested cubes---when particles with predetermined moving vector meet the surfaces of cubes, it will changing its moving vectors to the mirroring direction with continuous movement until it is beyond the boundaries of cubes . The aim of this experiment is to achieve the accurate calculation of how much sunlight each individual of cubes can get during the predetermined period of one day, which is similar to using the function of Ecotect, while here I just running a script inside Rhino with more convenient without losing accuracy.

Below is the main structures of this script:

Dim sunLocation,originPt,arrPartNew(),ini_vect,arrObjects,arrParticles,generation, scores
Dim arrSrf,normal_vect,testpoint,cenPt,dist
.....................
Dim i,j,p,k
.........................
For i = 0 To UBound(arrObjects)
arrPartNew(j) = Rhino.PointAdd (arrParticles, ini_vect)
arrParticles = arrPartNew(j)
...............................
For p = 0 To UBound(arrCubes)
test = testintersect(arrParticles,ini_vect,arrCubes(p))
If Not isnull(test) Then
.............................
arrSrf = rhino.ExplodePolysurfaces(arrCubes(p)
.............................
For k = 0 To UBound(arrSrf)
If rhino.IsPointOnSurface(arrSrf(k),testpoint) Then
.............................
ini_vect = rhino.VectorRotate(ini_vect,180,normal_vect)
.............................
If k>=1 And k <=4 Then
score = score +1
End If

End If
Next
End If
Next
End If