Class CdsHealpixUtil

java.lang.Object
uk.ac.starlink.ttools.cone.CdsHealpixUtil

public class CdsHealpixUtil extends Object
Utilities 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 final int
    Default minimum interpolation for HEALPix tile edges.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<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 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.
    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.
    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 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.
    static long
    vectorToHash(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 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DFLT_INTERPOLATE_DEPTH

      public static final int DFLT_INTERPOLATE_DEPTH
      Default minimum interpolation for HEALPix tile edges.
      See Also:
  • Method Details

    • 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 radians
      latRad - latitude in radians
      xyz - 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 radians
      xyz - 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 Set<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 work
      hash - tile index
      minDepth - 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
      lonlats - [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 work
      hash - tile index
      minDepth - 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