Here you go:
http://www.onlineopticianry.com/thickness.php
It's not an highly accurate form, but it'll get you there and it uses a neat google visualization Only gives you the thickness on the 180 so it ignores any vertical prism. Don't say I never gave ya nothin'.;)
Here's the source code (still hand coded using notepad) free to use just credit me with a comment tag:
PHP Code:
<?php
$sph = $_POST["sph"];
$cyl = $_POST["cyl"];
$axis = $_POST["axis"];
$prism = $_POST["prism"];
$base = $_POST["base"];
$pd = $_POST["pd"];
$a = $_POST["asize"];
$dbl = $_POST["dblsize"];
$index = $_POST["index"];
$minthick = $_POST["minthick"];
$angsin = pow(sin(deg2rad($axis)),2);
$power = $sph + ($cyl * $angsin);
$mbs = $a + 2*((($a + $dbl)/2) - $pd) + 1;
$dec = 10 * $prism / $power;
if ($power<0 && $base<=1) {
$dec *= (-1);}
if ($power>0 && $base<=1) {
$dec *= (-1);}
$modmbs = $mbs + $dec;
$thick1 = (pow(($modmbs/2),2) * $power) / (2000 * ($index - 1));
$thick1 = round($thick1*100)/100;
if ($thick1<0) {
$thick = (-1)*$thick1 + $minthick;}
else {
$thick = $thick1 + $minthick;}
?>
<html>
<head>
<!-- Created by Harry Chilinguerian ABOC-AC, NCLC-AC free to use as long as this disclaimer is included -->
<style type="text/css">
#chart_div {position: absolute; left: 450px; top: 150px;}
#frm_div {position: absolute; left: 50px; top: 20px;}
#dir_div {position: absolute; left: 450px; top: 50px; width: 400px;}
</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["gauge"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Label');
data.addColumn('number', 'Value');
data.addRows(1);
data.setValue(0, 0, 'Thick');
data.setValue(0, 1, <?php echo $thick; ?>);
var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
var options = {
min: 0,
max: 10,
width: 1200,
height: 361,
redFrom: 0,
redTo: 1,
yellowFrom: 1,
yellowTo: 2,
greenFrom: 2,
greenTo: 5,
majorTicks: ['0','1','2','3','4','5','6','7','8','9','10'],
minorTicks: 2};
chart.draw(data, options); }
</script>
</head>
<body>
<div id="chart_div"></div>
<div id="frm_div">
<table>
<form action="<?php echo $PHP_SELF; ?>" method="post">
<tr><td colspan="2"><h1>Lens Thickness</h1></td></tr>
<tr><td> </td><td><h3>Prescription Data</h3></td></tr>
<!-- <tr><td>Eye</td><td><input type="radio" name="side" checked /> OD <input type="radio" name="side" /> OS</td></tr> -->
<tr><td>Sphere Power</td><td><input type="text" name="sph" value="<?php echo $sph; ?>" /></td></tr>
<tr><td>Cylinder Power</td><td><input type="text" name="cyl" value="<?php echo $cyl; ?>" /></td></tr>
<tr><td>Axis</td><td><input type="text" name="axis" value="<?php echo $axis; ?>" /></td></tr>
<tr><td>Horizontal Prism</td><td><input type="text" name="prism" value="<?php echo $prism; ?>" /></td></tr>
<tr><td>Prism Direction</td><td><input type="radio" name="base" value="1" checked /> IN <input type="radio" name="base" value="0" /> OUT</td></tr>
<tr><td> </td><td><h3>Biometric Data</h3></td></tr>
<tr><td>Pupil Distance (monocular)</td><td><input type="text" name="pd" value="<?php echo $pd; ?>" /></td></tr>
<tr><td> </td><td><h3>Frame Data</h3></td></tr>
<tr><td>Frame A</td><td><input type="text" name="asize" value="<?php echo $a; ?>" /></td></tr>
<tr><td>Frame Dbl</td><td><input type="text" name="dblsize" value="<?php echo $dbl; ?>" /></td></tr>
<tr><td> </td><td><h3>Lens Data</h3></td></tr>
<tr><td>Index</td><td>
<select name="index" />
<option value="1.499" selected="selected">1.49 Hard Resin</option>
<option value="1.523">1.53 Crown Glass</option>
<option value="1.529">1.53 Trivex</option>
<option value="1.537">1.54 Spectralite</option>
<option value="1.555">1.56 Mid-Index</option>
<option value="1.558">1.56 Ormex</option>
<option value="1.586">1.59 Polycarbonate</option>
<option value="1.600">1.60 Finalite</option>
<option value="1.661">1.67 MR-10</option>
<option value="1.700">1.70 EYRY</option>
<option value="1.732">1.74 MR-174</option>
</select>
</td></tr>
<tr><td>Minimum Thickness</td><td><input type="text" name="minthick" value="<?php echo $minthick; ?>" /></td></tr>
<tr><td> </td><td><input type="submit" value="Calculate Thickness" /></td></tr>
</form>
</table>
</div>
<div id="dir_div"><font size="2">If the guage points in the red the minimum thickness
is too thin, if the guage points in the yellow the
minimum thickness may be too thin depending on the
material, if the guage is in the green this is the
optimal thickness, if the guage is in the white you
may want to consider changeing the material.</font>
</div>
</body>
</html>
Bookmarks