Hey @kng_ito,
So the normal direction of the generated polygons was the point!
It depends a bit on what you mean by normal direction, but generally speaking, normals only play a minor role here.
Wenn all segments would always lie nicely inside a plane, it would be easy. Just compute the mean point for each segment and then come up with some cockamamie rule when you would consider two segments not being in a shell-hole relation (as I did above with 'a hole is not a hole anymore when T farther away from S than S is tall or wide').
In practice things do not always lie nicely in a plane. So, you then must first project them there, find their mean plane. So, the 'point' would be finding the mean plane / dimensionality reduction. I cooked up an small example below.
Cheers,
Ferdinand
Result (the plane gizmos are a bit buggy and sliding, did not debug this. But that is why I turn them off):
The file:
spline_hole.c4d