Multiple Intersection of Curves (Iterative)

Hi guys,

I am facing a problem that involves the multiple intersection of lines. The issue is that I need to trim the line at its first intersection. When this trim happens, the now shorter line does not longer intersect with the rest of the lines, thus they can have a longer length until a new intersection happens.

This is why the logic is iterative. First check for intersections, trim curves at their first intersection. Extend curves and test for a new intersection again and again and again…

Any ideas on how this could be achieved? It seems I’m stuck right now.

TrimMultiple.gh (24.1 KB)

Iteresting…

TrimMultiple_re.gh (14.2 KB)
This is just a “trick” and often gives uncorrect or incomplete solution… but maybe it’s a start…

Probably the best idea would be to “pair” every line to the relative “mirror-index” to the next and previous branch (original polygon segment) and pick the nearest intersection of the 2.
Some tree management that my brain refuse to start to build up at 00:40

2 Likes

Thank you, will try to build from this. Its one of those problems that sound simple and are easy to do in Rhino manually but not parametrically.

Not really the solution you expected, but not far and surely could be tweeked.

It is Gilbert Tessellation

Could be interesting if you rotate the vector

4 Likes

Hi Laurent, this seems exactly what I am looking for. I think the only difference is that in your Gilbert Tessellation algorithm, it is set so that for each intersection one curve stops and one keep extending.

Can’t it be tweaked so that both lines stop when they intersect??

@PeterFotiadis Hi Peter, maybe you could help me a little bit with this? Do you think its feasible?

Rather easy via … er … hmm … you know what (but the big thing is that you are still miles away from the Right Side while time flies, he he). In fact I have some similar stuff either in 2d or 3d but I can hardly remember were (workstation/partition/directory/file).

In order to skip reinventing the wheel I do hope that Laurent could do it due to another good Samaritan act.

Yes, I know. In time I will join you, soon hopefully. But for now I am bounded by my current knowledge.
I do hope you can find that similar stuff you talk about. Thank you still!

Hello Peter,
it is good to see you there, I still don’t understand everything of what you write but I am used to that. You were right, I am a good Samaritan, as I imagined my code was tweakable. Just one line of code to add @ShynnSup (is it a real name ??) need

`````` gCurves[j].SetDMax(distance_j, gIntersectionsArray[k].param_j);
``````

And for the brave

if (distance_i >= distance_j)
{
gCurves[i].SetDMax(distance_i, gIntersectionsArray[k].param_i);
gCurves[j].SetDMax(distance_j, gIntersectionsArray[k].param_j);
}
else
{
gCurves[j].SetDMax(distance_j, gIntersectionsArray[k].param_j);
}
It gives that

1 Like

Hi Laurent! Thank you.

I am afraid its not quite what I intended yet

The logic is still the same, the lines extend and stop when they intersect.
Note that in my drawing there are two lines going in opposite directions. So maybe in the script the extend should only be one-sided.

To clarify my problem and how it applies here is the end result of the definition:

As you can see, there is a fault in the logic, as the central axis need to be the longer ones.

Right would be like this:

My attemp was not too far from the first question.

I don’t really understand exactly what you are after, but if you have the logic you are not far from the algorithm. So it will be good if you experiment by yourself. I had lots of difficulties to get a proper algorithm for Gilbert Tessellations.
Happy coding, in C# we trust

I have no experience in coding what so ever, but I plan to get into it in the near future. But for now… null.

I just want to trim curves by their first intersection without it affecting the other intersection events

Edit: I have been using the Multiple Curves GH component, but it has its limitations, because as noted in the original post, it trims all curves at the same time, so it does not recognize that after trimming a curve another curve can actually be longer, because it does not longer intersect with the the trimmed curve. This means that ideally, a recursive algorithm would check for intersections every “x” extension.

TrimMultiple_2.gh (9.7 KB)

Nor do I (but who’s gonna notice it?).

BTW: I think that our friend is after a similar logic (for the 2nd half minus one of I and for the 1st half minus one of the I+1 … do this and that etc etc):

I.e. get the last left and do the ccx with the first and second right (then get the meshes/surfaces in some tree). Then get the next from last left … blah, blah. Kinda removing items from lists were we count backwards (for more than obvious reasons).

Hi @ShynnSup,

Here’s a solution that requires no coding, however it’s not an all-round recipe.

It’s tailored for examples like the above, where the line network is symmetrical. You also provide only one half of the lines at the beginning!
Furthermore, the segments that should be deleted must be smaller than the remaining ones.

TrimMultiple_3.gh (18.2 KB)

What about Pufferfish’s Mirror Cut Curve component?

MirrorCutCurve.gh (8.7 KB)

Edit: ah missed the back parts going away, anyway seems the logic isn’t quite clear what should stay and go.

So you need separate every 2 curves and you can’t apply the same solution to different cases