I am trying to write a custom GRIN *.dll file for non sequential mode that will allow me to limit refractive index above or below a certain value and just set it to a constant. However, I am having a hard time defining the derivatives to return as required in the GRIN *.dll files. As an example, if my refractive index looks something like below:
I would like to cut everything off above and below a certain threshold, even if my n(x,y,z) function gives me a value thats within it. I have currently been doing this with just a merit function and limiting index that way, but would like to be able to just programmatically restrict it.
I also tried a variant where I set the derivatives to 0 or ignored them, but had errors tracing the rays.
Anyone have a good solution? Happy to provide any files needed.