LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
LSST Data Management Base Package
|
Point in an unspecified spherical coordinate system. More...
#include <SpherePoint.h>
Public Member Functions | |
SpherePoint (Angle const &longitude, Angle const &latitude) | |
Construct a SpherePoint from a longitude and latitude. | |
SpherePoint (double longitude, double latitude, AngleUnit units) | |
Construct a SpherePoint from double longitude and latitude. | |
SpherePoint (sphgeom::Vector3d const &vector) | |
Construct a SpherePoint from a vector representing a direction. | |
SpherePoint (sphgeom::LonLat const &lonLat) noexcept | |
Construct a SpherePoint from a sphgeom::LonLat. | |
SpherePoint () noexcept | |
Construct a SpherePoint with "nan" for longitude and latitude. | |
SpherePoint (SpherePoint const &other) noexcept | |
Create a copy of a SpherePoint. | |
SpherePoint (SpherePoint &&other) noexcept | |
Create a copy of a SpherePoint. | |
~SpherePoint () noexcept | |
SpherePoint & | operator= (SpherePoint const &other) noexcept |
Overwrite this object with the value of another SpherePoint. | |
SpherePoint & | operator= (SpherePoint &&other) noexcept |
Overwrite this object with the value of another SpherePoint. | |
operator sphgeom::LonLat () const noexcept | |
Make SpherePoint implicitly convertible to LonLat. | |
Angle | getLongitude () const noexcept |
The longitude of this point. | |
Angle | getRa () const noexcept |
Synonym for getLongitude. | |
Angle | getLatitude () const noexcept |
The latitude of this point. | |
Angle | getDec () const noexcept |
Synonym for getLatitude. | |
Point2D | getPosition (AngleUnit unit) const noexcept |
Return longitude, latitude as a Point2D object. | |
sphgeom::UnitVector3d | getVector () const noexcept |
A unit vector representation of this point. | |
Angle | operator[] (size_t index) const |
Longitude and latitude by index. | |
bool | atPole () const noexcept |
true if this point is either coordinate pole. | |
bool | isFinite () const noexcept |
true if this point is a well-defined position. | |
bool | operator== (SpherePoint const &other) const noexcept |
true if two points have the same longitude and latitude. | |
bool | operator!= (SpherePoint const &other) const noexcept |
false if two points represent the same position. | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. | |
Angle | bearingTo (SpherePoint const &other) const |
Orientation at this point of the great circle arc to another point. | |
Angle | separation (SpherePoint const &other) const noexcept |
Angular distance between two points. | |
SpherePoint | rotated (SpherePoint const &axis, Angle const &amount) const noexcept |
Return a point rotated from this one around an axis. | |
SpherePoint | offset (Angle const &bearing, Angle const &amount) const |
Return a point offset from this one along a great circle. | |
std::pair< Angle, Angle > | getTangentPlaneOffset (SpherePoint const &other) const |
Get the offset from a tangent plane centered at this point to another point. | |
Related Symbols | |
(Note that these are not member symbols.) | |
std::ostream & | operator<< (std::ostream &os, SpherePoint const &point) |
Print the value of a point to a stream. | |
Point in an unspecified spherical coordinate system.
This class represents a point on a sphere in the mathematical rather than the astronomical sense. It does not refer to any astronomical reference frame, nor does it have any concept of (radial) distance.
Points can be represented either as spherical coordinates or as a unit vector. The adopted convention for converting between these two systems is that (0, 0) corresponds to <1, 0, 0>, that (π/2, 0) corresponds to <0, 1, 0>, and that (0, π/2) corresponds to <0, 0, 1>.
To keep usage simple, SpherePoint does not support modification of existing values; transformations of SpherePoints should be expressed as a new object. To support cases where a SpherePoint must be updated in-place, SpherePoint supports assignment to an existing object. One example is in containers of SpherePoints; no STL container has an atomic element-replacement method, so complicated constructions would need to be used if you couldn't overwrite an existing element.
Definition at line 57 of file SpherePoint.h.
Construct a SpherePoint from a longitude and latitude.
longitude | The longitude of the point. +/-inf is treated as nan (because longitude is wrapped to a standard range and infinity cannot be wrapped) |
latitude | The latitude of the point. Must be in the interval [-π/2, π/2] radians. |
pex::exceptions::InvalidParameterError | Thrown if latitude is out of range. |
Definition at line 68 of file SpherePoint.cc.
lsst::geom::SpherePoint::SpherePoint | ( | double | longitude, |
double | latitude, | ||
AngleUnit | units ) |
Construct a SpherePoint from double longitude and latitude.
longitude | The longitude of the point. +/-inf is treated as nan (because longitude is wrapped to a standard range and infinity cannot be wrapped) |
latitude | The latitude of the point. Must be in the interval [-π/2, π/2] radians. |
units | The units of longitude and latitude |
pex::exceptions::InvalidParameterError | Thrown if latitude is out of range. |
Definition at line 65 of file SpherePoint.cc.
|
explicit |
Construct a SpherePoint from a vector representing a direction.
vector | A position whose direction will be stored as a SpherePoint. Must not be the zero vector. Need not be normalized, and the norm will not affect the value of the point. |
pex::exceptions::InvalidParameterError | Thrown if vector is the zero vector. |
Definition at line 76 of file SpherePoint.cc.
|
noexcept |
Construct a SpherePoint from a sphgeom::LonLat.
lonLat | The lonLat |
Definition at line 94 of file SpherePoint.cc.
|
noexcept |
Construct a SpherePoint with "nan" for longitude and latitude.
Definition at line 108 of file SpherePoint.cc.
|
defaultnoexcept |
Create a copy of a SpherePoint.
other | The point to copy. |
|
defaultnoexcept |
Create a copy of a SpherePoint.
As SpherePoint(SpherePoint const&), except that other
may be left in an unspecified but valid state.
|
defaultnoexcept |
|
inlinenoexcept |
true
if this point is either coordinate pole.
true
if this point is at the north or south pole, false
otherwiseDefinition at line 237 of file SpherePoint.h.
Angle lsst::geom::SpherePoint::bearingTo | ( | SpherePoint const & | other | ) | const |
Orientation at this point of the great circle arc to another point.
The orientation is measured in a plane tangent to the sphere at this point, with 0 degrees along the direction of increasing longitude and 90 degrees along the direction of increasing latitude. Thus for any point except the pole, the arc is due east at 0 degrees and due north at 90 degrees. To understand the behavior at the poles it may help to imagine the point has been shifted slightly by decreasing the absolute value of its latitude.
If the points are on opposite sides of the sphere then the returned bearing may be any value.
other | the point to which to measure the bearing |
A
and B
, A.bearingTo(B)
will in general not be 180 degrees away from B.bearingTo(A)
. Definition at line 159 of file SpherePoint.cc.
|
inlinenoexcept |
|
inlinenoexcept |
The latitude of this point.
Definition at line 190 of file SpherePoint.h.
|
inlinenoexcept |
The longitude of this point.
Definition at line 178 of file SpherePoint.h.
Return longitude, latitude as a Point2D object.
[in] | unit | Units of returned data. |
Definition at line 129 of file SpherePoint.cc.
|
inlinenoexcept |
std::pair< geom::Angle, geom::Angle > lsst::geom::SpherePoint::getTangentPlaneOffset | ( | SpherePoint const & | other | ) | const |
Get the offset from a tangent plane centered at this point to another point.
This is suitable only for small angles.
[in] | other | Coordinate to which to compute offset |
Definition at line 214 of file SpherePoint.cc.
|
noexcept |
A unit vector representation of this point.
Definition at line 124 of file SpherePoint.cc.
|
noexcept |
Return a hash of this object.
Definition at line 154 of file SpherePoint.cc.
|
noexcept |
true
if this point is a well-defined position.
true
if getLongitude(), getLatitude(), and getVector() return finite floating-point values; false
if any return NaN or infinity.Definition at line 144 of file SpherePoint.cc.
SpherePoint lsst::geom::SpherePoint::offset | ( | Angle const & | bearing, |
Angle const & | amount ) const |
Return a point offset from this one along a great circle.
For any point A
, any angle bearing
and any non-negative angle amount
, if B
= A.offset(bearing, amount)then
A.bearingTo(B) = amountand
A.separationTo(B) = amount. Negative values of
amountare supported in the obvious manner:
A.offset(bearing, delta) = A.offset(bearing + 180*degrees, -delta)`
bearing | the direction in which to move this point, following the conventions described in bearingTo. |
amount | the distance by which to move along the great circle defined by bearing |
Definition at line 185 of file SpherePoint.cc.
|
noexcept |
Make SpherePoint implicitly convertible to LonLat.
Definition at line 118 of file SpherePoint.cc.
|
noexcept |
false
if two points represent the same position.
This operator shall always return the logical negation of operator==(); see its documentation for a detailed specification.
Definition at line 152 of file SpherePoint.cc.
|
defaultnoexcept |
Overwrite this object with the value of another SpherePoint.
As operator=(SpherePoint const&), except that other
may be left in an unspecified but valid state.
|
defaultnoexcept |
Overwrite this object with the value of another SpherePoint.
This is the only method that can alter the state of a SpherePoint after its construction, and is provided to allow in-place replacement of SpherePoints where swapping is not possible.
other | The object with which to overwrite this one. |
|
noexcept |
true
if two points have the same longitude and latitude.
other | the point to test for equality |
other
, false otherwiseNaN
shall not compare equal to any point, including themselves. This may break algorithms that assume object equality is reflexive; use isFinite() to filter objects if necessary. Definition at line 146 of file SpherePoint.cc.
Longitude and latitude by index.
index | the index of the spherical coordinate to return. Must be either 0 or 1. |
index
= 0, or getLatitude() if index
= 1pex::exceptions::OutOfRangeError | Thrown if index is neither 0 nor 1. |
Definition at line 133 of file SpherePoint.cc.
|
noexcept |
Return a point rotated from this one around an axis.
axis | a point defining the north pole of the rotation axis. |
amount | the amount of rotation, where positive values represent right-handed rotations around axis . |
Definition at line 178 of file SpherePoint.cc.
|
noexcept |
Angular distance between two points.
other | the point to which to measure the separation |
Definition at line 173 of file SpherePoint.cc.
|
related |
Print the value of a point to a stream.
The exact details of the string representation are unspecified and subject to change, but the following may be regarded as typical: "(10.543250, +32.830583)"
.
os | the stream to which to print point |
point | the point to print to the stream |
os
pex::exceptions::std::ostream::failure | Thrown if an I/O state flag was set that was registered with os.exceptions() . See the documentation of std::ostream for more details. |
Definition at line 253 of file SpherePoint.cc.