cds.astro
Class Proj3

java.lang.Object
  extended by cds.astro.Proj3

public class Proj3
extends java.lang.Object

Class defining the Mathematical Projections of the Celestial Sphere. This class contains only the mathematical projections --- WCS and Aladin projections are in a derived class.

The available projections are defined by the formulae, where

          l,b   = longitude and latitude
          theta = angle to center of projection 
          x,y   = projections (cartesian) along x (East) and y (North)
          r,phi = projections (polar)
 TAN      / Standard = Gnomonic     
            r = tan(theta)          phi
 TAN2     / Stereographic           
            r = 2.tan(theta/2)      phi
 SIN      / Orthographic  
            r = sin(theta)          phi
 SIN2     / Equal-area    
            r = 2.sin(theta/2)      phi
 ARC      / Schmidt proj. 
            r = theta               phi
 AITOFF   / Aitoff (equal area)     if D = sqrt(0.5*(1+cos(b)cos(l/2)))
            x = 2cos(b)sin(l/2)/D   y = sin(b)/D
 SANSON   / Global Sinusoidal (equal area)
            x = l cos(b)            y = b
 MERCATOR / with poles at infinity
            x = l                   y = atanh(b)
 LAMBERT  / equal area projection
            x = l                   y = sin(b)
 

The typical usage of the Proj3 class consists in:

  1. Define a projection (type and the center of projection) by means of one of the constructors; the default center is the (0,0) point.
  2. Compute the projection values X,Y from a position with the computeXY method; the projections can be retrieved either via the getX and getY methods, or in aProj3.X and aProj3.Y elements.
  3. The reverse computation (from projections to coordinates) is done with the computeAngles method; the angles are obtained by means of the getLon and getLat methods.

Version:
1.0 : 03-Mar-2000, 1.1 : 24-Mar-2000: better documentation, 1.11: 24-Apr-2006: qualified exceptions
Author:
Pierre Fernique, Francois Ochsenbein [CDS]

Field Summary
static int AITOFF
           
static int ARC
           
static int LAMBERT
           
static int MERCATOR
           
static java.lang.String[] name
           
static int NONE
           
static int SANSON
           
static int SIN
           
static int SIN2
           
static int TAN
           
static int TAN2
           
 
Constructor Summary
Proj3(double lon, double lat)
          Standard projection.
Proj3(int type)
          Projection at the Origin.
Proj3(int type, double lon, double lat)
          Creation of object used for Projections.
Proj3(int type, java.lang.String text)
          Creation of object used for Projections from a String.
 
Method Summary
 boolean computeAngles(double px, double py)
          Reverse projection: compute the polar angle corresponding to (x,y)
Rem : the rotation matrix was computed at Constructor a la creation de l'objet
 boolean computeXY(double lon, double lat)
          Compute a projection from initial coordinates.
 double getLat()
          Get only the Y from the object
 double getLon()
          Get only the longitude from the object
 double getX()
          Get only the X from the object
 double getY()
          Get only the Y from the object
 java.lang.String toString()
          Returns a definition of this projection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

TAN

public static final int TAN
See Also:
Constant Field Values

TAN2

public static final int TAN2
See Also:
Constant Field Values

SIN

public static final int SIN
See Also:
Constant Field Values

SIN2

public static final int SIN2
See Also:
Constant Field Values

ARC

public static final int ARC
See Also:
Constant Field Values

AITOFF

public static final int AITOFF
See Also:
Constant Field Values

SANSON

public static final int SANSON
See Also:
Constant Field Values

MERCATOR

public static final int MERCATOR
See Also:
Constant Field Values

LAMBERT

public static final int LAMBERT
See Also:
Constant Field Values

name

public static final java.lang.String[] name
Constructor Detail

Proj3

public Proj3(int type,
             double lon,
             double lat)
Creation of object used for Projections. At creation, the center and the type of projection is specified

Parameters:
type - projection type -- default (standard) = TAN
lon - longitude of the center of projection (coordinates of the tangent point) expressed in degrees.
lat - latitude of the center of projection (coordinates of the tangent point) expressed in degrees.

Proj3

public Proj3(int type,
             java.lang.String text)
      throws java.text.ParseException
Creation of object used for Projections from a String.

Parameters:
type - projection type
text - the center in a string
Throws:
java.text.ParseException

Proj3

public Proj3(int type)
Projection at the Origin. Projection at tangent point (lon=0, lat=0)

Parameters:
type - projection type

Proj3

public Proj3(double lon,
             double lat)
Standard projection. At creation, the center and the type of projection is specified

Parameters:
lon - longitude of the center of projection. (coordinates of the tangent point)
lat - latitude of the center of projection. (coordinates of the tangent point)
Method Detail

getX

public final double getX()
Get only the X from the object

Returns:
the X projection

getY

public final double getY()
Get only the Y from the object

Returns:
the Y projection

getLon

public final double getLon()
Get only the longitude from the object

Returns:
the longitude in degrees of the point (point.lon)

getLat

public final double getLat()
Get only the Y from the object

Returns:
the latitude in degrees of the point (point.lat)

toString

public java.lang.String toString()
Returns a definition of this projection

Overrides:
toString in class java.lang.Object
Returns:
a string containing the definition

computeXY

public boolean computeXY(double lon,
                         double lat)
Compute a projection from initial coordinates.
Rem : the rotation matrix was computed at Constructor

Parameters:
lon - longitude
lat - latitude
Returns:
status true if the projection is possible and false when the position can't be projected. The values of the projections are in object.X and object.Y

computeAngles

public boolean computeAngles(double px,
                             double py)
Reverse projection: compute the polar angle corresponding to (x,y)
Rem : the rotation matrix was computed at Constructor a la creation de l'objet

Parameters:
px - x projection values
py - y projection values
Returns:
status true if the X / Y values are within the projection area and false otherwise, The values of the angles are obtained via getLon() and getLat()


Copyright © 2009 UDS/CNRS