You are not logged in.

## Determine viewable area/ bounding box

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Sunday, November 12th 2017, 11:03pm

### Determine viewable area/ bounding box

Hello all,

I like to calculate the min/max vlookat and hlookat of the area you are viewing (the bounding box). I like to determine which hotspots the users sees.

For example given a hfov and vfov of 90 (1:1 ratio), and a vlookat/hlookat of 0,0. I expect a bounding box of -45 45 45 -45 (West, South, East, North) So at first I thought it would be something like vlookat - vfov /2 and vlookat + vfov / 2 (same for hfov). But when you look down to 0, 90 you get coordinates like -45, 45, 45, 135 which isn't right because the panorama is spherical I'd expect -45 again. My math isn't great when it comes to sphericals ;p Can someone point me to the right direction?

Professional

Posts: 760

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

Monday, November 13th 2017, 3:25pm

Hi)

Not sure, but what if try to use screentosphere to determine sphere points corresponding to leftop, leftbottom, righttop and rightbotom points of the screen (thus, the bounding box in ath and atv coordinates).

E.g. something like this:

### Source code

```1
```
`<action name="check_view_area" >		screentosphere(calc(stagewidth - stagewidth), calc(stageheight - stageheight), lefttop_h, lefttop_v);		screentosphere(calc(stagewidth - stagewidth), stageheight, leftbottom_h, leftbottom_v);		screentosphere(stagewidth, calc(stageheight - stageheight), righttop_h, righttop_v);		screentosphere(stagewidth, stageheight, rightbottom_h, rightbottom_v);				trace('lefttop point coodtinates == ', calc(lefttop_h + ' : ' + lefttop_v));		trace('leftbottom point coodtinates == ', calc(leftbottom_h + ' : ' + leftbottom_v));		trace('righttop point coodtinates == ', calc(righttop_h + ' : ' + righttop_v));		trace('rightbottom point coodtinates == ', calc(rightbottom_h + ' : ' + rightbottom_v));	</action>`
Alexey Tkachenko has attached the following file:
• test.xml (884 Byte - 7 times downloaded - latest: Apr 29th 2020, 1:42pm)
Regards,

Alexey