exports.init = function() { if (Math.abs(this.lat1 + this.lat2) < common.EPSLN) { //proj4.reportError("aeaInitEqualLatitudes"); return; } this.temp = this.b / this.a; this.es = 1 - Math.pow(this.temp, 2); this.e3 = Math.sqrt(this.es); this.sin_po = Math.sin(this.lat1); this.cos_po = Math.cos(this.lat1); this.t1 = this.sin_po; this.con = this.sin_po; this.ms1 = common.msfnz(this.e3, this.sin_po, this.cos_po); this.qs1 = common.qsfnz(this.e3, this.sin_po, this.cos_po); this.sin_po = Math.sin(this.lat2); this.cos_po = Math.cos(this.lat2); this.t2 = this.sin_po; this.ms2 = common.msfnz(this.e3, this.sin_po, this.cos_po); this.qs2 = common.qsfnz(this.e3, this.sin_po, this.cos_po); this.sin_po = Math.sin(this.lat0); this.cos_po = Math.cos(this.lat0); this.t3 = this.sin_po; this.qs0 = common.qsfnz(this.e3, this.sin_po, this.cos_po); if (Math.abs(this.lat1 - this.lat2) > common.EPSLN) { this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1); } else { this.ns0 = this.con; } this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1; this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0; };
exports.forward = function(p) { var lon = p.x; var lat = p.y; this.sin_phi = Math.sin(lat); this.cos_phi = Math.cos(lat); var qs = common.qsfnz(this.e3, this.sin_phi, this.cos_phi); var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0; var theta = this.ns0 * common.adjust_lon(lon - this.long0); var x = rh1 * Math.sin(theta) + this.x0; var y = this.rh - rh1 * Math.cos(theta) + this.y0; p.x = x; p.y = y; return p; };