Last active
September 30, 2016 14:36
-
-
Save nortikin/7781a11d7459f4ac0c8d to your computer and use it in GitHub Desktop.
circles_onplane.json sverchok json
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.054", | |
| "framed_nodes": {}, | |
| "groups": {}, | |
| "nodes": { | |
| "Cylinder": { | |
| "bl_idname": "CylinderNode", | |
| "color": [ | |
| 0.0, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 467.47235107421875, | |
| 611.1668090820312 | |
| ], | |
| "params": { | |
| "cap_": 0, | |
| "radTop_": 0.0, | |
| "vert_": 12 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Delaunay 2D": { | |
| "bl_idname": "DelaunayTriangulation2DNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 538.406494140625, | |
| -266.5172119140625 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Distances": { | |
| "bl_idname": "DistancePPNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -146.58824157714844, | |
| 42.68064880371094 | |
| ], | |
| "params": { | |
| "Cross_dist": 1 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Formula2": { | |
| "bl_idname": "Formula2Node", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 99.89923095703125, | |
| 13.256214141845703 | |
| ], | |
| "params": { | |
| "formula": "1/x" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Formula2.001": { | |
| "bl_idname": "Formula2Node", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 355.44793701171875, | |
| 119.92184448242188 | |
| ], | |
| "params": { | |
| "formula": "x+n[0]" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Matrix in": { | |
| "bl_idname": "MatrixGenNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 742.5979614257812, | |
| 287.9610290527344 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Matrix out": { | |
| "bl_idname": "MatrixOutNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -360.8746032714844, | |
| -26.246292114257812 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Objects_in": { | |
| "bl_idname": "ObjectsNode", | |
| "color": [ | |
| 0.0, | |
| 0.5, | |
| 0.20000000298023224 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| -578.9334106445312, | |
| -18.15996551513672 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Pipe tube Node": { | |
| "bl_idname": "SvPipeNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 982.0776977539062, | |
| 65.40608215332031 | |
| ], | |
| "params": { | |
| "close": 0, | |
| "shape": "Square" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Script Generator": { | |
| "bl_idname": "SvScriptNode", | |
| "color": [ | |
| 0.0, | |
| 0.800000011920929, | |
| 0.949999988079071 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "circles_on_points.py", | |
| "location": [ | |
| -572.9432983398438, | |
| 236.7499542236328 | |
| ], | |
| "params": { | |
| "button_names": "", | |
| "files_popup": "circles_on_points.py", | |
| "float_list": [ | |
| 0.0, | |
| 4.03000020980835, | |
| 4.0, | |
| 0.10999998450279236, | |
| 0.3499999940395355, | |
| 5.0, | |
| 6.0, | |
| 7.0, | |
| 8.0, | |
| 9.0, | |
| 10.0, | |
| 11.0, | |
| 12.0, | |
| 13.0, | |
| 14.0, | |
| 15.0, | |
| 16.0, | |
| 17.0, | |
| 18.0, | |
| 19.0, | |
| 20.0, | |
| 21.0, | |
| 22.0, | |
| 23.0, | |
| 24.0, | |
| 25.0, | |
| 26.0, | |
| 27.0, | |
| 28.0, | |
| 29.0, | |
| 30.0, | |
| 31.0 | |
| ], | |
| "has_buttons": 0, | |
| "int_list": [ | |
| 0, | |
| 1, | |
| 2, | |
| 3, | |
| 4, | |
| 39, | |
| 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 | |
| ], | |
| "script_name": "circles_on_points.py", | |
| "script_str": "# BSD License\n# http://nbviewer.ipython.org/github/HyperionAnalytics/PyDataNYC2014/blob/master/poisson_disc_sampling.ipynb\n\nimport numpy as np\nimport math\nimport random\nfrom random import random, seed\n\ndef poisson_disc_select(img_width, img_hight, r1, r2, n_try):\n \"\"\"\n Select points from Poisson disc\n Input:\n img_width - integer, 1 to n\n img_hight - integer, 1 to n\n r - minimum didtance between two points, float\n n_try - number of randomly sampled points per try, integer, 1 - n\n Output:\n sample_pts_array - floats array, shape[img_width*img_hight, 2]\n \"\"\"\n def radiuses_calc(r):\n r_2 = r**2\n Ar3 = 3*r_2\n return r_2, Ar3\n rg = r1+(r2-r1)/2\n rg_square, Ag = radiuses_calc(rg)\n cell_size = rg/math.sqrt(2)\n grid_width = int(math.ceil(img_width/cell_size))\n grid_hight = int(math.ceil(img_hight/cell_size))\n grid = [None]*grid_width*grid_hight\n queue = list()\n radiuses = [None]*grid_width*grid_hight\n queue_size = 0\n sample_size = 0\n\n def distance(x, y, r, r_square):\n x_idx = int(x/cell_size)\n y_idx = int(y/cell_size)\n x0 = max(x_idx-2, 0)\n y0 = max(y_idx-2, 0)\n x1 = min(x_idx+3, grid_width)\n y1 = min(y_idx+3, grid_hight)\n rads = []\n\n for w in range(y0, y1):\n p = w*grid_width\n for h in range(x0, x1):\n if grid[p+h]:\n s = grid[p+h]\n dx = s[0]-x\n dy = s[1]-y\n rd = dx**2 + dy**2\n if rd < r_square:\n rads.append(math.sqrt(rd))\n return False, min(rads)/2\n return True, r/2\n\n def set_point(x, y, r):\n nonlocal queue, grid, queue_size, sample_size, radiuses\n s = [x, y]\n queue.append(s)\n index = grid_width*int(y/cell_size) + int(x/cell_size)\n grid[index] = s;\n queue_size += 1\n sample_size += 1\n radiuses[index] = r\n return s, r\n\n # Set first data point\n if sample_size == 0:\n r = random()*(r2-r1)+r1\n x = random()*img_width\n y = random()*img_hight\n set_point(x, y, r/2)\n\n while queue_size:\n x_idx = int(random()*queue_size)\n s = queue[x_idx]\n\n # Generate random point in annulus [r, 2r]\n r = random()*(r2-r1)+r1\n r_square, A = radiuses_calc(r)\n for y_idx in range(0, n_try):\n a = 2*math.pi*random()\n b = math.sqrt(A*random() + r_square)\n\n x = s[0] + b*math.cos(a)\n y = s[1] + b*math.sin(a)\n\n # Set point if farther than r from any other point\n dis = distance(x, y, r, r_square)\n if 0 <= x and x < img_width and 0 <= y and y < img_hight and dis[0]:\n set_point(x, y, dis[1])\n\n del queue[x_idx]\n queue_size -= 1\n\n sample_pts = list(filter(None, grid))\n radiuses_ = list(filter(None, radiuses))\n\n sample_pts_array = np.asfarray(sample_pts)\n N = sample_pts_array.shape[0]\n padded_pts = np.c_[ sample_pts_array, np.zeros(N) ] \n\n return padded_pts.tolist(), radiuses_\n\n\ndef sv_main(height=4.0, width=3.0, radius1=0.23, radius2=0.5, retries=30):\n verts_out = []\n radiuses_out = []\n\n in_sockets = [\n ['s', 'height', height],\n ['s', 'width', width],\n ['s', 'radius1', radius1],\n ['s', 'radius2', radius2],\n ['s', 'retries', retries]\n ]\n\n out_sockets = [\n ['v', 'verts', [verts_out]],\n ['s', 'radiuses_out', [radiuses_out]]\n ]\n seed(retries)\n pts_poisson = poisson_disc_select(height, width, radius1, radius2, retries)\n verts_out.extend(pts_poisson[0])\n radiuses_out.extend(pts_poisson[1])\n\n\n return in_sockets, out_sockets", | |
| "user_name": "nikitron" | |
| }, | |
| "width": 140.0 | |
| }, | |
| "UV Connect": { | |
| "bl_idname": "LineConnectNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 792.0255126953125, | |
| 79.90110778808594 | |
| ], | |
| "params": { | |
| "cicl_check": 0, | |
| "dir_check": "V_dir", | |
| "polygons": 0, | |
| "slice_check": 0 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Vectors in": { | |
| "bl_idname": "GenVectorsNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 542.0687866210938, | |
| 273.4356689453125 | |
| ], | |
| "params": {}, | |
| "width": 100.0 | |
| }, | |
| "Vectors in.001": { | |
| "bl_idname": "GenVectorsNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 548.4761962890625, | |
| -85.94448852539062 | |
| ], | |
| "params": {}, | |
| "width": 100.0 | |
| }, | |
| "Vectors out": { | |
| "bl_idname": "VectorsOutNode", | |
| "color": [ | |
| 0.6079999804496765, | |
| 0.6079999804496765, | |
| 0.6079999804496765 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 95.46870422363281, | |
| 177.5704345703125 | |
| ], | |
| "params": {}, | |
| "width": 140.0 | |
| }, | |
| "Viewer Draw2": { | |
| "bl_idname": "ViewerNode2", | |
| "color": [ | |
| 1.0, | |
| 0.30000001192092896, | |
| 0.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 977.8626708984375, | |
| 277.5162353515625 | |
| ], | |
| "params": { | |
| "activate": 1, | |
| "display_edges": 0, | |
| "display_faces": 1, | |
| "display_verts": 0, | |
| "edge_width": 1, | |
| "face_colors": [ | |
| 0.4466281235218048, | |
| 0.8990001082420349, | |
| 0.41050058603286743 | |
| ], | |
| "shading": 1, | |
| "transparant": 0 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Viewer Draw2.001": { | |
| "bl_idname": "ViewerNode2", | |
| "color": [ | |
| 1.0, | |
| 0.30000001192092896, | |
| 0.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 1228.626708984375, | |
| 74.23564910888672 | |
| ], | |
| "params": { | |
| "display_edges": 0, | |
| "display_faces": 1, | |
| "display_verts": 0, | |
| "face_colors": [ | |
| 0.8990001082420349, | |
| 0.6632565259933472, | |
| 0.14062939584255219 | |
| ], | |
| "shading": 1 | |
| }, | |
| "width": 140.0 | |
| }, | |
| "Viewer Draw2.002": { | |
| "bl_idname": "ViewerNode2", | |
| "color": [ | |
| 1.0, | |
| 0.30000001192092896, | |
| 0.0 | |
| ], | |
| "height": 100.0, | |
| "hide": false, | |
| "label": "", | |
| "location": [ | |
| 777.7086181640625, | |
| -161.05419921875 | |
| ], | |
| "params": { | |
| "display_edges": 0, | |
| "display_faces": 1, | |
| "display_verts": 0, | |
| "edge_colors": [ | |
| 0.8990001082420349, | |
| 0.8367944359779358, | |
| 0.5581746101379395 | |
| ], | |
| "edge_width": 1, | |
| "face_colors": [ | |
| 0.8989999890327454, | |
| 0.21425500512123108, | |
| 0.14062899351119995 | |
| ], | |
| "shading": 1 | |
| }, | |
| "width": 140.0 | |
| } | |
| }, | |
| "update_lists": [ | |
| [ | |
| "Script Generator", | |
| "verts", | |
| "Vectors out", | |
| "Vectors" | |
| ], | |
| [ | |
| "Objects_in", | |
| "Matrixes", | |
| "Matrix out", | |
| "Matrix" | |
| ], | |
| [ | |
| "Script Generator", | |
| "verts", | |
| "Distances", | |
| "vertices1" | |
| ], | |
| [ | |
| "Matrix out", | |
| "Location", | |
| "Distances", | |
| "vertices2" | |
| ], | |
| [ | |
| "Distances", | |
| "distances", | |
| "Formula2", | |
| "X" | |
| ], | |
| [ | |
| "Formula2", | |
| "Result", | |
| "Formula2.001", | |
| "X" | |
| ], | |
| [ | |
| "Script Generator", | |
| "radiuses_out", | |
| "Formula2.001", | |
| "n[0]" | |
| ], | |
| [ | |
| "Vectors out", | |
| "X", | |
| "Vectors in", | |
| "X" | |
| ], | |
| [ | |
| "Vectors out", | |
| "Y", | |
| "Vectors in", | |
| "Y" | |
| ], | |
| [ | |
| "Formula2.001", | |
| "Result", | |
| "Vectors in", | |
| "Z" | |
| ], | |
| [ | |
| "Vectors in", | |
| "Vectors", | |
| "Matrix in", | |
| "Location" | |
| ], | |
| [ | |
| "Script Generator", | |
| "radiuses_out", | |
| "Cylinder", | |
| "RadBot" | |
| ], | |
| [ | |
| "Script Generator", | |
| "radiuses_out", | |
| "Cylinder", | |
| "Height" | |
| ], | |
| [ | |
| "Cylinder", | |
| "Vertices", | |
| "Viewer Draw2", | |
| "vertices" | |
| ], | |
| [ | |
| "Cylinder", | |
| "Polygons", | |
| "Viewer Draw2", | |
| "edg_pol" | |
| ], | |
| [ | |
| "Matrix in", | |
| "Matrix", | |
| "Viewer Draw2", | |
| "matrix" | |
| ], | |
| [ | |
| "Vectors out", | |
| "X", | |
| "Vectors in.001", | |
| "X" | |
| ], | |
| [ | |
| "Vectors out", | |
| "Y", | |
| "Vectors in.001", | |
| "Y" | |
| ], | |
| [ | |
| "Formula2", | |
| "Result", | |
| "Vectors in.001", | |
| "Z" | |
| ], | |
| [ | |
| "Vectors in.001", | |
| "Vectors", | |
| "UV Connect", | |
| "vertices" | |
| ], | |
| [ | |
| "Vectors in", | |
| "Vectors", | |
| "UV Connect", | |
| "vertices 1" | |
| ], | |
| [ | |
| "Script Generator", | |
| "verts", | |
| "Delaunay 2D", | |
| "Vertices" | |
| ], | |
| [ | |
| "Vectors in.001", | |
| "Vectors", | |
| "Viewer Draw2.002", | |
| "vertices" | |
| ], | |
| [ | |
| "Delaunay 2D", | |
| "Polygons", | |
| "Viewer Draw2.002", | |
| "edg_pol" | |
| ], | |
| [ | |
| "UV Connect", | |
| "vertices", | |
| "Pipe tube Node", | |
| "Vers" | |
| ], | |
| [ | |
| "UV Connect", | |
| "data", | |
| "Pipe tube Node", | |
| "Edgs" | |
| ], | |
| [ | |
| "Pipe tube Node", | |
| "Vers", | |
| "Viewer Draw2.001", | |
| "vertices" | |
| ], | |
| [ | |
| "Pipe tube Node", | |
| "Pols", | |
| "Viewer Draw2.001", | |
| "edg_pol" | |
| ] | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment