This is a work-in-progress pull request, since some bugs need to be fixed and quite some refactoring is still needed. I added this as a draft pull request already so that it's easier to keep track of the progress and to be able to organize discussions more easily.
[x] Fix numeric instability described in this issue;
[x] Refactor the SolveRaytrace function definition to be more intuitive and to be constrained to 1D functions only, right now it's duct-taped together rather badly;
[x] Update documentation;
[x] Allow spherical end caps to also be deformed using a raytracer;
This is a work-in-progress pull request, since some bugs need to be fixed and quite some refactoring is still needed. I added this as a draft pull request already so that it's easier to keep track of the progress and to be able to organize discussions more easily.