30#ifndef LSST_SPHGEOM_ELLIPSE_H_
31#define LSST_SPHGEOM_ELLIPSE_H_
179 static constexpr uint8_t TYPE_CODE =
'e';
191 _tana(std::numeric_limits<double>::infinity()),
192 _tanb(std::numeric_limits<double>::infinity())
220 bool operator==(
Ellipse const & e)
const {
221 return _S == e._S && _a == e._a && _b == e._b;
224 bool operator!=(Ellipse
const & e)
const {
return !(*
this == e); }
226 bool isEmpty()
const {
return Angle(0.5 * PI) + _a < _gamma; }
228 bool isFull()
const {
return Angle(0.5 * PI) - _a <= _gamma; }
230 bool isGreatCircle()
const {
return _a.
asRadians() == 0.0; }
232 bool isCircle()
const {
return _a == _b; }
272 _S =
Matrix3d(-_S(0,0), -_S(0,1), -_S(0,2),
273 _S(1,0), _S(1,1), _S(1,2),
274 -_S(2,0), -_S(2,1), -_S(2,2));
284 std::unique_ptr<Region>
clone()
const override {
285 return std::unique_ptr<Ellipse>(
new Ellipse(*
this));
306 std::vector<uint8_t>
encode()
const override;
310 static std::unique_ptr<Ellipse>
decode(std::vector<uint8_t>
const & s) {
311 return decode(s.data(), s.size());
313 static std::unique_ptr<Ellipse>
decode(uint8_t
const * buffer,
size_t n);
317 static constexpr size_t ENCODED_SIZE = 113;
327std::ostream & operator<<(std::ostream &, Ellipse
const &);
This file declares a class for representing circular regions on the unit sphere.
This file contains a class representing 3x3 real matrices.
This file defines an interface for spherical regions.
This file declares a class for representing unit vectors in ℝ³.
double asRadians() const
asRadians returns the value of this angle in units of radians.
Definition Angle.h:92
Angle getOpeningAngle() const
Definition Circle.h:135
UnitVector3d const & getCenter() const
Definition Circle.h:125
Definition ConvexPolygon.h:64
Angle getAlpha() const
Definition Ellipse.h:259
UnitVector3d getF2() const
getF2 returns the second focal point of the ellipse.
Definition Ellipse.h:251
Angle getBeta() const
Definition Ellipse.h:264
Relationship relate(Region const &r) const override
Definition Ellipse.h:296
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Definition Ellipse.cc:248
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
Definition Ellipse.cc:197
Ellipse(Circle const &c)
This constructor creates an ellipse corresponding to the given circle.
Definition Ellipse.h:196
std::vector< uint8_t > encode() const override
Definition Ellipse.cc:346
Ellipse(UnitVector3d const &v, Angle alpha=Angle(0.0))
Definition Ellipse.h:202
Ellipse()
This constructor creates an empty ellipse.
Definition Ellipse.h:186
UnitVector3d getF1() const
getF1 returns the first focal point of the ellipse.
Definition Ellipse.h:245
Angle getGamma() const
Definition Ellipse.h:268
static std::unique_ptr< Ellipse > decode(std::vector< uint8_t > const &s)
Definition Ellipse.h:310
std::unique_ptr< Region > clone() const override
clone returns a deep copy of this region.
Definition Ellipse.h:284
Ellipse & complement()
complement sets this ellipse to the closure of its complement.
Definition Ellipse.h:271
Matrix3d const & getTransformMatrix() const
Definition Ellipse.h:237
Ellipse complemented() const
complemented returns the closure of the complement of this ellipse.
Definition Ellipse.h:281
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
Definition Ellipse.cc:167
UnitVector3d getCenter() const
getCenter returns the center of the ellipse as a unit vector.
Definition Ellipse.h:240
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
Definition Ellipse.cc:244
A 3x3 matrix with real entries stored in double precision.
Definition Matrix3d.h:45
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.
Definition UnitVector3d.h:62
static UnitVector3d fromNormalized(Vector3d const &v)
Definition UnitVector3d.h:89
UnitVector3d rotatedAround(UnitVector3d const &k, Angle a) const
Definition UnitVector3d.h:200
int orientation(UnitVector3d const &a, UnitVector3d const &b, UnitVector3d const &c)
Definition orientation.cc:142
Relationship invert(Relationship r)
Definition Relationship.h:62
std::bitset< 3 > Relationship
Relationship describes how two sets are related.
Definition Relationship.h:42