enzyme69 / blendersushi

Blender Sushi related scripts. Mostly about Sverchok, Geometry Nodes, Animation Nodes, and related Python scripts.
242 stars 33 forks source link

LIVENODING 772 / SV Scripted Node SN Random Walk #161

Open enzyme69 opened 6 years ago

enzyme69 commented 6 years ago

screen shot 2017-10-12 at 19 00 06 screen shot 2017-10-12 at 18 59 52 screen shot 2017-10-12 at 18 59 23

This is one way we can approach RANDOM WALK Curve Drawing using Sverchok Scripted Node (SN). There is a lot to understand here, but once you get it, it is almost like revelation.

BLEND ZIP: sv_sn_vector_accum_001_2017_10_12_07_59.zip

enzyme69 commented 6 years ago

SCRIPT:

"""
in verts_in v
out verts_out v
"""

from mathutils import Vector

# process for every LIST of Random Vectors
for verts in verts_in:
    new_verts = []

    # starting vector point for new vector list
    A = Vector((0, 0, 0)) # 0,0,0
    new_verts.append( A[:] )

    # vector accumulate for every vector in the list
    for vert in verts:
        A = A + Vector(vert) 
        new_verts.append(A)

    # output the new vector accumulated list into one big list
    verts_out.append(new_verts)