    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class FITSWCS.Projection

    java.lang.Object
       |
       +----FITSWCS.Projection

public class Projection
extends Object
implements ProjectionType

This class provides support for spherical map projections used by the FITS "World Coordinate System" (WCS) convention.

The FITSWCS package was translated from the WCSLIB C library (V2.3). This original library was written in support for coordinate systems used by astronomical data stored in FITS format. For more information on these coordinate systems, refer to the paper by Greisen and Calabretta at:

> ftp://fits.cv.nrao.edu/fits/documents/wcs/wcs.all.ps.Z

Nomenclature

In WCSLIB the "forward" direction is from (lng,lat) celestial coordinates to (x,y) coordinates in the plane of projection. This accords with the notion that spherical projections are a projection of the sphere onto a plane, the "reverse" direction is therefore that of deprojection from plane to sphere.

Unfortunately, this is opposite to what is generally understood to be the forward direction for FITS, namely that of transforming pixel coordinates to world coordinates. However, the ordering of function argument lists should make it clear what is intended.

Accuracy

Closure to a precision of at least 1.0-10 degree of longitude and latitude has been verified for typical projection parameters on the 1 degree grid of native longitude and latitude (to within 5 degrees of any latitude where the projection may diverge).

Notwithstanding this, absolutely no claim is made for the accuracy or reliability of these routines. They are supplied as is, with no warranty of fitness for any purpose.

COPYRIGHT NOTICE

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Correspondence concerning WCSLIB may be directed to:

         Internet email: mcalabre@atnf.csiro.au
         Postal address: Dr. Mark Calabretta,
                         Australia Telescope National Facility,
                         P.O. Box 76,
                         Epping, NSW, 2121,
                         AUSTRALIA

Correspondence concerning the Java implementation may be directed to Raymond L. Plante (rplante@ncsa.uiuc.edu).

##

D2R
n
  an intermedate datum
p
  the ten projection parameters corresponding to the PROJPn keywords in FITS, so p[0] is PROJP0, and p[9] is PROJP9.
PI
r0
  The radius of the generating sphere for the projection, a linear scaling parameter.
R2D
SQRT2
SQRT2INV
w
  intermediate values derived from the projection parameters

##

Projection()

##

fwd(double, double)
  Compute (x,y) coordinates in the plane of projection from native spherical coordinates (phi,theta).
fwd(double[])
  same as fwd(phitheta[0], phitheta[1])
getProjection(String, double[])
getProjParm()
  return a copy of the projection parameters
getR0()
  return the value of r0
projectionType(String)
  return an integer representing the projection type which can be compared with this.ARC, SIN, TAN, etc.
rev(double, double)
  Compute native spherical coordinates (phi,theta) from the (x,y) coordinates in the plane of projection.
rev(double[])
  same as rev(xy[0], xy[1])
setProjParm(double[])
  set with new projection parameters.
setR0(double)
  set the value of r0

##

r0

      protected double r0

  The radius of the generating sphere for the projection, a linear scaling parameter. If this is zero, it will be reset to the default value of 180/pi (the value for FITS WCS).

p

      protected double p[]

  the ten projection parameters corresponding to the PROJPn keywords in FITS, so p[0] is PROJP0, and p[9] is PROJP9. Many projections use p[1] (PROJP1) and some also use p[2] (PROJP2). ZPN is the only projection which uses any of the others.

w

      protected double w[]

  intermediate values derived from the projection parameters

n

      protected int n

  an intermedate datum

PI

      public final static double PI

D2R

      public final static double D2R

R2D

      public final static double R2D

SQRT2

      public final static double SQRT2

SQRT2INV

      public final static double SQRT2INV

##

Projection

      public Projection()

##

fwd

      public abstract double[] fwd(double phi,
                                   double theta) throws PixelBeyondProjectionException

  Compute (x,y) coordinates in the plane of projection from native spherical coordinates (phi,theta).

  The values of phi and theta (the native longitude and latitude) normally lie in the range [-180,180] for phi, and [-90,90] for theta. However, all forward projections will accept any value of phi and will not normalize it.

  Although many of the forward projections will accept values of theta outside the range [-90,90] such latitudes are not meaningful and should normally be marked as an error. However, in the interests of efficiency, the forward projection routines do not check for this, although they do check for any invalid values of theta within the range [-90,90].

  Returns:
    double[] a two-element array containing x,y

fwd

      public double[] fwd(double phitheta[]) throws PixelBeyondProjectionException

  same as fwd(phitheta[0], phitheta[1])

rev

      public abstract double[] rev(double x,
                                   double y) throws PixelBeyondProjectionException

  Compute native spherical coordinates (phi,theta) from the (x,y) coordinates in the plane of projection.

  Error checking on the projected coordinates (x,y) is limited to that required to ascertain whether a solution exists. Where a solution does exist no check is made that the value of phi and theta obtained lie within the ranges [-180,180] for phi, and [-90,90] for theta.

  Returns:
    double[] a two-element array containing phi,theta

rev

      public double[] rev(double xy[]) throws PixelBeyondProjectionException

  same as rev(xy[0], xy[1])

getR0

      public double getR0()

  return the value of r0

setR0

      public abstract void setR0(double r0)

  set the value of r0

setProjParm

      public abstract void setProjParm(double p[]) throws ArrayIndexOutOfBoundsException, BadProjectionParameterException

  set with new projection parameters.

getProjParm

      public double[] getProjParm()

  return a copy of the projection parameters

getProjection

      public final static Projection getProjection(String pcode,
                                                   double projparm[]) throws ArrayIndexOutOfBoundsException, BadProjectionParameterException, UnsupportedProjectionException

projectionType

      public final static int projectionType(String name)

  return an integer representing the projection type which can be compared with this.ARC, SIN, TAN, etc. -1 is returned if the name is not recognized.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index