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 http://wiki.panotools.org/Field_of_View) is:

    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.

    Edited once, last by dak (May 18, 2018 at 6:26 PM).

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

    As such the full calc is:

    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).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!