Package uk.ac.starlink.ttools.plot2
Class CdsHealpixUtil
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.CdsHealpixUtil
-
public class CdsHealpixUtil extends java.lang.ObjectUtilities for working with the cds-healpix-java library in sky plots.- Since:
- 21 May 2020
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_INTERPOLATE_DEPTHDefault minimum interpolation for HEALPix tile edges.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Set<java.lang.Long>bmocSet(cds.healpix.HealpixNestedBMOC bmoc)Represents the tiles in a BMOC as a Set of Longs.static double[]lonlatToVector(double[] lonlatRad)Converts a longitude, latitude 2-vector to a unit vector suitable for use as a sky surface data position, returning the result as a new array.static voidlonlatToVector(double[] lonlatRad, double[] xyz)Converts a longitude, latitude 2-vector to a unit vector suitable for use as a sky surface data position, writing the result to a supplied array.static voidlonlatToVector(double lonRad, double latRad, double[] xyz)Converts a longitude, latitude pair to a unit vector suitable for use as a sky surface data position, writing the result to a supplied array.static double[][]lonlatVertices(cds.healpix.VerticesAndPathComputer vpc, long hash, int minDepth)Calculates vertices round the edge of a HEALPix tile, returning the result in a new array.static intlonlatVertices(cds.healpix.VerticesAndPathComputer vpc, long hash, int minDepth, double[][] lonlats)Calculates vertices round the edge of a HEALPix tile, writing the result in a supplied array.static longvectorToHash(cds.healpix.HashComputer hasher, double[] xyz)Calculates the tile index given a sky surface position unit vector.static double[]vectorToLonlat(double[] xyz)Converts a sky surface data position unit vector to a longitude, latitude 2-vector, returning the restult as a new array.static voidvectorToLonlat(double[] xyz, double[] lonlatRad)Converts a sky surface data position unit vector to a longitude, latitude 2-vector, writing the result to a supplied array.
-
-
-
Field Detail
-
DFLT_INTERPOLATE_DEPTH
public static final int DFLT_INTERPOLATE_DEPTH
Default minimum interpolation for HEALPix tile edges.- See Also:
- Constant Field Values
-
-
Method Detail
-
lonlatToVector
public static void lonlatToVector(double lonRad, double latRad, double[] xyz)Converts a longitude, latitude pair to a unit vector suitable for use as a sky surface data position, writing the result to a supplied array. No error checking is done.- Parameters:
lonRad- longitude in radianslatRad- latitude in radiansxyz- 3-element vector into which (x,y,z) is written
-
lonlatToVector
public static void lonlatToVector(double[] lonlatRad, double[] xyz)Converts a longitude, latitude 2-vector to a unit vector suitable for use as a sky surface data position, writing the result to a supplied array. No error checking is done.- Parameters:
lonlatRad- 2-element vector giving (longitude,latitude) in radiansxyz- 3-element vector into which (x,y,z) is written
-
lonlatToVector
public static double[] lonlatToVector(double[] lonlatRad)
Converts a longitude, latitude 2-vector to a unit vector suitable for use as a sky surface data position, returning the result as a new array. No error checking is done.- Parameters:
lonlatRad- 2-element vector giving (longitude,latitude) in radians- Returns:
- 3-element unit vector containing (x,y,z)
-
vectorToHash
public static long vectorToHash(cds.healpix.HashComputer hasher, double[] xyz)Calculates the tile index given a sky surface position unit vector.- Parameters:
xyz- 3-element unit vector containing (x,y,z)
-
vectorToLonlat
public static void vectorToLonlat(double[] xyz, double[] lonlatRad)Converts a sky surface data position unit vector to a longitude, latitude 2-vector, writing the result to a supplied array. No error checking is done.- Parameters:
xyz- 3-element array containing (x,y,z)lonlatRad- 2-element array into which (longitude, latitude) in radians is written
-
vectorToLonlat
public static double[] vectorToLonlat(double[] xyz)
Converts a sky surface data position unit vector to a longitude, latitude 2-vector, returning the restult as a new array. No error checking is done.- Parameters:
xyz- 3-element unit vector containing (x,y,z)- Returns:
- 2-element array giving (longitude, latitude) in radians
-
bmocSet
public static java.util.Set<java.lang.Long> bmocSet(cds.healpix.HealpixNestedBMOC bmoc)
Represents the tiles in a BMOC as a Set of Longs. The returned object is a thin adapter on top of the input BMOC.- Parameters:
bmoc- result of healpix query- Returns:
- set of hashes at BMOC depth
-
lonlatVertices
public static int lonlatVertices(cds.healpix.VerticesAndPathComputer vpc, long hash, int minDepth, double[][] lonlats)Calculates vertices round the edge of a HEALPix tile, writing the result in a supplied array. This convenience method just simplifies the required parameters.- Parameters:
vpc- healpix object that does the workhash- tile indexminDepth- the minimal depth at which vertices are calculated; if the tile depth is greater or equal to this value then 4 vertices will be calculated, otherwise interpolated points will be includedlonlats- [N][2]-element array into which pairs of (longitude,latitude) in radians will be written- Returns:
- number of vertices written into lonlats
-
lonlatVertices
public static double[][] lonlatVertices(cds.healpix.VerticesAndPathComputer vpc, long hash, int minDepth)Calculates vertices round the edge of a HEALPix tile, returning the result in a new array. This convenience method just simplifies the required parameters.- Parameters:
vpc- healpix object that does the workhash- tile indexminDepth- the minimal depth at which vertices are calculated; if the tile depth is greater or equal to this value then 4 vertices will be calculated, otherwise interpolated points will be included- Returns:
- array of (longitude,latitude) pairs in radians
-
-