Measuring Lens Field of View
<html> <br><br> <form name="l"> <blockquote><table border=0 cellpadding=1 cellspacing=0 bgcolor="#C0C0C0"><tr><td><table border=0 cellpadding=4 cellspacing=0 bgcolor="#F8F8F8"><tr><td> <table><tr><td> <table> <tr><td align=right><b>Near Distance From Wall</b></td><td><input name="distancefromwall1" type="text" size=10></td></tr> <tr><td align=right><b>Near Wall Distance</b></td><td><input name="walldistance1" type="text" size=10></td></tr> <tr><td align=right><b>Far Distance From Wall</b></td><td><input name="distancefromwall2" type="text" size=10></td></tr> <tr><td align=right><b>Far Wall Distance</b></td><td><input name="walldistance2" type="text" size=10></td></tr> </table> </td><td> </td><td> <input type="button" value="Calculate Answer" onClick="javascript:calculate()"><br> <br> Near FOV° = <span id="fovest1"></span><br> Far FOV° = <span id="fovest2"></span><br> k = <span id="kanswer"></span><br> Final FOV° = <span id="fovanswer"></span><br> Effective focal length = <span id="angularfocallength"></span><br> </td></tr></table> </td></tr></table></td></tr></table></blockquote> </form> <script> function roundNumber(num,dec) { var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); return result; } function ffov(y,x) { return (2*Math.atan(y/x)) * 180/Math.PI; } function efl(deg) { return (36/2) / Math.tan((deg/2)/180*Math.PI); } function calculate() { var x1 = 1.0 * document.l.distancefromwall1.value; var y1 = 1.0 * document.l.walldistance1.value/2; var x2 = 1.0 * document.l.distancefromwall2.value; var y2 = 1.0 * document.l.walldistance2.value/2; var k = (y1*x2 - x1*y2) / (y2-y1); var jj = document.getElementById("kanswer"); if (jj) { jj.innerHTML = roundNumber(k,3); } var fov = ffov(y1,x1); jj = document.getElementById("fovest1"); if (jj) { jj.innerHTML = roundNumber(fov,2)+"°"; } var fov = ffov(y2,x2); jj = document.getElementById("fovest2"); if (jj) { jj.innerHTML = roundNumber(fov,2)+"°"; } fov = ffov(y1,(x1+k)); jj = document.getElementById("fovanswer"); if (jj) { jj.innerHTML = "<b>"+roundNumber(fov,2)+"°</b>"; } jj = document.getElementById("angularfocallength"); if (jj) { jj.innerHTML = "<b>"+roundNumber(efl(fov),2)+"</b>"; } } function lenstest1() { document.l.distancefromwall1.value = "29.125"; document.l.walldistance1.value = "39.84375"; document.l.distancefromwall2.value = "68"; document.l.walldistance2.value = "91.375"; calculate(); } function lenstest2() { document.l.distancefromwall1.value = "36"; document.l.walldistance1.value = "49.625"; document.l.distancefromwall2.value = "107.4375"; document.l.walldistance2.value = "145.375"; calculate(); } function lenstest3() { document.l.distancefromwall1.value = "34"; document.l.walldistance1.value = "48.125"; document.l.distancefromwall2.value = "77.5625"; document.l.walldistance2.value = "107.0625"; calculate(); } function lenstest4() { document.l.distancefromwall1.value = "30.875"; document.l.walldistance1.value = "42.25"; document.l.distancefromwall2.value = "74.125"; document.l.walldistance2.value = "100.125"; calculate(); } function lenstest5() { // 700_1219, 700_1220 document.l.distancefromwall1.value = "18"; document.l.walldistance1.value = "4.08"; document.l.distancefromwall2.value = "30"; document.l.walldistance2.value = "7.0162"; calculate(); } </script> </td></tr></table> </body></html>