jview
Class OrthographicTransformation

java.lang.Object
  extended by jview.AbstractFormattingTransform
      extended by jview.OrthographicTransformation
All Implemented Interfaces:
CoordinateTransforming, DeltaFormattedTransforming, DeltaTransforming, FormattedTransforming, SkyTransforming

public class OrthographicTransformation
extends AbstractFormattingTransform
implements SkyTransforming

This coordinate transforming instance translates ra/dec to normalized pixels under the rule of an orthogonal projection. It requires a center of projection in ra,dec and a field-of-view size, i.e. the size of the projected area in degrees. Setting a new component size can then be performed at will. The defining equations are:

   x = k_x cos(δ) sin(Δα),
   y = k_y [sin(δ)cos(δ_c)-cos(δ)sin(δ_c)cos(Δα)],
   sin(δ)=y/k_y cos(δ_c)+r sin(δ_c),
   tan(Δα)=x/[r cos(δ_c)-y sin(δ_c)]
   
where r is a radius,
   r^2 = (1-x^2/k_x^2-y^2/k_y^2)
   
The scaling factors k_x and k_y can be calculated using
   k_x = 1/2 sin(δ_c)/[tan(a/2)*(1-sin^2(δ_c)cos^2(a/2))^0.5],
   k_y = 0.5/sin(b/2)
   
Note that above formulars render the center of projection at (0,0). To allow direct conversion into normalized pixel, 0.5 has to be added.


Nested Class Summary
private static class OrthographicTransformation.AngleFormat
          A format that formats angles.
 
Field Summary
private  double cosdc
          The cosine of the declination of the center of projection.
private  double dec
          The center of projection, declination in degrees.
private  boolean hemisphere
          If true we only consider points on the front side.
private  double kx
          The scaling factor in x for fov-pixel size one.
private  double ky
          The scaling factor in y for fov-pixel size one.
private  double rac
          The center of projection, right ascension in degrees.
private  double sindc
          The sine of the declination of the center of projection.
 
Constructor Summary
OrthographicTransformation(double ra, double de, double width, double height)
          The center of the projcetion and the extend of the field-of-view in x and y directions must be specified.
OrthographicTransformation(double ra, double de, double width, double height, boolean half)
          The center of the projcetion and the extend of the field-of-view in x and y directions must be specified.
 
Method Summary
private  void defaultFormats()
          Sets the default formats for normal sky sizes.
 Format estimateX(double rasize)
          From ra-size to formatter.
 Format estimateY(double desize)
          From ra-size to formatter.
 Vector2D getCenter()
          Retruns the center of the projection as a vector2d.
 Point2D toNormalizedDistance(VectorG ul, VectorG dist)
          Converts a ra/dec distance to a normalized distance.
 Point2D toNormalizedSpace(VectorG radec)
          Converts a point from ra/dec into normalized pixel.
 VectorG toUserDistance(Rectangle2D norm)
          Converts a distance in normalized space to s distance in user space.
 VectorG toUserSpace(Point2D pixel)
          This conversation is non-unique, but we assume the solution closer to the center of projection to be the correct one.
 void useEstimatedFormats(Rectangle2D view, int nx, int ny)
          Does nothing, except if viewport is so small that we want to show sub-arcsec.
 
Methods inherited from class jview.AbstractFormattingTransform
deltaFormatUserSpaceX, deltaFormatUserSpaceY, formatUserCoordinates, formatUserSpaceX, formatUserSpaceY, getFormatUserX, getFormatUserY, setDeltaFormatUserX, setDeltaFormatUserY, setFormatUserX, setFormatUserY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rac

private double rac
The center of projection, right ascension in degrees.


dec

private double dec
The center of projection, declination in degrees.


sindc

private double sindc
The sine of the declination of the center of projection.


cosdc

private double cosdc
The cosine of the declination of the center of projection.


kx

private double kx
The scaling factor in x for fov-pixel size one.


ky

private double ky
The scaling factor in y for fov-pixel size one.


hemisphere

private boolean hemisphere
If true we only consider points on the front side.

Constructor Detail

OrthographicTransformation

public OrthographicTransformation(double ra,
                                  double de,
                                  double width,
                                  double height)
The center of the projcetion and the extend of the field-of-view in x and y directions must be specified. All units are in degrees. Scaling factors are calculated, but only for a 1pxl x 1pxl field. All angles are in degrees. Only considers points on the positive hemisphere


OrthographicTransformation

public OrthographicTransformation(double ra,
                                  double de,
                                  double width,
                                  double height,
                                  boolean half)
The center of the projcetion and the extend of the field-of-view in x and y directions must be specified. All units are in degrees. Scaling factors are calculated, but only for a 1pxl x 1pxl field. All angles are in degrees.

Method Detail

toUserSpace

public VectorG toUserSpace(Point2D pixel)
This conversation is non-unique, but we assume the solution closer to the center of projection to be the correct one.

Specified by:
toUserSpace in interface CoordinateTransforming
Parameters:
pixel - The image coordinates.
Returns:
A Point in the secondary system, i.e. ra/dec
Throws:
UnsupportedOperationException

toNormalizedSpace

public Point2D toNormalizedSpace(VectorG radec)
Converts a point from ra/dec into normalized pixel. Note that under a orthographic projection, two positions on the sphere exist that convert to the same pixel. If hemisphere is true, then null is returned if the ra/dec point handed over is on the 'backside'.

Specified by:
toNormalizedSpace in interface CoordinateTransforming
Parameters:
radec - A point in the secondary system.
Returns:
Pixel coordinates.
Throws:
UnsupportedOperationException

toUserDistance

public VectorG toUserDistance(Rectangle2D norm)
Converts a distance in normalized space to s distance in user space.

Specified by:
toUserDistance in interface DeltaTransforming

toNormalizedDistance

public Point2D toNormalizedDistance(VectorG ul,
                                    VectorG dist)
Converts a ra/dec distance to a normalized distance.

Specified by:
toNormalizedDistance in interface DeltaTransforming

useEstimatedFormats

public void useEstimatedFormats(Rectangle2D view,
                                int nx,
                                int ny)
Does nothing, except if viewport is so small that we want to show sub-arcsec.

Specified by:
useEstimatedFormats in interface FormattedTransforming
Overrides:
useEstimatedFormats in class AbstractFormattingTransform

estimateX

public Format estimateX(double rasize)
From ra-size to formatter.

Specified by:
estimateX in interface FormattedTransforming

estimateY

public Format estimateY(double desize)
From ra-size to formatter.

Specified by:
estimateY in interface FormattedTransforming

getCenter

public Vector2D getCenter()
Retruns the center of the projection as a vector2d.


defaultFormats

private void defaultFormats()
Sets the default formats for normal sky sizes.