You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

1

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? *confused*
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

Alexey Tkachenko

Professional

Posts: 742

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

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 - 6 times downloaded - latest: Nov 21st 2017, 11:10pm)
Regards,

Alexey