@Test public void testLatLonToProj() { LatLonPoint latlon = LatLonPoint.create(54, 254); ProjectionPoint result = proj.latLonToProj(latlon); Assert.assertEquals("Unexpected rotated longitude", 0, result.getX(), TOLERANCE); Assert.assertEquals("Unexpected rotated latitude", 0, result.getY(), TOLERANCE); }
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon) { double lon = latlon.getLongitude(); double lat = latlon.getLatitude(); double lonRad = Math.toRadians(lon); double latRad = Math.toRadians(lat); double[] p0 = {Math.cos(latRad) * Math.cos(lonRad), Math.cos(latRad) * Math.sin(lonRad), Math.sin(latRad)}; double[] p1 = {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1], rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1], p0[2]}; double[] p2 = {rotY[0][0] * p1[0] + rotY[0][2] * p1[2], p1[1], rotY[2][0] * p1[0] + rotY[2][2] * p1[2]}; double lonR = LatLonPoints.range180(Math.atan2(p2[1], p2[0]) * DEG_PER_RAD); double latR = Math.asin(p2[2]) * DEG_PER_RAD; return ProjectionPoint.create(lonR, latR); }
RotatedPole extends AbstractProjection { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon) { double lon = latlon.getLongitude(); double lat = latlon.getLatitude(); double lonRad = Math.toRadians(lon); double latRad = Math.toRadians(lat); double[] p0 = {Math.cos(latRad) * Math.cos(lonRad), Math.cos(latRad) * Math.sin(lonRad), Math.sin(latRad)}; double[] p1 = {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1], rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1], p0[2]}; double[] p2 = {rotY[0][0] * p1[0] + rotY[0][2] * p1[2], p1[1], rotY[2][0] * p1[0] + rotY[2][2] * p1[2]}; double lonR = LatLonPoints.range180(Math.atan2(p2[1], p2[0]) * DEG_PER_RAD); double latR = Math.asin(p2[2]) * DEG_PER_RAD; return ProjectionPoint.create(lonR, latR); } }
RotatedPole extends AbstractProjection { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon) { double lon = latlon.getLongitude(); double lat = latlon.getLatitude(); double lonRad = Math.toRadians(lon); double latRad = Math.toRadians(lat); double[] p0 = {Math.cos(latRad) * Math.cos(lonRad), Math.cos(latRad) * Math.sin(lonRad), Math.sin(latRad)}; double[] p1 = {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1], rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1], p0[2]}; double[] p2 = {rotY[0][0] * p1[0] + rotY[0][2] * p1[2], p1[1], rotY[2][0] * p1[0] + rotY[2][2] * p1[2]}; double lonR = LatLonPoints.range180(Math.atan2(p2[1], p2[0]) * DEG_PER_RAD); double latR = Math.asin(p2[2]) * DEG_PER_RAD; return ProjectionPoint.create(lonR, latR); } RotatedPole();  RotatedPole(double northPoleLat, double northPoleLon); }
RotatedPole extends AbstractProjection { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon) { double lon = latlon.getLongitude(); double lat = latlon.getLatitude(); double lonRad = Math.toRadians(lon); double latRad = Math.toRadians(lat); double[] p0 = {Math.cos(latRad) * Math.cos(lonRad), Math.cos(latRad) * Math.sin(lonRad), Math.sin(latRad)}; double[] p1 = {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1], rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1], p0[2]}; double[] p2 = {rotY[0][0] * p1[0] + rotY[0][2] * p1[2], p1[1], rotY[2][0] * p1[0] + rotY[2][2] * p1[2]}; double lonR = LatLonPoints.range180(Math.atan2(p2[1], p2[0]) * DEG_PER_RAD); double latR = Math.asin(p2[2]) * DEG_PER_RAD; return ProjectionPoint.create(lonR, latR); } RotatedPole();  RotatedPole(double northPoleLat, double northPoleLon); ProjectionPoint getNorthPole(); @Override Projection constructCopy(); @Override String paramsToString(); @Override ProjectionPoint latLonToProj(LatLonPoint latlon); @Override LatLonPoint projToLatLon(ProjectionPoint ppt); boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2); @Override boolean equals(Object o); @Override int hashCode(); }
RotatedPole extends AbstractProjection { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon) { double lon = latlon.getLongitude(); double lat = latlon.getLatitude(); double lonRad = Math.toRadians(lon); double latRad = Math.toRadians(lat); double[] p0 = {Math.cos(latRad) * Math.cos(lonRad), Math.cos(latRad) * Math.sin(lonRad), Math.sin(latRad)}; double[] p1 = {rotZ[0][0] * p0[0] + rotZ[0][1] * p0[1], rotZ[1][0] * p0[0] + rotZ[1][1] * p0[1], p0[2]}; double[] p2 = {rotY[0][0] * p1[0] + rotY[0][2] * p1[2], p1[1], rotY[2][0] * p1[0] + rotY[2][2] * p1[2]}; double lonR = LatLonPoints.range180(Math.atan2(p2[1], p2[0]) * DEG_PER_RAD); double latR = Math.asin(p2[2]) * DEG_PER_RAD; return ProjectionPoint.create(lonR, latR); } RotatedPole();  RotatedPole(double northPoleLat, double northPoleLon); ProjectionPoint getNorthPole(); @Override Projection constructCopy(); @Override String paramsToString(); @Override ProjectionPoint latLonToProj(LatLonPoint latlon); @Override LatLonPoint projToLatLon(ProjectionPoint ppt); boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2); @Override boolean equals(Object o); @Override int hashCode();  }