Contouring a Set of Curves into Upper and Lower Halves

Hi all!

I’m slowly getting better with grasshopper, but often still get stuck. This time I’m working on a vector file I received. Its an “artwork” where the lines are spaced 10mm from each other. I’m using these lines to divide the image curves in “over the line” and “under the line”, and then merging them creating a line that’s made of the straight lines and the upper/lower picture lines. in pictures:

vector art:

Vector art with guidelines:

Close up:

Here is my procedure:

Divider.gh (36.7 KB)

It partially works. The problem i’m not finding a way to solve is that it doesn’t pick some of the lines.

I also tried creating a pre-check, where I remove curves that don’t touch any guidelines (there are a few of them). One of the problems may be using sort list + list item to divide the curves in upper and lower, because maybe the list is not made of subsequents upper/lower curves. Any help?

Hey @CarlosFilho,

Maybe start by only uploading the relevant {internalized} objects (artwork + lines). You’re missing stuff + have plugins some of us might not have installed:

Ah, sorry… I tried to organize things to make it look cleaner, forgot about plugins, and thought I internalized everything. Here is the file again, and should be better now.

Divider.gh (276.4 KB)

Thanks,

Before proceeding, one quick question—you mentioned:

This could sound like you’re splitting the “artwork” curves with the lines they intersect, but I could be wrong. It also might sound like you want a continuous curve made of top-curve + line (full line or intersecting line segment?) + bottom-curve…Can you show a closeup sketch of a single result resembling the desired outcome?

:person_shrugging:

:sweat_smile:

Overkill, yes.

Sorry deleted by accident—yes slow way split all surfaces with the lines then join the pairs, debrep them and sort them top/bottom face based on the Y coordinate of their centroids. Still unsure what @CarlosFilho meant, though.

The rectangles keep things ordered though.

The entire creating lines section is unnecessary. I could have just taken the container of lines. Then the two close curve sections could be shortened with a close curve component from some plug-in. Sorting the curves by adjacency may be also unimportant.

If the lines don’t extend past the picture, the curves they can’t be split…

Is this more to your liking?:


Divider VR 2.gh (295.4 KB)

Haha how couldn’t it be! Succinct and educational as always.

But your GH vocabulary might be too advanced :winking_face_with_tongue:

My initial quick’n’dirty (and lazy):
Divider_lazy.gh (310.4 KB)


I like that you kept things ordered, though…I should do the same. Oh well!

Who are we kidding; this is much better than what I did! :clap:

Hey, first of all thanks everyone for tipping in. This is by far the most fun conversation I had here in the forum :sweat_smile:

I’m sorry but I have the files and Rino at work on my computer, but here is a small ugly hand sketch of what I meant:

The way I thought was:

  1. Find curves intersection with lines
  2. Split lines using the points found
  3. Remove the lines segments that are inside the curves
  4. Find out which curves are over the line and which ones are under the lines
  5. Merge the upper lines with the outer segments
  6. Merge the lower lines with the outer segments

I’ll check the data you sent me as soon as I get my work computer. Thank you all!

Oh…

@CarlosFilho Do you need to parametrically determine where the lines are, or should we assume them as well defined imported geometry?

If this is a one off, why even do this with Grasshopper?

This is the best that I can do:

The problem is that Grasshopper recognizes intersections with Collision which then do not get made with Trim with Region. Intersection detection is dependent on the unit tolerance of the file. Increasing it helps. But you might have to go in manually to do corrections yourself.

Above, white lines are fine while blue ones are problem areas.

Divider VR 3.gh (279.8 KB)

Maybe Rene has a better approach.

:thinking:

I thought of something, but I’m not sure I want to play again yet, plus I’m watching the world cup!

@CarlosFilho ,

Beautiful sketch! It matters, and changes the approach.

Also, it is an ideal sketch and does not yet specify what the outcome should be in the very specific cases such as tiny but still colliding curves:

Furthermore, of all the lazy wishes I could have is that your spacing lines were consistent with your artwork as opposed to having different start/end conditions, for instance:

Anyway maybe we can fake it. Fun problem! TBC…

Alright, all complaints set aside, this new imperfect try involves ‘correcting’ the inconsistent spacing lines by contouring the overall bounding rectangle for all the artwork using the same interval. This facilitates (1) keeping things ordered per-line as taught by Volker, (2) skip slower surface-splitting, and other shenanigans to get us closer to the goal:

Here’s a version that relies on the fast curve-line intersection operation. As already mentioned, there are inconsistencies in the initial curves and the horizontal lines’ spacing and position. With a few checks, I think the horizontal lines should start at the origin with a spacing of 10 units (that gives the most convincing result):


Still, far from perfect:

The definition uses point in curve to find the remaining horizontal segments, but sometimes there are self-intersecting curves, so some resulting curves are not quite right:

Here’s an above/below separation side by side:

Divider_AE.gh (295.6 KB)

I saw some Mr Brainwash artwork in a local gallery and nearly laughed my head off when I saw what he was charging for the Mona Lisa screen print. I went away and had a play around and ended up putting a piece in a local abstract exhibition (first time in 20yrs) but it was supposed to be 2m long and water jet cut from 1mm mild steel, but I didn’t have time.

The way I got around it was to divide a surface into strips, cull every other strip after twisting them through 90 degrees and then just projecting and hatching the outlines… The A2 PVC artwork.

Don’t judge me too harshly on the animations, they were done on my iPhone with edits and were just tests, not really for public viewing.

Get some of them printed at your local reprographics place to play around with line thicknesses if you’re going to make them into artwork - curves always look very different on the screen.

The bottom anim works with 3D glasses.

‘Artist or Vampire?’:

‘79.45% Brainwashed’:

Ribbon test:

Test:

‘Not a role model (lol)’

Yes, this was stated in the OP.

Making surfaces out of the curves via Boundary Surface and casting back to curves fixes that.

Am excited to look at your script more cloesly later.

Sorry, I wasn’t clear. I was thinking of it from a first principles perspective and redoing the original image rather than trying to rectify what’s already been created:

  1. Split the surface into strips 10mm apart.
  2. Twist them through 90 degrees using image sampler.
  3. Cull every other strip.
  4. Give the surface a thickness .01mm
  5. Explode the offset surfaces and cull the edges leaving just the front and back faces.
  6. Duplicate face border, silhouette or outline.
  7. Project to c plane.
  8. Move both 0.05mm back to the centre line
  9. Explode and remove duplicates
  10. Join

This method creates a horizontal centreline as part of the process.

Sorry, in the workshop today so can’t pull something together.