Closed enzyme69 closed 7 years ago
Hmm... yeah this part is strange isn't it.
Anyway this one I understand:
It would be quite trivial to write. For me low priority right now.
torus was planned for the geom module https://github.com/nortikin/sverchok/issues/854 but also low priority.
am surprised to see torus is missing from bmesh.ops
For now I suggest the monad method.
Ok, I guess we can leave it there. Somebody (me) needs to try to make a SV node. I still don't know how "trivial" is.
If only if anyone in the world make a node from scratch, make a video tutorial, and then post it. <=== if nobody, I will be the first.
I'd use the lathe node, which is vectorized to the core :)
"""
in major_segments s d=48 n=2
in minor_segments s d=12 n=2
in major_radius s d=1.0 n=2
in minor_radius s d=0.25 n=2
in abso_major_radius s d=1.25 n=2
in abso_minor_radius s d=0.75 n=2
out verts v
out faces s
"""
import bpy
verts = [[]]
faces = [[]]
mesh_set_before = {mesh for mesh in bpy.data.meshes}
bpy.ops.mesh.primitive_torus_add(
major_segments=major_segments,
minor_segments=minor_segments,
major_radius=major_radius,
minor_radius=minor_radius,
abso_major_rad=abso_major_radius,
abso_minor_rad=abso_minor_radius
)
mesh_set_after = {mesh for mesh in bpy.data.meshes}
data = (mesh_set_after - mesh_set_before).pop()
verts[0].extend([v.co[:] for v in data.vertices])
faces[0].extend([i.vertices[:] for i in data.polygons])
bpy.data.meshes.remove(data, do_unlink=True)
ps : not vectorized, but the snlite thread contains enough examples and hints on how to do that.
Sometimes I wish we could package monads as nodes for keeping the amount of nodes down...
Way way way off topic
what if we "just" nodify the major parts of the python language.. that way each node would be described at highest level as a monad/node and compiled to python text when needed.
Would be fun but probably a biggish project...
That is a really nice picture btw
i was impressed too!
Idea which is more realistic for "refactored sverchok": if each node is basically a function; then we can compose nodes programmatically as easily as composing functions; something like
def torus(...):
return lathe(move(circle(..), ..), ..)
So having relatively small number of basic nodes, we could implement complex nodes easier.
Yeah something like that should indeed be possible.
@portnov as i see, main transformations + generators + modifiers as functions or even classes... what part of incapsulation is usefull here?
@nortikin if we had one generic data type for "mesh" (have no idea in what representation yet), and node functions could get and return "meshes", then we could compose these functions as in my example above. For now i have no idea how to "plug" one node into another programmatically to get complex node.
I think an efficient chain would be bm all the way, and
def bm_torus(...):
return bm_lathe(bm_move(bm_circle(..), ..), ..)
Using bm in the function name to make it's return type obvious. ideally, pipedreams, these functions would convert the first parameter to bm automatically if it was passes as a pydata 'tuple' . (v, e, f).
a decorator might help a little, but it still becomes verbose...
def bm_torus(maj_segs, min_segs, maj_rad, min_rad, abso_maj_rad, abso_min_rad):
...
matrix_rotate = ...
translate = abso_maj_rad
axis = (0,0,1)
steps = maj_segs
bm = bm_circle(verts=min_segs, radius=min_rad)
bm_rotate(bm, matrix_rotate)
bm_move(bm, translate)
bm_lathe(bm, axis, steps)
return bm
maybe not :)
On iPhone.
@zeffii how did you create that beautiful diagram?
@portnov
My dream is to be able to node Processing ... well there is NodeBox.
But so far Sverchok caters most of my ideas already. As it is.
But the Script Node is a pending study.
@zeffii how did you create that beautiful diagram?
it's not mine. https://fossbytes.com/learn-it-faster-the-entire-python-language-in-a-single-image/
I realized that we don't have SV Torus node, so I am making it from scratch as node tree for now. https://gist.github.com/c1ca412b5f37eb40607e840e8e5e2a1c
I can make it using node tree and it was under 15 minutes and now it's one way we can have torus.
However, there is this part I learn from @nortikin, the Vector data plug into Angle to make this polar circular structure:
I am also wondering what it takes to create a real SV Torus node? If one of the devs make from scratch, how long will it take? Can you create a video creation of Sverchok Torus node, I will study it.
If I were to make Torus node, for example, what is required? Because I can see that we already have:
Although I can make the Torus procedurally using node, but in order to actually make SV Torus node, where do one have to start?