Add example files and various improvements

Tested with the unit testing, Very few modifications of the algorithms. Now the distance internal variable contains zero when there is a collision. This should not change anything for external user, but if you have a rapid test of an actual use of the library, it would be good to give it a try.