Here’s a quick and dirty implementation of a couple of strange attractors in MASH using the Python node. To use them simply copy and paste the Python into the Python node and click run (top right of the Python Editor).
I used the Trails node in Join the Dots mode to create the tube between all the points (I duplicated it, then got rid of the trails node, and smoothed the mesh). Make sure to have a zeroed distribution on the Distribute node and a few thousand points.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import openMASH #initialise the MASH network data md = openMASH.MASHData(thisNode) #this is how to get the frame number frame = md.getFrame() #and this gets the number of objects in the network count = md.count() a = .9 b = 5 c = 10 d = 1 dt = 0.003 #delta for i in range(count): x = md.position[i].x y = md.position[i].y z = md.position[i].z if i > 0: x += md.position[i-1].x y += md.position[i-1].y z += md.position[i-1].z x += (-a*x + y*y - z*z + a*c) * dt y += (x*(y - b*z) + d) * dt z += (-z + x*(b*y + z)) * dt md.outPosition[i].x=x md.outPosition[i].y=y md.outPosition[i].z=z #tell MASH to write the network data md.setData() |

This one is a Lorenz System / Attractor. Check out this fantastic Behance page for some inspiration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import openMASH #initialise the MASH network data md = openMASH.MASHData(thisNode) #this is how to get the frame number frame = md.getFrame() #and this gets the number of objects in the network count = md.count() h = 0.01 sigma = 10.0 rho = 28.0 beta = 8.0 / 3.0 x0 = 0.1 y0 = 0.0 z0 = 0.0 for i in range(count): x1 = x0 + h * sigma * (y0 - x0) y1 = y0 + h * (x0 * (rho - z0) - y0) z1 = z0 + h * (x0 * y0 - beta * z0) x0 = x1 y0 = y1 z0 = z1 md.outPosition[i].x=x0 md.outPosition[i].y=y0 md.outPosition[i].z=z0 #tell MASH to write the network data md.setData() |

will be nice to do more detail tutuorial for beginers in mash.
Check out the Python tutorial here: https://www.youtube.com/watch?v=ij5ke9ftyH8