skyview.geometry.projecter

## Class Hpx

• All Implemented Interfaces:
java.io.Serializable, Component

```public class Hpx
extends Projecter```
The HEALPix project projects the sky into equal area pixels where the centers of the pixels are lined up on constant values of declination. The nominal HEALPix projection is to the plane and the pixels are shaped like diamonds in this plane. Since we want to have square (or at least rectangular) pixels we often use a rotated plane where we have rotated by 45 degrees and also rescaled the tiles (only slightly) to be unit squares. This is the normalized or oblique projection. In the oblique projection we arrange the 12 base squares into the following orientation ``` 3 40 851 962 A7 B ``` Thus the 12 data squares can be enclosed in a 6x4 array including another 12 unused squares. The diagonal stripe continues where each of the three rows repeats 01230123..., 456745674567..., 89AB89AB89AB... indefinitely and we are free to pick the most convenient arrangement.

An alternative arrangement might be. ``` 40 851 962 A73 B ``` where the data squares can be enclosed in a 5x5 array. (This is similar to the Calabretta arrangement except that they would repeat tile 4 below tile 3. Note that we use a bend dexter rather than the bend sinister in Calabretta since we treat the longitude coordinate are increasing to the right.)

The actual transformations to and from the coordinate plane are carried out using the static methods proj and deproj which are called by the relevant method of Hpx and HpxDeproj. Note that HpxDeproj is included as a static class.

HEALPix is a true transformation so this transformation function does not depend upon the input order (i.e., the number of pixels in the pixelization). This does affect ancillary functions (notably cvtPixel) which are used when individual pixels are to be considered rather than the geometric transformation between sphere and plane.

The nominal HEALPix Projection runs from 0-2 PI in x and is fully filled between 0 and +- Pi/4 in y. It has triangular teeth that extend from the filled region to Pi/2 and cover half the vertical region between PI/4 and PI/2. Thus the total area covered by the projections is 2 PI * (PI/2 + 1/2 * PI/2) A = 2 PI * 3/4 PI. In principle since this is an area conserving transformation we might expect the total area to be 4 PI. However to allow these convenient boundaries to the map the nominal project expands pixels by a factor of 3 PI/8. The nominal area of the projection is A=3 PI^2/2 A = 3 PI^2 /2. So the area of the pixels expands by a factor of 3 PI/8 relative to the area on the unit sphere. A=14.8 so we shrink the tiles slightly when we work in the oblique normalized projection where the tiles are unit squares and the total area is exactly 12.

Given that the total area is 3*PI^2/2, the area of each tile is 3*PI^2 / 24 = PI^2/8 Thus each of the tile sides is sqrt(A/12) = PI/SQRT(8) = PI/ (2 SQRT(2)) in the nominal HEALPix projection (in which the tiles are oriented as diamonds)

Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static class ` `Hpx.HpxDeproj`
• ### Constructor Summary

Constructors
Constructor and Description
`Hpx()`
Default to the 512x512 squares
`Hpx(int order)`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`long` `cvtPixel(long pixel)`
This method converts a pixel number based on the assumption that we have a simple two-d image map, into the nested HEALPix pixel number.
`double[]` `denorm(double[] position)`
`static void` ```deproj(double[] in, double[] unit)```
Given an X-Y in the nominal HEALPix projection, return the unit vector on the sphere.
`double[][]` `getCorners(long pix)`
Get the scaled corners of a pixel in the nominal HEALPix projection
`java.lang.String` `getDescription()`
Get the description of this component.
`double` `getHealpixScale()`
Get the size of the HEALPix pixels in the projection frame.
`Interleave` `getInterleave()`
`java.lang.String` `getName()`
Get the name of this component.
`long` `getNSide()`
Get the number of pixels on each side of one of the 12 main HEALPix tiles.
`double[]` `getOblCorner(long pix)`
Get the unscaled (i.e., unit tiles) lower left corner in the oblique projection
`long` ```getObliquePixel(double u, double v)```
Given the coordinates in the normalized oblique projection, find the pixel number.
`long` `getPixel(double[] pos)`
Find the pixel that includes the given position.
`Deprojecter` `inverse()`
Get the inverse
`boolean` `isInverse(Transformer t)`
Are these two transformations, inverses of each other? This method is used to optimize a series of transformations where transformations.
`static void` `main(java.lang.String[] args)`
`double[]` `normCoords(double[] position)`
`int` `normTile(double[] norm)`
Return the tile number corresponding to the normalized coordinate location.
`static void` ```proj(double[] unit, double[] proj)```
`double[]` `rotateAndScale(double[] position)`
`void` `setOrder(int order)`
Set up the base geometry of the HEALPix projection for the given order.
`boolean` `straddle(double[][] xy)`
Does this region specified by the points straddle?
`boolean` `straddleable()`
Can a region straddle in the projection -- and do we have code that can address this?
`double[][][]` `straddleComponents(double[][] xy)`
`int` `tile(double[] position)`
Return the tile number corresponding to the nominal projection location.
`void` ```transform(double[] sphere, double[] plane)```
Convert a single point where the output vector is supplied.
`boolean` `validPosition(double[] plane)`
Decide whether this is in the valid field of the HEALPix projection.
• ### Methods inherited from class skyview.geometry.Projecter

`allValid, getInputDimension, getOutputDimension, getXTiling, getYTiling, shadowPoint, tissot`
• ### Methods inherited from class skyview.geometry.Transformer

`transform, transform`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Hpx

`public Hpx()`
Default to the 512x512 squares
• #### Hpx

`public Hpx(int order)`
Parameters:
`order` - The power of two giving the number of pixels along an edge of a square. The total number of pixels in the projection is 12 * Math.pow(2, 2*order)
• ### Method Detail

• #### getHealpixScale

`public double getHealpixScale()`
Get the size of the HEALPix pixels in the projection frame.
• #### setOrder

`public void setOrder(int order)`
Set up the base geometry of the HEALPix projection for the given order.
Parameters:
`order` -
• #### getInterleave

`public Interleave getInterleave()`
• #### getName

`public java.lang.String getName()`
Description copied from interface: `Component`
Get the name of this component.
• #### getDescription

`public java.lang.String getDescription()`
Description copied from interface: `Component`
Get the description of this component.
• #### inverse

`public Deprojecter inverse()`
Description copied from class: `Projecter`
Get the inverse
Specified by:
`inverse` in class `Projecter`
• #### isInverse

`public boolean isInverse(Transformer t)`
Description copied from class: `Transformer`
Are these two transformations, inverses of each other? This method is used to optimize a series of transformations where transformations.
Specified by:
`isInverse` in class `Transformer`
• #### validPosition

`public boolean validPosition(double[] plane)`
Decide whether this is in the valid field of the HEALPix projection. This uses the geometry noted above.
Overrides:
`validPosition` in class `Projecter`
Parameters:
`plane` -
Returns:
• #### getOblCorner

`public double[] getOblCorner(long pix)`
Get the unscaled (i.e., unit tiles) lower left corner in the oblique projection
• #### getCorners

`public double[][] getCorners(long pix)`
Get the scaled corners of a pixel in the nominal HEALPix projection
• #### deproj

```public static void deproj(double[] in,
double[] unit)```
Given an X-Y in the nominal HEALPix projection, return the unit vector on the sphere.
• #### proj

```public static void proj(double[] unit,
double[] proj)```
• #### transform

```public void transform(double[] sphere,
double[] plane)```
Description copied from class: `Transformer`
Convert a single point where the output vector is supplied.
Specified by:
`transform` in class `Transformer`
Parameters:
`sphere` - The input vector.
`plane` - The output vector, it may be the same as the input vector if the dimensionalities are the same. All transformers are expected to work with aliased inputs and output.
• #### getPixel

`public long getPixel(double[] pos)`
Find the pixel that includes the given position.
Parameters:
`pos` - The position in the nominal HEALPix projection plane
• #### getObliquePixel

```public long getObliquePixel(double u,
double v)```
Given the coordinates in the normalized oblique projection, find the pixel number.
• #### normCoords

`public double[] normCoords(double[] position)`
• #### denorm

`public double[] denorm(double[] position)`
• #### tile

`public int tile(double[] position)`
Return the tile number corresponding to the nominal projection location.
• #### normTile

`public int normTile(double[] norm)`
Return the tile number corresponding to the normalized coordinate location.
• #### rotateAndScale

`public double[] rotateAndScale(double[] position)`
• #### getNSide

`public long getNSide()`
Get the number of pixels on each side of one of the 12 main HEALPix tiles. Note that while nSide is stored internally as a long to minimize long/int transformations, it must be in the range of an int.
Returns:
• #### cvtPixel

`public long cvtPixel(long pixel)`
This method converts a pixel number based on the assumption that we have a simple two-d image map, into the nested HEALPix pixel number. This routine assumes that the input pixel numbers are associated with a (4 nSide)x(6 nSide) virtual image. Note that this is assumed to be in the oblique frame.

`public boolean straddleable()`
Can a region straddle in the projection -- and do we have code that can address this?
Overrides:
`straddleable` in class `Projecter`

`public boolean straddle(double[][] xy)`
Does this region specified by the points straddle?
Overrides:
`straddle` in class `Projecter`
`public double[][][] straddleComponents(double[][] xy)`
`straddleComponents` in class `Projecter`
`public static void main(java.lang.String[] args)`