public final class HealpixNested extends java.lang.Object implements HashComputer, VerticesAndPathComputer, NeighbourSelector
protected
. to get an instance, see the Healpix.getNested(int)
or Healpix.getNested(int, FillingCurve2DType)
.ALL_CARDINAL_POINTS, LAT_INDEX, LON_INDEX
ALL_MAIN_WINDS
Modifier and Type | Method and Description |
---|---|
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.
|
void |
center(long hash,
double[] resultLonLat)
See
VerticesAndPathComputer.center(long) , except that the result is stored in the given array. |
int |
depth()
Returns the depth of the hash computed by
HashComputer.hash(double, double) method. |
long |
dividedBy4Quotient(long d) |
FlatHashList |
externalEdges(long hash,
int deltaDepth) |
void |
externalEdges(long hash,
int deltaDepth,
FlatHashList result) |
long |
hash(double lonRad,
double latRad)
This method is **not** thread safe.
|
long |
internalCorner(long hash,
int deltaDepth,
CompassPoint.Cardinal direction) |
long |
internalCornerE(long hash,
int deltaDepth) |
long |
internalCornerN(long hash,
int deltaDepth) |
long |
internalCornerS(long hash,
int deltaDepth) |
long |
internalCornerW(long hash,
int deltaDepth) |
FlatHashList |
internalEdges(long hash,
int deltaDepth) |
void |
internalEdges(long hash,
int deltaDepth,
FlatHashList result) |
long |
neighbour(long hash,
CompassPoint.MainWind direction)
The hash value of the neighbour of the cell of given hash, in the given deirection.
|
NeighbourList |
neighbours(long hash)
Returns the list of the hash of the cells surrounding the cell defined
by the given hash.
|
NeighbourList |
neighbours(long hash,
java.util.EnumSet<CompassPoint.MainWind> directions)
Equivalent of
NeighbourSelector.neighbours(long, FlatHashList) but with the list of direction of the
wanted neighbours. |
void |
neighbours(long hash,
java.util.EnumSet<CompassPoint.MainWind> directions,
NeighbourList result)
Equivalent of
NeighbourSelector.neighbours(long, FlatHashList) but with the list of direction of the
wanted neighbours. |
void |
neighbours(long hash,
FlatHashList result)
Idem as
NeighbourSelector.neighbours(long, NeighbourList) except that the result is put in a
simple FlatHashList . |
void |
neighbours(long hash,
NeighbourList result)
Equivalent of
NeighbourSelector.neighbours(long) but passing in argument the
list object to be filled. |
HealpixNestedFixedRadiusConeComputer |
newConeComputer(double coneRadiusRad)
Returns a
HealpixNestedFixedRadiusConeComputer , to be used in a distinct thread. |
HealpixNestedFixedRadiusCone4XMatch |
newConeComputer4Xmatch(double coneRadiusRad)
We suppose here that the radius of the (cross-match) cone is smaller that the typical size of
the cell by a factor at least 2 or 3.
|
HealpixNestedFixedRadiusConeComputer |
newConeComputerApprox(double coneRadiusRad)
Simpler version of the cone search, but at the cost of approximation (false positives).
|
HashComputer |
newHashComputer()
In multi-threaded environments, each thread must have its own
HashComputer since
HashComputer is not thread safe. |
HashComputerWithAux |
newHashComputerWithAux(AuxiliaryAxis auxAxis)
WARNING: the return object in not thread-safe!
|
NeighbourSelector |
newNeighbourSelector()
The internal
NeighbourSelector being thread-safe and unmutable, we return it instead
of creating a new instance. |
HealpixNestedPolygonComputer |
newPolygonComputer()
Returns a new instance of
HealpixNestedPolygonComputer at this object depth. |
VerticesAndPathComputer |
newVerticesAndPathComputer()
Returns a
VerticesAndPathComputer , to be used in a distinct thread. |
double[][] |
pathAlongCellEdge(long hash,
CompassPoint.Cardinal startingVertex,
boolean clockwiseDirection,
int nSegmentsBySide) |
void |
pathAlongCellEdge(long hash,
CompassPoint.Cardinal startingVertex,
boolean clockwiseDirection,
int nSegmentsBySide,
double[][] pathPoints)
See
#pathAlongCellEdge(long, Cardinal, boolean, int) . |
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)
See
#pathAlongCellSide(long, Cardinal, Cardinal, boolean, int) . |
long |
regularRingEncode(long baseCellHash,
int iInBasePixel,
int jInBasePixel)
Encode the given data into the ring scheme hash.
|
FlatHashList |
sortedExternalEdges(long hash,
int deltaDepth) |
void |
sortedExternalEdges(long hash,
int deltaDepth,
FlatHashList result) |
FlatHashList |
sortedInternalEdge(long hash,
int deltaDepth,
CompassPoint.Ordinal direction) |
void |
sortedInternalEdge(long hash,
int deltaDepth,
CompassPoint.Ordinal direction,
FlatHashList result) |
FlatHashList |
sortedInternalEdgeNE(long hash,
int deltaDepth) |
void |
sortedInternalEdgeNE(long hash,
int deltaDepth,
FlatHashList result) |
FlatHashList |
sortedInternalEdgeNW(long hash,
int deltaDepth) |
void |
sortedInternalEdgeNW(long hash,
int deltaDepth,
FlatHashList result) |
FlatHashList |
sortedInternalEdges(long hash,
int deltaDepth) |
void |
sortedInternalEdges(long hash,
int deltaDepth,
FlatHashList result) |
FlatHashList |
sortedInternalEdgeSE(long hash,
int deltaDepth) |
void |
sortedInternalEdgeSE(long hash,
int deltaDepth,
FlatHashList result) |
FlatHashList |
sortedInternalEdgeSW(long hash,
int deltaDepth) |
void |
sortedInternalEdgeSW(long hash,
int deltaDepth,
FlatHashList result) |
long |
toNested(long ringHash)
Returns the nested representation if the given ring hash.
|
long |
toRing(long nestedHash)
Returns the ring representation if the given nested hash.
|
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)
See
#vertex(long, Cardinal) , except that the result is stored in the given array. |
void |
vertices(long hash,
java.util.EnumMap<CompassPoint.Cardinal,double[]> cardinalPoints)
|
java.util.EnumMap<CompassPoint.Cardinal,double[]> |
vertices(long hash,
java.util.EnumSet<CompassPoint.Cardinal> cardinalPoints)
Returns the vertices located at the given cardinal points.
|
public int depth()
HashComputer
HashComputer.hash(double, double)
method.depth
in interface HashComputer
depth
in interface HierarchyItem
HashComputer.hash(double, double)
method.public HashComputer newHashComputer()
HashComputer
since
HashComputer
is not thread safe.HashComputer
, to be used in a distinct thread.public HashComputerWithAux newHashComputerWithAux(AuxiliaryAxis auxAxis)
auxAxis
- object describing the auxiliary axisHashComputerWithAux
, to be used in a distinct thread.public long hash(double lonRad, double latRad)
HashComputer
created by
newHashComputer()
per thread.
WARNING: this method IS NOT thread safe. In multi-threaded environments, use the method
newHashComputer()
to create a HashComputer
for each thread.hash
in interface HashComputer
lonRad
- longitude (in radians) of the the coordinate we want the HEALPix hash value.latRad
- latitude (in radians) of the coordinate we want the HEALPix hash value.public VerticesAndPathComputer newVerticesAndPathComputer()
VerticesAndPathComputer
, to be used in a distinct thread.VerticesAndPathComputer
, to be used in a distinct thread.public double[] center(long hash)
VerticesAndPathComputer
center
in interface VerticesAndPathComputer
hash
- hash value of the cell we look for the unprojected centerVerticesAndPathComputer.LON_INDEX
and VerticesAndPathComputer.LAT_INDEX
respectively.
Lat in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.public void center(long hash, double[] resultLonLat)
VerticesAndPathComputer
VerticesAndPathComputer.center(long)
, except that the result is stored in the given array.center
in interface VerticesAndPathComputer
hash
- hash value of the cell we look for the unprojected center.resultLonLat
- array used to store the result. Must be of size >= 2.public double[] vertex(long hash, CompassPoint.Cardinal cardinalPoint)
VerticesAndPathComputer
vertex
in interface VerticesAndPathComputer
hash
- hash value of the cell we look for the given vertex.cardinalPoint
- location of the vertex with respect to the cell centerVerticesAndPathComputer.LON_INDEX
and VerticesAndPathComputer.LAT_INDEX
respectively.
Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.public void vertex(long hash, CompassPoint.Cardinal cardinalPoint, double[] resultLonLat)
VerticesAndPathComputer
#vertex(long, Cardinal)
, except that the result is stored in the given array.vertex
in interface VerticesAndPathComputer
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.public java.util.EnumMap<CompassPoint.Cardinal,double[]> vertices(long hash, java.util.EnumSet<CompassPoint.Cardinal> cardinalPoints)
VerticesAndPathComputer
EnumSet.allOf(Cardinal)
.
For West and East vertices, use EnumSet.of(Cardinal.W, Cardinal.E)
.vertices
in interface VerticesAndPathComputer
hash
- hash value of the cell we look for the given vertices.cardinalPoints
- locations of the vertices we look for the positionsVerticesAndPathComputer.LON_INDEX
and VerticesAndPathComputer.LAT_INDEX
respectively.
Lat is in [-pi/2, pi/2] radians, lon is in [0, 2pi] radians.public void vertices(long hash, java.util.EnumMap<CompassPoint.Cardinal,double[]> cardinalPoints)
VerticesAndPathComputer
VerticesAndPathComputer.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.vertices
in interface VerticesAndPathComputer
hash
- hash value of the cell we look for the given vertices.cardinalPoints
- the map to be modified ypublic double[][] pathAlongCellSide(long hash, CompassPoint.Cardinal fromVertex, CompassPoint.Cardinal toVertex, boolean isToVertexIncluded, int nSegments)
VerticesAndPathComputer
pathAlongCellSide
in interface VerticesAndPathComputer
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
- 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 vertexpublic void pathAlongCellSide(long hash, CompassPoint.Cardinal fromVertex, CompassPoint.Cardinal toVertex, boolean isToVertexIncluded, int nSegments, double[][] pathPoints)
VerticesAndPathComputer
#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.pathAlongCellSide
in interface VerticesAndPathComputer
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
- 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 vertexpathPoints
- object used to store the result.public double[][] pathAlongCellEdge(long hash, CompassPoint.Cardinal startingVertex, boolean clockwiseDirection, int nSegmentsBySide)
pathAlongCellEdge
in interface VerticesAndPathComputer
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
- 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
.public void pathAlongCellEdge(long hash, CompassPoint.Cardinal startingVertex, boolean clockwiseDirection, int nSegmentsBySide, double[][] pathPoints)
VerticesAndPathComputer
#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.pathAlongCellEdge
in interface VerticesAndPathComputer
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
- 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.public NeighbourSelector newNeighbourSelector()
NeighbourSelector
being thread-safe and unmutable, we return it instead
of creating a new instance.public long neighbour(long hash, CompassPoint.MainWind direction)
NeighbourSelector
neighbour
in interface NeighbourSelector
hash
- ash value of the cell we are looking for the neighbour.direction
- direction of the neighbour we are looking for.public NeighbourList neighbours(long hash)
NeighbourSelector
neighbours
in interface NeighbourSelector
hash
- hash value of the cell we are looking for the neighbours.public void neighbours(long hash, NeighbourList result)
NeighbourSelector
NeighbourSelector.neighbours(long)
but passing in argument the
list object to be filled.
WARNING: the content of the provided list is overwritten, and be sure
the list is large enough (at least of size 8).
And the value -1 is returned if the given hash has no neighbour at the given main wind direction.neighbours
in interface NeighbourSelector
hash
- the hash code we want the neighboursresult
- which contains the list of neighbours from index 0 to the number of neighbourspublic void neighbours(long hash, FlatHashList result)
NeighbourSelector
NeighbourSelector.neighbours(long, NeighbourList)
except that the result is put in a
simple FlatHashList
.
WARNING: the content of the provided list is overwritten, and be sure
the list is large enough (at least of size 8).neighbours
in interface NeighbourSelector
hash
- the hash code we want the neighboursresult
- which contains the list of neighbours from index 0 to the number of neighbourspublic NeighbourList neighbours(long hash, java.util.EnumSet<CompassPoint.MainWind> directions)
NeighbourSelector
NeighbourSelector.neighbours(long, FlatHashList)
but with the list of direction of the
wanted neighbours.neighbours
in interface NeighbourSelector
hash
- hash value of the cell we are looking for the neighbours.directions
- the directions of the neighbours we are looking for.public void neighbours(long hash, java.util.EnumSet<CompassPoint.MainWind> directions, NeighbourList result)
NeighbourSelector
NeighbourSelector.neighbours(long, FlatHashList)
but with the list of direction of the
wanted neighbours.
And the value -1 is returned if the given hash has no neighbour at the given main wind direction.neighbours
in interface NeighbourSelector
hash
- hash value of the cell we are looking for the neighbours.directions
- the directions of the neighbours we are looking for.result
- the list holding the result.public FlatHashList internalEdges(long hash, int deltaDepth)
internalEdges
in interface NeighbourSelector
public void internalEdges(long hash, int deltaDepth, FlatHashList result)
internalEdges
in interface NeighbourSelector
public FlatHashList sortedInternalEdges(long hash, int deltaDepth)
sortedInternalEdges
in interface NeighbourSelector
public void sortedInternalEdges(long hash, int deltaDepth, FlatHashList result)
sortedInternalEdges
in interface NeighbourSelector
public FlatHashList sortedInternalEdge(long hash, int deltaDepth, CompassPoint.Ordinal direction)
sortedInternalEdge
in interface NeighbourSelector
public void sortedInternalEdge(long hash, int deltaDepth, CompassPoint.Ordinal direction, FlatHashList result)
sortedInternalEdge
in interface NeighbourSelector
public FlatHashList sortedInternalEdgeNE(long hash, int deltaDepth)
sortedInternalEdgeNE
in interface NeighbourSelector
public void sortedInternalEdgeNE(long hash, int deltaDepth, FlatHashList result)
sortedInternalEdgeNE
in interface NeighbourSelector
public FlatHashList sortedInternalEdgeNW(long hash, int deltaDepth)
sortedInternalEdgeNW
in interface NeighbourSelector
public void sortedInternalEdgeNW(long hash, int deltaDepth, FlatHashList result)
sortedInternalEdgeNW
in interface NeighbourSelector
public FlatHashList sortedInternalEdgeSE(long hash, int deltaDepth)
sortedInternalEdgeSE
in interface NeighbourSelector
public void sortedInternalEdgeSE(long hash, int deltaDepth, FlatHashList result)
sortedInternalEdgeSE
in interface NeighbourSelector
public FlatHashList sortedInternalEdgeSW(long hash, int deltaDepth)
sortedInternalEdgeSW
in interface NeighbourSelector
public void sortedInternalEdgeSW(long hash, int deltaDepth, FlatHashList result)
sortedInternalEdgeSW
in interface NeighbourSelector
public long internalCorner(long hash, int deltaDepth, CompassPoint.Cardinal direction)
internalCorner
in interface NeighbourSelector
public long internalCornerN(long hash, int deltaDepth)
internalCornerN
in interface NeighbourSelector
public long internalCornerS(long hash, int deltaDepth)
internalCornerS
in interface NeighbourSelector
public long internalCornerE(long hash, int deltaDepth)
internalCornerE
in interface NeighbourSelector
public long internalCornerW(long hash, int deltaDepth)
internalCornerW
in interface NeighbourSelector
public FlatHashList externalEdges(long hash, int deltaDepth)
externalEdges
in interface NeighbourSelector
public void externalEdges(long hash, int deltaDepth, FlatHashList result)
externalEdges
in interface NeighbourSelector
public FlatHashList sortedExternalEdges(long hash, int deltaDepth)
sortedExternalEdges
in interface NeighbourSelector
public void sortedExternalEdges(long hash, int deltaDepth, FlatHashList result)
sortedExternalEdges
in interface NeighbourSelector
public HealpixNestedFixedRadiusConeComputer newConeComputer(double coneRadiusRad)
HealpixNestedFixedRadiusConeComputer
, to be used in a distinct thread.coneRadiusRad
- radius of the cone.HealpixNestedFixedRadiusConeComputer
, to be used in a distinct thread.public HealpixNestedFixedRadiusConeComputer newConeComputerApprox(double coneRadiusRad)
coneRadiusRad
- radius of the conepublic HealpixNestedFixedRadiusCone4XMatch newConeComputer4Xmatch(double coneRadiusRad)
coneRadiusRad
- radius of the conepublic HealpixNestedPolygonComputer newPolygonComputer()
HealpixNestedPolygonComputer
at this object depth.HealpixNestedPolygonComputer
at this object depth.public long toRing(long nestedHash)
nestedHash
- an HEALPix cell nested hash.public long regularRingEncode(long baseCellHash, int iInBasePixel, int jInBasePixel)
baseCellHash
- base cell number, in [0, 12[.iInBasePixel
- x-axis (i.e. South-East) z-curve coordinate in the base cell.jInBasePixel
- y-axis (i.e. South West) z-curve coordinate in the base cell.public long toNested(long ringHash)
ringHash
- an HEALPix cell ring hash.public long dividedBy4Quotient(long d)
Copyright © 2018 F.-X. Pineau, CDS, Observatoire Astronomique de Strasbourg, Universite de Strasbourg, CNRS. All Rights Reserved.