30#ifndef LSST_SPHGEOM_CIRCLE_H_
31#define LSST_SPHGEOM_CIRCLE_H_
75 _squaredChordLength(-1.0),
86 _squaredChordLength(0.0),
104 _squaredChordLength(cl2),
111 (_center == c._center &&
112 _squaredChordLength == c._squaredChordLength &&
113 _openingAngle == c._openingAngle);
119 return !(_squaredChordLength >= 0.0);
122 bool isFull()
const {
return _squaredChordLength >= 4.0; }
240 (v - _center).getSquaredNorm() <= _squaredChordLength;
247 return invert(r.relate(*
this));
268 return decode(s.data(), s.size());
274 static constexpr size_t ENCODED_SIZE = 41;
277 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.
static constexpr std::uint8_t TYPE_CODE
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
TriState overlaps(Region const &other) const override
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
Circle dilatedBy(Angle r) const
bool isDisjointFrom(UnitVector3d const &x) const
std::vector< std::uint8_t > encode() const override
encode serializes this region into an opaque byte string.
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.
static std::unique_ptr< Circle > decode(std::vector< std::uint8_t > const &s)
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.
Relationship relate(Region const &r) const override
Circle erodedBy(Angle r) const
bool isEmpty() const override
isEmpty returns true when a region does not contain any points.
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 bool contains(UnitVector3d const &) const =0
contains tests whether the given unit vector is inside this region.
virtual TriState overlaps(Region const &other) const =0
TriState represents a boolean value with additional unknown state.
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.