When using the spheretoscreen function with a point outside the screen, the function returns sometimes negative values (whitch is ok with what i wanna do).
In some case it returns NaN value but i don't understand why.
You should validate your input first..
ifnot (mouse.x > 0,
ifnot (mouse.y > 0,
screentosphere(mouse.x,mouse.y,toh,tov);
,
trace('invalid input');
);,
trace('invalid input');
);
NaN is short for not a number.
in fact i do spheretoscreen on a certain point (long/lat) not on the mouse coordinates (i need the cartesian coordinates of the point)
sometimes the function is fired when that point is "out of screen" : in some cases the function return negative values, which is fine for me but in other cases the function returns NaN
the value 'Not a Number' (NaN) is correct for some values for the spheretoscreen() action,
when the given coordinate is pointing backwards / away from the screen,
then the 'viewing ray' from the viewer will never 'hit' the screen and so a projection on the screen is not possible,