/* * GIS.java * * Created on March 4, 2001, 8:41 AM */ package myutil; /** * * @author rvdb * @version */ public class GIS extends Object { /** Creates new GIS */ public GIS() { } public static void setCenter(double lat, double lon) { double phi = 2*Math.PI*(90-lat)/360; double theta = 2*Math.PI*lon/360; /**************************************************** * Compute unit tangent vector parallel to lat line. ***************************************************/ x1 = -Math.sin(theta); y1 = Math.cos(theta); z1 = 0; /**************************************************** * Compute unit tangent vector parallel to lon line. ***************************************************/ x2 = -Math.cos(phi)*Math.cos(theta); y2 = -Math.cos(phi)*Math.sin(theta); z2 = Math.sin(phi); } public static double azimuthX(double lat, double lon) { /**************************************************** * The azimuthal coords are simply the inner products * of the cartesian coords with these unit vectors. ***************************************************/ double phi = 2*Math.PI*(90-lat)/360; double theta = 2*Math.PI*lon/360; double xbar = Math.sin(phi)*Math.cos(theta); double ybar = Math.sin(phi)*Math.sin(theta); double zbar = Math.cos(phi); return xbar*x1 + ybar*y1 + zbar*z1; } public static double azimuthY(double lat, double lon) { /**************************************************** * The azimuthal coords are simply the inner products * of the cartesian coords with these unit vectors. ***************************************************/ double phi = 2*Math.PI*(90-lat)/360; double theta = 2*Math.PI*lon/360; double xbar = Math.sin(phi)*Math.cos(theta); double ybar = Math.sin(phi)*Math.sin(theta); double zbar = Math.cos(phi); return xbar*x2 + ybar*y2 + zbar*z2; } static double x1, y1, z1, x2, y2, z2; }