LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Box
represents a rectangle in spherical coordinate space that contains its boundary.
More...
#include <Box.h>
|
| Box () |
| This constructor creates an empty box. More...
|
|
| Box (LonLat const &p) |
| This constructor creates a box containing a single point. More...
|
|
| Box (LonLat const &p1, LonLat const &p2) |
| This constructor creates a box spanning the longitude interval [p1.getLon(), p2.getLon()] and latitude interval [p1.getLat(), p2.getLat()]. More...
|
|
| Box (LonLat const &p, Angle w, Angle h) |
| This constructor creates a box with center p, half-width (in longitude angle) w and half-height (in latitude angle) h. More...
|
|
| Box (NormalizedAngleInterval const &lon, AngleInterval const &lat) |
| This constructor creates a box spanning the given longitude and latitude intervals. More...
|
|
bool | operator== (Box const &b) const |
| Two boxes are equal if they contain the same points. More...
|
|
bool | operator!= (Box const &b) const |
|
bool | operator== (LonLat const &p) const |
| A box is equal to a point p if it contains only p. More...
|
|
bool | operator!= (LonLat const &p) const |
|
NormalizedAngleInterval const & | getLon () const |
| getLon returns the longitude interval of this box. More...
|
|
AngleInterval const & | getLat () const |
| getLat returns the latitude interval of this box. More...
|
|
bool | isEmpty () const |
| isEmpty returns true if this box does not contain any points. More...
|
|
bool | isFull () const |
| isFull returns true if this box contains all points on the unit sphere. More...
|
|
LonLat | getCenter () const |
| getCenter returns the center of this box. More...
|
|
NormalizedAngle | getWidth () const |
| getWidth returns the width in longitude angle of this box. More...
|
|
Angle | getHeight () const |
| getHeight returns the height in latitude angle of this box. More...
|
|
Box & | clipTo (LonLat const &x) |
| clipTo shrinks this box until it contains only x. More...
|
|
Box & | clipTo (Box const &x) |
| x.clipTo(y) sets x to the smallest box containing the intersection of x and y. More...
|
|
Box | clippedTo (LonLat const &x) const |
| clippedTo returns the intersection of this box and x. More...
|
|
Box | clippedTo (Box const &x) const |
| clippedTo returns the smallest box containing the intersection of this box and x. More...
|
|
Box & | dilateBy (Angle r) |
| dilateBy minimally expands this Box to include all points within angular separation r of its boundary. More...
|
|
Box | dilatedBy (Angle r) const |
|
Box & | dilateBy (Angle w, Angle h) |
| dilateBy morphologically dilates or erodes the longitude interval of this box by w, and the latitude interval of this box by h. More...
|
|
Box | dilatedBy (Angle w, Angle h) const |
|
Box & | erodeBy (Angle r) |
|
Box & | erodeBy (Angle w, Angle h) |
|
Box | erodedBy (Angle r) const |
|
Box | erodedBy (Angle w, Angle h) const |
|
Relationship | relate (LonLat const &p) const |
|
double | getArea () const |
| getArea returns the area of this box in steradians. More...
|
|
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 &b) 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...
|
|
|
bool | contains (LonLat const &x) const |
|
bool | contains (Box const &x) const |
|
|
bool | isDisjointFrom (LonLat const &x) const |
|
bool | isDisjointFrom (Box const &x) const |
|
|
bool | intersects (LonLat const &x) const |
|
bool | intersects (Box const &x) const |
|
|
bool | isWithin (LonLat const &x) const |
|
bool | isWithin (Box const &x) const |
|
|
Box & | expandTo (LonLat const &x) |
|
Box & | expandTo (Box const &x) |
|
|
Box | expandedTo (LonLat const &x) const |
|
Box | expandedTo (Box const &x) const |
|
Box
represents a rectangle in spherical coordinate space that contains its boundary.
A box can be empty or full (equal to the entire unit sphere), and may contain just a single point. Besides the usual rectangular regions, a box can also represent polar caps or annuli (i.e. when the box spans all longitudes).
For any instance b of this class, the following properties hold:
Definition at line 54 of file Box.h.
◆ Box() [1/5]
lsst::sphgeom::Box::Box |
( |
| ) |
|
|
inline |
This constructor creates an empty box.
Definition at line 92 of file Box.h.
◆ Box() [2/5]
lsst::sphgeom::Box::Box |
( |
LonLat const & |
p | ) |
|
|
inlineexplicit |
This constructor creates a box containing a single point.
Definition at line 95 of file Box.h.
◆ Box() [3/5]
lsst::sphgeom::Box::Box |
( |
LonLat const & |
p1, |
|
|
LonLat const & |
p2 |
|
) |
| |
|
inline |
This constructor creates a box spanning the longitude interval [p1.getLon(), p2.getLon()] and latitude interval [p1.getLat(), p2.getLat()].
Definition at line 105 of file Box.h.
106 _lon(p1.getLon(), p2.getLon()),
107 _lat(p1.getLat(), p2.getLat())
109 _enforceInvariants();
◆ Box() [4/5]
This constructor creates a box with center p, half-width (in longitude angle) w and half-height (in latitude angle) h.
Definition at line 114 of file Box.h.
115 _lon(NormalizedAngleInterval(p.getLon()).dilatedBy(
w)),
116 _lat(AngleInterval(p.getLat()).dilatedBy(h))
118 _enforceInvariants();
◆ Box() [5/5]
This constructor creates a box spanning the given longitude and latitude intervals.
Definition at line 123 of file Box.h.
127 _enforceInvariants();
◆ allLatitudes()
allLatitudes
returns an angle interval containing all valid latitude angles.
Definition at line 87 of file Box.h.
◆ allLongitudes()
allLongitudes
returns a normalized angle interval containing all valid longitude angles.
Definition at line 81 of file Box.h.
◆ clippedTo() [1/2]
Box lsst::sphgeom::Box::clippedTo |
( |
Box const & |
x | ) |
const |
|
inline |
clippedTo
returns the smallest box containing the intersection of this box and x.
The result is not always unique, and x.clippedTo(y)
is not guaranteed to equal y.clippedTo(x)
.
Definition at line 240 of file Box.h.
240 {
return Box(*this).clipTo(
x); }
◆ clippedTo() [2/2]
Box lsst::sphgeom::Box::clippedTo |
( |
LonLat const & |
x | ) |
const |
|
inline |
clippedTo
returns the intersection of this box and x.
Definition at line 235 of file Box.h.
235 {
return Box(*this).clipTo(
x); }
◆ clipTo() [1/2]
Box& lsst::sphgeom::Box::clipTo |
( |
Box const & |
x | ) |
|
|
inline |
x.clipTo(y)
sets x to the smallest box 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)
.
Definition at line 227 of file Box.h.
230 _enforceInvariants();
◆ clipTo() [2/2]
Box& lsst::sphgeom::Box::clipTo |
( |
LonLat const & |
x | ) |
|
|
inline |
clipTo
shrinks this box until it contains only x.
If this box does not contain x, it is emptied.
Definition at line 217 of file Box.h.
220 _enforceInvariants();
◆ clone()
◆ contains() [1/3]
bool lsst::sphgeom::Box::contains |
( |
Box const & |
x | ) |
const |
|
inline |
contains
returns true if the intersection of this box and x is equal to x.
Definition at line 178 of file Box.h.
◆ contains() [2/3]
bool lsst::sphgeom::Box::contains |
( |
LonLat const & |
x | ) |
const |
|
inline |
contains
returns true if the intersection of this box and x is equal to x.
Definition at line 174 of file Box.h.
◆ contains() [3/3]
bool lsst::sphgeom::Box::contains |
( |
UnitVector3d const & |
| ) |
const |
|
inlineoverridevirtual |
◆ decode() [1/2]
decode
deserializes a Box from a byte string produced by encode.
Definition at line 338 of file Box.h.
◆ decode() [2/2]
decode
deserializes a Box from a byte string produced by encode.
Definition at line 459 of file Box.cc.
460 if (buffer ==
nullptr || n != ENCODED_SIZE || *buffer !=
TYPE_CODE) {
471 box->_enforceInvariants();
◆ dilateBy() [1/2]
Box & lsst::sphgeom::Box::dilateBy |
( |
Angle |
r | ) |
|
dilateBy
minimally expands this Box to include all points within angular separation r of its boundary.
If this box is empty or full, or if r is non-positive, there is no effect.
Definition at line 78 of file Box.cc.
◆ dilateBy() [2/2]
dilateBy
morphologically dilates or erodes the longitude interval of this box by w, and the latitude interval of this box by h.
If w is positive, the longitude interval is dilated by [-w,w]. If w is zero, the corresponding interval is not modified, and if it is negative, the longitude interval is eroded by [w,-w]. The action of h on the latitude interval is analogous.
If this box is empty or full, there is no effect. Furthermore, a box containing the north or south pole is not considered to have a latitude boundary there, so that eroding it will not necessarily remove the pole.
If the desired outcome is the bounding box of points within some angular separation r of this box, then dilateBy(r)
must be called, not dilateBy(r, r)
.
Definition at line 101 of file Box.cc.
109 _lat = AngleInterval(
a,
b);
111 _enforceInvariants();
◆ dilatedBy() [1/2]
Box lsst::sphgeom::Box::dilatedBy |
( |
Angle |
r | ) |
const |
|
inline |
Definition at line 273 of file Box.h.
273 {
return Box(*this).dilateBy(r); }
◆ dilatedBy() [2/2]
Definition at line 291 of file Box.h.
291 {
return Box(*this).dilateBy(
w, h); }
◆ empty()
static Box lsst::sphgeom::Box::empty |
( |
| ) |
|
|
inlinestatic |
Definition at line 69 of file Box.h.
◆ encode()
std::vector< uint8_t > lsst::sphgeom::Box::encode |
( |
| ) |
const |
|
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 447 of file Box.cc.
◆ erodeBy() [1/2]
Box& lsst::sphgeom::Box::erodeBy |
( |
Angle |
r | ) |
|
|
inline |
◆ erodeBy() [2/2]
◆ erodedBy() [1/2]
Box lsst::sphgeom::Box::erodedBy |
( |
Angle |
r | ) |
const |
|
inline |
◆ erodedBy() [2/2]
◆ expandedTo() [1/2]
Box lsst::sphgeom::Box::expandedTo |
( |
Box const & |
x | ) |
const |
|
inline |
expandedTo
returns the smallest box containing the union of this box and x. The result is not always unique, and x.expandedTo(y)
is not guaranteed to equal y.expandedTo(x)
.
Definition at line 264 of file Box.h.
264 {
return Box(*this).expandTo(
x); }
◆ expandedTo() [2/2]
Box lsst::sphgeom::Box::expandedTo |
( |
LonLat const & |
x | ) |
const |
|
inline |
expandedTo
returns the smallest box containing the union of this box and x. The result is not always unique, and x.expandedTo(y)
is not guaranteed to equal y.expandedTo(x)
.
Definition at line 263 of file Box.h.
263 {
return Box(*this).expandTo(
x); }
◆ expandTo() [1/2]
Box& lsst::sphgeom::Box::expandTo |
( |
Box const & |
x | ) |
|
|
inline |
expandTo
minimally expands this box to contain x. The result is not always unique, and x.expandTo(y)
is not guaranteed to equal y.expandTo(x)
.
Definition at line 252 of file Box.h.
◆ expandTo() [2/2]
Box& lsst::sphgeom::Box::expandTo |
( |
LonLat const & |
x | ) |
|
|
inline |
expandTo
minimally expands this box to contain x. The result is not always unique, and x.expandTo(y)
is not guaranteed to equal y.expandTo(x)
.
Definition at line 246 of file Box.h.
◆ fromDegrees()
static Box lsst::sphgeom::Box::fromDegrees |
( |
double |
lon1, |
|
|
double |
lat1, |
|
|
double |
lon2, |
|
|
double |
lat2 |
|
) |
| |
|
inlinestatic |
Definition at line 59 of file Box.h.
◆ fromRadians()
static Box lsst::sphgeom::Box::fromRadians |
( |
double |
lon1, |
|
|
double |
lat1, |
|
|
double |
lon2, |
|
|
double |
lat2 |
|
) |
| |
|
inlinestatic |
Definition at line 64 of file Box.h.
◆ full()
static Box lsst::sphgeom::Box::full |
( |
| ) |
|
|
inlinestatic |
Definition at line 71 of file Box.h.
◆ getArea()
double lsst::sphgeom::Box::getArea |
( |
| ) |
const |
getArea
returns the area of this box in steradians.
Definition at line 115 of file Box.cc.
◆ getBoundingBox()
Box lsst::sphgeom::Box::getBoundingBox |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getBoundingBox3d()
Box3d lsst::sphgeom::Box::getBoundingBox3d |
( |
| ) |
const |
|
overridevirtual |
getBoundingBox3d
returns a 3-dimensional bounding-box for this region.
Implements lsst::sphgeom::Region.
Definition at line 127 of file Box.cc.
162 if (_lon.
contains(NormalizedAngle(0.0))) {
165 if (_lon.
contains(NormalizedAngle(0.5 *
PI))) {
171 if (_lon.
contains(NormalizedAngle(1.5 *
PI))) {
182 return Box3d(Interval1d(
xmin,
xmax),
183 Interval1d(ymin, ymax),
184 Interval1d(zmin, zmax));
◆ getBoundingCircle()
Circle lsst::sphgeom::Box::getBoundingCircle |
( |
| ) |
const |
|
overridevirtual |
getBoundingCircle
returns a bounding-circle for this region.
Implements lsst::sphgeom::Region.
Definition at line 187 of file Box.cc.
197 if (
w.asRadians() <=
PI) {
199 UnitVector3d boxVerts[4] = {
200 UnitVector3d(_lon.
getA(), _lat.
getA()),
201 UnitVector3d(_lon.
getA(), _lat.
getB()),
202 UnitVector3d(_lon.
getB(), _lat.
getA()),
203 UnitVector3d(_lon.
getB(), _lat.
getB())
261 double phi1, phi2, phi3;
262 double c =
cos(0.5 *
w);
274 if (phi1 <= phi3 && phi3 <= phi2) {
279 if (p1.dot(boxVerts[0]) > p2.dot(boxVerts[1])) {
288 double cl2 = (p - boxVerts[0]).getSquaredNorm();
289 for (
int i = 1; i < 4; ++i) {
290 cl2 =
std::max(cl2, (p - boxVerts[i]).getSquaredNorm());
311 if (!_lon.
isFull() && 0.5 *
w < r) {
◆ getCenter()
LonLat lsst::sphgeom::Box::getCenter |
( |
| ) |
const |
|
inline |
getCenter
returns the center of this box.
It is NaN for empty boxes and arbitrary for full boxes.
Definition at line 159 of file Box.h.
◆ getHeight()
Angle lsst::sphgeom::Box::getHeight |
( |
| ) |
const |
|
inline |
getHeight
returns the height in latitude angle of this box.
It is negative or NaN for empty boxes.
Definition at line 169 of file Box.h.
◆ getLat()
getLat
returns the latitude interval of this box.
Definition at line 148 of file Box.h.
◆ getLon()
getLon
returns the longitude interval of this box.
Definition at line 145 of file Box.h.
◆ getWidth()
getWidth
returns the width in longitude angle of this box.
It is NaN for empty boxes.
Definition at line 165 of file Box.h.
◆ halfWidthForCircle()
halfWidthForCircle
computes the half-width of bounding boxes for circles with radius r
and centers at the given latitude.
If r is non-positive, the result is zero, and if |lat| + r >= PI/2, the result is PI.
Definition at line 43 of file Box.cc.
44 if (r <=
Angle(0.0)) {
45 return NormalizedAngle(0.0);
50 return NormalizedAngle(
PI);
73 return NormalizedAngle(0.5 *
PI);
◆ intersects() [1/2]
bool lsst::sphgeom::Box::intersects |
( |
Box const & |
x | ) |
const |
|
inline |
intersects
returns true if the intersection of this box and x is non-empty.
Definition at line 198 of file Box.h.
◆ intersects() [2/2]
bool lsst::sphgeom::Box::intersects |
( |
LonLat const & |
x | ) |
const |
|
inline |
intersects
returns true if the intersection of this box and x is non-empty.
Definition at line 194 of file Box.h.
◆ isDisjointFrom() [1/2]
bool lsst::sphgeom::Box::isDisjointFrom |
( |
Box const & |
x | ) |
const |
|
inline |
isDisjointFrom
returns true if the intersection of this box and x is empty.
Definition at line 188 of file Box.h.
◆ isDisjointFrom() [2/2]
bool lsst::sphgeom::Box::isDisjointFrom |
( |
LonLat const & |
x | ) |
const |
|
inline |
isDisjointFrom
returns true if the intersection of this box and x is empty.
Definition at line 186 of file Box.h.
◆ isEmpty()
bool lsst::sphgeom::Box::isEmpty |
( |
| ) |
const |
|
inline |
isEmpty
returns true if this box does not contain any points.
Definition at line 151 of file Box.h.
◆ isFull()
bool lsst::sphgeom::Box::isFull |
( |
| ) |
const |
|
inline |
isFull
returns true if this box contains all points on the unit sphere.
Definition at line 155 of file Box.h.
◆ isWithin() [1/2]
bool lsst::sphgeom::Box::isWithin |
( |
Box const & |
x | ) |
const |
|
inline |
isWithin
returns true if the intersection of this box and x is this box.
Definition at line 210 of file Box.h.
◆ isWithin() [2/2]
bool lsst::sphgeom::Box::isWithin |
( |
LonLat const & |
x | ) |
const |
|
inline |
isWithin
returns true if the intersection of this box and x is this box.
Definition at line 206 of file Box.h.
◆ operator!=() [1/2]
bool lsst::sphgeom::Box::operator!= |
( |
Box const & |
b | ) |
const |
|
inline |
Definition at line 135 of file Box.h.
135 {
return !(*
this ==
b); }
◆ operator!=() [2/2]
bool lsst::sphgeom::Box::operator!= |
( |
LonLat const & |
p | ) |
const |
|
inline |
Definition at line 142 of file Box.h.
142 {
return !(*
this == p); }
◆ operator==() [1/2]
bool lsst::sphgeom::Box::operator== |
( |
Box const & |
b | ) |
const |
|
inline |
Two boxes are equal if they contain the same points.
Definition at line 131 of file Box.h.
132 return _lon ==
b._lon && _lat ==
b._lat;
◆ operator==() [2/2]
bool lsst::sphgeom::Box::operator== |
( |
LonLat const & |
p | ) |
const |
|
inline |
A box is equal to a point p if it contains only p.
Definition at line 138 of file Box.h.
139 return _lat == p.getLat() && _lon == p.getLon();
◆ relate() [1/6]
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
- Bit
S & DISJOINT
is set only if A and B do not have any points in common.
- Bit
S & CONTAINS
is set only if A contains all points in B.
- Bit
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 320 of file Box.h.
327 return ((r1 & r2) & (CONTAINS | WITHIN)) | ((r1 | r2) & DISJOINT);
◆ relate() [2/6]
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
- Bit
S & DISJOINT
is set only if A and B do not have any points in common.
- Bit
S & CONTAINS
is set only if A contains all points in B.
- Bit
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 318 of file Box.cc.
321 return CONTAINS | DISJOINT | WITHIN;
323 return DISJOINT | WITHIN;
324 }
else if (c.isEmpty()) {
325 return CONTAINS | DISJOINT;
329 return CONTAINS | WITHIN;
332 }
else if (c.isFull()) {
340 LonLat vertLonLat[4] = {
346 UnitVector3d verts[4];
348 for (
int i = 0; i < 4; ++i) {
349 verts[i] = UnitVector3d(vertLonLat[i]);
350 double d = (verts[i] - c.getCenter()).getSquaredNorm();
351 if (
std::fabs(d - c.getSquaredChordLength()) <
356 bool b = d < c.getSquaredChordLength();
359 }
else if (inside !=
b) {
364 UnitVector3d norms[2] = {
371 for (
int i = 0; i < 2; ++i) {
373 c.getCenter(), verts[2 * i + 1], verts[2 * i], norms[i]);
374 if (d > c.getSquaredChordLength() -
379 LonLat cc(-c.getCenter());
387 if (d > c.getSquaredChordLength() -
409 for (
int i = 0; i < 2; ++i) {
411 c.getCenter(), verts[2 * i + 1], verts[2 * i], norms[i]);
416 LonLat cc(c.getCenter());
◆ relate() [3/6]
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
- Bit
S & DISJOINT
is set only if A and B do not have any points in common.
- Bit
S & CONTAINS
is set only if A contains all points in B.
- Bit
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 437 of file Box.cc.
439 return invert(p.relate(*
this));
◆ relate() [4/6]
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
- Bit
S & DISJOINT
is set only if A and B do not have any points in common.
- Bit
S & CONTAINS
is set only if A contains all points in B.
- Bit
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 442 of file Box.cc.
444 return invert(e.relate(*
this));
◆ relate() [5/6]
◆ relate() [6/6]
relate
computes the spatial relationships between this region A and another region B. The return value S is a bitset with the following properties:
- Bit
S & DISJOINT
is set only if A and B do not have any points in common.
- Bit
S & CONTAINS
is set only if A contains all points in B.
- Bit
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 315 of file Box.h.
317 return invert(r.relate(*
this));
◆ TYPE_CODE
constexpr uint8_t lsst::sphgeom::Box::TYPE_CODE = 'b' |
|
staticconstexpr |
Definition at line 56 of file Box.h.
The documentation for this class was generated from the following files:
- /j/snowflake/release/lsstsw/stack/cb4e2dc/Linux64/sphgeom/20.0.0-5-gfbfe500+d529cf1a41/include/lsst/sphgeom/Box.h
- /j/snowflake/release/lsstsw/stack/cb4e2dc/Linux64/sphgeom/20.0.0-5-gfbfe500+d529cf1a41/src/Box.cc
Scalar getCenter() const
getCenter returns the center of this interval.
double asRadians() const
asRadians returns the value of this angle in units of radians.
NormalizedAngleInterval & expandTo(NormalizedAngle x)
NormalizedAngle getCenter() const
getCenter returns the center of this interval.
static NormalizedAngleInterval fromRadians(double a, double b)
bool isFull() const
isFull returns true if this interval contains all normalized angles.
double sin(Angle const &a)
static double squaredChordLengthFor(Angle openingAngle)
squaredChordLengthFor computes and returns the squared chord length between points in S² that are sep...
Box dilatedBy(Angle r) const
double asRadians() const
asRadians returns the value of this angle in units of radians.
NormalizedAngleInterval & clipTo(NormalizedAngle x)
clipTo shrinks this interval until all its points are in x.
Angle abs(Angle const &a)
Box()
This constructor creates an empty box.
bool isFull() const
isFull returns true if this box contains all points on the unit sphere.
Relationship relate(LonLat const &p) const
bool isEmpty() const
isEmpty returns true if this box does not contain any points.
Interval & clipTo(Scalar x)
Scalar getSize() const
getSize returns the size (length, width) of this interval.
NormalizedAngle getWidth() const
getWidth returns the width in longitude angle of this box.
NormalizedAngleInterval & dilateBy(Angle x)
Scalar getA() const
getA returns the lower endpoint of this interval.
bool isEmpty() const
isEmpty returns true if this interval does not contain any points.
Relationship relate(Scalar x) const
bool intersects(LonLat const &x) const
static NormalizedAngle halfWidthForCircle(Angle r, Angle lat)
halfWidthForCircle computes the half-width of bounding boxes for circles with radius r and centers at...
bool isWithin(NormalizedAngle x) const
double tan(Angle const &a)
Scalar getB() const
getB returns the upper endpoint of this interval.
bool contains(Scalar x) const
bool isWithin(Scalar x) const
constexpr double MAX_SQUARED_CHORD_LENGTH_ERROR
Angle getMinAngleToCircle(Angle x, Angle c)
getMinAngleToCircle returns the minimum angular separation between a point at latitude x and the poin...
Box & dilateBy(Angle r)
dilateBy minimally expands this Box to include all points within angular separation r of its boundary...
double getMaxSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector furthest from v that lies on the plane with normal n in the direction of the...
std::bitset< 3 > Relationship
Relationship describes how two sets are related.
static NormalizedAngleInterval allLongitudes()
allLongitudes returns a normalized angle interval containing all valid longitude angles.
bool contains(LonLat const &x) const
double decodeDouble(uint8_t const *buffer)
decode extracts an IEEE double from the 8 byte little-endian byte sequence in buffer.
static NormalizedAngleInterval full()
static Box3d aroundUnitSphere()
aroundUnitSphere returns a minimal Box3d containing the unit sphere.
bool contains(NormalizedAngle x) const
NormalizedAngle getA() const
getA returns the first endpoint of this interval.
NormalizedAngle getSize() const
getSize returns the size (length, width) of this interval.
static constexpr uint8_t TYPE_CODE
bool intersects(NormalizedAngle x) const
static AngleInterval fromDegrees(double x, double y)
Relationship relate(NormalizedAngle x) const
static NormalizedAngleInterval fromDegrees(double a, double b)
static UnitVector3d orthogonalTo(Vector3d const &v)
orthogonalTo returns an arbitrary unit vector that is orthogonal to v.
double getMinSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector closest to v that lies on the plane with normal n in the direction of the cr...
Interval & expandTo(Scalar x)
static AngleInterval allLatitudes()
allLatitudes returns an angle interval containing all valid latitude angles.
constexpr double MAX_ASIN_ERROR
bool intersects(Scalar x) const
double cos(Angle const &a)
static AngleInterval fromRadians(double x, double y)
static std::unique_ptr< Box > decode(std::vector< uint8_t > const &s)
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
NormalizedAngle getB() const
getB returns the second endpoint of this interval.
void encodeDouble(double item, std::vector< uint8_t > &buffer)
encode appends an IEEE double in little-endian byte order to the end of buffer.