Package cds.healpix
Interface VerticesAndPathComputer
- All Superinterfaces:
HierarchyItem
- All Known Implementing Classes:
HealpixNested
,HealpixNestedFast
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final EnumSet<CompassPoint.Cardinal>
EnumSet
containing all elements of theCompassPoint.Cardinal
enum.static final int
Index of the lattitude in the array containing coordinate on the unit sphere.static final int
Index of the longitude in the array containing coordinate on the unit sphere. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
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.void
center
(long hash, double[] resultLonLat) Seecenter(long)
, except that the result is stored in the given array.double[][]
pathAlongCellEdge
(long hash, CompassPoint.Cardinal startingVertex, boolean clockwiseDirection, int nSegmentsBySide) void
pathAlongCellEdge
(long hash, CompassPoint.Cardinal startingVertex, boolean clockwiseDirection, int nSegmentsBySide, double[][] pathPoints) 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.void
pathAlongCellSide
(long hash, CompassPoint.Cardinal fromVertex, CompassPoint.Cardinal toVertex, boolean isToVertexIncluded, int nSegments, double[][] pathPoints) double[]
vertex
(long hash, CompassPoint.Cardinal cardinalPoint) Compute the position of an HEALPix cell vertex on the unit sphere.void
vertex
(long hash, CompassPoint.Cardinal cardinalPoint, double[] resultLonLat) Seevertex(long, Cardinal)
, except that the result is stored in the given array.void
vertices
(long hash, EnumMap<CompassPoint.Cardinal, double[]> cardinalPoints) EnumMap<CompassPoint.Cardinal,
double[]> vertices
(long hash, EnumSet<CompassPoint.Cardinal> cardinalPoints) Returns the vertices located at the given cardinal points.Methods inherited from interface cds.healpix.HierarchyItem
depth
-
Field Details
-
ALL_CARDINAL_POINTS
EnumSet
containing all elements of theCompassPoint.Cardinal
enum. Defined for users comodity. -
LON_INDEX
static final int LON_INDEXIndex of the longitude in the array containing coordinate on the unit sphere.- See Also:
-
LAT_INDEX
static final int LAT_INDEXIndex of the lattitude in the array containing coordinate on the unit sphere.- See Also:
-
-
Method Details
-
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
andLAT_INDEX
respectively. Lat in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
-
center
void center(long hash, double[] resultLonLat) Seecenter(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
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
andLAT_INDEX
respectively. Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
-
vertex
Seevertex(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 centerresultLonLat
- array used to store the result. Must be of size >= 2.
-
vertices
EnumMap<CompassPoint.Cardinal,double[]> vertices(long hash, EnumSet<CompassPoint.Cardinal> cardinalPoints) Returns the vertices located at the given cardinal points. If you want the full 4 vertices, simply useEnumSet.allOf(Cardinal)
. For West and East vertices, useEnumSet.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
andLAT_INDEX
respectively. Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.
-
vertices
Seevertices(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 vertextoVertex
- direction (from the cell center) of the path ending vertexisToVertexIncluded
- iffalse
, the result containsnSegments
points and do no include the result ending vertex. Else the result containsnSegments + 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) SeepathAlongCellSide(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 vertextoVertex
- direction (from the cell center) of the path ending vertexisToVertexIncluded
- iffalse
, the result containsnSegments
points and do no include the result ending vertex. Else the result containsnSegments + 1
points.nSegments
- number of segments in the path from the starting vertex to the ending vertexpathPoints
- 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 vertexclockwiseDirection
- iftrue
, 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 is4 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) SeepathAlongCellEdge(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 vertexclockwiseDirection
- iftrue
, 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 is4 x nSegmentsBySide
.pathPoints
- object used to store the result.
-