Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Geom::Piecewise< T > Class Template Reference

Function defined as discrete pieces. More...

#include <piecewise.h>

Public Types

typedef T::output_type output_type
 

Public Member Functions

 Piecewise ()
 
 Piecewise (const T &s)
 
unsigned input_dim ()
 
 Piecewise (const output_type &v)
 
void reserve (unsigned i)
 
T const & operator[] (unsigned i) const
 
T & operator[] (unsigned i)
 
output_type operator() (double t) const
 
output_type valueAt (double t) const
 
output_type firstValue () const
 
output_type lastValue () const
 
std::vector< output_typevalueAndDerivatives (double t, unsigned n_derivs) const
 The size of the returned vector equals n_derivs+1.
 
Piecewise< T > operator() (SBasis f)
 
Piecewise< T > operator() (Piecewise< SBasis >f)
 
unsigned size () const
 
bool empty () const
 
void clear ()
 
void push (const T &s, double to)
 Convenience/implementation hiding function to add segment/cut pairs.
 
void push (T &&s, double to)
 
void push_cut (double c)
 
void push_seg (const T &s)
 
void push_seg (T &&s)
 
unsigned segN (double t, int low=0, int high=-1) const
 Returns the segment index which corresponds to a 'global' piecewise time.
 
double segT (double t, int i=-1) const
 Returns the time within a segment, given the 'global' piecewise time.
 
double mapToDomain (double t, unsigned i) const
 
void offsetDomain (double o)
 
void scaleDomain (double s)
 
Interval domain () const
 
void setDomain (Interval dom)
 
void concat (const Piecewise< T > &other)
 
void continuousConcat (const Piecewise< T > &other)
 
bool invariants () const
 

Public Attributes

std::vector< double > cuts
 
std::vector< T > segs
 

Private Member Functions

 BOOST_CLASS_REQUIRE (T, Geom, FragmentConcept)
 

Related Symbols

(Note that these are not member symbols.)

template<typename T >
FragmentConcept< T >::BoundsType bounds_fast (const Piecewise< T > &f)
 ...
 
template<typename T >
FragmentConcept< T >::BoundsType bounds_exact (const Piecewise< T > &f)
 ...
 
template<typename T >
FragmentConcept< T >::BoundsType bounds_local (const Piecewise< T > &f, const OptInterval &_m)
 ...
 
template<typename T >
elem_portion (const Piecewise< T > &a, unsigned i, double from, double to)
 Returns a portion of a piece of a Piecewise<T>, given the piece's index and a to/from time.
 
template<typename T >
Piecewise< T > partition (const Piecewise< T > &pw, std::vector< double > const &c)
 Piecewise<T> partition(const Piecewise<T> &pw, std::vector<double> const &c); Further subdivides the Piecewise<T> such that there is a cut at every value in c.
 
template<typename T >
Piecewise< T > portion (const Piecewise< T > &pw, double from, double to)
 Returns a Piecewise<T> with a defined domain of [min(from, to), max(from, to)].
 
template<typename T >
Piecewise< T > remove_short_cuts (Piecewise< T > const &f, double tol)
 ...
 
template<typename T >
Piecewise< T > remove_short_cuts_extending (Piecewise< T > const &f, double tol)
 ...
 
template<typename T >
std::vector< double > roots (const Piecewise< T > &pw)
 ...
 
template<typename T >
Piecewise< T > operator+ (Piecewise< T > const &a, typename T::output_type b)
 ...
 
template<typename T >
Piecewise< T > operator- (Piecewise< T > const &a)
 ...
 
template<typename T >
Piecewise< T > operator* (Piecewise< T > const &a, double b)
 ...
 
template<typename T >
Piecewise< T > operator* (Piecewise< T > const &a, T b)
 ...
 
template<typename T >
Piecewise< T > operator/ (Piecewise< T > const &a, double b)
 ...
 
template<typename T >
Piecewise< T > operator+ (Piecewise< T > const &a, Piecewise< T > const &b)
 ...
 
template<typename T >
Piecewise< T > operator- (Piecewise< T > const &a, Piecewise< T > const &b)
 ...
 
template<typename T1 , typename T2 >
Piecewise< T2 > operator* (Piecewise< T1 > const &a, Piecewise< T2 > const &b)
 ...
 
template<typename T >
Piecewise< T > & operator*= (Piecewise< T > &a, Piecewise< T > const &b)
 ...
 
template<typename T >
Piecewise< T > compose (Piecewise< T > const &f, SBasis const &g)
 ...
 
template<typename T >
Piecewise< T > compose (Piecewise< T > const &f, Piecewise< SBasis > const &g)
 ...
 
Piecewise< SBasispw_compose_inverse (SBasis const &f, SBasis const &g, unsigned order, double zero)
 Compose an SBasis with the inverse of another.
 
template<typename T >
Piecewise< T > integral (Piecewise< T > const &a)
 ...
 
template<typename T >
Piecewise< T > derivative (Piecewise< T > const &a)
 ...
 
template<typename T >
Piecewise< T > reverse (Piecewise< T > const &f)
 ...
 
template<typename T >
Piecewise< T > lerp (double t, Piecewise< T > const &a, Piecewise< T > b)
 Interpolates between a and b.
 
Piecewise< SBasisdot (Piecewise< D2< SBasis > > const &a, Piecewise< D2< SBasis > > const &b)
 Calculates the 'dot product' or 'inner product' of a and b.
 
Piecewise< SBasisdot (Piecewise< D2< SBasis > > const &a, Point const &b)
 Calculates the 'dot product' or 'inner product' of a and b.
 
Piecewise< SBasisatan2 (Piecewise< D2< SBasis > > const &vect, double tol, unsigned order)
 Return a function which gives the angle of vect at each point.
 
Piecewise< SBasisatan2 (D2< SBasis > const &vect, double tol, unsigned order)
 Return a function which gives the angle of vect at each point.
 
D2< Piecewise< SBasis > > tan2 (Piecewise< SBasis > const &angle, double tol, unsigned order)
 tan2 is the pseudo-inverse of atan2.
 
Piecewise< D2< SBasis > > unitVector (D2< SBasis > const &V_in, double tol, unsigned order)
 Return a Piecewise<D2<SBasis> > which points in the same direction as V_in, but has unit_length.
 
Piecewise< D2< SBasis > > unitVector (Piecewise< D2< SBasis > > const &V, double tol, unsigned order)
 Return a Piecewise<D2<SBasis> > which points in the same direction as V_in, but has unit_length.
 
Piecewise< SBasisarcLengthSb (Piecewise< D2< SBasis > > const &M, double tol)
 returns a function giving the arclength at each point in M.
 
Piecewise< SBasisarcLengthSb (D2< SBasis > const &M, double tol)
 returns a function giving the arclength at each point in M.
 
Piecewise< SBasiscurvature (D2< SBasis > const &M, double tol)
 returns a function giving the curvature at each point in M.
 
Piecewise< SBasiscurvature (Piecewise< D2< SBasis > > const &V, double tol)
 returns a function giving the curvature at each point in M.
 
Piecewise< D2< SBasis > > arc_length_parametrization (D2< SBasis > const &M, unsigned order, double tol)
 Reparameterise M to have unit speed.
 
Piecewise< D2< SBasis > > arc_length_parametrization (Piecewise< D2< SBasis > > const &M, unsigned order, double tol)
 Reparameterise M to have unit speed.
 
double length (Piecewise< D2< SBasis > > const &s, double tol)
 Calculates the length of a Piecewise<D2<SBasis> > through gsl integration.
 
unsigned centroid (Piecewise< D2< SBasis > > const &p, Point &centroid, double &area)
 Centroid using sbasis integration.
 

Detailed Description

template<typename T>
class Geom::Piecewise< T >

Function defined as discrete pieces.

The Piecewise class manages a sequence of elements of a type as segments and the ’cuts’ between them. These cuts are time values which separate the pieces. This function representation allows for more interesting functions, as it provides a viable output for operations such as inversion, which may require multiple SBasis to properly invert the original.

As for technical details, while the actual SBasis segments begin on the first cut and end on the last, the function is defined throughout all inputs by ex- tending the first and last segments. The exact switching between segments is arbitrarily such that beginnings (t=0) have preference over endings (t=1). This only matters if it is discontinuous at the location.

\[ f(t) \rightarrow \left\{ \begin{array}{cc} s_1,& t <= c_2 \\ s_2,& c_2 <= t <= c_3\\ \ldots \\ s_n,& c_n <= t \end{array}\right. \]

Definition at line 71 of file piecewise.h.

Member Typedef Documentation

◆ output_type

template<typename T >
typedef T::output_type Geom::Piecewise< T >::output_type

Definition at line 89 of file piecewise.h.

Constructor & Destructor Documentation

◆ Piecewise() [1/3]

template<typename T >
Geom::Piecewise< T >::Piecewise ( )
inline

Definition at line 79 of file piecewise.h.

◆ Piecewise() [2/3]

template<typename T >
Geom::Piecewise< T >::Piecewise ( const T &  s)
inlineexplicit

◆ Piecewise() [3/3]

template<typename T >
Geom::Piecewise< T >::Piecewise ( const output_type v)
inlineexplicit

Member Function Documentation

◆ BOOST_CLASS_REQUIRE()

template<typename T >
Geom::Piecewise< T >::BOOST_CLASS_REQUIRE ( ,
Geom  ,
FragmentConcept   
)
private

◆ clear()

◆ concat()

◆ continuousConcat()

◆ domain()

◆ empty()

◆ firstValue()

◆ input_dim()

template<typename T >
unsigned Geom::Piecewise< T >::input_dim ( )
inline

Definition at line 87 of file piecewise.h.

◆ invariants()

template<typename T >
bool Geom::Piecewise< T >::invariants ( ) const
inline

◆ lastValue()

◆ mapToDomain()

template<typename T >
double Geom::Piecewise< T >::mapToDomain ( double  t,
unsigned  i 
) const
inline

Definition at line 191 of file piecewise.h.

References Geom::Piecewise< T >::cuts.

Referenced by Geom::multi_roots(), and Geom::roots().

◆ offsetDomain()

template<typename T >
void Geom::Piecewise< T >::offsetDomain ( double  o)
inline

◆ operator()() [1/3]

template<typename T >
output_type Geom::Piecewise< T >::operator() ( double  t) const
inline

Definition at line 101 of file piecewise.h.

References Geom::Piecewise< T >::valueAt().

◆ operator()() [2/3]

template<typename T >
Piecewise< T > Geom::Piecewise< T >::operator() ( Piecewise< SBasis f)

Definition at line 850 of file piecewise.h.

References Geom::compose().

◆ operator()() [3/3]

template<typename T >
Piecewise< T > Geom::Piecewise< T >::operator() ( SBasis  f)

Definition at line 848 of file piecewise.h.

References Geom::compose().

◆ operator[]() [1/2]

template<typename T >
T & Geom::Piecewise< T >::operator[] ( unsigned  i)
inline

Definition at line 100 of file piecewise.h.

References Geom::Piecewise< T >::segs.

◆ operator[]() [2/2]

template<typename T >
T const & Geom::Piecewise< T >::operator[] ( unsigned  i) const
inline

Definition at line 99 of file piecewise.h.

References Geom::Piecewise< T >::segs.

◆ push() [1/2]

◆ push() [2/2]

template<typename T >
void Geom::Piecewise< T >::push ( T &&  s,
double  to 
)
inline

◆ push_cut()

◆ push_seg() [1/2]

◆ push_seg() [2/2]

template<typename T >
void Geom::Piecewise< T >::push_seg ( T &&  s)
inline

Definition at line 158 of file piecewise.h.

References Geom::Piecewise< T >::segs.

◆ reserve()

◆ scaleDomain()

template<typename T >
void Geom::Piecewise< T >::scaleDomain ( double  s)
inline

◆ segN()

template<typename T >
unsigned Geom::Piecewise< T >::segN ( double  t,
int  low = 0,
int  high = -1 
) const
inline

Returns the segment index which corresponds to a 'global' piecewise time.

Also takes optional low/high parameters to expedite the search for the segment.

Definition at line 163 of file piecewise.h.

References Geom::Piecewise< T >::cuts, and Geom::Piecewise< T >::size().

Referenced by Geom::Piecewise< T >::bounds_local(), Geom::Piecewise< T >::portion(), Geom::Piecewise< T >::segT(), Geom::Piecewise< T >::valueAndDerivatives(), and Geom::Piecewise< T >::valueAt().

◆ segT()

template<typename T >
double Geom::Piecewise< T >::segT ( double  t,
int  i = -1 
) const
inline

Returns the time within a segment, given the 'global' piecewise time.

Also takes an optional index parameter which may be used for efficiency or to find the time on a segment outside its range. If it is left to its default, -1, it will call segN to find the index.

Definition at line 185 of file piecewise.h.

References Geom::Piecewise< T >::cuts, and Geom::Piecewise< T >::segN().

Referenced by Geom::Piecewise< T >::bounds_local(), Geom::Piecewise< T >::partition(), Geom::Piecewise< T >::portion(), Geom::Piecewise< T >::valueAndDerivatives(), and Geom::Piecewise< T >::valueAt().

◆ setDomain()

◆ size()

template<typename T >
unsigned Geom::Piecewise< T >::size ( ) const
inline

Definition at line 131 of file piecewise.h.

References Geom::Piecewise< T >::segs.

Referenced by Geom::abs(), Geom::Piecewise< T >::arc_length_parametrization(), Geom::Piecewise< T >::bounds_exact(), Geom::Piecewise< T >::bounds_fast(), cairo_pw(), cairo_pw(), Geom::Piecewise< T >::compose(), Geom::Piecewise< T >::concat(), Geom::Piecewise< T >::continuousConcat(), Geom::cos(), Geom::Piecewise< T >::curvature(), Geom::divide(), Geom::divide(), Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2(), Geom::Piecewise< T >::dot(), Geom::Piecewise< T >::elem_portion(), Inkscape::LivePathEffect::find_cusps(), Geom::level_set(), Geom::multi_roots(), Geom::Piecewise< T >::offsetDomain(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::operator*=(), Geom::Piecewise< T >::operator+(), Geom::operator+=(), Geom::Piecewise< T >::operator-(), Geom::operator-(), Geom::operator-=(), Geom::Piecewise< T >::operator/(), Geom::operator/=(), Geom::Piecewise< T >::partition(), plot(), plot(), plot(), plot3d(), Geom::Piecewise< T >::portion(), Geom::prolongateByConstants(), prolongateByConstants(), pw_inverse(), Geom::reciprocalOnDomain(), Geom::Piecewise< T >::remove_short_cuts(), Geom::Piecewise< T >::remove_short_cuts_extending(), Geom::Piecewise< T >::reverse(), Geom::Piecewise< T >::roots(), Geom::roots(), Geom::Piecewise< T >::scaleDomain(), Geom::sectionize(), Geom::Piecewise< T >::segN(), Geom::Piecewise< T >::setDomain(), Geom::sqrt(), and Geom::Piecewise< T >::unitVector().

◆ valueAndDerivatives()

template<typename T >
std::vector< output_type > Geom::Piecewise< T >::valueAndDerivatives ( double  t,
unsigned  n_derivs 
) const
inline

The size of the returned vector equals n_derivs+1.

Definition at line 116 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::segN(), Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::segT().

◆ valueAt()

Friends And Related Symbol Documentation

◆ arc_length_parametrization() [1/2]

template<typename T >
Piecewise< D2< SBasis > > arc_length_parametrization ( D2< SBasis > const &  M,
unsigned  order,
double  tol 
)
related

Reparameterise M to have unit speed.

Parameters
Mthe Element.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation , D2

Definition at line 402 of file sbasis-geometric.cpp.

References Geom::arcLengthSb(), Geom::are_near(), Geom::SBasis::at0(), Geom::SBasis::at1(), Geom::compose(), Geom::compose_inverse(), Geom::Piecewise< T >::cuts, order, Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push_cut(), Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::size().

◆ arc_length_parametrization() [2/2]

template<typename T >
Piecewise< D2< SBasis > > arc_length_parametrization ( Piecewise< D2< SBasis > > const &  M,
unsigned  order,
double  tol 
)
related

Reparameterise M to have unit speed.

Parameters
Mthe Element.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation

Definition at line 434 of file sbasis-geometric.cpp.

References Geom::arc_length_parametrization(), Geom::Piecewise< T >::concat(), order, and result.

◆ arcLengthSb() [1/2]

template<typename T >
Piecewise< SBasis > arcLengthSb ( D2< SBasis > const &  M,
double  tol 
)
related

returns a function giving the arclength at each point in M.

Parameters
Mthe Element.
tolthe maximum error allowed. , D2

Definition at line 338 of file sbasis-geometric.cpp.

References Geom::arcLengthSb().

◆ arcLengthSb() [2/2]

template<typename T >
Piecewise< SBasis > arcLengthSb ( Piecewise< D2< SBasis > > const &  M,
double  tol 
)
related

returns a function giving the arclength at each point in M.

Parameters
Mthe Element.
tolthe maximum error allowed.

Definition at line 324 of file sbasis-geometric.cpp.

References Geom::derivative(), Geom::dot(), Geom::integral(), Geom::length(), and Geom::sqrt().

◆ atan2() [1/2]

template<typename T >
Piecewise< SBasis > atan2 ( D2< SBasis > const &  vect,
double  tol,
unsigned  order 
)
related

Return a function which gives the angle of vect at each point.

Parameters
vecta piecewise parameteric curve.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation , D2

Definition at line 188 of file sbasis-geometric.cpp.

References Geom::atan2(), and order.

◆ atan2() [2/2]

template<typename T >
Piecewise< SBasis > atan2 ( Piecewise< D2< SBasis > > const &  vect,
double  tol,
unsigned  order 
)
related

Return a function which gives the angle of vect at each point.

Parameters
vecta piecewise parameteric curve.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation

Definition at line 157 of file sbasis-geometric.cpp.

References Geom::D2< T >::at0(), Geom::cutAtRoots(), Geom::derivative(), Geom::divide(), Geom::integral(), order, RescaleForNonVanishingEnds(), and result.

◆ bounds_exact()

template<typename T >
FragmentConcept< T >::BoundsType bounds_exact ( const Piecewise< T > &  f)
related

...

Returns
...

Definition at line 300 of file piecewise.h.

References Geom::bounds_exact(), Geom::Piecewise< T >::empty(), and Geom::Piecewise< T >::size().

◆ bounds_fast()

template<typename T >
FragmentConcept< T >::BoundsType bounds_fast ( const Piecewise< T > &  f)
related

...

Returns
...

Definition at line 284 of file piecewise.h.

References Geom::bounds_fast(), Geom::Piecewise< T >::empty(), and Geom::Piecewise< T >::size().

◆ bounds_local()

◆ centroid()

template<typename T >
unsigned centroid ( Piecewise< D2< SBasis > > const &  p,
Point centroid,
double &  area 
)
related

Centroid using sbasis integration.

Parameters
pthe Element.
centroidon return contains the centroid of the shape
areaon return contains the signed area of the shape.

This approach uses green's theorem to compute the area and centroid using integrals. For curved shapes this is much faster than converting to polyline. Note that without an uncross operation the output is not the absolute area.

Returned values: 0 for normal execution; 2 if area is zero, meaning centroid is meaningless.

Definition at line 521 of file sbasis-geometric.cpp.

References Geom::area(), Geom::D2< T >::at0(), Geom::SBasis::at0(), Geom::D2< T >::at1(), Geom::SBasis::at1(), Geom::centroid(), Geom::cross(), Geom::derivative(), Geom::dot(), Geom::integral(), Geom::multiply(), and Geom::rot90().

◆ compose() [1/2]

template<typename T >
Piecewise< T > compose ( Piecewise< T > const &  f,
Piecewise< SBasis > const &  g 
)
related

...

Returns
...
Todo:
add concept check

Definition at line 815 of file piecewise.h.

References Geom::compose(), Geom::Piecewise< T >::cuts, result, Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::setDomain().

◆ compose() [2/2]

◆ curvature() [1/2]

template<typename T >
Piecewise< SBasis > curvature ( D2< SBasis > const &  M,
double  tol 
)
related

returns a function giving the curvature at each point in M.

Parameters
Mthe Element.
tolthe maximum error allowed. , D2
Todo:
claimed incomplete. Check.

Definition at line 364 of file sbasis-geometric.cpp.

References Geom::cross(), Geom::derivative(), Geom::divide(), Geom::dot(), and Geom::unitVector().

◆ curvature() [2/2]

template<typename T >
Piecewise< SBasis > curvature ( Piecewise< D2< SBasis > > const &  V,
double  tol 
)
related

returns a function giving the curvature at each point in M.

Parameters
Mthe Element.
tolthe maximum error allowed.
Todo:
claimed incomplete. Check.

Definition at line 380 of file sbasis-geometric.cpp.

References Geom::curvature(), Geom::cutAtRoots(), Geom::Piecewise< T >::cuts, result, Geom::Piecewise< T >::segs, Geom::Piecewise< T >::setDomain(), and Geom::Piecewise< T >::size().

◆ derivative()

template<typename T >
Piecewise< T > derivative ( Piecewise< T > const &  a)
related

...

Returns
...

Definition at line 877 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::derivative(), result, and Geom::Piecewise< T >::segs.

◆ dot() [1/2]

template<typename T >
Piecewise< SBasis > dot ( Piecewise< D2< SBasis > > const &  a,
Piecewise< D2< SBasis > > const &  b 
)
related

Calculates the 'dot product' or 'inner product' of a and b.

Returns

\[ f(t) \rightarrow \left\{ \begin{array}{c} a_1 \bullet b_1 \\ a_2 \bullet b_2 \\ \ldots \\ a_n \bullet b_n \\ \end{array}\right. \]

Definition at line 106 of file d2-sbasis.cpp.

References Geom::Piecewise< T >::cuts, Geom::dot(), result, Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::size().

◆ dot() [2/2]

template<typename T >
Piecewise< SBasis > dot ( Piecewise< D2< SBasis > > const &  a,
Point const &  b 
)
related

Calculates the 'dot product' or 'inner product' of a and b.

Returns

\[ f(t) \rightarrow \left\{ \begin{array}{c} a_1 \bullet b \\ a_2 \bullet b \\ \ldots \\ a_n \bullet b \\ \end{array}\right. \]

Definition at line 131 of file d2-sbasis.cpp.

References Geom::dot(), Geom::Piecewise< T >::push_cut(), and result.

◆ elem_portion()

template<typename T >
T elem_portion ( const Piecewise< T > &  a,
unsigned  i,
double  from,
double  to 
)
related

Returns a portion of a piece of a Piecewise<T>, given the piece's index and a to/from time.

Definition at line 341 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::portion(), and Geom::Piecewise< T >::size().

◆ integral()

template<typename T >
Piecewise< T > integral ( Piecewise< T > const &  a)
related

...

Returns
...

Definition at line 858 of file piecewise.h.

References Geom::Bezier::at0(), c, Geom::Piecewise< T >::cuts, Geom::integral(), result, and Geom::Piecewise< T >::segs.

◆ length()

template<typename T >
double length ( Piecewise< D2< SBasis > > const &  s,
double  tol 
)
related

Calculates the length of a Piecewise<D2<SBasis> > through gsl integration.

Parameters
sthe Element.
tolthe maximum error allowed.

If you only want the total length, this routine faster and more accurate than constructing an arcLengthSb.

Definition at line 498 of file sbasis-geometric.cpp.

References Geom::length_integrating(), and result.

◆ lerp()

template<typename T >
Piecewise< T > lerp ( double  t,
Piecewise< T > const &  a,
Piecewise< T >  b 
)
related

Interpolates between a and b.

Returns
a if t = 0, b if t = 1, or an interpolation between a and b for t in [0,1]

Definition at line 925 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::domain(), and Geom::Piecewise< T >::setDomain().

◆ operator*() [1/3]

template<typename T >
Piecewise< T > operator* ( Piecewise< T > const &  a,
double  b 
)
related

◆ operator*() [2/3]

template<typename T >
Piecewise< T > operator* ( Piecewise< T > const &  a,
b 
)
related

◆ operator*() [3/3]

template<typename T1 , typename T2 >
Piecewise< T2 > operator* ( Piecewise< T1 > const &  a,
Piecewise< T2 > const &  b 
)
related

◆ operator*=()

template<typename T >
Piecewise< T > & operator*= ( Piecewise< T > &  a,
Piecewise< T > const &  b 
)
related

...

Returns
\( a \cdot b \)

Definition at line 730 of file piecewise.h.

◆ operator+() [1/2]

template<typename T >
Piecewise< T > operator+ ( Piecewise< T > const &  a,
Piecewise< T > const &  b 
)
related

...

Returns
\( a + b = \)

Definition at line 662 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::push_seg(), and Geom::Piecewise< T >::segs.

◆ operator+() [2/2]

template<typename T >
Piecewise< T > operator+ ( Piecewise< T > const &  a,
typename T::output_type  b 
)
related

...

Returns
\( a + b = \)

Definition at line 522 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::size().

◆ operator-() [1/2]

template<typename T >
Piecewise< T > operator- ( Piecewise< T > const &  a)
related

...

Returns
\( -a = \)

Definition at line 571 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::segs, and Geom::Piecewise< T >::size().

◆ operator-() [2/2]

template<typename T >
Piecewise< T > operator- ( Piecewise< T > const &  a,
Piecewise< T > const &  b 
)
related

...

Returns
\( a - b = \)

Definition at line 680 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::push_seg(), and Geom::Piecewise< T >::segs.

◆ operator/()

template<typename T >
Piecewise< T > operator/ ( Piecewise< T > const &  a,
double  b 
)
related

◆ partition()

template<typename T >
Piecewise< T > partition ( const Piecewise< T > &  pw,
std::vector< double > const &  c 
)
related

Piecewise<T> partition(const Piecewise<T> &pw, std::vector<double> const &c); Further subdivides the Piecewise<T> such that there is a cut at every value in c.

Precondition: c sorted lower to higher.

//Given Piecewise<T> a and b: Piecewise<T> ac = a.partition(b.cuts); Piecewise<T> bc = b.partition(a.cuts); //ac.cuts should be equivalent to bc.cuts

Definition at line 359 of file piecewise.h.

References c, Geom::Piecewise< T >::cuts, Geom::Piecewise< T >::empty(), Geom::Piecewise< T >::invariants(), Geom::portion(), Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push_cut(), Geom::Piecewise< T >::push_seg(), Geom::Piecewise< T >::reserve(), Geom::Piecewise< T >::segs, Geom::Piecewise< T >::segT(), and Geom::Piecewise< T >::size().

◆ portion()

template<typename T >
Piecewise< T > portion ( const Piecewise< T > &  pw,
double  from,
double  to 
)
related

◆ pw_compose_inverse()

template<typename T >
Piecewise< SBasis > pw_compose_inverse ( SBasis const &  f,
SBasis const &  g,
unsigned  order,
double  zero 
)
related

Compose an SBasis with the inverse of another.

WARNING: It's up to the user to check that the second SBasis is indeed invertible (i.e. strictly increasing or decreasing).

Returns
\( f \cdot g^{-1} \)

Definition at line 158 of file piecewise.cpp.

References Geom::SBasis::at0(), Geom::SBasis::at1(), Geom::compose(), Geom::compose_inverse(), order, Geom::portion(), Geom::pw_compose_inverse(), result, Geom::reverse(), Geom::SBasis::size(), and Geom::SBasis::tailError().

◆ remove_short_cuts()

template<typename T >
Piecewise< T > remove_short_cuts ( Piecewise< T > const &  f,
double  tol 
)
related

◆ remove_short_cuts_extending()

template<typename T >
Piecewise< T > remove_short_cuts_extending ( Piecewise< T > const &  f,
double  tol 
)
related

◆ reverse()

◆ roots()

template<typename T >
std::vector< double > roots ( const Piecewise< T > &  pw)
related

...

Returns
...

Definition at line 505 of file piecewise.h.

References Geom::Piecewise< T >::cuts, Geom::roots(), and Geom::Piecewise< T >::size().

◆ tan2()

template<typename T >
D2< Piecewise< SBasis > > tan2 ( Piecewise< SBasis > const &  angle,
double  tol,
unsigned  order 
)
related

tan2 is the pseudo-inverse of atan2.

It takes an angle and returns a unit_vector that points in the direction of angle.

Parameters
anglea piecewise function of angle wrt t.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation , D2

Definition at line 210 of file sbasis-geometric.cpp.

References Geom::cos(), order, and Geom::sin().

◆ unitVector() [1/2]

template<typename T >
Piecewise< D2< SBasis > > unitVector ( D2< SBasis > const &  V_in,
double  tol,
unsigned  order 
)
related

Return a Piecewise<D2<SBasis> > which points in the same direction as V_in, but has unit_length.

Parameters
V_inthe original path.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation

unitVector(x,y) is computed as (b,-a) where a and b are solutions of: ax+by=0 (eqn1) and a^2+b^2=1 (eqn2)

, D2

Definition at line 225 of file sbasis-geometric.cpp.

References Geom::SBasis::at(), Geom::D2< T >::at0(), Geom::Linear::at0(), Geom::D2< T >::at1(), Geom::Linear::at1(), Geom::compose(), Geom::Piecewise< T >::concat(), Geom::dot(), order, RescaleForNonVanishingEnds(), result, Geom::Piecewise< T >::setDomain(), Geom::SBasis::size(), Geom::SBasis::tailError(), Geom::unit_vector(), and Geom::unitVector().

◆ unitVector() [2/2]

template<typename T >
Piecewise< D2< SBasis > > unitVector ( Piecewise< D2< SBasis > > const &  V,
double  tol,
unsigned  order 
)
related

Return a Piecewise<D2<SBasis> > which points in the same direction as V_in, but has unit_length.

Parameters
V_inthe original path.
tolthe maximum error allowed.
orderthe maximum degree to use for approximation

unitVector(x,y) is computed as (b,-a) where a and b are solutions of: ax+by=0 (eqn1) and a^2+b^2=1 (eqn2)

Definition at line 305 of file sbasis-geometric.cpp.

References Geom::cutAtRoots(), Geom::Piecewise< T >::cuts, order, result, Geom::Piecewise< T >::segs, Geom::Piecewise< T >::setDomain(), Geom::Piecewise< T >::size(), and Geom::unitVector().

Member Data Documentation

◆ cuts

template<typename T >
std::vector<double> Geom::Piecewise< T >::cuts

Definition at line 75 of file piecewise.h.

Referenced by Geom::Piecewise< T >::arc_length_parametrization(), cairo_pw(), cairo_pw(), Geom::Piecewise< T >::clear(), Geom::Piecewise< T >::compose(), Geom::Piecewise< T >::compose(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::Piecewise< T >::concat(), Geom::Piecewise< T >::continuousConcat(), convole(), convole(), Geom::cos(), Geom::cross(), Geom::Piecewise< T >::curvature(), Geom::Piecewise< T >::derivative(), Geom::divide(), Geom::divide(), Inkscape::LivePathEffect::LPEInterpolate::doEffect_path(), doEffect_pwd2(), Inkscape::LivePathEffect::LPEBendPath::doEffect_pwd2(), Inkscape::LivePathEffect::LPEDynastroke::doEffect_pwd2(), Inkscape::LivePathEffect::LPEEnvelope::doEffect_pwd2(), Inkscape::LivePathEffect::LPERoughHatches::doEffect_pwd2(), doEffect_pwd2(), Geom::Piecewise< T >::domain(), Geom::Piecewise< T >::dot(), Geom::Piecewise< T >::elem_portion(), Inkscape::LivePathEffect::find_cusps(), Geom::Piecewise< T >::firstValue(), Geom::Piecewise< T >::integral(), Geom::interpolate(), Geom::Piecewise< T >::invariants(), Geom::Piecewise< T >::lastValue(), Geom::Piecewise< T >::lerp(), Geom::level_set(), linearizeCusps(), Geom::Piecewise< T >::mapToDomain(), Geom::max(), Geom::Piecewise< T >::offsetDomain(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator+(), Geom::Piecewise< T >::operator+(), Geom::Piecewise< T >::operator-(), Geom::Piecewise< T >::operator-(), Geom::operator-(), Geom::Piecewise< T >::operator/(), Geom::Piecewise< T >::partition(), plot(), plot(), plot(), plot(), plot3d(), plot_graph(), Geom::Piecewise< T >::portion(), Geom::prolongateByConstants(), prolongateByConstants(), Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push_cut(), pw_inverse(), Geom::reciprocalOnDomain(), Geom::Piecewise< T >::remove_short_cuts(), Geom::Piecewise< T >::remove_short_cuts_extending(), Geom::Piecewise< T >::reserve(), Geom::Piecewise< T >::reverse(), Geom::Piecewise< T >::roots(), Geom::Piecewise< T >::scaleDomain(), Geom::sectionize(), Geom::Piecewise< T >::segN(), Geom::Piecewise< T >::segT(), Geom::Piecewise< T >::setDomain(), Inkscape::LivePathEffect::TextParam::setPosAndAnchor(), Geom::split_at_discontinuities(), Geom::sqrt(), Geom::Piecewise< T >::unitVector(), and Geom::Piecewise< T >::valueAndDerivatives().

◆ segs

template<typename T >
std::vector<T> Geom::Piecewise< T >::segs

Definition at line 76 of file piecewise.h.

Referenced by Geom::abs(), Geom::Piecewise< T >::arc_length_parametrization(), Geom::Piecewise< T >::clear(), Geom::Piecewise< T >::compose(), Geom::Piecewise< T >::compose(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::Piecewise< T >::concat(), Geom::Piecewise< T >::continuousConcat(), Geom::cos(), Geom::cross(), Geom::Piecewise< T >::curvature(), Geom::Piecewise< T >::derivative(), Inkscape::LivePathEffect::LPEEmbroderyStitch::doEffect_path(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::LPEDynastroke::doEffect_pwd2(), Inkscape::LivePathEffect::LPERuler::doEffect_pwd2(), Inkscape::LivePathEffect::LPESketch::doEffect_pwd2(), Geom::Piecewise< T >::dot(), Geom::Piecewise< T >::empty(), Geom::fuse_nearby_ends(), Geom::Piecewise< T >::integral(), Geom::Piecewise< T >::invariants(), Geom::max(), Geom::multi_roots(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator*(), Geom::Piecewise< T >::operator+(), Geom::Piecewise< T >::operator+(), Geom::Piecewise< T >::operator-(), Geom::Piecewise< T >::operator-(), Geom::operator-(), Geom::Piecewise< T >::operator/(), Geom::Piecewise< T >::operator[](), Geom::Piecewise< T >::operator[](), Geom::Piecewise< T >::partition(), plot(), plot(), plot(), Geom::Piecewise< T >::portion(), Geom::prolongateByConstants(), prolongateByConstants(), Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push(), Geom::Piecewise< T >::push_seg(), Geom::Piecewise< T >::push_seg(), pw_inverse(), Geom::reciprocalOnDomain(), recursive_curvature_fitter(), Geom::Piecewise< T >::reserve(), Geom::Piecewise< T >::reverse(), Geom::roots(), Geom::Piecewise< T >::scaleDomain(), single_curvature_fitter(), Geom::Piecewise< T >::size(), Geom::split_at_discontinuities(), Geom::sqrt(), Geom::truncateResult(), Geom::Piecewise< T >::unitVector(), Geom::Piecewise< T >::valueAndDerivatives(), and Geom::Piecewise< T >::valueAt().


The documentation for this class was generated from the following files: