i finally solved all my problems. the code runs perfect. sorts the cellular automata points. as input you need a list of 3d CA grid-points. the code looks for all points with a neighbor directly in front. outputs 2 lists. a with neighbors in front and b without.
i have attached a final screenshot, a rhino testfile with ca points and the final definition.
this is the code:
'Declare and Initialize data
Dim i As Integer = 0
Dim j As Integer = 0
Dim pts_count As Integer = pts.Count() - 1
Dim new_ptsA As New List(Of On3dPoint)
Dim new_ptsB As New List(Of On3dPoint)
Dim temp_pt1 As On3dPoint
Dim c As Integer = 0
'Loop through base points
For i = 0 To pts_count
c = 0
For j = 0 To pts_count
If pts(j).x = pts(i).x And pts(j).z = pts(i).z And pts(j).y = pts(i).y - 10 Then
Print("neighbor in front")
temp_pt1 = pts(i)
new_ptsA.Add(temp_pt1)
c = 1
End If
Next
If c = 0 Then
Print("NO neighbor in front")
temp_pt1 = pts(i)
new_ptsB.Add(temp_pt1)
End If
Next
'Assign new points
A = new_ptsA
B = new_ptsB
be aware that the code assumes a grid width and depth of 10x10.
volker.
Tags: