# Help with geometry manipulation

Hi all,

In another topic that I wrote (Difference between results (Python and Dictionaries)), I asked about some issues in a python node for a script that I’m developing.

My goal is to get the green curves from the geometry below (elevation):

Also the inputs are described in the image.

So, the algorithm I came with is as follows:

Jus for clarification: I managed to create a unitary coordinate r because the points in space have 3 coordinates (X,Y,Z), so now, no matter the direction the element was created, I now which curve is before the other.

• I projected the StartPoint and EndPoint of the curves 1,2,3 and 4 into the plane where curve 0 is. So I split curve 0 by points. I get the segments of the curves 1-4 at the bottom.
Also, I translate the curves using Vector.Zaxis().Reverse() and the z value from the input list, for every curve 1-4. Now I have curves 1-4 projected where curve 0 is.

• With every element in the same position, I start the loop for every projected line. The first iteration is checking the curve 1 projected with every segment and if it is the same curve, store the remainig segments in an “AUX” list and exclude the repeated one. <<<<< Here I have curves to create Curves A and B in the future (translate and join the first two).

• Next iteration, the program has to know that curve 1 already exists, so when I exclude curve 2 and 3, curve 1 was already gone. So, in the 2° iteration I get only the curve C as my result and this is the end of the story.

I’m struggling with the algorith for a couple of days now and I think I need a second opinion. I’m sure there is a better solution (simplier I hope). The condition for this to work is that (I think), my algorithm also works for the case below: Hope I explained enough the issue. Any suggestion will be well received.

1 idea: Get the midpoint of each line and translate that point up, down, left, and right an obscene distance (say 1000ft). Then create 4 lines from the midpoint to each of those points. Then test to see if any one of those lines Does Not Intersect with any of the original curves (look at Bimorph package for a good intersection test node). If any of the 4 radiating lines fails to intersect - it’s probably on the outside of the curve set.

1 Like

Thanks for your response. I’ll try it!

@Jorge_Villarroel Seems like you want to isolate the boundary lines. Assuming they are all straight lines, you could try these steps …

1. Get start/end points of all lines (prune duplicates, if required)
2. Create a closed polycurve with these points
3. Check if the midpoints of the lines intersect the polycurve
4. The ones that don’t are the lines you want
1 Like

Thanks @Vikram_Subbaiah. I’ll try your solution too.

1 Like

@Vikram_Subbaiah, when you say Get start/end points of all lines (prune duplicates, if required), you mean in the list of the curves translated to the bottom? And then, the check of the midpoints of the curves projected in the bottom right?

1 Like

Take both start and end points of all curves, flatten the list and prune duplicate points.
This should account for any curves that are reversed.