Showing results for 
Search instead for 
Did you mean: 

Finding all closed loops in a 2d sketch (C++)



Hello all


I'm trying to write a function that goes through a coplanar set of curves a recognises all closed loops and creates a domain in them (in the form of a surface).


Essentially, I would like to automate the process of recognising domains bounded by a closed loop of curves and then use the 'sheet from curves' tool, or something like that.


I've tried journalling my actions but the 'sheet from curves' tool isn't recordable.


Below is an example of a set of closed loops, with the leftmost loop filled in using 'sheet from curves'



sheet from curves.JPG


Any suggestions would be greatly appreciated


Re: Finding all closed loops in a 2d sketch (C++)

Siemens Phenom Siemens Phenom
Siemens Phenom

As long as the curves meet end-to-end, the Bounded Plane function will sort out the mess for you and create the "domain" you want. In Snap, it's just Snap.Create.BoundedPlane, and you input an array of curves. I'm not familiar with C++, but I expect a similar function is available.