nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.24k stars 233 forks source link

Cutting Pattern in Sverchok #181

Closed enzyme69 closed 10 years ago

enzyme69 commented 10 years ago

I don't know what this pattern is called but I think quite beautiful. http://blenderthings.blogspot.nl/2013/08/irregular-stone-patterns-in-osl-first.html

Anyone reckon if I made random vertical lines along horizontal lines I could easily "intersect" it and get interesting BOX patterns? => I will try this.

Now, imagine I have random irregular shapes like area Map of the World, and then from whatever BOX pattern I have above, I want it to FIT into the shape and then nicely intersect cut again.

Is this hard to do in Sverchok?

My guess is using List Mask and then, some what do random Projection Cutting, but in a less random fashion.

For example: Imagine a paper, and I cut into 2 rectangles, and then for each rectangle, I cut it again in vertical or horizontal, but random. And then cut it again.

Recursion in Sverchok, maybe that's what I am thinking.

enzyme69 commented 10 years ago

@nortikin I am just "Participant" and not "Contributor" so I cannot Labels, I don't think.

zeffii commented 10 years ago

I'm not sure how we would express a recursive loop in the sv node structure, currently recursion must happen inside a node as code. It would be possible to approximate the output of that algorithm with a clever set of nodes. I think that is what in synthesis terminology is called subtractive modeling, as opposed to additive.

Where in subtractive modeling you mask, delete, filter stuff. In additive modeling you grow something from a set of parameters.. yes, perfect for SN, parametrized algorithms - but also perfect for Sverchok Nodes if you get away from the idea that you are getting nodes to do what you might do by hand.

see how little code produces these: http://www.mrdoob.com/lab/javascript/webgl/city/01/ http://jsdo.it/zz85/7jWa

enzyme69 commented 10 years ago

"Substractive" and "Additive" Modeling. That's new term for me.

Cheers for the link. MrDoob is really awesome, I have seen his WebGL works.

A quick test with multiple lines to do intersection. Apparently this does not work: prtscr capture_10

https://dl.dropboxusercontent.com/u/3654459/SVERCHOK_GITHUB/lines_random_intersection_006.blend

enzyme69 commented 10 years ago

I just realized something:

"Intersect Edges" actually keeps the older edges.

I thought that if I have 2 lines, crossing each other, I would end up with just 5 points, and 4 edges. But that is not the case.

prtscr capture_11

What is the advice to clean up Intersect Edges?

ly29 commented 10 years ago

Regarding, recursion or rather iteration would be possible using a kind of while/for node group construct, I started think about recently, it would have to pretty explicit. But before we get to that we need do some changes, so short term no. Right now one can use text in/out to iterate to a certain state. For design the amount of iterations is usually not so large. I was even experimenting with a reload and dump on every update scheme that can produce interesting effects but want think about the a bit more.

enzyme69 commented 10 years ago

Maybe SN node is the answer for now. Cheers @ly20

Text In and Out to iterate?

Ok, issue number 2 is the Intersect Edges that gives/leaves extra bit of data, like overlapping edges and multiple vertices. @Zeffii any idea?

zeffii commented 10 years ago

@enzyme69 for now you must merge meshes first, before sending to intersect edges. stick a mesh-join infront of that

enzyme69 commented 10 years ago

I think I did the merge, @zeffii still getting strange thing.


On 20 May 2014 17:11, Dealga McArdle notifications@github.com wrote:

@enzyme69 https://github.com/enzyme69 for now you must merge meshes first, before sending to intersect edges.

— Reply to this email directly or view it on GitHubhttps://github.com/nortikin/sverchok/issues/181#issuecomment-43593080 .

enzyme69 commented 10 years ago

Here is the Blend @zeffii : https://dl.dropboxusercontent.com/u/3654459/SVERCHOK_GITHUB/lines_intersection_003.blend

I am trying to merge 2 lines only for now, to keep it simple.

Look at the result. Open Blend and scrub on timeline to update view.

ly29 commented 10 years ago

It gives some to many lines and points as outputs. Perhaps it would be an idea to separate the output into intersection points and intersecting lines or something.

zeffii commented 10 years ago

image there is also no guarantee that the vertex indices will be where you expect.

The node slices all intersecting geometry, which is an expensive operation. I could have added optional remove doubles but there is a node for that and I didn't want to force doubles removals because there are other scenarios where you want all separate geometry.

enzyme69 commented 10 years ago

prtscr capture_12

@zeffii on the 2nd example, I did exactly that, but the result still too many edges. Remove double is cleaning something, but there are some overlapping edges, was probably a left over.

zeffii commented 10 years ago

Thanks, i see now, it doesn't seem to be removing the original edges. weird (but fixable)

ly29 commented 10 years ago

@zeffii Also would it be possible to just get the intersection points? Or is there some order so they are easy to get?

zeffii commented 10 years ago

Yeah I think so, this is mostly a port from the XALL tinyCAD tool, but it makes sense to have a mode that returns only vertices of intersections (much lighter operation probably) -- but it won't be happening in the immediate future. -- added to todolist.

ly29 commented 10 years ago

:+1: The ever growing todos...

enzyme69 commented 10 years ago

Cheers Dealga, I appending this to try again in the future then.

On Tuesday, 20 May 2014, Dealga McArdle notifications@github.com wrote:

Yeah I think so, this is mostly a port from the XALL tinyCAD tool, but it makes sense to have a mode that returns only vertices of intersections (much lighter operation probably) -- but it won't be happening in the immediate future. -- added to todolist.

— Reply to this email directly or view it on GitHubhttps://github.com/nortikin/sverchok/issues/181#issuecomment-43597043 .


zeffii commented 10 years ago

unless something happens to me, this particular point will be done because it bugs me :)

enzyme69 commented 10 years ago

​Alright, let me test that! Cheers!

enzyme69 commented 10 years ago

prtscr capture_13

Alright, it's working! Let me try on 3 lines scenario.

enzyme69 commented 10 years ago

prtscr capture_15

Also working!

Case closed? Or pending until Zeffii added the Intersecting Points output? :+1:

enzyme69 commented 10 years ago

Nice and clean. I can proceed with my creation of random lines making box. However, I will need to deal with Face creation.

Next node wishlist: Fill Holes Faces based on the number of vertices (just like Blender function)

enzyme69 commented 10 years ago

prtscr capture_13

The funny thing is, with the setup like we had above, it will delete any edges without intersection point. Not mind it too much.

zeffii commented 10 years ago

yeah, non intersecting edges get trashed straight away, that's probably not ideal in some scenarios - worth fixing. I think both issues are fixed with the same change to the code. Outputting intersection vertices only is perhaps possible by adding a new mode to the node, this may break stuff and I have no intention of maintaining two versions of this node.

But my mind is not clear right now for these fun things.

enzyme69 commented 10 years ago

prtscr capture_14

My "random" and range is not so random. Strange...

enzyme69 commented 10 years ago

No worries @zeffii later when you are on the flow, you can jump to this problem. "Intersect Edge" is still a pretty cool node.

I don't know how it is used in Math, but interesting.

ly29 commented 10 years ago

Randomness is tricky sometimes, what setup did you use, and what result did you expect?

enzyme69 commented 10 years ago

Here is the BLEND for study. https://dl.dropboxusercontent.com/u/3654459/SVERCHOK_GITHUB/lines_intersection_015.blend

I think if we have GPS data tracing of people walking around area, interesting to see the POINT OF INTERSECTION.

enzyme69 commented 10 years ago

@ly29 The Random seems to avoid negative value.

prtscr capture_15

Oh, I just remembered random is just between 0 - 1 ...!

ly29 commented 10 years ago

A map interval node would be helpful I have thought many times. For input x in [a,b] map to [c,d]. For r from random [0,1] map to [-1,1] would give distribution as you want. With a clamp option also.

zeffii commented 10 years ago

map would definitely find good use cases. perhaps a second random node to include range, also : numpy has some neat distribution types

enzyme69 commented 10 years ago

prtscr capture_17 prtscr capture_16

Random -1 and /2 this time. The interesting thing is depending on the number of "Divisions" in the range, I am getting result that is more Negative or more Positive.

Map node is awesome to have. I like Map.

Map and Interpolate.

Value A and Value B, and another value to go from A to B.

enzyme69 commented 10 years ago

Map = Old Value Min, Old Value Max, New Value Min, New Value Max, and Original Value.

enzyme69 commented 10 years ago

-1 * 2 more even random, but I still play around with the "Divisions" to get more even result. Not too positive, or not too negative.

prtscr capture_19

This reminds me of Airplane Route Visualization.

zeffii commented 10 years ago

random -> -0.5 -> *2

enzyme69 commented 10 years ago

prtscr capture_20

Weird that "List Range" Division cannot be lower than 2.

However, getting result I want, more equally distributed lines from A to B.

Thanks @ly29 and @zeffii

ly29 commented 10 years ago

List Range is deprecated but the new node works the same way. The mode is called Count, maybe it should be interval, I think a minimum of 2 makes sense if you want a interval with numbers in [a,b]. Count=1 would be the average of start stop I guess. Could make sense perhaps. (a+b)/2

Different random distributions would be good also. Have considered it but put it off.

ly29 commented 10 years ago

maprange Done.

enzyme69 commented 10 years ago

Thanks Sverchok Wizards!!

On Wednesday, May 21, 2014, ly29 notifications@github.com wrote:

[image: maprange]https://cloud.githubusercontent.com/assets/6241382/3038790/a27f2016-e0d2-11e3-9ca3-e2a4d6368e72.png Done.

— Reply to this email directly or view it on GitHubhttps://github.com/nortikin/sverchok/issues/181#issuecomment-43738402 .