Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@WilberdvanderKallen Your answer is very good and I truly thank you for your help! I will probably accept it, I just thought that maybe I should wait a little longer in case some other solutions appear.
@MattF. I pondered over this aspect before posting, as I know that crossposting is not encouraged, but I reached the conclusion that it would be all right since it has been there for a while and little progress has been made(the only answer there was for the 2D case and I encouraged that user to post it since I had got no response to the problem and I thought that maybe it would somehow prove to be useful for the 3D case in which I am interested). I hoped that by posting here I would draw more attention to the problem. I am sorry if I were wrong, but I find this problem really interesting.