001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032:
033: package com.vividsolutions.jump.coordsys.impl;
034:
035: import com.vividsolutions.jump.coordsys.*;
036:
037: /**
038: * @author $Author: javamap $
039: * @version $Revision: 4 $
040: * <pre>
041: * $Id: MeridianArcLength.java 4 2005-06-16 15:27:48Z javamap $
042: * $Date: 2005-06-16 08:27:48 -0700 (Thu, 16 Jun 2005) $
043: *
044: *
045: * $Log$
046: * Revision 1.1 2005/06/16 15:25:29 javamap
047: * *** empty log message ***
048: *
049: * Revision 1.2 2005/05/03 15:23:55 javamap
050: * *** empty log message ***
051: *
052: * Revision 1.2 2003/11/05 05:13:43 dkim
053: * Added global header; cleaned up Javadoc.
054: *
055: * Revision 1.1 2003/09/15 20:26:12 jaquino
056: * Reprojection
057: *
058: * Revision 1.2 2003/07/25 17:01:04 gkostadinov
059: * Moved classses reponsible for performing the basic projection to a new
060: * package -- base.
061: *
062: * Revision 1.1 2003/07/24 23:14:44 gkostadinov
063: * adding base projection classes
064: *
065: * Revision 1.1 2003/06/20 18:34:31 gkostadinov
066: * Entering the source code into the CVS.
067: *</pre>
068: */
069:
070: public class MeridianArcLength {
071:
072: public double s, a0, a2, a4, a6, a8;
073:
074: public void compute(Spheroid spheroid, double lat, int diff) {
075: // Returns the meridian arc length given the latitude
076: double e2;
077: // Returns the meridian arc length given the latitude
078: double e4;
079: // Returns the meridian arc length given the latitude
080: double e6;
081: // Returns the meridian arc length given the latitude
082: double e8;
083: double a;
084: double e;
085: a = spheroid.getA();
086: e = spheroid.getE();
087: e2 = e * e;
088: e4 = e2 * e2;
089: e6 = e4 * e2;
090: e8 = e4 * e4;
091: a0 = 1.0 - e2 / 4.0 - 3.0 * e4 / 64.0 - 5.0 * e6 / 256.0
092: - 175.0 * e8 / 16384.0;
093: a2 = 3.0 / 8.0 * (e2 + e4 / 4.0 + 15.0 * e6 / 128.0 - 455.0 * e8 / 4096.0);
094: a4 = 15.0 / 256.0 * (e4 + 3.0 * e6 / 4.0 - 77.0 * e8 / 128.0);
095: a6 = 35.0 / 3072.0 * (e6 - 41.0 * e8 / 32.0);
096: a8 = -315.0 * e8 / 131072.0;
097: if (diff == 0) {
098: s = a
099: * (a0 * lat - a2 * Math.sin(2.0 * lat) + a4
100: * Math.sin(4.0 * lat) - a6
101: * Math.sin(6.0 * lat) + a8
102: * Math.sin(8.0 * lat));
103: } else {
104: s = a0 * lat - 2.0 * a2 * Math.cos(2.0 * lat) + 4.0 * a4
105: * Math.cos(4.0 * lat) - 6.0 * a6
106: * Math.cos(6.0 * lat) + 8.0 * a8
107: * Math.cos(8.0 * lat);
108: }
109: }
110:
111: }
|