algorithmic modeling for Rhino
I am trying to make a circle on an Evalpoint drive it through a grid of circles, and push them away as it goes through. Like if you put a bunch of coins on a table and moves one of them with your finger and bumps into the others.
This problem got me thinking in circles too, like I need the circles to know where the points will go and the points to know where the circles are.
I guess there will be some scripting involved, but i hope not
Any ideas?
Tags:
like this ?
I think this problem is unavoidably iterative, so will require either scripting, hoopsnake or kangaroo.
In Kangaroo, this is done with springs between the centres of all the circles which only have an effect when they are closer than the sum of their radii.
Thats pretty close!, except I would like it if the pushed circles did not try to close the gaps, but left a cleared path.
I guess what I need is somewhere to store the points that has been pushed away from their original position, but I get my inputpoints from a divided surface and I dont really understand how not to overwrite the new displaced coordinates. Is it possible to actually move referenced rhinopoints with grasshopper?
In the end it turned out to be enough just to make a variable static, but in my n00biness I took a week to figure this out. Heres the script:
Sub RunScript(ByVal evalPoint As On3dPoint, ByVal pushThreshold As Double, ByVal gridpts As List(Of On3dPoint), ByVal ringpts As List(Of On3dPoint), ByVal RESET As Boolean)
Static _lista As List(Of On3dPoint)
If ((_lista Is Nothing) Or (RESET = True)) Then
_lista = New List(Of On3dPoint)
For Each punkt As On3dPoint In gridpts
_lista.Add(punkt)
Next
End If
Dim k As Integer
k = 0
For Each pt As On3dPoint In _lista
Dim n As Double
n = pt.DistanceTo(evalPoint)
If (n < pushThreshold) Then
_lista(k).Set(ringpts(k))
End If
k += 1
Next
A = _lista
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by