algorithmic modeling for Rhino
hi all,
I am trying to write an attraction and repulsion script in VB ,but at the moment I have this problem which my points moves away till infinitey,I guess.....I know I need to write some threshold for it,but I did this for max and min distance,but still moves away....I just want a fraction of moments.....can somebody help me and tell me how I can fix this script,pleaseeeeeeeeee!!!!!!
this is for the positive points:
Dim vectorlength As Double
vectorlength = saharsvector.Length()
If(vectorlength < min) Then
vectorlength = min
End If
'if vectorlength is larger than our max value
If (vectorlength > max) Then
'then make the modifier 0 instead of 1/vector length
modifier = 0
'otherwise
Else
modifier = 1 / vectorlength
this is for the negative points:
Dim vectorlength As Double
vectorlength = sepidvector.Length()
If(vectorlength > max) Then
vectorlength = max
End If
If(vectorlength < min) Then
vectorlength = 1000
End If
'if vectorlength is larger than our max value
If (vectorlength > max) Then
'then make the modifier 0 instead of 1/vector length
modifier = 0
Else
modifier = 1 / vectorlength
and please, I am beginner in scripting and know a little....
thx alotttttttttt
Tags:
' BORDES
If p.DistanceTo(bo.ClosestPointTo(p)) < 0.01 Then
a = p
Return
End If
'
Dim ptlist As New list(Of Point3d)
Dim pn As point3d = p
ptlist.add(pn)
Dim k As Double = 1 / (4 * math.PI * (8.85 * 10 ^ -12))
Dim vvect As vector3d = New Vector3d(0, 0, 0)
For j As Integer = 1 To it
Dim fvect As New Vector3d(0, 0, 0)
For i As Integer = 0 To ps.Count - 1
Dim vtemp As New Vector3d(0, 0, 0)
Dim f As Double = 0
Dim val As Double = 1 - v(i)
vtemp = ps(i) - pn
Dim dist As Double = vtemp.Length
If dist < r Then dist = r
' LEY COULOMB
f = k * ((q * q * val) / (dist ^ e))
' LEY MODIFICADA
' f = k * ((q * q * val ^ e2) / (dist ^ e))
vtemp.Unitize
vtemp = vtemp * f
fvect = fvect + vtemp
Next
Dim avect As Vector3d = fvect / m
' MRUA
' vvect = vvect + avect * t
' pn = pn + vvect * t + 1 / 2 * avect * t ^ 2
'LINEAL
vvect = avect * t
pn = pn + vvect
ptlist.add(pn)
Next
a = ptlist
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