38#ifndef LIB2GEOM_SEEN_CURVE_H
39#define LIB2GEOM_SEEN_CURVE_H
42#include <boost/operators.hpp>
77 : boost::equality_comparable<Curve>
267 Coord to = 1 )
const;
346 virtual void feed(
PathSink &sink,
bool moveto_initial)
const;
355 return c.nearestTime(p);
Cartesian point / 2D vector and related operations.
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Abstract continuous curve on a plane defined on [0,1].
virtual D2< SBasis > toSBasis() const =0
Convert the curve to a symmetric power basis polynomial.
virtual Point operator()(Coord t) const
Evaluate the function at the specified time value.
Curve * portion(Interval const &i) const
A version of that accepts an Interval.
virtual Point initialPoint() const =0
Retrieve the start of the curve.
virtual Point finalPoint() const =0
Retrieve the end of the curve.
virtual Rect boundsFast() const =0
Quickly compute the curve's approximate bounding box.
virtual Curve * reverse() const
Create a reversed version of this curve.
virtual Curve * transformed(Affine const &m) const
Create a curve transformed by an affine transformation.
virtual Point unitTangentAt(Coord t, unsigned n=3) const
Compute a vector tangent to the curve.
virtual void operator*=(Scale const &s)
virtual Interval timeRange() const
Get the interval of allowed time values.
virtual std::vector< Coord > roots(Coord v, Dim2 d) const =0
Computes time values at which the curve intersects an axis-aligned line.
virtual void feed(PathSink &sink, bool moveto_initial) const
Feed the curve to a PathSink.
virtual void operator*=(VShear const &vs)
virtual std::vector< CurveIntersection > intersect(Curve const &other, Coord eps=EPSILON) const
Compute intersections with another curve.
virtual bool isDegenerate() const =0
Check whether the curve has exactly zero length.
virtual int winding(Point const &p) const
Compute the partial winding number of this curve.
virtual void operator*=(Affine const &m)=0
virtual Rect boundsExact() const =0
Compute the curve's exact bounding box.
virtual int degreesOfFreedom() const
Return the number of independent parameters required to represent all variations of this curve.
virtual Coord valueAt(Coord t, Dim2 d) const
Evaluate one of the coordinates at the specified time value.
virtual std::vector< Coord > allNearestTimes(Point const &p, Coord from=0, Coord to=1) const
Compute time values at which the curve comes closest to a specified point.
bool operator==(Curve const &c) const
Test equality of two curves.
virtual Coord nearestTime(Point const &p, Coord a=0, Coord b=1) const
Compute a time value at which the curve comes closest to a specified point.
virtual void operator*=(Translate const &tr)
virtual void expandToTransformed(Rect &bbox, Affine const &transform) const =0
Expand the given rectangle to include the transformed curve, assuming it already contains its initial...
virtual std::vector< CurveIntersection > intersectSelf(Coord eps=EPSILON) const
Compute intersections of this curve with itself.
virtual void operator*=(Zoom const &z)
virtual Coord length(Coord tolerance=0.01) const
Compute the arc length of this curve.
std::vector< Coord > allNearestTimes(Point const &p, Interval const &i)
A version that takes an Interval.
virtual Curve * derivative() const =0
Create a derivative of this curve.
OptRect boundsLocal(OptInterval const &a) const
Compute the bounding box of a part of the curve.
virtual void setInitial(Point const &v)=0
Change the starting point of the curve.
virtual bool _equalTo(Curve const &c) const =0
virtual bool isNear(Curve const &c, Coord precision) const =0
Test whether two curves are approximately the same.
virtual Curve * duplicate() const =0
Create an exact copy of this curve.
virtual void operator*=(Rotate const &r)
virtual void operator*=(HShear const &hs)
virtual Curve * portion(Coord a, Coord b) const =0
Create a curve that corresponds to a part of this curve.
virtual std::vector< Point > pointAndDerivatives(Coord t, unsigned n) const =0
Evaluate the curve and its derivatives.
virtual OptRect boundsLocal(OptInterval const &i, unsigned deg) const =0
virtual bool isLineSegment() const
Check whether the curve is a line segment.
virtual void setFinal(Point const &v)=0
Change the ending point of the curve.
virtual Point pointAt(Coord t) const
Evaluate the curve at a specified time value.
Coord nearestTime(Point const &p, Interval const &i) const
A version that takes an Interval.
void transform(Affine const &m)
Transform this curve by an affine transformation.
Adaptor that creates 2D functions from 1D ones.
Intersection between two shapes.
Range of real numbers that is never empty.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
Callback interface for processing path data.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Rotation around the origin.
Combination of a translation and uniform scale.
Integral and real coordinate types and some basic utilities.
Lifts one dimensional objects into 2D.
Dim2
2D axis enumeration (X or Y).
double Coord
Floating point type used to store coordinates.
constexpr Coord EPSILON
Default "acceptably small" value.
Simple closed interval class.
Various utility functions.
Intersection CurveIntersection
Coord nearest_time(Point const &p, Curve const &c)
Curve * new_clone(Curve const &c)
Polynomial in symmetric power basis (S-basis)