23#ifndef LSST_SPHGEOM_CIRCLE_H_
24#define LSST_SPHGEOM_CIRCLE_H_
67 _squaredChordLength(-1.0),
78 _squaredChordLength(0.0),
96 _squaredChordLength(cl2),
103 (_center == c._center &&
104 _squaredChordLength == c._squaredChordLength &&
105 _openingAngle == c._openingAngle);
111 return !(_squaredChordLength >= 0.0);
114 bool isFull()
const {
return _squaredChordLength >= 4.0; }
166 return Circle(*this).clipTo(
x);
170 return Circle(*this).clipTo(
x);
184 return Circle(*this).expandTo(
x);
188 return Circle(*this).expandTo(
x);
232 (v - _center).getSquaredNorm() <= _squaredChordLength;
258 static constexpr size_t ENCODED_SIZE = 41;
261 double _squaredChordLength;
This file defines an interface for spherical regions.
This file declares a class for representing unit vectors in ℝ³.
Angle represents an angle in radians.
Box3d represents a box in ℝ³.
Box represents a rectangle in spherical coordinate space that contains its boundary.
Circle is a circular region on the unit sphere that contains its boundary.
bool contains(Circle const &x) const
contains returns true if the intersection of this circle and x is equal to x.
static Angle openingAngleFor(double squaredChordLength)
openingAngleFor computes and returns the angular separation between points in S² that are separated b...
bool isWithin(Circle const &x) const
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
Circle clippedTo(UnitVector3d const &x) const
Circle & clipTo(UnitVector3d const &x)
bool operator==(Circle const &c) const
bool operator!=(Circle const &c) const
std::unique_ptr< Region > clone() const override
clone returns a deep copy of this region.
double getArea() const
getArea returns the area of this circle in steradians.
Circle & dilateBy(Angle r)
If r is positive, dilateBy increases the opening angle of this circle to include all points within an...
bool isWithin(UnitVector3d const &) const
static std::unique_ptr< Circle > decode(std::vector< uint8_t > const &s)
Circle expandedTo(UnitVector3d const &x) const
Circle(UnitVector3d const &c, Angle a)
This constructor creates a circle with center c and opening angle a.
bool intersects(Circle const &x) const
std::vector< uint8_t > encode() const override
encode serializes this region into an opaque byte string.
Circle dilatedBy(Angle r) const
bool isDisjointFrom(UnitVector3d const &x) const
Circle(UnitVector3d const &c, double cl2)
This constructor creates a circle with center c and squared chord length cl2.
Circle(UnitVector3d const &c)
This constructor creates the circle with center c and squared chord length / opening angle of zero.
Relationship relate(UnitVector3d const &v) const
Circle & erodeBy(Angle r)
double getSquaredChordLength() const
getSquaredChordLength returns the squared length of chords between the circle center and points on th...
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
Angle getOpeningAngle() const
getOpeningAngle returns the opening angle of this circle - that is, the angle between its center vect...
UnitVector3d const & getCenter() const
getCenter returns the center of this circle as a unit vector.
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
Circle clippedTo(Circle const &x) const
bool intersects(UnitVector3d const &x) const
Circle & complement()
complement sets this circle to the closure of its complement.
Circle & expandTo(UnitVector3d const &x)
Circle()
This constructor creates an empty circle.
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
static double squaredChordLengthFor(Angle openingAngle)
squaredChordLengthFor computes and returns the squared chord length between points in S² that are sep...
Circle expandedTo(Circle const &x) const
Circle complemented() const
complemented returns the closure of the complement of this circle.
static constexpr uint8_t TYPE_CODE
Relationship relate(Region const &r) const override
Circle erodedBy(Angle r) const
ConvexPolygon is a closed convex polygon on the unit sphere.
Ellipse is an elliptical region on the sphere.
Region is a minimal interface for 2-dimensional regions on the unit sphere.
virtual Relationship relate(Region const &) const =0
virtual bool contains(UnitVector3d const &) const =0
contains tests whether the given unit vector is inside this region.
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
std::ostream & operator<<(std::ostream &, Angle const &)
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.