35#ifndef LIB2GEOM_SEEN_ELLIPSE_H
36#define LIB2GEOM_SEEN_ELLIPSE_H
61 : boost::multipliable< Ellipse, Translate
62 , boost::multipliable< Ellipse, Scale
63 , boost::multipliable< Ellipse, Rotate
64 , boost::multipliable< Ellipse, Zoom
65 , boost::multipliable< Ellipse, Affine
66 , boost::equality_comparable< Ellipse
84 Ellipse(
double A,
double B,
double C,
double D,
double E,
double F) {
105 void setCoefficients(
double A,
double B,
double C,
double D,
double E,
double F);
134 void fit(std::vector<Point>
const& points);
208 std::vector<ShapeIntersection>
intersect(
Line const &line)
const;
234 bool operator==(
Ellipse const &other)
const;
245std::ostream &operator<<(std::ostream &out, Ellipse
const &e);
Defines the different types of exceptions that 2geom can throw.
Various trigoniometric helper functions.
3x3 matrix representing an affine transformation.
Wrapper for angular values.
Set of all points at a fixed distance from the center.
Adaptor that creates 2D functions from 1D ones.
Set of points with a constant sum of distances from two foci.
Coord valueAt(Coord t, Dim2 d) const
Evaluate a single coordinate of a point on the ellipse.
void setRay(Coord r, Dim2 d)
Set one of the rays of the ellipse.
Ellipse(Point const &c, Point const &r, Coord angle)
LineSegment semiaxis(Dim2 d, int sign=1) const
void setRays(Point const &p)
Set both rays of the ellipse.
LineSegment axis(Dim2 d) const
Point initialPoint() const
Get the point corresponding to the +X ray of the ellipse.
void setRotationAngle(Angle a)
Set the angle the X ray makes with the +X axis.
void setRays(Coord x, Coord y)
Set both rays of the ellipse as coordinates.
Point unitTangentAt(Coord t) const
Get the value of the derivative at time t normalized to unit length.
std::vector< double > coefficients() const
Get the coefficients of the ellipse's implicit equation.
Ellipse & operator*=(Scale const &s)
bool contains(Point const &p) const
Check whether the ellipse contains the given point.
Ellipse(Coord cx, Coord cy, Coord rx, Coord ry, Coord angle)
Ellipse canonicalForm() const
Return an ellipse with less degrees of freedom.
Rect boundsFast() const
Get a fast to compute bounding box which contains the ellipse.
Ellipse & operator*=(Zoom const &z)
Coord timeAt(Point const &p) const
Find the time value of a point on an ellipse.
LineSegment semiminorAxis(int sign=1) const
Angle rotationAngle() const
Get the angle the X ray makes with the +X axis.
std::vector< ShapeIntersection > intersect(Line const &line) const
Compute intersections with an infinite line.
void setCenter(Point const &p)
Set the center.
Affine unitCircleTransform() const
Compute the transform that maps the unit circle to this ellipse.
void set(Coord cx, Coord cy, Coord rx, Coord ry, Coord a)
Set center, rays and angle as constituent values.
LineSegment minorAxis() const
void set(Point const &c, Point const &r, Coord angle)
Set center, rays and angle.
EllipticalArc * arc(Point const &ip, Point const &inner, Point const &fp)
Create an elliptical arc from a section of the ellipse.
Affine inverseUnitCircleTransform() const
Compute the transform that maps this ellipse to the unit circle.
LineSegment semimajorAxis(int sign=1) const
Point pointAt(Coord t) const
Evaluate a point on the ellipse.
Ellipse & operator*=(Translate const &t)
Coord ray(Dim2 d) const
Get one ray of the ellipse.
Rect boundsExact() const
Get the tight-fitting bounding box of the ellipse.
void setCenter(Coord cx, Coord cy)
Set the center by coordinates.
Ellipse(double A, double B, double C, double D, double E, double F)
Point rays() const
Get both rays as a point.
Coord center(Dim2 d) const
LineSegment majorAxis() const
Point finalPoint() const
Get the point corresponding to the +X ray of the ellipse.
void setCoefficients(double A, double B, double C, double D, double E, double F)
Set an ellipse by solving its implicit equation.
Infinite line on a plane.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Rotation around the origin.
Combination of a translation and uniform scale.
double inner(valarray< double > const &x, valarray< double > const &y)
Contains forward declarations of 2geom types.
Dim2
2D axis enumeration (X or Y).
double Coord
Floating point type used to store coordinates.
constexpr Coord EPSILON
Default "acceptably small" value.
Various utility functions.
static float sign(double number)
Returns +1 for positive numbers, -1 for negative numbers, and 0 otherwise.
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)