23 #ifndef LSST_SPHGEOM_BOX_H_ 24 #define LSST_SPHGEOM_BOX_H_ 109 _enforceInvariants();
118 _enforceInvariants();
127 _enforceInvariants();
132 return _lon == b._lon && _lat == b._lat;
220 _enforceInvariants();
230 _enforceInvariants();
327 return ((r1 & r2) & (CONTAINS | WITHIN)) | ((r1 | r2) & DISJOINT);
345 static constexpr
size_t ENCODED_SIZE = 33;
347 void _enforceInvariants() {
368 #endif // LSST_SPHGEOM_BOX_H_ std::unique_ptr< Region > clone() const override
clone returns a deep copy of this region.
static constexpr uint8_t TYPE_CODE
Box & expandTo(LonLat const &x)
bool isEmpty() const
isEmpty returns true if this interval does not contain any normalized angles.
static NormalizedAngleInterval allLongitudes()
allLongitudes returns a normalized angle interval containing all valid longitude angles.
Box()
This constructor creates an empty box.
Box expandedTo(Box const &x) const
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
lsst::afw::geom::Angle Angle
static AngleInterval fromDegrees(double x, double y)
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
NormalizedAngle is an angle that lies in the range [0, 2π), with one exception - a NormalizedAngle ca...
Angle getHeight() const
getHeight returns the height in latitude angle of this box.
Box erodedBy(Angle w, Angle h) const
static Box fromRadians(double lon1, double lat1, double lon2, double lat2)
NormalizedAngle getWidth() const
getWidth returns the width in longitude angle of this box.
AngleInterval represents closed intervals of arbitrary angles.
Box & erodeBy(Angle w, Angle h)
std::vector< uint8_t > encode() const override
encode serializes this region into an opaque byte string.
NormalizedAngleInterval & expandTo(NormalizedAngle x)
Interval & clipTo(Scalar x)
static NormalizedAngleInterval fromRadians(double a, double b)
Box(LonLat const &p)
This constructor creates a box containing a single point.
bool isWithin(NormalizedAngle x) const
static AngleInterval fromRadians(double x, double y)
std::ostream & operator<<(std::ostream &, Angle const &)
bool isWithin(Scalar x) const
static NormalizedAngleInterval fromDegrees(double a, double b)
bool contains(NormalizedAngle x) const
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
Scalar getCenter() const
getCenter returns the center of this interval.
Box(NormalizedAngleInterval const &lon, AngleInterval const &lat)
This constructor creates a box spanning the given longitude and latitude intervals.
bool isDisjointFrom(LonLat const &x) const
NormalizedAngle getLon() const
bool isFull() const
isFull returns true if this interval contains all normalized angles.
Box represents a rectangle in spherical coordinate space that contains its boundary.
Box & dilateBy(Angle r)
dilateBy minimally expands this Box to include all points within angular separation r of its boundary...
Scalar getSize() const
getSize returns the size (length, width) of this interval.
Box(LonLat const &p1, LonLat const &p2)
This constructor creates a box spanning the longitude interval [p1.getLon(), p2.getLon()] and latitud...
Relationship relate(LonLat const &p) const
This file declares a class for representing unit vectors in ℝ³.
static Box fromDegrees(double lon1, double lat1, double lon2, double lat2)
Ellipse is an elliptical region on the sphere.
bool intersects(LonLat const &x) const
bool contains(Box const &x) const
Box dilatedBy(Angle r) const
Relationship relate(Scalar x) const
A base class for image defects.
This file defines an interface for spherical regions.
bool isEmpty() const
isEmpty returns true if this box does not contain any points.
static AngleInterval allLatitudes()
allLatitudes returns an angle interval containing all valid latitude angles.
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 l...
Region is a minimal interface for 2-dimensional regions on the unit sphere.
NormalizedAngleInterval const & getLon() const
getLon returns the longitude interval of this box.
Box clippedTo(LonLat const &x) const
clippedTo returns the intersection of this box and x.
bool intersects(NormalizedAngle x) const
Interval & expandTo(Scalar x)
Box & clipTo(LonLat const &x)
clipTo shrinks this box until it contains only x.
virtual Relationship relate(Region const &) const =0
Relationship relate(NormalizedAngle x) const
NormalizedAngleInterval represents closed intervals of normalized angles, i.e.
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
bool isWithin(LonLat const &x) const
bool isEmpty() const
isEmpty returns true if this interval does not contain any points.
bool contains(LonLat const &x) const
This file declares a class representing closed intervals of normalized angles, i.e.
Circle is a circular region on the unit sphere that contains its boundary.
ConvexPolygon is a closed convex polygon on the unit sphere.
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.
static NormalizedAngleInterval full()
bool operator!=(LonLat const &p) const
LonLat getCenter() const
getCenter returns the center of this box.
This file defines a class for representing angle intervals.
bool isDisjointFrom(Box const &x) const
Box & clipTo(Box const &x)
x.clipTo(y) sets x to the smallest box containing the intersection of x and y.
Angle represents an angle in radians.
AngleInterval const & getLat() const
getLat returns the latitude interval of this box.
NormalizedAngleInterval & clipTo(NormalizedAngle x)
clipTo shrinks this interval until all its points are in x.
LonLat represents a spherical coordinate (longitude/latitude angle) pair.
bool intersects(Box const &x) const
Box & expandTo(Box const &x)
Box clippedTo(Box const &x) const
clippedTo returns the smallest box containing the intersection of this box and x. ...
Box3d represents a box in ℝ³.
bool operator==(Box const &b) const
Two boxes are equal if they contain the same points.
static NormalizedAngle halfWidthForCircle(Angle r, Angle lat)
halfWidthForCircle computes the half-width of bounding boxes for circles with radius r and centers at...
bool contains(Scalar x) const
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
Relationship relate(Region const &r) const override
double getArea() const
getArea returns the area of this box in steradians.
Box erodedBy(Angle r) const
NormalizedAngle getCenter() const
getCenter returns the center of this interval.
bool isFull() const
isFull returns true if this box contains all points on the unit sphere.
bool isWithin(Box const &x) const
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Relationship relate(Box const &b) const override
Box dilatedBy(Angle w, Angle h) const
This file contains a class representing spherical coordinates.
Box expandedTo(LonLat const &x) const
NormalizedAngle getSize() const
getSize returns the size (length, width) of this interval.
static std::unique_ptr< Box > decode(std::vector< uint8_t > const &s)
bool intersects(Scalar x) const