Alexandre:
So, that is my C# code...
If you don't receive answers, then I suggest you to cut your program in perpendicular slices, and try to translate them in D, one after the other, and to show them here, hoping for comments. In a technical forum people are usually happier when you do some work yourself.
Bye, bearophile