Last active
October 8, 2019 12:54
-
-
Save Durman/bf2fe89881faa0e847771f2449b09052 to your computer and use it in GitHub Desktop.
to do later? 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "export_version": "0.072", | |
| "framed_nodes": {}, | |
| "groups": {}, | |
| "nodes": { | |
| "Bounding box": { | |
| "bl_idname": "SvBBoxNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 766.6818237304688, | |
| -84.703369140625 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Easing 0..1": { | |
| "bl_idname": "SvEasingNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -999.59326171875, | |
| -355.7294006347656 | |
| ], | |
| "params": { | |
| "selected_mode": "28", | |
| "selected_theme_mode": "scope" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Frame info": { | |
| "bl_idname": "SvFrameInfoNodeMK2", | |
| "color": [ | |
| 0.0, | |
| 0.5, | |
| 0.20000000298023224 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -1439.59326171875, | |
| -417.10992431640625 | |
| ], | |
| "params": {}, | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| }, | |
| "IcoSphere": { | |
| "bl_idname": "SvIcosphereNode", | |
| "color": [ | |
| 0.0, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -1646.9925537109375, | |
| 40.823089599609375 | |
| ], | |
| "params": { | |
| "radius": 3.0, | |
| "subdivisions": 2 | |
| }, | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| }, | |
| "List Item": { | |
| "bl_idname": "ListItem2Node", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -150.117431640625, | |
| -61.586669921875 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "List Length": { | |
| "bl_idname": "ListLengthNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -982.1319580078125, | |
| -172.1795196533203 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Make monotone": { | |
| "bl_idname": "SvMakeMonotone", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1775.8482666015625, | |
| -12.201763153076172 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Math MK2": { | |
| "bl_idname": "SvScalarMathNodeMK2", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -701.77294921875, | |
| -141.7528076171875 | |
| ], | |
| "params": { | |
| "current_op": "INTDIV", | |
| "input_mode_two": "Float", | |
| "y_": 2.450000047683716 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Math MK2.001": { | |
| "bl_idname": "SvScalarMathNodeMK2", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -1219.59326171875, | |
| -454.1764221191406 | |
| ], | |
| "params": { | |
| "current_op": "MUL", | |
| "input_mode_two": "Float", | |
| "y_": 10.0 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Move": { | |
| "bl_idname": "SvMoveNodeMK2", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 790.0140380859375, | |
| 137.82177734375 | |
| ], | |
| "params": { | |
| "mult_": 1.149999976158142 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Plane MK2": { | |
| "bl_idname": "SvPlaneNodeMK2", | |
| "color": [ | |
| 0.0, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1180.2320556640625, | |
| -223.62725830078125 | |
| ], | |
| "params": { | |
| "center": 1, | |
| "stepx": 10.0, | |
| "stepy": 10.0 | |
| }, | |
| "use_custom_color": true, | |
| "width": 174.6741943359375 | |
| }, | |
| "Random Num Gen": { | |
| "bl_idname": "SvRndNumGen", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -407.023193359375, | |
| -116.18777465820312 | |
| ], | |
| "params": { | |
| "unique": 1 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Reroute": { | |
| "bl_idname": "NodeReroute", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 331.7965087890625, | |
| -129.7991943359375 | |
| ], | |
| "params": {}, | |
| "width": 16.0 | |
| }, | |
| "Rotation": { | |
| "bl_idname": "SvRotationNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 90.798583984375, | |
| -117.19764709472656 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Scripted Node Lite": { | |
| "bl_idname": "SvScriptNodeLite", | |
| "color": [ | |
| 0.0, | |
| 0.800000011920929, | |
| 0.949999988079071 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1227.2086181640625, | |
| 113.47164154052734 | |
| ], | |
| "params": { | |
| "float_list": [ | |
| 0.0, | |
| 0.6100001931190491, | |
| 0.1899999976158142, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0, | |
| 0.0 | |
| ], | |
| "inject_params": 0, | |
| "injected_state": 0, | |
| "script_name": "voronoi_with_radius.py", | |
| "script_str": "'''\nin verts_in v d=[] n=0\nin radius s d=1.0 n=1\nin resolution s d=0.1 n=1\nout verts_out v\nout polys_out s\n'''\nfrom math import pi, acos, sin, cos\nimport numpy as np\n\nfrom mathutils import Vector, Matrix\nfrom mathutils.geometry import intersect_line_line_2d\n\nfrom sverchok.utils.voronoi import Site, computeDelaunayTriangulation\nfrom sverchok.nodes.modifier_change.polygons_to_edges import pols_edges\nfrom sverchok.data_structure import match_long_repeat\n\nTWO_PI = 2 * pi\n\ndef get_delaunay_triangulation(verts_in):\n pt_list = [Site(pt[0], pt[1]) for pt in verts_in]\n res = computeDelaunayTriangulation(pt_list)\n polys_in = [tri for tri in res if -1 not in tri]\n #all faces hase normals -Z, should be reversed\n polys_in = [pol[::-1] for pol in polys_in]\n edges_in = pols_edges([polys_in], unique_edges=True)[0]\n return edges_in, polys_in\n\ndef calc_angle(p1,p2,mode='clockwise'):\n #Gives angle in pi2 format from first point to second\n angle = p1.angle_signed(p2)\n angle = angle + TWO_PI if angle < 0 else angle\n if mode != 'clockwise':\n angle = TWO_PI - angle\n return angle\n\ndef get_intersection_point(v_a1, v_a2, v_b1, v_b2):\n #return vector or None\n return intersect_line_line_2d(v_a1, v_a2, v_b1, v_b2)\n\ndef gen_neighbours_from_edges(verts, edges):\n # output for triangle: [[i_neib_A, i_neib_C],\n # [i_neib_B, i_neib_C],\n # [i_neib_A, i_neib_C]]\n neighbours = [[] for _ in verts]\n for edg in edges:\n neighbours[edg[0]].append(edg[1])\n neighbours[edg[1]].append(edg[0])\n return neighbours\n\ndef sort_neib(current_v, neibs, all_v):\n #Sorting neighbours by hour hand, \n #all_v is all verts in graph,\n # neighbours is position of neghbours vectors\n angles = [0]\n if len(neibs) > 1:\n first_item = neibs[0]\n vector1 = all_v[first_item] - current_v\n for second_item in neibs[1:]: \n vector2 = all_v[second_item] - current_v\n angles.append(calc_angle(vector1, vector2))\n \n sorted_by_angle = list(zip(angles, neibs))\n sorted_by_angle.sort()\n return [neib for ang, neib in sorted_by_angle],[ang for ang, neib in sorted_by_angle]\n return neibs, angles\n\ndef get_point_by_angle(vector1, vector2, angle, len_new_v, mode='left and right'):\n #return cords of points in triangle with nown two sides and one angle\n #vector1 is base point, vector2 means only direction\n #angle is measured in vector1 node\n #len_new_v is distanse between vector1 and retrun point\n mat_left = Matrix.Rotation(angle,2,'X') #hope it left turn\n mat_right = Matrix.Rotation(angle * -1,2,'X')\n v = vector1 - vector2\n new_v_left = (v * mat_left ).normalized() * len_new_v + vector2\n new_v_right = (v * mat_right).normalized() * len_new_v + vector2\n mode_words = mode.split(' ')\n if 'left' in mode_words and 'right' in mode_words:\n if mode_words.index('left') < mode_words.index('right'):\n return new_v_left, new_v_right\n else:\n return new_v_right, new_v_left\n elif 'left' in mode_words:\n return new_v_left\n else:\n return new_v_right\n \ndef get_distance(vector1, vector2):\n #retrun distance between two points\n return (vector1 - vector2).length\n\ndef get_chord(height,radius,center_v,direction_chord_v):\n #return cords of chord with nown radius and height of chord\n #center is vector of center of circle, direction is direction of normal to chord\n # chord dosen't exist for given parameters so return 0\n if height >= radius:\n return 0\n else:\n #Angle of visibility of half chord\n angle = acos(height / radius)\n points = get_point_by_angle(center_v, direction_chord_v,angle,radius)\n return points, angle\n \ndef is_chord_intersect(angle_ch1, angle_ch2, angle_both):\n #retrun True or False\n #angle_ch1 and ch2 is half angle of visibility chord\n #angle_both is angle between normals of chords\n return True if angle_ch1 + angle_ch2 > angle_both else False\n\ndef get_len_arc(radius,angle):\n #angle between extreme points in radians\n return radius * angle\n\ndef get_arc(start_v, end_v, center_v, resolution, mode='clockwise'):\n #return points of arc by two points and center of circle\n #resolution determines distanse between points of arc\n start_v, end_v = start_v - center_v, end_v - center_v\n start_angle = calc_angle(Vector((0,1)), start_v)\n #angle between start and end vectors\n angle = calc_angle(start_v, end_v)\n radius = get_distance(start_v, Vector((0,0)))\n len_arc = get_len_arc(radius, angle)\n count = len_arc / resolution #this place can be calculate once for current radius!!!\n count = count if count > 3 else 3\n end_angle = start_angle + angle if mode == 'clockwise' else start_angle + angle - TWO_PI\n steps_angle = list(np.linspace(start_angle,end_angle,count))\n vectors = [Vector((sin(ang),cos(ang))) * radius + center_v for ang in steps_angle]\n return vectors\n\ndef get_circle(center_v, radius, resolution):\n #return points of circle\n count = TWO_PI * radius / resolution\n count = count if count >= 5 else 5\n steps_angle = list(np.linspace(0, TWO_PI, count))[:-1]\n vectors = [Vector((sin(ang),cos(ang))) * radius + center_v for ang in steps_angle]\n return vectors\n \ndef get_structure_vert():\n dictionary = {'neibs':[],\n 'ang_neibs':[], #sorted\n 'sorted_neibs':[],\n 'height_chords':[], #nested, sorted, PDC\n 'chords':[], #nested, sorted, PDC\n 'vis_angles':[], #sorted, PDC\n 'intersect_chords':[],\n 'is_intersect':[]} #if point was born intersection two chords - True\n return dictionary\n \ndef get_structure_edg(edg):\n dictionary = {tuple(edg):{'height_chord':[], #PDC\n 'chord':[], #PDC\n 'vis_angle':[], #PDC\n 'intersect_chord':None, #PDC\n 'is_intersect':None, #[T,T] or [T,F] or [F,T] or [F,F]\n 'hiden_chord':None,\n 'used_edg':[None,None]}}\n return dictionary\n\ndef get_structure_pol(pol):\n dictionary = {tuple(sorted(pol)):{'polygon':pol,\n 'intersect_point':None,\n 'used_point':None}}\n return dictionary\n\ndef check_key(key, dict):\n return key if tuple(key) in dict else key[::-1]\n\ndef cycle_item(i,len_i):\n #return correct item of list\n return i % len_i\n\ndef get_voronoi_with_radius(verts_in,radius,resolution):\n verts_out, polys_out = [],[]\n edges_in, polys_in = get_delaunay_triangulation(verts_in)\n verts_in = [Vector(v).to_2d() for v in verts_in]\n neighbours = gen_neighbours_from_edges(verts_in, edges_in)\n verts_data = [get_structure_vert() for _ in verts_in]\n edges_data = {}\n [edges_data.update(get_structure_edg(edg)) for edg in edges_in]\n #structure verts_data - [{'a':[],...},{'b':[],...}...]\n #structure edges_data - {'edg':{'a':[],'b':[]},..., 'edg':{'a':[],...},...}\n [dict['neibs'].extend(neibs) for dict,neibs in zip(verts_data, neighbours)]\n\n #sorting up neibs and calculation height of chords\n for i,dict in enumerate(verts_data):\n neibs, angles = sort_neib(verts_in[i],dict['neibs'],verts_in)\n dict['ang_neibs'].extend(angles)\n dict['sorted_neibs'].extend(neibs)\n for neib in dict['sorted_neibs']:\n edg = check_key([i,neib],edges_data)\n \n #Protection of Double Calculation\n if not(edges_data[tuple(edg)]['height_chord']):\n height_chord = get_distance(verts_in[i],verts_in[neib]) / 2\n edges_data[tuple(edg)]['height_chord'].append(height_chord)\n else:\n height_chord = edges_data[tuple(edg)]['height_chord'][0]\n \n dict['height_chords'].append(height_chord)\n\n #calculation chords\n for i,dict in enumerate(verts_data):\n for h_chord,neib in zip(dict['height_chords'],dict['sorted_neibs']):\n \n edg = check_key([i,neib],edges_data)\n #Protection of Double Calculation\n if not(edges_data[tuple(edg)]['chord']):\n if h_chord > radius:\n v_chord, vis_angle = None, None\n edges_data[tuple(edg)]['chord'] = v_chord\n edges_data[tuple(edg)]['vis_angle'] = vis_angle\n else:\n v_chord, vis_angle = get_chord(h_chord,radius,verts_in[i],verts_in[neib])\n edges_data[tuple(edg)]['chord'].extend(v_chord)\n edges_data[tuple(edg)]['vis_angle'].append(vis_angle)\n else:\n v_chord = edges_data[tuple(edg)]['chord'][::-1]\n vis_angle = edges_data[tuple(edg)]['vis_angle'][0]\n \n dict['chords'].append(v_chord)\n dict['vis_angles'].append(vis_angle)\n\n #get intersection points\n polys_data = {}\n [polys_data.update(get_structure_pol(pol)) for pol in polys_in]\n for key in polys_data.keys():\n neib1, current, neib2 = polys_data[key]['polygon']\n dict = verts_data[current]\n angles = dict['ang_neibs'] + [TWO_PI]\n i = dict['sorted_neibs'].index(neib1) #not good i think\n len_neibs = len(dict['neibs'])\n i_next = cycle_item(i + 1,len_neibs)\n \n if dict['chords'][i] and dict['chords'][i_next]:\n ang_cur = angles[i+1] - angles[i]\n vis_cur = dict['vis_angles'][i]\n vis_next = dict['vis_angles'][i_next]\n cho_cur = dict['chords'][i]\n cho_next = dict['chords'][i_next]\n \n if ang_cur < vis_cur + vis_next:\n intersect_v = get_intersection_point(cho_cur[0], cho_cur[1], cho_next[0], cho_next[1])\n else:\n intersect_v = False\n \n polys_data[key]['intersect_point'] = intersect_v\n\n #get new chords\n for edg in edges_in:\n dict = edges_data[tuple(edg)]\n if dict['chord']:\n v_cur = edg[0]\n n_cur = edg[1]\n i = verts_data[v_cur]['sorted_neibs'].index(n_cur)\n angles = verts_data[v_cur]['ang_neibs'] + [TWO_PI]\n \n if len(verts_data[v_cur]['neibs']) == 2:\n angle = angles[i+1] - angles[i]\n #if angle > 180(pi) Left else Right\n i_next = 1 if i == 0 else 0\n polygon = sorted([*edg,verts_data[v_cur]['sorted_neibs'][i_next]])\n intersect = polys_data[tuple(polygon)]['intersect_point']\n chord = verts_data[v_cur]['chords'][i]\n i_place = intersect if intersect else chord[0] if angle > pi else chord[1]\n dict['intersect_chord'] = ([i_place,chord[1]] if angle > pi else [chord[0],i_place])\n \n if intersect and angle > pi:\n dict['is_intersect'] = [True,False]\n elif intersect and angle < pi:\n dict['is_intersect'] = [False,True]\n else:\n dict['is_intersect'] = [False,False]\n \n else:\n len_neibs = len(verts_data[v_cur]['sorted_neibs'])\n i_prev = cycle_item(i-1,len_neibs)\n i_next = cycle_item(i+1,len_neibs)\n p_prev = sorted([*edg,verts_data[v_cur]['sorted_neibs'][i_prev]])\n p_next = sorted([*edg,verts_data[v_cur]['sorted_neibs'][i_next]])\n sec_prev = polys_data.get(tuple(p_prev),{'intersect_point':None})['intersect_point']\n sec_next = polys_data.get(tuple(p_next),{'intersect_point':None})['intersect_point']\n chord = verts_data[v_cur]['chords'][i]\n \n if sec_prev and sec_next:\n dict['intersect_chord'] = [sec_prev, sec_next]\n elif sec_prev:\n dict['intersect_chord'] = [sec_prev,chord[1]]\n elif sec_next:\n dict['intersect_chord'] = [chord[0],sec_next]\n else:\n dict['intersect_chord'] = chord\n \n dict['is_intersect'] = [bool(sec_prev),bool(sec_next)]\n\n #add new chords to verts_data\n for i,dict in enumerate(verts_data):\n for neib in dict['sorted_neibs']:\n edg = check_key([i,neib],edges_data)\n sec_chord = edges_data[tuple(edg)]['intersect_chord']\n is_sec_chord = edges_data[tuple(edg)]['is_intersect']\n if sec_chord:\n oder = edg[0] == i\n dict['intersect_chords'].append(sec_chord if oder else sec_chord[::-1])\n dict['is_intersect'].append(is_sec_chord if oder else is_sec_chord[::-1])\n else:\n dict['intersect_chords'].append(None)\n dict['is_intersect'].append([None,None])\n \n #generation new geometry\n count_v = 0\n for i,dict in enumerate(verts_data):\n poly = []\n is_chords = [cho for cho in dict['intersect_chords'] if cho]\n if not(is_chords):\n circle = get_circle(verts_in[i], radius, resolution)\n len_circle = len(circle)\n poly.extend(list(range(count_v,count_v + len_circle))[::-1])\n verts_out.extend(circle)\n count_v += len_circle\n polys_out.append(poly)\n continue\n \n len_neibs = len(dict['neibs'])\n #We chould start from chord wich have the list hight chord\n min_hight = min(dict['height_chords'])\n i_min_chord = dict['height_chords'].index(min_hight)\n iterator = list(range(len_neibs))[i_min_chord:] + list(range(len_neibs))[:i_min_chord]\n \n if is_chords:\n for i_iter,i_cur in enumerate(iterator):\n chord_cur = dict['intersect_chords'][i_cur]\n edg_cur = check_key([i,dict['sorted_neibs'][i_cur]],edges_data)\n \n if not(chord_cur) or edges_data[tuple(edg_cur)]['hiden_chord']:\n continue\n \n vis_angle_cur = dict['vis_angles'][i_cur]\n angle_cur = dict['ang_neibs'][i_cur]\n \n #Chowsing next chord\n for i_next in (iterator[cycle_item(i_iter + 1, len_neibs):] + \n iterator[:cycle_item(i_iter + 1, len_neibs)]):\n chord_next = dict['intersect_chords'][i_next]\n i_next2 = cycle_item(i_next+1, len_neibs)\n \n if not(chord_next):\n continue\n \n if chord_cur == chord_next:\n break\n \n edg_next = check_key([i,dict['sorted_neibs'][i_next]],edges_data)\n if edges_data[tuple(edg_next)]['hiden_chord']:\n continue\n \n #Chercking is next chord in shadow of the previous\n if (dict['height_chords'][i_next] > dict['height_chords'][i_cur] or\n dict['height_chords'][i_next] > dict['height_chords'][i_next2]):\n \n vis_angle_next = dict['vis_angles'][i_next]\n angle_next = dict['ang_neibs'][i_next]\n angle = (angle_next - angle_cur if i_cur < i_next \n else TWO_PI - abs(angle_next - angle_cur))\n \n if (angle + vis_angle_cur - vis_angle_next > TWO_PI or\n 2 * vis_angle_cur > vis_angle_cur + angle + vis_angle_next):\n edges_data[tuple(edg_next)]['hiden_chord'] = True\n continue\n \n #Cherching is next chord in shadow of the tvice next chord\n if dict['height_chords'][i_next] > dict['height_chords'][i_next2]:\n \n edg_next2 = check_key([i,dict['sorted_neibs'][i_next2]],edges_data)\n vis_angle_next2 = dict['vis_angles'][i_next2]\n angle_next2 = dict['ang_neibs'][i_next2]\n angle2 = (angle_next2 - angle_next if i_next < i_next2\n else TWO_PI - abs(angle_next2 - angle_next))\n \n if (vis_angle_next2 - angle2 > vis_angle_next or\n angle2 + vis_angle_next2 - vis_angle_next > TWO_PI):\n edges_data[tuple(edg_next)]['hiden_chord'] = True\n continue\n \n break\n \n if dict['is_intersect'][i_next][0]:\n polygon = sorted([*edg_cur,dict['sorted_neibs'][i_next]])\n if polys_data[tuple(polygon)]['used_point'] != None:\n poly.append(polys_data[tuple(polygon)]['used_point'])\n else:\n poly.append(count_v)\n verts_out.append(chord_cur[1])\n polys_data[tuple(polygon)]['used_point'] = count_v\n count_v += 1\n \n else:\n oder_cur = True if i == edg_cur[0] else False\n used_edg_cur = (edges_data[tuple(edg_cur)]['used_edg'] if oder_cur else\n edges_data[tuple(edg_cur)]['used_edg'][::-1])\n if used_edg_cur[1] != None:\n poly.append(used_edg_cur[1])\n else:\n poly.append(count_v)\n verts_out.append(chord_cur[1])\n item = 1 if oder_cur else 0\n edges_data[tuple(edg_cur)]['used_edg'][item] = count_v\n count_v += 1\n \n arc = get_arc(chord_cur[1],chord_next[0],verts_in[i],resolution)[1:-1]\n len_arc = len(arc)\n poly.extend(list(range(count_v,count_v + len_arc)))\n verts_out.extend(arc)\n count_v += len_arc\n \n edg_next = check_key([i,dict['sorted_neibs'][i_next]],edges_data)\n oder_next = True if i == edg_next[0] else False\n used_edg_next = (edges_data[tuple(edg_next)]['used_edg'] if oder_next else\n edges_data[tuple(edg_next)]['used_edg'][::-1])\n if used_edg_next[0] != None:\n poly.append(used_edg_next[0])\n else:\n poly.append(count_v)\n verts_out.append(chord_next[0])\n item = 0 if oder_next else 1\n edges_data[tuple(edg_next)]['used_edg'][item] = count_v\n count_v += 1\n \n if chord_cur == chord_next:\n break\n \n polys_out.append(poly[::-1])\n\n verts_out = [v.to_3d()[:] for v in verts_out]\n return verts_out, polys_out\n\n#Process\nif type(radius) != list:\n radius = [radius]\n \nif type(resolution) != list:\n resolution = [resolution]\n\ndata = verts_in, radius, resolution\ndata = match_long_repeat(data)\n\nfor v_obj,rad,res in zip(*data):\n #protection zero deviding\n res = res if res > 0.02 else 0.02\n\n verts, polys = get_voronoi_with_radius(v_obj,rad,res)\n verts_out.append(verts)\n polys_out.append(polys)\n" | |
| }, | |
| "snlite_ui": [], | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| }, | |
| "Stethoscope MK2": { | |
| "bl_idname": "SvStethoscopeNodeMK2", | |
| "color": [ | |
| 0.5, | |
| 0.5, | |
| 1.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -577.5839233398438, | |
| -369.3519287109375 | |
| ], | |
| "params": { | |
| "num_elements": 1, | |
| "text_color": [ | |
| 0.949999988079071, | |
| 0.949999988079071, | |
| 0.949999988079071 | |
| ] | |
| }, | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| }, | |
| "Vector Noise MK2": { | |
| "bl_idname": "SvNoiseNodeMK2", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 480.5545654296875, | |
| 56.6800537109375 | |
| ], | |
| "params": { | |
| "noise_type": "BLENDER" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Vector Sort": { | |
| "bl_idname": "SvVertSortNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1428.780029296875, | |
| -217.96987915039062 | |
| ], | |
| "params": { | |
| "mode": "CONNEX" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Vector in": { | |
| "bl_idname": "GenVectorsNode", | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -1550.9324951171875, | |
| -366.86468505859375 | |
| ], | |
| "params": { | |
| "x_": 1.0, | |
| "z_": 1.0 | |
| }, | |
| "width": 100.0 | |
| }, | |
| "Viewer Draw": { | |
| "bl_idname": "ViewerNode2", | |
| "color": [ | |
| 1.0, | |
| 0.30000001192092896, | |
| 0.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1444.0489501953125, | |
| 123.3070068359375 | |
| ], | |
| "params": { | |
| "activate": 0, | |
| "display_edges": 1, | |
| "display_verts": 0 | |
| }, | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| }, | |
| "Viewer Draw.001": { | |
| "bl_idname": "ViewerNode2", | |
| "color": [ | |
| 1.0, | |
| 0.30000001192092896, | |
| 0.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 2016.790771484375, | |
| 28.82376480102539 | |
| ], | |
| "params": { | |
| "display_verts": 0, | |
| "ngon_tessellate": 1, | |
| "transparant": 1 | |
| }, | |
| "use_custom_color": true, | |
| "width": 140.0 | |
| } | |
| }, | |
| "update_lists": [ | |
| [ | |
| "Frame info", | |
| 3, | |
| "Math MK2.001", | |
| 0 | |
| ], | |
| [ | |
| "Math MK2.001", | |
| 0, | |
| "Easing 0..1", | |
| 0 | |
| ], | |
| [ | |
| "IcoSphere", | |
| 0, | |
| "List Length", | |
| 0 | |
| ], | |
| [ | |
| "List Length", | |
| 0, | |
| "Math MK2", | |
| 0 | |
| ], | |
| [ | |
| "Easing 0..1", | |
| 0, | |
| "Math MK2", | |
| 1 | |
| ], | |
| [ | |
| "Math MK2", | |
| 0, | |
| "Random Num Gen", | |
| 0 | |
| ], | |
| [ | |
| "List Length", | |
| 0, | |
| "Random Num Gen", | |
| 3 | |
| ], | |
| [ | |
| "IcoSphere", | |
| 0, | |
| "List Item", | |
| 0 | |
| ], | |
| [ | |
| "Random Num Gen", | |
| 0, | |
| "List Item", | |
| 1 | |
| ], | |
| [ | |
| "List Item", | |
| 0, | |
| "Rotation", | |
| 0 | |
| ], | |
| [ | |
| "Vector in", | |
| 0, | |
| "Rotation", | |
| 2 | |
| ], | |
| [ | |
| "Frame info", | |
| 0, | |
| "Rotation", | |
| 3 | |
| ], | |
| [ | |
| "Rotation", | |
| "Vertices", | |
| "Reroute", | |
| "Input" | |
| ], | |
| [ | |
| "Reroute", | |
| "Output", | |
| "Vector Noise MK2", | |
| "Vertices" | |
| ], | |
| [ | |
| "Reroute", | |
| "Output", | |
| "Move", | |
| "vertices" | |
| ], | |
| [ | |
| "Vector Noise MK2", | |
| 0, | |
| "Move", | |
| 1 | |
| ], | |
| [ | |
| "Move", | |
| 0, | |
| "Scripted Node Lite", | |
| 0 | |
| ], | |
| [ | |
| "Easing 0..1", | |
| 0, | |
| "Stethoscope MK2", | |
| 0 | |
| ], | |
| [ | |
| "Scripted Node Lite", | |
| 0, | |
| "Viewer Draw", | |
| 0 | |
| ], | |
| [ | |
| "Scripted Node Lite", | |
| 1, | |
| "Viewer Draw", | |
| 1 | |
| ], | |
| [ | |
| "Plane MK2", | |
| 0, | |
| "Vector Sort", | |
| 0 | |
| ], | |
| [ | |
| "Plane MK2", | |
| 2, | |
| "Vector Sort", | |
| 1 | |
| ], | |
| [ | |
| "Vector Sort", | |
| 0, | |
| "Make monotone", | |
| 0 | |
| ], | |
| [ | |
| "Scripted Node Lite", | |
| 0, | |
| "Make monotone", | |
| 1 | |
| ], | |
| [ | |
| "Scripted Node Lite", | |
| 1, | |
| "Make monotone", | |
| 2 | |
| ], | |
| [ | |
| "Make monotone", | |
| 0, | |
| "Viewer Draw.001", | |
| 0 | |
| ], | |
| [ | |
| "Make monotone", | |
| 1, | |
| "Viewer Draw.001", | |
| 1 | |
| ], | |
| [ | |
| "Move", | |
| 0, | |
| "Bounding box", | |
| 0 | |
| ] | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment