lsst.sphgeom  20.0.0-1-g009f3de
Public Member Functions | Static Public Member Functions | List of all members
lsst::sphgeom::NormalizedAngleInterval Class Reference

#include <NormalizedAngleInterval.h>

Public Member Functions

 NormalizedAngleInterval ()
 This constructor creates an empty interval.
 
 NormalizedAngleInterval (Angle const &x)
 
 NormalizedAngleInterval (NormalizedAngle const &x)
 This constructor creates a closed interval containing only x.
 
 NormalizedAngleInterval (Angle x, Angle y)
 
 NormalizedAngleInterval (NormalizedAngle x, NormalizedAngle y)
 This constructor creates an interval with the given endpoints.
 
bool operator== (NormalizedAngleInterval const &i) const
 Two intervals are equal if they contain the same points.
 
bool operator!= (NormalizedAngleInterval const &i) const
 
bool operator== (NormalizedAngle x) const
 A closed interval is equal to a point x if both endpoints equal x.
 
bool operator!= (NormalizedAngle x) const
 
NormalizedAngle getA () const
 getA returns the first endpoint of this interval.
 
NormalizedAngle getB () const
 getB returns the second endpoint of this interval.
 
bool isEmpty () const
 
bool isFull () const
 isFull returns true if this interval contains all normalized angles.
 
bool wraps () const
 
NormalizedAngle getCenter () const
 
NormalizedAngle getSize () const
 
NormalizedAngleIntervalclipTo (NormalizedAngle x)
 clipTo shrinks this interval until all its points are in x.
 
NormalizedAngleIntervalclipTo (NormalizedAngleInterval const &x)
 
NormalizedAngleInterval clippedTo (NormalizedAngle x) const
 clippedTo returns the intersection of this interval and x.
 
NormalizedAngleInterval clippedTo (NormalizedAngleInterval const &x) const
 
NormalizedAngleInterval dilatedBy (Angle x) const
 
NormalizedAngleInterval erodedBy (Angle x) const
 
NormalizedAngleIntervaldilateBy (Angle x)
 
NormalizedAngleIntervalerodeBy (Angle x)
 
bool contains (NormalizedAngle x) const
 
bool contains (NormalizedAngleInterval const &x) const
 
bool isDisjointFrom (NormalizedAngle x) const
 
bool isDisjointFrom (NormalizedAngleInterval const &x) const
 
bool intersects (NormalizedAngle x) const
 
bool intersects (NormalizedAngleInterval const &x) const
 
bool isWithin (NormalizedAngle x) const
 
bool isWithin (NormalizedAngleInterval const &x) const
 
Relationship relate (NormalizedAngle x) const
 
Relationship relate (NormalizedAngleInterval const &x) const
 
NormalizedAngleIntervalexpandTo (NormalizedAngle x)
 
NormalizedAngleIntervalexpandTo (NormalizedAngleInterval const &x)
 
NormalizedAngleInterval expandedTo (NormalizedAngle x) const
 
NormalizedAngleInterval expandedTo (NormalizedAngleInterval const &x) const
 

Static Public Member Functions

static NormalizedAngleInterval fromDegrees (double a, double b)
 
static NormalizedAngleInterval fromRadians (double a, double b)
 
static NormalizedAngleInterval empty ()
 
static NormalizedAngleInterval full ()
 

Detailed Description

NormalizedAngleInterval represents closed intervals of normalized angles, i.e. intervals of the unit circle.

A point on the unit circle is represented by the angle ∈ [0, 2π) between it and a reference point, and an interval by a pair of bounding points a and b. The points in the interval are traced out by counter-clockwise rotation of a around the circle until it reaches b. Because the endpoints are represented via normalized angles, a can be greater than b, indicating that the interval consists of the points represented by angles [a, 2π) ⋃ [0, b]. When this is the case, calling wraps() on the interval will return true.

An interval with identical endpoints contains just that point, and is equal to that point.

An interval with NaN as either endpoint is empty, meaning that it contains no points on the unit circle. The interval [0, 2 * PI] is full, meaning that it contains all representable normalized angles in [0, 2π).

Constructor & Destructor Documentation

◆ NormalizedAngleInterval() [1/2]

lsst::sphgeom::NormalizedAngleInterval::NormalizedAngleInterval ( Angle const &  x)
inlineexplicit

This constructor creates a closed interval containing only the normalization of x.

◆ NormalizedAngleInterval() [2/2]

lsst::sphgeom::NormalizedAngleInterval::NormalizedAngleInterval ( Angle  x,
Angle  y 
)

This constructor creates an interval from the given endpoints. If both x and y lie in the range [0, 2π), then y may be less than x. For example, passing in x = 3π/2 and y = π/2 will result in an interval containing angles [3π/2, 2π) ⋃ [0, π/2]. Otherwise, x must be less than or equal to y, and the interval will correspond to the the set of angles produced by normalizing the elements of the interval [x, y].

Member Function Documentation

◆ clippedTo()

NormalizedAngleInterval lsst::sphgeom::NormalizedAngleInterval::clippedTo ( NormalizedAngleInterval const &  x) const
inline

clippedTo returns the smallest interval containing the intersection of this interval and x. The result is not always unique, and x.clippedTo(y) is not guaranteed to equal y.clippedTo(x).

◆ clipTo()

NormalizedAngleInterval & lsst::sphgeom::NormalizedAngleInterval::clipTo ( NormalizedAngleInterval const &  x)

x.clipTo(y) sets x to the smallest interval containing the intersection of x and y. The result is not always unique, and x.clipTo(y) is not guaranteed to equal y.clipTo(x).

◆ contains()

bool lsst::sphgeom::NormalizedAngleInterval::contains ( NormalizedAngle  x) const
inline

contains returns true if the intersection of this interval and x is equal to x.

◆ dilatedBy()

NormalizedAngleInterval lsst::sphgeom::NormalizedAngleInterval::dilatedBy ( Angle  x) const

For positive x, dilatedBy returns the morphological dilation of this interval by [-x,x]. For negative x, it returns the morphological erosion of this interval by [x,-x]. If x is zero or NaN, or this interval is empty, there is no effect.

◆ expandedTo()

NormalizedAngleInterval lsst::sphgeom::NormalizedAngleInterval::expandedTo ( NormalizedAngle  x) const
inline

expandedTo returns the smallest interval containing the union of this interval and x. The result is not always unique, and x.expandedTo(y) is not guaranteed to equal y.expandedTo(x).

◆ expandTo()

NormalizedAngleInterval & lsst::sphgeom::NormalizedAngleInterval::expandTo ( NormalizedAngle  x)

expandTo minimally expands this interval to contain x. The result is not always unique, and x.expandTo(y) is not guaranteed to equal y.expandTo(x).

◆ getCenter()

NormalizedAngle lsst::sphgeom::NormalizedAngleInterval::getCenter ( ) const
inline

getCenter returns the center of this interval. It is NaN for empty intervals, and arbitrary for full intervals.

◆ getSize()

NormalizedAngle lsst::sphgeom::NormalizedAngleInterval::getSize ( ) const
inline

getSize returns the size (length, width) of this interval. It is zero for single-point intervals, and NaN for empty intervals. Note that due to rounding errors, an interval with size 2 * PI is not necessarily full, and an interval with size 0 may contain more than a single point.

◆ intersects()

bool lsst::sphgeom::NormalizedAngleInterval::intersects ( NormalizedAngle  x) const
inline

intersects returns true if the intersection of this interval and x is non-empty.

◆ isDisjointFrom()

bool lsst::sphgeom::NormalizedAngleInterval::isDisjointFrom ( NormalizedAngle  x) const
inline

isDisjointFrom returns true if the intersection of this interval and x is empty.

◆ isEmpty()

bool lsst::sphgeom::NormalizedAngleInterval::isEmpty ( ) const
inline

isEmpty returns true if this interval does not contain any normalized angles.

◆ isWithin()

bool lsst::sphgeom::NormalizedAngleInterval::isWithin ( NormalizedAngle  x) const
inline

isWithin returns true if the intersection of this interval and x is this interval.

◆ relate()

Relationship lsst::sphgeom::NormalizedAngleInterval::relate ( NormalizedAngle  x) const

relate returns a bitset S describing the spatial relationships between this interval and x. For each relation that holds, the bitwise AND of S and the corresponding Relationship will be non-zero.

◆ wraps()

bool lsst::sphgeom::NormalizedAngleInterval::wraps ( ) const
inline

wraps returns true if the interval "wraps" around the 0/2π angle discontinuity, i.e. consists of [getA(), 2π) ∪ [0, getB()].


The documentation for this class was generated from the following files: