CylDetector - Check whether asin(NA/n) is in the range of (-1,1)
asin() will though an error if the input is not between -1 and 1. This could result in a crash in the program.
While this should not occur if the user inputs sensible values for the numerical aperture for the cylindrical detector or the refractive indices of the materials, we should make sure, that we catch this error before the program crashes.
My suggestion:
I think you can check if the NA becomes invalid during your preprocessing step.
If not maybe it is enough to do something like this:
- If NA/n > 1, just set NA/n to 1
Edited by Shuran Wang