Given a 2-D Shape and the positions of the vertices, or the nature, of this 2-D Shape, on which $n$ cuts are made, and given the equations for these $n$ lines, and the size of the 2-D shape,
How would you algorithmically find the number of closed spaces inside the 2-D Shape, or, in other words, the number of individual slices formed by the $n$ lines.
How would algorithmically you do this, starting from the simplest triangle to more complex shapes such as toruses?
Example of three lines forming 6 slices on a circle
Example of four lines forming 8 slices on a more complex shape
And if possible, what would the time complexity of this algorithm be?