NormalizedAngle
is an angle that lies in the range [0, 2π), with one exception - a NormalizedAngle can be NaN.
More...
#include <NormalizedAngle.h>
NormalizedAngle
is an angle that lies in the range [0, 2π), with one exception - a NormalizedAngle can be NaN.
Definition at line 41 of file NormalizedAngle.h.
◆ NormalizedAngle() [1/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
| ) |
|
|
inline |
◆ NormalizedAngle() [2/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
NormalizedAngle const & |
a | ) |
|
|
inline |
◆ NormalizedAngle() [3/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
Angle const & |
a | ) |
|
|
inlineexplicit |
This constructor creates a normalized copy of a.
Definition at line 77 of file NormalizedAngle.h.
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ NormalizedAngle() [4/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
double |
a | ) |
|
|
inlineexplicit |
This constructor creates a NormalizedAngle with the given value in radians, normalized to be in the range [0, 2π).
Definition at line 83 of file NormalizedAngle.h.
88 }
else if (
a > 2 *
PI) {
◆ NormalizedAngle() [5/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
LonLat const & |
p1, |
|
|
LonLat const & |
p2 |
|
) |
| |
This constructor creates a NormalizedAngle equal to the angle between the given points on the unit sphere.
Definition at line 59 of file NormalizedAngle.cc.
60 double x =
sin((p1.getLon() - p2.getLon()) * 0.5);
62 double y =
sin((p1.getLat() - p2.getLat()) * 0.5);
64 double z =
cos((p1.getLat() + p2.getLat()) * 0.5);
69 double sha2 = (x * (z -
y) + y);
73 }
else if (sha2 >= 1.0) {
double sin(Angle const &a)
double cos(Angle const &a)
◆ NormalizedAngle() [6/6]
lsst::sphgeom::NormalizedAngle::NormalizedAngle |
( |
Vector3d const & |
v1, |
|
|
Vector3d const & |
v2 |
|
) |
| |
This constructor creates a NormalizedAngle equal to the angle between the given 3-vectors, which need not have unit norm.
Definition at line 80 of file NormalizedAngle.cc.
81 double s = v1.cross(v2).getNorm();
82 double c = v1.dot(v2);
83 if (s == 0.0 && c == 0.0) {
◆ asDegrees()
double lsst::sphgeom::NormalizedAngle::asDegrees |
( |
| ) |
const |
|
inline |
asDegrees
returns the value of this angle in units of degrees.
Definition at line 125 of file NormalizedAngle.h.
double asDegrees() const
asDegrees returns the value of this angle in units of degrees.
◆ asRadians()
double lsst::sphgeom::NormalizedAngle::asRadians |
( |
| ) |
const |
|
inline |
asRadians
returns the value of this angle in units of radians.
Definition at line 128 of file NormalizedAngle.h.
double asRadians() const
asRadians returns the value of this angle in units of radians.
◆ between()
For two angles a and b, between(a, b)
returns the smaller of a.getAngleTo(b)
and b.getAngleTo(a)
.
The result will be in the range [0, π].
If one interprets an angle in [0, 2π) as a point on the unit circle, then between
can be thought of as computing the arc length of the shortest unit circle segment between the points for a and b.
Definition at line 35 of file NormalizedAngle.cc.
39 double a1 =
std::fabs(
a.asRadians() -
b.asRadians());
40 double a2 = 2.0 *
PI - a1;
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ center()
For two normalized angles a and b, center(a, b)
returns the angle m such that a.getAngleTo(m)
is equal to m.getAngleTo(b)
.
Definition at line 45 of file NormalizedAngle.cc.
49 double c = 0.5 * (
a.asRadians() +
b.asRadians());
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ fromDegrees()
static NormalizedAngle lsst::sphgeom::NormalizedAngle::fromDegrees |
( |
double |
a | ) |
|
|
inlinestatic |
Definition at line 47 of file NormalizedAngle.h.
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
constexpr double RAD_PER_DEG
◆ fromRadians()
static NormalizedAngle lsst::sphgeom::NormalizedAngle::fromRadians |
( |
double |
a | ) |
|
|
inlinestatic |
Definition at line 51 of file NormalizedAngle.h.
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ getAngleTo()
getAngleTo
computes the angle α ∈ [0, 2π) such that adding α to this angle and then normalizing the result yields a
.
If one interprets an angle in [0, 2π) as a point on the unit circle, then this method can be thought of as computing the positive rotation angle required to map this point to a
.
Definition at line 139 of file NormalizedAngle.h.
142 x._a =
Angle((d < 0.0) ? 2.0 *
PI + d : d);
double asRadians() const
asRadians returns the value of this angle in units of radians.
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ isNan()
bool lsst::sphgeom::NormalizedAngle::isNan |
( |
| ) |
const |
|
inline |
isNan
returns true if the angle value is NaN.
Definition at line 131 of file NormalizedAngle.h.
131 {
return _a.
isNan(); }
bool isNan() const
isNan returns true if the angle value is NaN.
◆ nan()
Definition at line 43 of file NormalizedAngle.h.
NormalizedAngle()
This constructor creates a NormalizedAngle with a value of zero.
◆ operator Angle const &()
lsst::sphgeom::NormalizedAngle::operator Angle const & |
( |
| ) |
const |
|
inline |
This conversion operator returns a const reference to the underlying Angle.
It allows a NormalizedAngle to transparently replace an Angle as an argument in most function calls.
Definition at line 106 of file NormalizedAngle.h.
◆ operator!=()
bool lsst::sphgeom::NormalizedAngle::operator!= |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator*()
Angle lsst::sphgeom::NormalizedAngle::operator* |
( |
double |
a | ) |
const |
|
inline |
◆ operator+()
Angle lsst::sphgeom::NormalizedAngle::operator+ |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator-() [1/2]
Angle lsst::sphgeom::NormalizedAngle::operator- |
( |
| ) |
const |
|
inline |
◆ operator-() [2/2]
Angle lsst::sphgeom::NormalizedAngle::operator- |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator/() [1/2]
Angle lsst::sphgeom::NormalizedAngle::operator/ |
( |
double |
a | ) |
const |
|
inline |
◆ operator/() [2/2]
double lsst::sphgeom::NormalizedAngle::operator/ |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator<()
bool lsst::sphgeom::NormalizedAngle::operator< |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator<=()
bool lsst::sphgeom::NormalizedAngle::operator<= |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator==()
bool lsst::sphgeom::NormalizedAngle::operator== |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator>()
bool lsst::sphgeom::NormalizedAngle::operator> |
( |
Angle const & |
a | ) |
const |
|
inline |
◆ operator>=()
bool lsst::sphgeom::NormalizedAngle::operator>= |
( |
Angle const & |
a | ) |
const |
|
inline |
The documentation for this class was generated from the following files:
- /j/snowflake/release/lsstsw/stack/Linux64/sphgeom/18.1.0/include/lsst/sphgeom/NormalizedAngle.h
- /j/snowflake/release/lsstsw/stack/Linux64/sphgeom/18.1.0/src/NormalizedAngle.cc