Sie sind nicht angemeldet.

1

Montag, 4. Juni 2012, 20:09

spheretoscreen returns NaN when out of bounds

Hello,

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.

Someone may help on this?

Regards!

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

2

Montag, 4. Juni 2012, 20:51

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.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Montag, 4. Juni 2012, 22:23

Hey Sacha,

Yes NaN = 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

i can't clearly identify why this happens

any idea?

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

4

Montag, 4. Juni 2012, 23:56

Trace out your input. Your input probably has an exponent in it.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

5

Dienstag, 5. Juni 2012, 07:26

Hi,

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,

best regards,
Klaus

6

Dienstag, 5. Juni 2012, 09:02

ok i get it

projection seems to be done on the hemisphere facing the screen right?

7

Dienstag, 5. Juni 2012, 10:36

projection seems to be done on the hemisphere facing the screen right?
yes, it can be also seen this way