cds.astro Class Proj3

```java.lang.Object
cds.astro.Proj3
```

`public class Proj3extends 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 set(Coo) 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 set(X,Y) method; the corresponding point is obtained by means of the getCoo method.

Field Summary
`static int` `AITOFF`

`static int` `ARC`

`static int` `LAMBERT`

`static int` `MERCATOR`

`static java.lang.String[]` `name`

`static int` `NONE`

`protected  Coo` `point`
The corresponding polar angles
`static int` `SANSON`

`static int` `SIN`

`static int` `SIN2`

`static int` `TAN`

`static int` `TAN2`

`protected  byte` `type`

`protected  double` `X`
The values of the projections
`protected  double` `Y`
The values of the projections

Constructor Summary
`Proj3(Coo centre)`
Standard (TAN) projection.
```Proj3(double lon, double lat)```
Standard projection.
`Proj3(int type)`
Projection at the Origin.
```Proj3(int type, Coo centre)```
Projection of a point on the sphere.
```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
` Coo` `getCoo()`
Get the coordinate
` double` `getLat()`
Get the latitude of the point on the projection.
` double` `getLon()`
Get the longitude of the point on the projection.
` double` `getX()`
Get only the X value of the projection.
` double` `getY()`
Get the Y value of the projection
` boolean` `set(Coo coo)`
Compute a projection from initial coordinates.
` boolean` ```set(double px, double py)```
Reverse projection: compute the polar angle corresponding to (x,y)
Rem: Method was called computeAngles in a previous version.
` java.lang.String` `toString()`
Returns a definition of this projection

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

type

`protected byte type`

X

`protected double X`
The values of the projections

Y

`protected double Y`
The values of the projections

point

`protected Coo point`
The corresponding polar angles

NONE

`public static final int NONE`
Constant Field Values

TAN

`public static final int TAN`
Constant Field Values

TAN2

`public static final int TAN2`
Constant Field Values

SIN

`public static final int SIN`
Constant Field Values

SIN2

`public static final int SIN2`
Constant Field Values

ARC

`public static final int ARC`
Constant Field Values

AITOFF

`public static final int AITOFF`
Constant Field Values

SANSON

`public static final int SANSON`
Constant Field Values

MERCATOR

`public static final int MERCATOR`
Constant Field Values

LAMBERT

`public static final int LAMBERT`
Constant Field Values

name

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

Proj3

`public Proj3(Coo centre)`
Standard (TAN) projection. At creation, the center and the type of projection is specified

Parameters:
`centre` - Point defining the center of projection. (coordinates of the tangent point, expressed in degrees).

Proj3

```public Proj3(int type,
Coo centre)```
Projection of a point on the sphere. At creation, the center and the type of projection is specified

Parameters:
`type` - projection type -- default (standard) = TAN
`centre` - Point defining the center of projection. (coordinates of the tangent point, expressed in degrees).

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 value of the projection.

Returns:
the X projection

getY

`public final double getY()`
Get the Y value of the projection

Returns:
the Y projection

getCoo

`public final Coo getCoo()`
Get the coordinate

Returns:
the point

getLon

`public final double getLon()`
Get the longitude of the point on the projection.

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

getLat

`public final double getLat()`
Get the latitude of the point on the projection.

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

set

`public boolean set(Coo coo)`
Compute a projection from initial coordinates.
Rem: the method was named computeXY in a previous version.

Parameters:
`coo` - coordinates (lon + lat)
Returns:
status (true if the projection is possible). false when the position can't be projected. The values of the projections are in this.X and this.Y

set

```public boolean set(double px,
double py)```
Reverse projection: compute the polar angle corresponding to (x,y)
Rem: Method was called computeAngles in a previous version.

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().