Package cds.healpix.common.sphgeom
Class CooXYZ
java.lang.Object
cds.healpix.common.sphgeom.CooXYZ
- Direct Known Subclasses:
Cone
Defines a coordinates on the unit-sphere, internally both Euclidean and Spherical coordinates
are stored.
To solve the Minimum Enclosing Cone (MEC) problem, we use the same algorithm as in
Berg et al. (2008) "Computational Geometry - Algorithms and Applications, 3rd Ed.pdf",
see ยง4.7, p. 86-89 (), which principle is general and works well in the sphere
as cited in Barequet & Elber (2005) "Optimal bounding cones of vectors in three dimensions"
(https://www.sciencedirect.com/science/article/pii/S0020019004002911?via%3Dihub).
It uses LP (linear programming) and performs in O(n), n being the number of points we
want the smallest enclosing cone.
The code and its documentation (for the case of the unit sphere) is originally part of the
ARCHES x-match tool (developped by F.-X. Pineau for the European FP7 project ARCHES).
- Author:
- F.-X. Pineau
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final CooXYZ
Returns the center of the arc define by the smallest distance (on the unit sphere) between the two given points.static final CooXYZ
Faster version ofarcCenter(CooXYZ, CooXYZ)
when we already know the distance between the two given points.static Cone
boundingCone
(CooXYZ... p) Returns a bounding cone (not the smallest one, for the samllest one,mec(cds.healpix.common.sphgeom.CooXYZ, cds.healpix.common.sphgeom.CooXYZ)
).static final CooXYZ
circumCenter
(CooXYZ a, CooXYZ b, CooXYZ c) Returns the center on the unit sphere of the circumcircle of a spherical triangle of given vertices a, b and c.static final CooXYZ
circumCenter
(CooXYZ a, CooXYZ b, CooXYZ c, double r) Returns the center on the unit sphere of the circumcircle of radius r of a spherical triangle of given vertices a, b and c.static final double
circumRadiusSphe
(double a, double b, double c) Returns the angular radius (in radians) of the circumcircle of a spherical triangle of given side lengths a, b and c.static final double
circumRadiusSphe
(CooXYZ a, CooXYZ b, CooXYZ c) Returns the angular radius (in radians) of the circumcircle of a spherical triangle of given vertices a, b and c.static Vect3D
Returns the cross-product of the two given vectors.static final double
Returns the Euclidean distance separating the two given points.static final double
Returns the spherival distance (using the Haversine formula) separating the two given points.final double
lat()
Getterfinal double
lon()
Getterstatic Cone
Returns the Minimum Enclosing Cone, i.e.static Cone
Returns the minimum enclosing cone, i.e.static Cone
Returns the Minimum Enclosing Cone, i.e.static CooXYZ
normalizedSum
(CooXYZ... vects) Returns the sum of the given vector, normalized so that the resulting vector is on the unit sphere.double
scalarProd
(CooXYZ v) Computes the scalar product of this point with given vectors.double
scalarProd
(Vect3D v) Computes the scalar product of this point with given vectors.static final double
Retruns the spherical distance separating the two given points.static CooXYZ
toEquaCooXYZ
(CooXYZ pos) toString()
final double
x()
Getterfinal double
y()
Getterfinal double
z()
Getter
-
Constructor Details
-
CooXYZ
public CooXYZ(double lonRad, double latRad) -
CooXYZ
public CooXYZ(double x, double y, double z) -
CooXYZ
-
-
Method Details
-
toEquaCooXYZ
-
lon
public final double lon()Getter- Returns:
- the longitude, in radians
-
lat
public final double lat()Getter- Returns:
- the latitude, in radians
-
x
public final double x()Getter- Returns:
- the x cartesian coordinate
-
y
public final double y()Getter- Returns:
- the y cartesian coordinate
-
z
public final double z()Getter- Returns:
- the z cartesian coordinate
-
normalizedSum
Returns the sum of the given vector, normalized so that the resulting vector is on the unit sphere.- Parameters:
vects
- vector we are looking for the normalized sum.- Returns:
- the sum of the given vector, normalized so that the resulting vector is on the unit sphere.
-
crossProd
Returns the cross-product of the two given vectors.- Parameters:
v1
- first vectorv2
- second vector- Returns:
- the cross-product of the two given vectors.
-
scalarProd
Computes the scalar product of this point with given vectors.- Parameters:
v
- the second vector used in the scalar product.- Returns:
- the scalar product of this point with given vectors.
-
scalarProd
Computes the scalar product of this point with given vectors.- Parameters:
v
- the second vector used in the scalar product.- Returns:
- the scalar product of this point with given vectors.
-
havDist
Returns the spherival distance (using the Haversine formula) separating the two given points.- Parameters:
c1
- first pointc2
- second point- Returns:
- the spherival distance (using the Haversine formula) separating the two given points.
-
spheDist
Retruns the spherical distance separating the two given points.- Parameters:
c1
- first pointc2
- second point- Returns:
- the spherical distance separating the two given points.
-
euclDist
Returns the Euclidean distance separating the two given points.- Parameters:
c1
- first pointc2
- second point- Returns:
- the Euclidean distance separating the two given points.
-
toString
-
boundingCone
Returns a bounding cone (not the smallest one, for the samllest one,mec(cds.healpix.common.sphgeom.CooXYZ, cds.healpix.common.sphgeom.CooXYZ)
). In the worst case, the bounding cone has a radius ~= 2x the MEC radius.- Parameters:
p
- input points on the sphere- Returns:
- a cone containing all the points given in input (not the smallest one)
-
mec
Returns the minimum enclosing cone, i.e. the cone containig the two given points and having the smallest possible radius. In this trivial case, the diameter of the cone is the arc (ab).- Parameters:
a
- first pointb
- secobd point- Returns:
- the minimum enclosing cone, i.e. the cone containig the two given points and having the smallest possible radius. In this trivial case, the diameter of the cone is the arc (ab).
-
mec
Returns the Minimum Enclosing Cone, i.e. the cone containig the three given points and having the smallest possible radius.- Parameters:
a
- first pointb
- secobd pointc
- third point- Returns:
- the Minimum Enclosing Cone, i.e. the cone containig the three given points and having the smallest possible radius.
-
mec
Returns the Minimum Enclosing Cone, i.e. the cone containig all the given points and having the smallest possible radius. WARNING: the algorithm used here is not made to work with nonreflex cones (i.e. if the points are distributed is more than an hemisphere). For our purpose, we stop the algo AND RETURN NULL if we detect a radius > 7 rad ( i.e. ~97 deg) since below this value, the cell-in-cone or cell-in-polygone algorithm will test the 12 healpix base cells.- Parameters:
p
- list of the points we look for the minimum enclising cone- Returns:
- the Minimum Enclosing Cone, i.e. the cone containig all the given points and having the smallest possible radius.
-
circumRadiusSphe
public static final double circumRadiusSphe(double a, double b, double c) Returns the angular radius (in radians) of the circumcircle of a spherical triangle of given side lengths a, b and c.- Parameters:
a
- first size length (in radians)b
- second size length (in radians)c
- third size length (in radians)- Returns:
- in the angular radius (in radians) of the circumcircle of a spherical triangle of given side lengths a, b and c.
-
circumRadiusSphe
Returns the angular radius (in radians) of the circumcircle of a spherical triangle of given vertices a, b and c.- Parameters:
a
- first vertexb
- second vertexc
- third vertex- Returns:
- the angular radius (in radians) of the circumcircle of a spherical triangle of given vertices a, b and c.
-
circumCenter
Returns the center on the unit sphere of the circumcircle of a spherical triangle of given vertices a, b and c.- Parameters:
a
- first vertexb
- second vertexc
- third vertex- Returns:
- the center on the unit sphere of the circumcircle of a spherical triangle of given vertices a, b and c.
-
circumCenter
Returns the center on the unit sphere of the circumcircle of radius r of a spherical triangle of given vertices a, b and c.- Parameters:
a
- first vertexb
- second vertexc
- third vertexr
- spherical radius of the circumcircle- Returns:
- the center on the unit sphere of the circumcircle of radius r of a spherical triangle of given vertices a, b and c.
-
arcCenter
Returns the center of the arc define by the smallest distance (on the unit sphere) between the two given points.- Parameters:
a
- first pointb
- second point- Returns:
- the center of the arc define by the smallest distance (on the unit sphere) between the two given points.
-
arcCenter
Faster version ofarcCenter(CooXYZ, CooXYZ)
when we already know the distance between the two given points. INFO (2019/10/01 while porting in Rust): WE CAN SIMPLY COMPUTE THE NORMALIZED MEAN OF THE TWO VECTORS!!- Parameters:
a
- first pointb
- second pointr
- half the distance between a and b- Returns:
- the center of the arc define by the smallest distance (on the unit sphere, = 2*r) between the two given points.
-