5
$\begingroup$

I have a different number of splines representing text.
My goal is to ensure that the number of splines is always not lower than the threshold I need.

If I'm given 3 splines, but I only need 3 splines, then everything is great and I don't need to do anything.

But if I'm given 5 splines and I need 6 splines, then I just convert this to mesh, and select a random edge. And then I split the edge, and turn the result back into splines.
After which I get the required 6 number of splines.

If instead of 6 splines I need 10 splines, then I make 5 cuts instead of 1.

Since the number of cuts can be large, it is important that they are in random places for beauty.

But... there is one problem.

If a random cut falls on a "symbol with a hole" (an edge between two different splines, not between the same one), or if all these splines are symbols with holes,

Then, after a random cut, instead of increasing the number of splines, their number will decrease.

In order for their number to really increase, an 2 additional cut will have to be made.

In total we come to the conclusion "number of cuts $\ne$ goal splines $-$ current splines".

So I had to just use a repeat zone, something like

Continue randomly cutting until get lucky and the quantity is right.

Well... Is there a way to solve this without a repeat zone? Any math tricks or other tricks? Something that will work faster than repeat zone on a large number of splines?

$\endgroup$
8
  • 1
    $\begingroup$ Hello and welcome. Please use a title that matches the content of the post. It should read like a question, be descriptive but succinct, unique and identifying, summarizing the problem so that anyone searching for similar issues is likely to find this. Remove anything superfluous, avoid using words like "this", "help with", "issue" or "question about", instead describe what "it" is. Remember, your title is the first thing visitors see, answers you get depend heavily on it. See What is the problem of asking “How do I do this?" $\endgroup$ Commented Apr 18 at 12:06
  • 1
    $\begingroup$ Maybe I'm too dumb to understand this... I mean I understand cutting something and getting less than before. I just do not understand this being given x splines and needing y splines. Who/what gives these splines? Who/what determines how many splines are needed? I just don't get why there is no other way than cutting meshes to match given number with needed number because I somehow missed how these numbers are determined (well the given ones of course by the text - wherever this comes from - but what determines the threshold?) $\endgroup$ Commented Apr 18 at 12:06
  • 1
    $\begingroup$ Actually it looks like a topology question. If your object has a hole i.e. its Euler characteristics is 0, than you need to cut it whole going through the hole to reduce the number of splines. If the Euler number is 2 i.e. a continuous object then only 1 cut is needed. But I don't know how to detect the topology of a mesh in Blender ^^ $\endgroup$
    – Jag JB
    Commented Apr 18 at 12:33
  • $\begingroup$ Additionnally I join the other comments. Knowing why you want to cut these letters and why the number of spline is important would help. $\endgroup$
    – Jag JB
    Commented Apr 18 at 12:46
  • 1
    $\begingroup$ Of course if it was really important, I would definitely clarify this. I take threshold count of splines as I want randomly from my head. How about thinking about this question as it stands? Just in the context of a solution in Blender? $\endgroup$
    – ugorek
    Commented Apr 18 at 12:56

2 Answers 2

5
+150
$\begingroup$

...Oh, I love this task, so I played around with it a bit...

Animation

First of all:
You got it absolutely right: The Fill Curve node is extremely helpful here, as it reliably prepares the geometry in such a way that there are no more internal curves.

This seems to have solved the actual problem.


Nevertheless, I don't want to withhold my gimmick from you, as it might work a little more efficiently than your previous approach:

Overview

Essentially, I also use Fill Curve as a starting point to process the problematic areas correctly.

However, I then divide the mesh into two parts:

  1. the outer (original) curves
  2. the inner edges, which I obtain by triangulating the mesh

The advantage here, however, is that I edit the existing curves directly and thus avoid having to convert them into a mesh again.

To obtain the inner edges, I use the following group:

Interior Edges Interior Edges - Node Group
Extract interior edges

I use these inner edges to cut the curves, which looks like this within the Repeat Zone:

Cut Processing
Process the cuts

But the trick here is to separate the selected edge from the rest so that Random Value does not select the same edge again in the next run.

This process also takes place in a group that looks like this:

Select Random Edge
Select a random edge from the interior edges

By then checking which points of the outer curves intersect with the selected edge, I can separate the curve that I want to cut.

The Accumulate Field node then helps me to separate the points that lie on one side or the other of the intersection.

Cut Curve
Cut the curve into two parts

By defining with Set Spline Cyclic that these curves should be closed, I finally get the necessary curves, which I then only have to join with Join Geometry.

Depending on the target value, this process is then repeated until the desired number of curves is reached.


(Blender 4.1.0+)

$\endgroup$
3
  • 1
    $\begingroup$ Amazing. It would have taken me a long time to come up with a method yourself with Spline Cyclic. However, your method of Extract interior edges is quite unusual; you probably didn’t like GeometryNodeInputMeshFaceNeighbors and FunctionNodeCompare for some reason. $\endgroup$
    – ugorek
    Commented Apr 27 at 19:53
  • $\begingroup$ @ugorek Thank you for your praise (and the bounty, of course)! To be honest, I just wrote it down like that and didn't even think about the fact that there are other ways to get the inner edges (there are usually several ways that you don't always think of straight away). I haven't tested whether it would work any better with the method you suggested. Have you tried that? $\endgroup$
    – quellenform
    Commented Apr 27 at 19:59
  • $\begingroup$ Yes. The result is the same, and it works, as expected, faster. GeometryNodeSeparateGeometry which uses result of the two aforementioned nodes. $\endgroup$
    – ugorek
    Commented Apr 27 at 20:22
2
$\begingroup$

Brilliantly! N-gons mode from Fill Curve helped to unambiguously determine the number of partition iterations.

Since polygons in Blender cannot contain holes, converting to n-gons automatically solves problems with letters that contains holes.

This is the same trick I was talking about. How come I didn't think of this right away?.

Now, instead of entering a large number of iterations (ex. 1111 cycles),
you can find them out using "number of cuts $=$ goal $-$ face count from n-gones"

But... this method requires two Fill Curves nodes, which does not improve performance much. So still puzzled.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .