1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!-- first get the h/v coordinates in degrees from the current mouse position -->
screentosphere(mouse.x, mouse.y, h, v);
<!-- get the highest/largest multires level index (0-based) -->
sub(largestlevelindex, image.level.count, 1);
<!-- get the width of the largest levels -->
copy(cubewidth, image.level[get(largestlevelindex)].tiledimagewidth);
<!-- calculate the spherical pano size -->
mul(spherewidth, cubewidth, Math.PI);
mul(sphereheight, spherewidth, 0.5);
<!-- linearly map the degrees values to the pixel positions -->
div(px, h, 360);
add(px, 0.5);
mul(px, spherewidth);
roundval(px);
div(py, v, 180);
add(py, 0.5);
mul(py, sphereheight);
roundval(py);
<!-- done - trace the results -->
trace('pixelpos=',px,'/',py);
|