At this point, the next big leap would be to start writing code that could split shape into two shapes. This has to be achieved in order to successfully fill in a piece of design with color.
I started the issue with for the line function as there is a less complicated solution. Firstly, the definition of shape might be a bit confusing. Here in the application, a shape is a set of vertices that define the polygon and are used as spawn points too.
I began implementation with the idea of creating spawn points for the line that has been recently generated. These points will be used later on. The method that generates a line also returns indexes of start and end points in the array of spawn points of parent shape. That way I know at which part the spawn point array must be split. A new shape is created out of spawn points of parent shape starting from start index, ending at end index plus spawn points that were generated previously.
Lastly, the spawn points list of the parent shape has to be modified as well. To do so, a new list is created which will include all the spawn points from endpoint index to the end of the parent’s shape spawn point array, from the index 0 to the start point index, plus all spawn points from the previously generated line in reverse. This has to be done because the SAT algorithm only accepts polygons that are defined with vertices in the counter-clockwise order.
Here are some results of the first version of new implementation:




Although at these runs designs look as it is intended, it is still pretty buggy and there are some edge cases that are not fixed at the moment.