How to Find Polygons from Different Intersecting Curves

Hi,
I have encountered a problem that is too hard for me to solve, yet I know the basics of how to do it.
So let me explain, also please look at the image. I want to take these lines from the geometry on the left, and transform it into two closed squares like the geometry on the right. My idea to start was to find the intersecting points, so that later I can trim them to have my official geometry. However, I am open to any other ideas on how to solve this problem. I do not have any preferences to how you solve it, I am open to GH components as well as scripts from C# or Python.

Here is the GH definition:
CurvesToPolygon.gh (7.4 KB)

I am not 100% sure this is a general solution, but might work.
Heteroptera Region used.

CurvesToPolygon_RE.gh (9.2 KB)

2 Likes

Native version-pseudo solution. Do the following.
1_do a curve/curve intersection of all the curves( feed the component the same curves, just graft the top input)
2_ Just take out two branches that belong to the different geometry
3_further do list item and take out a single point out of the two.
4_Find the 3 farthest points to both the points. (Closest points reverse the list, the cloud point input should come from the curve/curve intersection, flatten the list and remove duplicate points( you should have a total of eight points)
5_Now merge the solution from step ‘3’ and step ‘4’.
6_ Do a convex Hull.
Hope this helps!

Best,
Mr.A

_

1 Like

These are two solutions with different result , but i think you want 2 squares

Added some other solutions…

CurvesToPolygon_RE.gh (23.3 KB)

3 Likes

Added another solution- a pretty non intelligent one though!
Hope this helps!
Best,
Mr.A

CurvesToPolygon_RE_V3.gh (23.3 KB)

3 Likes

I want to thank all of you, for the time you spent in solving this problem for me. I didn’t expect such a number of responses, in such a short time. Even though I haven’t been on this forum for long, it is by far the best, the nicest and quickest forum I ever was in.

Here is what happened when I rotated my original figure:

@Jakinta Your first post: I don’t have the Heteroptera Region plugin, so, unfortunately, I am unable to run this script. The second solution you gave me, is working flawlessly and thanks for spending so much time on it. :grinning: I noticed that the yellowish- coloured script works best.

@seghierkhaled I can’t see the script you wrote, as you didn’t attach it and your image is too zoomed out for me to read the GH components and remake it. :thinking:

@tognatta.aditya In your first post, I am a bit confused, which intersection do you mean? Region or solid? The second post you sent to me, it only works on curves that are horizontal or vertical. :shushing_face:

Having said all this, I have come across a figure that the definitions decline, or don’t work with:

Here is the figure:
CurvesToPolygon_newcase.gh (2.7 KB)

1 Like

Try this and check Pufferfish automatic edge surface

shatter.gh (18.3 KB)

@seghierkhaled
Thanks for the definition, but I don’t have the component Brep Borders…

Is there another possibility?

Use Brep edges

shatter2.gh (15.4 KB)

1 Like

@seghierkhaled
Thanks, this is working very well, and also that you gave me an alternative solution to my problem. To this I am very grateful.