Finds the point in an array of 3-D points that is closest to a test point.
Rhino.PointArrayClosestPoint (arrPoints, arrPoint)
arrPoints |
Required. Array. An array of 3-D points to test. |
arrPoint |
Required. Array. The 3-D test point. |
Number |
The index of the element in the point array that is closest to the test point if successful. |
Null |
If not successful, or on error. |
Dim strCloud, arrCloud, arrPoint, index, strPoint
strCloud = Rhino.GetObject("Select point cloud")
If Not IsNull(strCloud) Then
arrPoint = Rhino.GetPoint("Point to test")
If IsArray(arrPoint) Then
arrCloud = Rhino.PointCloudPoints(strCloud)
index = Rhino.PointArrayClosestPoint(arrCloud, arrPoint)
If IsNumeric(index) Then
strPoint = Rhino.AddPoint(arrCloud(index))
Rhino.SelectObject strPoint
End If
End If
End If