Closest Point

'
' Searchs for the closest Point
'—-

Function functNearestNeighbor (arrPts, index)

Dim k, dblDist
Dim dblDistMin : dblDistMin = 100
For k = 0 To UBound(arrPts)

dblDist = Rhino.Distance(arrPts(index), arrPts(k))

If dblDist <> 0 And dblDist < dblDistMin Then
dblDistMin = dblDist
Dim arrPtNearest : arrPtNearest = arrPts(k)
End If

Next

functNearestNeighbor = arrPtNearest

End Function

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License