Hello all,
I have been struggling to filter one array generating another that contains arrays. I have tried to do my homework and even though the dog did not eat it I haven't managed to find a solution here at the forum or by myself. It seems I have followed the same logic as the code on page 132 of the Grasshopper Primer second edition without any success on my component's output. Well the code currently is as it follows:
Sub RunScript(ByVal ArrPoints As List(Of On3dPoint), ByVal SecurityDistance As Double)
'''
A = New List (Of On3dPoint)
Dim _A As New List (Of on3dPoint)
Dim Arr2d_Columns As New ArrayList
ArrayOfColumns = New ArrayList
Dim i As Integer
For i = 0 To (ArrPoints.count - 1)
Dim CurrPt As New On3dPoint : CurrPt = ArrPoints(i)
Dim j As Integer
For j = 0 To (ArrPoints.count - 1)
Dim CheckPt As New On3dPoint : CheckPt = ArrPoints(j)
If i <> j
Dim MyDistance As Double
MyDistance = ((currPt.x - checkPt.x) ^ 2 + (currPt.y - checkPt.y) ^ 2) ^ 0.5
Dim ArrColumn As New List (Of on3dPoint)
If i = 0 Then ArrColumn.Add(CurrPt)
If MyDistance > SecurityDistance Then
Dim MyDistanceX As Double
MyDistanceX = Abs(currPt.x - checkPt.x)
If MyDistanceX < SecurityDistance Then ArrColumn.Add(CheckPt)
End If
Arr2d_Columns.Add(ArrColumn)
End If
Next
Next
ArrayOfColumns = Arr2d_Columns
'''
End Sub
#Region "Additional methods and Type declarations"
#End Region
End Class
It is still missing a couple of comparisons to be built, anyway the issue that I want to stress here is how can I output a nested array (should it be called Data Tree?) in a component? If anyone could give me some directions that would be great.
Thanks!
Guimas.
Tags: