after endless attempts at implementing the winding algorithm, I used a short snippet from the web
merge and upate doc