LSST Applications
21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
LSST Data Management Base Package
|
Circle
is a circular region on the unit sphere that contains its boundary.
More...
#include <Circle.h>
Public Member Functions | |
Circle () | |
This constructor creates an empty circle. More... | |
Circle (UnitVector3d const &c) | |
This constructor creates the circle with center c and squared chord length / opening angle of zero. More... | |
Circle (UnitVector3d const &c, Angle a) | |
This constructor creates a circle with center c and opening angle a. More... | |
Circle (UnitVector3d const &c, double cl2) | |
This constructor creates a circle with center c and squared chord length cl2. More... | |
bool | operator== (Circle const &c) const |
bool | operator!= (Circle const &c) const |
bool | isEmpty () const |
bool | isFull () const |
UnitVector3d const & | getCenter () const |
getCenter returns the center of this circle as a unit vector. More... | |
double | getSquaredChordLength () const |
getSquaredChordLength returns the squared length of chords between the circle center and points on the circle boundary. More... | |
Angle | getOpeningAngle () const |
getOpeningAngle returns the opening angle of this circle - that is, the angle between its center vector and points on its boundary. More... | |
bool | contains (Circle const &x) const |
contains returns true if the intersection of this circle and x is equal to x. More... | |
Circle & | dilateBy (Angle r) |
If r is positive, dilateBy increases the opening angle of this circle to include all points within angle r of its boundary. More... | |
Circle | dilatedBy (Angle r) const |
Circle & | erodeBy (Angle r) |
Circle | erodedBy (Angle r) const |
double | getArea () const |
getArea returns the area of this circle in steradians. More... | |
Circle & | complement () |
complement sets this circle to the closure of its complement. More... | |
Circle | complemented () const |
complemented returns the closure of the complement of this circle. More... | |
Relationship | relate (UnitVector3d const &v) const |
std::unique_ptr< Region > | clone () const override |
clone returns a deep copy of this region. More... | |
Box | getBoundingBox () const override |
getBoundingBox returns a bounding-box for this region. More... | |
Box3d | getBoundingBox3d () const override |
getBoundingBox3d returns a 3-dimensional bounding-box for this region. More... | |
Circle | getBoundingCircle () const override |
getBoundingCircle returns a bounding-circle for this region. More... | |
bool | contains (UnitVector3d const &v) const override |
contains tests whether the given unit vector is inside this region. More... | |
Relationship | relate (Region const &r) const override |
Relationship | relate (Box const &) const override |
Relationship | relate (Circle const &) const override |
Relationship | relate (ConvexPolygon const &) const override |
Relationship | relate (Ellipse const &) const override |
std::vector< uint8_t > | encode () const override |
encode serializes this region into an opaque byte string. More... | |
virtual bool | contains (UnitVector3d const &) const=0 |
contains tests whether the given unit vector is inside this region. More... | |
bool | contains (double x, double y, double z) const |
contains tests whether the unit vector defined by the given (not necessarily normalized) coordinates is inside this region. More... | |
bool | contains (double lon, double lat) const |
contains tests whether the unit vector defined by the given longitude and latitude coordinates (in radians) is inside this region. More... | |
bool | contains (double x, double y, double z) const |
contains tests whether the unit vector defined by the given (not necessarily normalized) coordinates is inside this region. More... | |
bool | contains (double lon, double lat) const |
contains tests whether the unit vector defined by the given longitude and latitude coordinates (in radians) is inside this region. More... | |
bool | isDisjointFrom (UnitVector3d const &x) const |
bool | isDisjointFrom (Circle const &x) const |
bool | intersects (UnitVector3d const &x) const |
bool | intersects (Circle const &x) const |
bool | isWithin (UnitVector3d const &) const |
bool | isWithin (Circle const &x) const |
Circle & | clipTo (UnitVector3d const &x) |
Circle & | clipTo (Circle const &x) |
Circle | clippedTo (UnitVector3d const &x) const |
Circle | clippedTo (Circle const &x) const |
Circle & | expandTo (UnitVector3d const &x) |
Circle & | expandTo (Circle const &x) |
Circle | expandedTo (UnitVector3d const &x) const |
Circle | expandedTo (Circle const &x) const |
Static Public Member Functions | |
static Circle | empty () |
static Circle | full () |
static double | squaredChordLengthFor (Angle openingAngle) |
squaredChordLengthFor computes and returns the squared chord length between points in S² that are separated by the given angle. More... | |
static Angle | openingAngleFor (double squaredChordLength) |
openingAngleFor computes and returns the angular separation between points in S² that are separated by the given squared chord length. More... | |
static std::unique_ptr< Circle > | decode (std::vector< uint8_t > const &s) |
static std::unique_ptr< Circle > | decode (uint8_t const *buffer, size_t n) |
Static Public Attributes | |
static constexpr uint8_t | TYPE_CODE = 'c' |
Circle
is a circular region on the unit sphere that contains its boundary.
Internally, the circle is represented by its center vector and the squared length of the chords between its center and points on its boundary. This yields a fast point-in-circle test but, unlike a representation that uses the center vector and cosine of the circle opening angle, remains accurate for circles with very small opening angles.
|
inline |
|
inlineexplicit |
This constructor creates the circle with center c and squared chord length / opening angle of zero.
Because of rounding error, (v - c).squaredNorm() == 0.0 does not imply that v == c. Therefore calling contains(v) on the resulting circle may return true for unit vectors v != c.
|
inline |
This constructor creates a circle with center c and opening angle a.
If a is negative or NaN, the circle will be empty, and if a is greater than or equal to PI, the circle will be full.
Definition at line 85 of file Circle.h.
|
inline |
This constructor creates a circle with center c and squared chord length cl2.
If cl2 is negative or NaN, the circle will be empty, and if cl2 is greater than or equal to 4, the circle will be full.
Definition at line 94 of file Circle.h.
clippedTo
returns the minimal bounding circle for the intersection of this circle and x.
Definition at line 169 of file Circle.h.
|
inline |
Circle & lsst::sphgeom::Circle::clipTo | ( | UnitVector3d const & | x | ) |
clipTo
sets this circle to the minimal bounding circle for the intersection of this circle and x.
|
inlineoverridevirtual |
clone
returns a deep copy of this region.
Implements lsst::sphgeom::Region.
Circle & lsst::sphgeom::Circle::complement | ( | ) |
complement
sets this circle to the closure of its complement.
Note that both the empty circle as well as all circles containing a single point are mapped to a full circle, so that taking the complement of a circle twice is not guaranteed to reproduce the original circle, even in the absence of rounding error.
Definition at line 194 of file Circle.cc.
|
inline |
bool lsst::sphgeom::Circle::contains | ( | Circle const & | x | ) | const |
contains
returns true if the intersection of this circle and x is equal to x.
bool lsst::sphgeom::Region::contains |
contains
tests whether the unit vector defined by the given longitude and latitude coordinates (in radians) is inside this region.
Definition at line 104 of file Region.cc.
|
inherited |
bool lsst::sphgeom::Region::contains |
|
inherited |
virtual bool lsst::sphgeom::Region::contains |
contains
tests whether the given unit vector is inside this region.
|
inlineoverridevirtual |
contains
tests whether the given unit vector is inside this region.
Implements lsst::sphgeom::Region.
|
inlinestatic |
decode
deserializes a Circle from a byte string produced by encode.
Definition at line 251 of file Circle.h.
|
static |
decode
deserializes a Circle from a byte string produced by encode.
Definition at line 337 of file Circle.cc.
If r is positive, dilateBy
increases the opening angle of this circle to include all points within angle r of its boundary.
If r is negative, it decreases the opening angle to exclude those points instead.
If this circle is empty or full, or r is zero or NaN, there is no effect.
Definition at line 184 of file Circle.cc.
|
inlinestatic |
|
overridevirtual |
encode
serializes this region into an opaque byte string.
Byte strings emitted by encode can be deserialized with decode.
Implements lsst::sphgeom::Region.
Definition at line 324 of file Circle.cc.
Definition at line 201 of file Circle.h.
|
inline |
expandTo
minimally expands this circle to contain x.
Definition at line 144 of file Circle.cc.
Circle & lsst::sphgeom::Circle::expandTo | ( | UnitVector3d const & | x | ) |
|
inline |
|
overridevirtual |
getBoundingBox
returns a bounding-box for this region.
Implements lsst::sphgeom::Region.
Definition at line 211 of file Circle.cc.
|
overridevirtual |
getBoundingBox3d
returns a 3-dimensional bounding-box for this region.
Implements lsst::sphgeom::Region.
Definition at line 219 of file Circle.cc.
|
inlineoverridevirtual |
getBoundingCircle
returns a bounding-circle for this region.
Implements lsst::sphgeom::Region.
|
inline |
|
inline |
|
inline |
|
inline |
intersects
returns true if the intersection of this circle and x is non-empty.
Definition at line 145 of file Circle.h.
|
inline |
bool lsst::sphgeom::Circle::isDisjointFrom | ( | Circle const & | x | ) | const |
isDisjointFrom
returns true if the intersection of this circle and x is empty.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
|
inline |
|
inline |
|
overridevirtual |
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
S & DISJOINT
is set only if A and B do not have any points in common.S & CONTAINS
is set only if A contains all points in B.S & WITHIN
is set only if B contains all points in A.Said another way: if the CONTAINS, WITHIN or DISJOINT bit is set, then the corresponding spatial relationship between the two regions holds conclusively. If it is not set, the relationship may or may not hold.
These semantics allow for conservative relationship computations. In particular, a Region may choose to implement relate
by replacing itself and/or the argument with a simplified bounding region.
Implements lsst::sphgeom::Region.
Definition at line 277 of file Circle.cc.
|
overridevirtual |
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
S & DISJOINT
is set only if A and B do not have any points in common.S & CONTAINS
is set only if A contains all points in B.S & WITHIN
is set only if B contains all points in A.Said another way: if the CONTAINS, WITHIN or DISJOINT bit is set, then the corresponding spatial relationship between the two regions holds conclusively. If it is not set, the relationship may or may not hold.
These semantics allow for conservative relationship computations. In particular, a Region may choose to implement relate
by replacing itself and/or the argument with a simplified bounding region.
Implements lsst::sphgeom::Region.
Definition at line 282 of file Circle.cc.
|
overridevirtual |
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
S & DISJOINT
is set only if A and B do not have any points in common.S & CONTAINS
is set only if A contains all points in B.S & WITHIN
is set only if B contains all points in A.Said another way: if the CONTAINS, WITHIN or DISJOINT bit is set, then the corresponding spatial relationship between the two regions holds conclusively. If it is not set, the relationship may or may not hold.
These semantics allow for conservative relationship computations. In particular, a Region may choose to implement relate
by replacing itself and/or the argument with a simplified bounding region.
Implements lsst::sphgeom::Region.
Definition at line 314 of file Circle.cc.
|
overridevirtual |
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
S & DISJOINT
is set only if A and B do not have any points in common.S & CONTAINS
is set only if A contains all points in B.S & WITHIN
is set only if B contains all points in A.Said another way: if the CONTAINS, WITHIN or DISJOINT bit is set, then the corresponding spatial relationship between the two regions holds conclusively. If it is not set, the relationship may or may not hold.
These semantics allow for conservative relationship computations. In particular, a Region may choose to implement relate
by replacing itself and/or the argument with a simplified bounding region.
Implements lsst::sphgeom::Region.
Definition at line 319 of file Circle.cc.
|
inlineoverridevirtual |
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
S & DISJOINT
is set only if A and B do not have any points in common.S & CONTAINS
is set only if A contains all points in B.S & WITHIN
is set only if B contains all points in A.Said another way: if the CONTAINS, WITHIN or DISJOINT bit is set, then the corresponding spatial relationship between the two regions holds conclusively. If it is not set, the relationship may or may not hold.
These semantics allow for conservative relationship computations. In particular, a Region may choose to implement relate
by replacing itself and/or the argument with a simplified bounding region.
Implements lsst::sphgeom::Region.
Relationship lsst::sphgeom::Circle::relate | ( | UnitVector3d const & | v | ) | const |
|
static |
squaredChordLengthFor
computes and returns the squared chord length between points in S² that are separated by the given angle.
The squared chord length l² and angle θ are related by l² = 4 sin²(θ/2).
|
staticconstexpr |