Originally Posted by

**avi**
thank a lot

i asume that after calculate the add power we will get deffernt cyl and angel from the sph calculation

so we need to use Axis problem in oblique cross-cylinder calculation

or just using subtraction of the mean refractive error will suffice

thanks

Avi

Depends if you are ordering a digital design they should be able to customize the Rx in both zones although I don't think anyone is currently doing that with outside calculations. For a traditional molded design the MRE will suffice since we don't have any other control over the outcome.

If you are interested in going even deeper down the rabit hole then you can calculate the thickness at 090 and 180, then use the bevel setting 40/60, front, back, basecurve, etc to calculate the thickness at both sides of the meridian and use those figures to calculate the tilt due to beveling and decentration. If you have a progressive lens design you would need to also consider prism thinning and the difference in thickness of the top portion of the lens compared to the bottom due to the change in power and then calc out the lens tilt. Aspherics can throw off the calcs but can be computed into the tilt as well to account for the change in curvature which will effect the lens tilt.

As an optician all of these additional layers of accuracy are all moot since the cost to have me factor everything in on each and every job would make the lens cost prohibitive to the patient, but as a programmer I only have to create the algorithm once, write out the pseudo code, then program the calculator and from that point forward I can calc any client with very little effort. The link to the calc provided her is a basic function consisting of the above formula with no additional lens tilt calced in.

To see the code here is a fiddle: http://jsfiddle.net/harrychiling/bsmhcege/

HTML Code:

//helper functions to simplify the code
function sq(x) {return Math.pow(x,2);}
function si(x) {return Math.sin(x);}
function asi(x) {return Math.asin(x);}
function co(x) {return Math.cos(x);}
function aco(x) {return Math.acos(x);}
function ta(x) {return Math.tan(x);}
function ata(x) {return Math.atan(x);}
function par(x) {return parseFloat(x);}
function sqr(x) {return Math.sqrt(x);}
function rnd(x,y) {return (Math.round(x*y)/y);}
function d2r(x) {return x*(Math.PI/180);}
function r2d(x) {return x*(180/Math.PI);}
function ata2(x) {return Math.atan2(x,1);}
var pi = Math.PI;
function nozero(x) {return (x===0)? 0.0001 : x;}
function comp(sph, cyl, axis, p, f, n, side) {
// variable declarations
sph = par(sph);
cyl = par(cyl);
axis = d2r(par(axis));
p = d2r(par(p));
f = d2r(par(f));
n = par(n);
side = (side==="L");
//effective tilt
var tilt = ata(sqr(sq(si(f))+sq(ta(p)))/nozero(co(f)));
//comp values
var sc = 1+(sq(si(tilt)))/(2*n);
var tc = sc/sq(co(tilt));
var hc = sc/co(tilt);
//coordinate rotation
var tanA = ta(p)/nozero(si(f));
var A = ata(tanA);
A = (side)? (pi/2)-A : A;
var tA = axis-A;
//effective power matrix
var Pxe = sph+cyl*sq(si(tA));
var Pye = sph+cyl*sq(co(tA));
var Pte = (-1)*cyl*si(tA)*co(tA);
//compensated power matrix rotated
var Px = (side)? Pxe/nozero(sc) : Pxe/nozero(tc);
var Py = (side)? Pye/nozero(tc) : Pye/nozero(sc);
var Pt = Pte/hc;
//trace and determinant
var trc = Px+Py;
var det = Px*Py-sq(Pt);
//rotated sphero-cylinder power
var c = (-1)*sqr(sq(trc)-4*det);
var s = (trc-c)/2;
var tA2 = ata((s-Px)/nozero(Pt));
var A2 = ata(si(p)/nozero(ta(f)));
A2 = (side)? (pi/2)-A2 : A2;
//rotate the coordinate system back
var ax = tA2 + A2;
ax = (ax<pi)? ax+pi : ax;
ax = (ax>pi)? ax-pi : ax;
//comp power
s = rnd(s,100);
c = rnd(c,100);
ax = (c===0)? pi : ax;
ax = rnd(r2d(ax),1);
ax = (ax===0)? 180 : ax;
//display
results = String(s) + "DS " + String(c) + "DC x " + String(ax);
alert(results);
return false;
}

You'll notice it is eerily similar to opticampus calculator but works faster, I even recreated a rounding error that occurs if you enter a decimal in opticampus and compute twice.

## Bookmarks