Package cds.healpix

Interface VerticesAndPathComputer

  • All Superinterfaces:
    HierarchyItem
    All Known Implementing Classes:
    HealpixNested, HealpixNestedFast

    public interface VerticesAndPathComputer
    extends HierarchyItem
    Interface defining methods used to compute the position (on the unit sphere) of HEALPix cells center and vertices, and paths along HEALPix cells sides and edge.
    Author:
    F.-X. Pineau
    • Field Detail

      • LON_INDEX

        static final int LON_INDEX
        Index of the longitude in the array containing coordinate on the unit sphere.
        See Also:
        Constant Field Values
      • LAT_INDEX

        static final int LAT_INDEX
        Index of the lattitude in the array containing coordinate on the unit sphere.
        See Also:
        Constant Field Values
    • Method Detail

      • center

        double[] center​(long hash)
        Compute the position on the unit sphere of the center (in the Euclidean projection plane) of the cell associated to the given hash value.
        Parameters:
        hash - hash value of the cell we look for the unprojected center
        Returns:
        the unprojected position (on the unit sphere) of the center of the cell in the Euclidean plane. The lon and lat coordinate are stored in the returned array at indices LON_INDEX and LAT_INDEX respectively. Lat in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
      • center

        void center​(long hash,
                    double[] resultLonLat)
        See center(long), except that the result is stored in the given array.
        Parameters:
        hash - hash value of the cell we look for the unprojected center.
        resultLonLat - array used to store the result. Must be of size >= 2.
      • vertex

        double[] vertex​(long hash,
                        CompassPoint.Cardinal cardinalPoint)
        Compute the position of an HEALPix cell vertex on the unit sphere.
        Parameters:
        hash - hash value of the cell we look for the given vertex.
        cardinalPoint - location of the vertex with respect to the cell center
        Returns:
        the position (on the unit sphere) of the vertex located at the given cardinal direction from the center of the given cell. The lon and lat coordinate are stored in the returned array at indices LON_INDEX and LAT_INDEX respectively. Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
      • vertex

        void vertex​(long hash,
                    CompassPoint.Cardinal cardinalPoint,
                    double[] resultLonLat)
        See vertex(long, Cardinal), except that the result is stored in the given array.
        Parameters:
        hash - hash value of the cell we look for the given vertex.
        cardinalPoint - location of the vertex with respect to the cell center
        resultLonLat - array used to store the result. Must be of size >= 2.
      • vertices

        java.util.EnumMap<CompassPoint.Cardinal,​double[]> vertices​(long hash,
                                                                         java.util.EnumSet<CompassPoint.Cardinal> cardinalPoints)
        Returns the vertices located at the given cardinal points. If you want the full 4 vertices, simply use EnumSet.allOf(Cardinal). For West and East vertices, use EnumSet.of(Cardinal.W, Cardinal.E).
        Parameters:
        hash - hash value of the cell we look for the given vertices.
        cardinalPoints - locations of the vertices we look for the positions
        Returns:
        the positions (on the unit sphere) of the vertices located at the given cardinal directions from the center of the given cell. The lon and lat coordinates of each vertex are stored in the arrays at indices LON_INDEX and LAT_INDEX respectively. Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
      • vertices

        void vertices​(long hash,
                      java.util.EnumMap<CompassPoint.Cardinal,​double[]> cardinalPoints)
        See vertices(long, EnumSet). The difference is that the user provides a pre-set Map. The structure of the Map is not modified, but the coordinates of the values (array values) are overwritten. An error will be thrown if a value is null or contains less than two elements.
        Parameters:
        hash - hash value of the cell we look for the given vertices.
        cardinalPoints - the map to be modified y
      • pathAlongCellSide

        double[][] pathAlongCellSide​(long hash,
                                     CompassPoint.Cardinal fromVertex,
                                     CompassPoint.Cardinal toVertex,
                                     boolean isToVertexIncluded,
                                     int nSegments)
        Compute points on a given side of a given HEALPix cell on the unit sphere.
        Parameters:
        hash - hash value of the cell we look for side path on the unit sphere.
        fromVertex - direction (from the cell center) of the path starting vertex
        toVertex - direction (from the cell center) of the path ending vertex
        isToVertexIncluded - if false, the result contains nSegments points and do no include the result ending vertex. Else the result contains nSegments + 1 points.
        nSegments - number of segments in the path from the starting vertex to the ending vertex
        Returns:
        a list of points on the given side of the given HEALPix cell on the unit sphere.
      • pathAlongCellSide

        void pathAlongCellSide​(long hash,
                               CompassPoint.Cardinal fromVertex,
                               CompassPoint.Cardinal toVertex,
                               boolean isToVertexIncluded,
                               int nSegments,
                               double[][] pathPoints)
        See pathAlongCellSide(long, Cardinal, Cardinal, boolean, int). The difference is that the user provides a list of points whose coordinates are going to be overwritten. An error will be thrown if the array (of array) is not large enough (i.e. its is smaller than nSegments or nSegments + 1) or if one of the array is null or contains less than two elements.
        Parameters:
        hash - hash value of the cell we look for side path on the unit sphere.
        fromVertex - direction (from the cell center) of the path starting vertex
        toVertex - direction (from the cell center) of the path ending vertex
        isToVertexIncluded - if false, the result contains nSegments points and do no include the result ending vertex. Else the result contains nSegments + 1 points.
        nSegments - number of segments in the path from the starting vertex to the ending vertex
        pathPoints - object used to store the result.
      • pathAlongCellEdge

        double[][] pathAlongCellEdge​(long hash,
                                     CompassPoint.Cardinal startingVertex,
                                     boolean clockwiseDirection,
                                     int nSegmentsBySide)
        Parameters:
        hash - hash value of the cell we look for the edge path on the unit sphere.
        startingVertex - direction (from the cell center) of the path starting vertex
        clockwiseDirection - if true, result points are stored in a clockwise direction order, else they are stored in counter-clockwise direction order.
        nSegmentsBySide - number of segments in each each side is divided. Hence, the total number of points in the result is 4 x nSegmentsBySide.
        Returns:
        a list of points on the given edge of the given HEALPix cell on the unit sphere, clockwise or counter-clockwise ordered.
      • pathAlongCellEdge

        void pathAlongCellEdge​(long hash,
                               CompassPoint.Cardinal startingVertex,
                               boolean clockwiseDirection,
                               int nSegmentsBySide,
                               double[][] pathPoints)
        See pathAlongCellEdge(long, Cardinal, boolean, int). The difference is that the user provides a list of points whose coordinates are going to be overwritten. An error will be thrown if the array (of array) is not large enough (i.e. its is smaller than 4 *nSegments) or if one of the array is null or contains less than two elements.
        Parameters:
        hash - hash hash value of the cell we look for the edge path on the unit sphere.
        startingVertex - direction (from the cell center) of the path starting vertex
        clockwiseDirection - if true, result points are stored in a clockwise direction order, else they are stored in counter-clockwise direction order.
        nSegmentsBySide - number of segments in each each side is divided. Hence, the total number of points in the result is 4 x nSegmentsBySide.
        pathPoints - object used to store the result.