Rhino Scripting – Pickover Attractors
Generated through Rhino Scripting. First of all, the Pickover Strange Attractor is scripted. For more information on Pickover Attractors, you can check http://www.chaoscope.org/ .
Then, each point in the Pickover Attractor point cloud is evaluated. The nearest 7 points to each point is found and connected to the input point.
Thanks a lot to Seda Zirek for her help in the point connection code.
(http://mel-examples.blogspot.com/)
Pickover Strange Attractor code
Option Explicit
‘Script written by Elif Erdine
Call Pickover()
Sub Pickover()
Dim i
Dim x()
Dim y()
Dim z()
Dim pt()
Dim maxpoints
maxpoints = 20000
DimA, B, C, D
A= -0.759494
B= 2.449367
C= 1.253165
D= 1.5
ReDim Preserve x(maxpoints)
ReDim Preserve y(maxpoints)
ReDim Preserve z(maxpoints)
x(i) = 0
y(i) = 0
z(i) = 0
i=0
Do While (i < maxpoints)
x(i+1) = Sin(A * y(i)) – z(i) * Cos(B * x(i))
y(i+1) = z(i) * Sin(C * x(i)) – Cos(D * y(i))
z(i+1) = Sin(x(i))
ReDim Preserve pt(i)
pt(i) = Array(x(i), y(i), z(i))
If IsArray(pt(i)) Then
Call Rhino.AddPoint(pt(i))
‘Dim plane
‘plane = Rhino.PlaneFromNormal(pt(i), Array(0,0,1))
‘Call Rhino.AddCircle(plane, 0.2)
End If
i = i+1
Loop
End Sub
Point Connection code
Call ConnectPoints()
Sub ConnectPoints()
Dim ptcloud, ptall
ptcloud = Rhino.GetObject(”input pointcloud”, 2, True, True)
If IsNull(ptcloud) Then Exit Sub
ptall = Rhino.PointCloudPoints(ptcloud)
If IsNull(ptall) Then Exit Sub
Dim i
Dim ptnearest
For i=0 To UBound(ptall)
Dim arrPtall : arrPtall = functNearestNeighbor(ptall, i)
Dim strLine1 : strLine1 = Rhino.AddLine(ptall(i), arrPtall(0))
Dim strLine2 : strLine2 = Rhino.AddLine(ptall(i), arrPtall(1))
Dim strLine3 : strLine3 = Rhino.AddLine(ptall(i), arrPtall(2))
Dim strLine4 : strLine4 = Rhino.AddLine(ptall(i), arrPtall(3))
Dim strLine5 : strLine5 = Rhino.AddLine(ptall(i), arrPtall(4))
Dim strLine6 : strLine6 = Rhino.AddLine(ptall(i), arrPtall(5))
Dim strLine7 : strLine7 = Rhino.AddLine(ptall(i), arrPtall(6))
i=i+1
Next
End Sub
Source: Elif Erdine