Yes. It is a bug. Thank you for reporting it.
The last ray should be a total reflection ray. However, the ray was treated emmitted from air to glass, so the code did something wrong.
It is fixed now.
You do not need to re-compile the EJS. For you case :
document.polygonsn._setVariables("n=4;px=10,-50,100,100;py=-30,30,30,-30;xs=-90;ys=-25");//set up the above parameters
document.polygonsn._model.setit();// Some parameters need to re-calculate according to the above change,this is the method defined as Custom code
EJS variables are decleared as global variables, so you can change it with _setVariables (";" separated variable assignment , use "," to separate indicidual array (variable) values.
I just added another option so that user can edit coordinate for polygon in the popup window (when table is checked).
There is a second tabbed panel which display coordinate for the polygon points (it is editable).
However, only the fist N rows are useful (You can adjust N with slider).