Measuring Lens Field of View

From X10Wiki
Revision as of 18:49, 12 March 2013 by X10Level2Tech (talk | contribs)
Jump to navigation Jump to search



 <form name="l">
Near Distance From Wall<input name="distancefromwall1" type="text" size=10>
Near Wall Distance<input name="walldistance1" type="text" size=10>
Far Distance From Wall<input name="distancefromwall2" type="text" size=10>
Far Wall Distance<input name="walldistance2" type="text" size=10>
 

<input type="button" value="Calculate Answer" onClick="javascript:calculate()">

Near FOV° =
Far FOV° =
k =
Final FOV° =
Effective focal length =

 </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 = ""+roundNumber(fov,2)+"°";
   }
 jj = document.getElementById("angularfocallength");
 if (jj) {
   jj.innerHTML = ""+roundNumber(efl(fov),2)+"";
   }
 }

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>