-- This script will help you figure out the appropriate field of view parameter to use when using GLOM's over-render function.
-- Overrendering is useful to help eliminate problems with glows and some other post effects that require image information
-- outside of the 90deg field of view that stitching requires.

--define variables

hemisize = 1900
overrndr = 0
glomfov = 90
trs = hemisize+overrndr

rollout Mathamathingy "GLOM FOV Mathamathingy" width:278 height:234
(
	spinner spn1 "Hemicube Size" pos:[40,16] width:200 height:16 range:[0,10000,hemisize] type:#integer
	spinner spn2 "Over Render amount" pos:[40,40] width:200 height:16 range:[0,5000,overrndr] type:#integer
	spinner spn3 "GLOMcam FOV Should Be:" pos:[40,64] width:200 height:16 range:[0,160,glomfov] type:#float
	spinner spn4 "Total Render Size Should Be:" pos:[40,88] width:200 height:16 range:[0,13000,trs] type:#integer
	
	label lbl1 "* For most accurate results, enter hemicube size and over render amount to derive FOV.  Overrender amount  refers to the TOTAL number of pixels to over render and therefore must be divisible by 2 (duh) Entering a value for GLOMcam FOV will round  over render amount value to the nearest whole number" pos:[7,128] width:265 height:80
		

		
	on spn1 changed val do
	(
			spn3.value = ((atan((spn1.value as float + spn2.value as float) / spn1.value as float ))*2)
			spn4.value = spn1.value + spn2.value
			)
	on spn2 changed val do
	(
			spn3.value = ((atan((spn1.value as float + spn2.value as float ) / spn1.value as float ))*2)
			spn4.value = spn1.value + spn2.value
			)
	on spn3 changed val do
	(
			spn2.value = ( spn1.value*(tan(.5 * spn3.value )-1)) as integer
			spn4.value = spn1.value + spn2.value
			)
	on spn4 changed val do
	(
			spn2.value = spn4.value - spn1.value
			spn3.value = ((atan((spn1.value as float + spn2.value as float ) / spn1.value as float ))*2)
			)
)
CreateDialog Mathamathingy
