public final class Healpix extends java.lang.Object implements Projection
Modifier and Type | Field and Description |
---|---|
static FillingCurve2DType |
DEFAULT_FCTYPE
Default implementation of the z-order curve.
|
static int |
DEPTH_MAX
29, largest possible depth we can store on a signed positive long
(4 bits for base cells + 2 bits per depth + 2 remaining bits (1 use in the unique notation).
|
static double |
LAT_OF_SQUARE_CELL
Latitude, in the equatorial region, for which the distance from the cell center to its four
vertices is equal on the sky (i.e. the shape of the cell on the sky is similar to a square):
dX = dY = 1 / nside (center to vertex distance)
X = 4/pi * lon => dX = 4/pi dlon
Y = 3/2 * sin(lat) => dY = 3/2 * cos(lat) dlat
dlon * cos(lat) = dlat (same distance on the sky)
=> cos^2(lat) = 2/3 * 4/pi
=> lat = arccos(sqrt(2/3 * 4/pi)) = 22.88050802005781976715 deg = 0.39934019947897773410 rad
|
static double |
TRANSITION_LATITUDE
Limit on the |latitude (in radians)| between the equatorial region and the polar caps.
|
static double |
TRANSITION_Z
Limit on |z|=|sin(lat)| between the equatorial region and the polar caps.
|
static Healpix |
UI
Unique instance of this class (needed to implement the
Projection interface). |
LAT_INDEX, LON_INDEX, X_INDEX, Y_INDEX
Modifier and Type | Method and Description |
---|---|
static int |
depth(int nside)
Returns the number of subdivision of a base-resolution pixel at the given nside.
|
static int |
getBestStartingDepth(double distMaxInRad)
Returns the the smallest depth (in [0, 29]) at which a shape having the given largest distance
from its center to a border overlaps a maximum of 9 cells (the cell containing the center of
the shape plus the 8 neighbouring cells).
|
static double |
getLargestCenterToCellVertexDistance(double lonRad,
double latRad,
int depth)
For a given position on the unit sphere and a given depth, returns an upper limit on the
distance between the center of a cell and its farthest vertex.
|
static HealpixNested |
getNested(int depth)
Lazy instantiation of unique instances of
HealpixNested for each required depth. |
static HealpixNested |
getNested(int depth,
FillingCurve2DType fillingCurveType)
Same as
getNested(int) except that we have here a given instance per depth and
z-order curve implementation DEFAULT_FCTYPE . |
static HealpixNestedFast |
getNestedFast(int depth)
Same as
getNested(int) for HealpixNestedFast , i.e. faster but less readable
version of HealpixNested . |
static HealpixNestedFast |
getNestedFast(int depth,
FillingCurve2DType fillingCurveType)
Same as
getNested(int, FillingCurve2DType) for HealpixNestedFast ,
i.e. faster but less readable version of HealpixNested . |
static boolean |
isLatInNorthPolarCap(double latRad)
Returns
true if the given latitude is in the North polar cap |
static boolean |
isLatInSouthPolarCap(double latRad)
Returns
true if the given latitude is in the South polar cap |
static long |
nHash(int depth)
Returns the number of cells (so the number of distinct hash value) the unit sphere is divided
in at the given depth.
|
static int |
nIsolatitudeRings(int depth)
Returns the number of isolatitude rings at the given depth, i.e. the number of small circles
parallel to the equator containing HEALPix cell centers
|
static int |
nside(int depth)
Returns the number of cells along both axis of a base-resolution cell at the given depth.
|
double[] |
project(double lonRad,
double latRad)
Project the given spherical coordinates into the Euclidean plane, following the HPX WCS
projection (see Calabretta2007).
|
void |
project(double lonRad,
double latRad,
double[] resultXY)
See
Projection.project(double, double) with the result stored in the given array. |
static long |
uniq(int depth,
long hash)
Create the unique representation of the given hash at the given depth.
|
static int |
uniq2depth(long uniqedHash)
Extract the depth from the unique representation of the hash.
|
static long |
uniq2hash(long uniqedHash)
Extract the hash from the the unique representation of the hash.
|
static long |
uniq2hash(long uniqdHash,
int depth)
Faster version of
uniq2hash(long) in case we know (or have already extracted) the depth. |
double[] |
unproject(double x,
double y)
Reverse projection: we look for spherical coordinates from their projected coordinates
(
Projection.project(double, double) . |
void |
unproject(double x,
double y,
double[] resultLonLat)
See
Projection.unproject(double, double) with the result stored in the given array. |
public static final int DEPTH_MAX
public static final double TRANSITION_Z
public static final double TRANSITION_LATITUDE
public static final double LAT_OF_SQUARE_CELL
public static final FillingCurve2DType DEFAULT_FCTYPE
public static final Healpix UI
Projection
interface).public static double getLargestCenterToCellVertexDistance(double lonRad, double latRad, int depth)
lonRad
- longitude in radians.latRad
- latitude in radians.depth
- HEALPix depth.public static HealpixNested getNested(int depth)
HealpixNested
for each required depth.
Uses internally a double-checked lock.depth
- the depth of the wanted HealpixNested
instanceHealpixNested
instance at the given depthpublic static HealpixNested getNested(int depth, FillingCurve2DType fillingCurveType)
getNested(int)
except that we have here a given instance per depth and
z-order curve implementation DEFAULT_FCTYPE
.depth
- the depth of the wanted HealpixNested
instancefillingCurveType
- the wanted z-order curve implementationHealpixNested
instance at the given depth, with the given z-order curve
implementationpublic static HealpixNestedFast getNestedFast(int depth)
getNested(int)
for HealpixNestedFast
, i.e. faster but less readable
version of HealpixNested
.depth
- the depth of the wanted HealpixNestedFast
instanceHealpixNestedFast
instance at the given depthpublic static HealpixNestedFast getNestedFast(int depth, FillingCurve2DType fillingCurveType)
getNested(int, FillingCurve2DType)
for HealpixNestedFast
,
i.e. faster but less readable version of HealpixNested
.depth
- he depth of the wanted HealpixNestedFast
instancefillingCurveType
- the wanted z-order curve implementationHealpixNestedFast
instance at the given depth, with the given z-order curve
implementationpublic static int nside(int depth)
depth
- (or order) number of subdivision of a base-resolution cell, from 0 to DEPTH_MAX
.public static int depth(int nside)
nside
- number of pixels along both axis of a base-resolution pixel, from 1 to 2 power
DEPTH_MAX
.public static long nHash(int depth)
depth
- (or order) number of subdivision of a base-resolution cell, from 0 to DEPTH_MAX
.public static int nIsolatitudeRings(int depth)
depth
- (or order) number of subdivision of a base-resolution cell, from 0 to DEPTH_MAX
.public static boolean isLatInNorthPolarCap(double latRad)
true
if the given latitude is in the North polar caplatRad
- latitude, in radianstrue
if latRad >
TRANSITION_LATITUDE
public static boolean isLatInSouthPolarCap(double latRad)
true
if the given latitude is in the South polar caplatRad
- latitude, in radianstrue
if latRad < -
TRANSITION_LATITUDE
public static int getBestStartingDepth(double distMaxInRad)
distMaxInRad
- largest possible distance, in radians, between the center and the border
of a shape.public double[] project(double lonRad, double latRad)
project
in interface Projection
lonRad
- longitude in radians, support positive and negative reasonably large values with a
naive approach (no Cody-Waite nor Payne Hanek range reduction).latRad
- latitude, must be in [-pi/2, pi/2] radianspublic void project(double lonRad, double latRad, double[] resultXY)
Projection
Projection.project(double, double)
with the result stored in the given array.project
in interface Projection
lonRad
- see Projection.project(double, double)
latRad
- see Projection.project(double, double)
resultXY
- array used to store the result. Must be of size >= 2.public double[] unproject(double x, double y)
Projection
Projection.project(double, double)
.unproject
in interface Projection
x
- the x coordinate of the projected spherical point we are looking for,
the accepted value range is implementation dependenty
- the y coordinate of the projected spherical point we are looking for,
must be in [-2, 2].Projection.LON_INDEX
and Projection.LAT_INDEX
respectively.
Lat is in [-pi/2, pi/2] radians, lon is also in radians but it possible value range
is implementation dependent).public void unproject(double x, double y, double[] resultLonLat)
Projection
Projection.unproject(double, double)
with the result stored in the given array.unproject
in interface Projection
x
- Projection.unproject(double, double)
y
- Projection.unproject(double, double)
resultLonLat
- array used to store the result. Must be of size >= 2.public static long uniq(int depth, long hash)
depth
- the depth of the wanted unique hashhash
- the hash we want the unique representationpublic static int uniq2depth(long uniqedHash)
uniq(int, long)
to know more about the uniq encoding.uniqedHash
- the uniq nested hash value we want to extract the depthpublic static long uniq2hash(long uniqedHash)
uniq(int, long)
to know more about the uniq encoding.uniqedHash
- the uniq nested hash value we want to extract the hash valuepublic static long uniq2hash(long uniqdHash, int depth)
uniq2hash(long)
in case we know (or have already extracted) the depth.uniqdHash
- the uniq hash value we want to extract the hash valuedepth
- the known depth encoded in the given uniq hashCopyright © 2018 F.-X. Pineau, CDS, Observatoire Astronomique de Strasbourg, Universite de Strasbourg, CNRS. All Rights Reserved.