You are not logged in.


Thursday, May 17th 2018, 10:46pm

Droplet Cylindrical vlookatmax Calculation

In porting a Flash based (non-KRPano) interactive pano solution to a HTML5 KRPano solution I've run across an issue when calculating the vlookatmax. The previous and custom Flash based solution works as expected. In porting this custom Flash version to HTML5 while using KRPano, the vlookatmax calculation (informed by is:

Source code

vlookatmax = 2 * (Math.atan(Math.tan(hfov/2) * (height/width)) * (180/Math.PI))

This calculation works but often clips some of the panos (of which there are tons) prematurely when using limitview="range". When I take a sample pano and run it through the MAKE PANO (NORMAL) droplet the value works when applied manually to the KRPano XML. The problem is I need to use a formula (like the one above) to calculate the correct vlookatmax dynamically as we can't run them all through the droplet.

My questions are:
  1. Does anything standout with the formula above? It doesn't result in the same value (though close) that the manual droplet process evaluates to?
  2. Is there any way @klaus.krpano that you could share the droplet code that calculates just the vlookatmax value? That would be extremely helpful I'm sure. If not, is there anything anyone can share that would lead me down the path of finding the correct solution?

FWIW - Using version krpano-1.19-pr12

Thank you in advance for any help.

This post has been edited 1 times, last edit by "dak" (May 18th 2018, 6:26pm)


Friday, May 18th 2018, 9:28pm

For future reference the calc from Cartesian to cylindrical is θ = arctan (y/x).

As such the full calc is:

Source code

x = width / (2*Math.PI);y = height/2;maxPitch = Math.atan(y/x) * (180/Math.PI);minPitch = -maxPitch;

where width and height are the original pano image dimensions (x is the radius).