36#ifndef LIB2GEOM_SEEN_SBASIS_CURVE_H
37#define LIB2GEOM_SEEN_SBASIS_CURVE_H
95 return inner.valueAndDerivatives(t, n);
99 for (
unsigned d = 0; d < 2; d++) {
inner[d][0][0] = v[d]; }
102 for (
unsigned d = 0; d < 2; d++) {
inner[d][0][1] = v[d]; }
117 Coord to = 1 )
const override
126 using Curve::operator*=;
134 THROW_NOTIMPLEMENTED();
138 return inner[0].degreesOfFreedom() +
inner[1].degreesOfFreedom();
143 if (
this == &
c)
return true;
145 if (!other)
return false;
Defines the different types of exceptions that 2geom can throw.
3x3 matrix representing an affine transformation.
Abstract continuous curve on a plane defined on [0,1].
void transform(Affine const &m)
Transform this curve by an affine transformation.
Adaptor that creates 2D functions from 1D ones.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Symmetric power basis curve.
void setInitial(Point const &v) override
Change the starting point of the curve.
std::vector< Coord > roots(Coord v, Dim2 d) const override
Computes time values at which the curve intersects an axis-aligned line.
bool isDegenerate() const override
Check whether the curve has exactly zero length.
Coord nearestTime(Point const &p, Coord from=0, Coord to=1) const override
Compute a time value at which the curve comes closest to a specified point.
Curve * derivative() const override
Create a derivative of this curve.
bool _equalTo(Curve const &c) const override
Curve * portion(Coord f, Coord t) const override
Create a curve that corresponds to a part of this curve.
Curve * duplicate() const override
Create an exact copy of this curve.
OptRect boundsLocal(OptInterval const &i, unsigned deg) const override
D2< SBasis > toSBasis() const override
Convert the curve to a symmetric power basis polynomial.
void setFinal(Point const &v) override
Change the ending point of the curve.
int degreesOfFreedom() const override
Return the number of independent parameters required to represent all variations of this curve.
bool isLineSegment() const override
Check whether the curve is a line segment.
Rect boundsFast() const override
Quickly compute the curve's approximate bounding box.
bool isNear(Curve const &, Coord) const override
Test whether two curves are approximately the same.
Point finalPoint() const override
Retrieve the end of the curve.
SBasisCurve(Curve const &other)
void expandToTransformed(Rect &bbox, Affine const &transform) const override
Expand the given rectangle to include the transformed curve, assuming it already contains its initial...
Coord valueAt(Coord t, Dim2 d) const override
Evaluate one of the coordinates at the specified time value.
Point pointAt(Coord t) const override
Evaluate the curve at a specified time value.
void operator*=(Affine const &m) override
SBasisCurve(D2< SBasis > const &sb)
std::vector< Coord > allNearestTimes(Point const &p, Coord from=0, Coord to=1) const override
Compute time values at which the curve comes closest to a specified point.
std::vector< Point > pointAndDerivatives(Coord t, unsigned n) const override
Evaluate the curve and its derivatives.
Point initialPoint() const override
Retrieve the start of the curve.
Coord length(Coord tolerance) const override
Compute the arc length of this curve.
Rect boundsExact() const override
Compute the curve's exact bounding box.
Dim2
2D axis enumeration (X or Y).
double Coord
Floating point type used to store coordinates.
Various utility functions.
OptInterval bounds_exact(Bezier const &b)
OptInterval bounds_local(Bezier const &b, OptInterval const &i)
Coord nearest_time(Point const &p, Curve const &c)
std::vector< double > roots(SBasis const &s)
std::vector< double > all_nearest_times(Point const &p, D2< SBasis > const &c, D2< SBasis > const &dc, double from=0, double to=1)
Bezier portion(const Bezier &a, double from, double to)
Bezier derivative(Bezier const &a)
OptInterval bounds_fast(Bezier const &b)
Nearest time routines for D2<SBasis> and Piecewise<D2<SBasis>>
two-dimensional geometric operators.