Sie sind nicht angemeldet.

1

Samstag, 21. November 2020, 08:10

spheretoscreen - screentosphere

I'm converting the hotspot coordinates to screen coordinates and then I want to get the spherical coordinates back to the h v variables. But if the hotspot has ath=0 and atv=0, then I get the wrong result. What am I doing wrong? *confused*

Quellcode

1
2
3
4
5
6
7
8
9
10
11
<layer name="info"  type="text"  x="10" y="10" width="200"   />	
	
<hotspot name="test" type="text" ath="0" atv="0" width="30" height="30" bg="true" bgcolor="0x00FF00" distorted="true" />
	
<events  onviewchange="test();"   />
	
<action name="test" >	
	spheretoscreen(hotspot[test].ath, hotspot[test].atv, hsx, hsy);
	screentosphere(hsx, hsy, h,v);
	calc(layer[info].html, ' h=' + h + '[br] v=' + v );
</action>

When I rotate the panorama the converted v h values are output
example

2

Samstag, 21. November 2020, 12:08

Hi,

works correctly as it should.

What do you expect?

Or are you confused by the near zero numbers in exponential notation? (e.g. values like 1.2345e-9)

Due rounding errors the result can't be exactly 0/0 again, but they are very near to 0.

Maybe add a rounding like this, then the results should be always 0.0.

Quellcode

1
calc(layer[info].html, ' h=' + roundval(h,1) + '[br] v=' + roundval(v,1) );


Best regards,
Klaus

3

Samstag, 21. November 2020, 12:14

Klaus, thank you for your answer !