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

Adaptor that creates 2D functions from 1D ones. More...

#include <d2.h>

Public Types

typedef T D1Value
 
typedef T & D1Reference
 
typedef T const & D1ConstReference
 
typedef Point output_type
 

Public Member Functions

 D2 ()
 
 D2 (Point const &a)
 
 D2 (T const &a, T const &b)
 
template<typename Iter >
 D2 (Iter first, Iter last)
 
 D2 (std::vector< Point > const &vec)
 
T & operator[] (unsigned i)
 
T const & operator[] (unsigned i) const
 
Point point (unsigned i) const
 
bool isZero (double eps=EPSILON) const
 
bool isConstant (double eps=EPSILON) const
 
bool isFinite () const
 
Point at0 () const
 
Point at1 () const
 
Point pointAt (double t) const
 
Point valueAt (double t) const
 
std::vector< PointvalueAndDerivatives (double t, unsigned n) const
 
D2< SBasistoSBasis () const
 
Point operator() (double t) const
 
Point operator() (double x, double y) const
 

Private Attributes

f [2]
 

Related Symbols

(Note that these are not member symbols.)

template<typename T >
dot (D2< T > const &a, Point const &b)
 Calculates the 'dot product' or 'inner product' of a and b.
 
template<typename T >
cross (D2< T > const &a, D2< T > const &b)
 Calculates the 'cross product' or 'outer product' of a and b.
 
D2< Piecewise< SBasis > > tan2 (SBasis const &angle, double tol, unsigned order)
 tan2 is the pseudo-inverse of atan2.
 
void length_integrating (D2< SBasis > const &B, double &result, double &abs_error, double tol)
 Calculates the length of a D2<SBasis> through gsl integration.
 
double length (D2< SBasis > const &s, double tol)
 Calculates the length of a D2<SBasis> through gsl integration.
 
std::vector< D2< SBasis > > cubics_fitting_curvature (Point const &M0, Point const &M1, Point const &dM0, Point const &dM1, double d2M0xdM0, double d2M1xdM1, int insist_on_speed_signs, double epsilon)
 returns the cubics fitting direction and curvature of a given input curve at two points.
 
std::vector< double > find_tangents (Point P, D2< SBasis > const &A)
 returns all the parameter values of A whose tangent passes through P.
 
std::vector< double > find_normals (Point P, D2< SBasis > const &A)
 returns all the parameter values of A whose normal passes through P.
 
std::vector< double > find_normals_by_vector (Point V, D2< SBasis > const &A)
 returns all the parameter values of A whose normal is parallel to vector V.
 
std::vector< double > find_tangents_by_vector (Point V, D2< SBasis > const &A)
 returns all the parameter values of A whose tangent is parallel to vector V.
 

Detailed Description

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

Adaptor that creates 2D functions from 1D ones.

Definition at line 54 of file d2.h.

Member Typedef Documentation

◆ D1ConstReference

template<typename T >
typedef T const& Geom::D2< T >::D1ConstReference

Definition at line 62 of file d2.h.

◆ D1Reference

template<typename T >
typedef T& Geom::D2< T >::D1Reference

Definition at line 61 of file d2.h.

◆ D1Value

template<typename T >
typedef T Geom::D2< T >::D1Value

Definition at line 60 of file d2.h.

◆ output_type

template<typename T >
typedef Point Geom::D2< T >::output_type

Definition at line 108 of file d2.h.

Constructor & Destructor Documentation

◆ D2() [1/5]

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

Definition at line 64 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

◆ D2() [2/5]

template<typename T >
Geom::D2< T >::D2 ( Point const &  a)
inlineexplicit

Definition at line 65 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

◆ D2() [3/5]

template<typename T >
Geom::D2< T >::D2 ( T const &  a,
T const &  b 
)
inline

Definition at line 69 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

◆ D2() [4/5]

template<typename T >
template<typename Iter >
Geom::D2< T >::D2 ( Iter  first,
Iter  last 
)
inline

Definition at line 75 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

◆ D2() [5/5]

template<typename T >
Geom::D2< T >::D2 ( std::vector< Point > const &  vec)
inline

Definition at line 86 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

Member Function Documentation

◆ at0()

◆ at1()

◆ isConstant()

template<typename T >
bool Geom::D2< T >::isConstant ( double  eps = EPSILON) const
inline

Definition at line 113 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

Referenced by Geom::nearest_time().

◆ isFinite()

template<typename T >
bool Geom::D2< T >::isFinite ( ) const
inline

Definition at line 117 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

Referenced by Geom::build_from_sbasis().

◆ isZero()

template<typename T >
bool Geom::D2< T >::isZero ( double  eps = EPSILON) const
inline

Definition at line 109 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

Referenced by Geom::touching_circle().

◆ operator()() [1/2]

template<typename T >
Point Geom::D2< T >::operator() ( double  t) const
inline

Definition at line 433 of file d2.h.

◆ operator()() [2/2]

template<typename T >
Point Geom::D2< T >::operator() ( double  x,
double  y 
) const
inline

Definition at line 443 of file d2.h.

◆ operator[]() [1/2]

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

Definition at line 100 of file d2.h.

References Geom::D2< T >::f.

◆ operator[]() [2/2]

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

Definition at line 101 of file d2.h.

References Geom::D2< T >::f.

◆ point()

template<typename T >
Point Geom::D2< T >::point ( unsigned  i) const
inline

Definition at line 102 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

◆ pointAt()

template<typename T >
Point Geom::D2< T >::pointAt ( double  t) const
inline

Definition at line 129 of file d2.h.

◆ toSBasis()

template<typename T >
D2< SBasis > Geom::D2< T >::toSBasis ( ) const
inline

Definition at line 148 of file d2.h.

References Geom::D2< T >::f, Geom::D2< T >::toSBasis(), Geom::X, and Geom::Y.

Referenced by Geom::D2< T >::toSBasis().

◆ valueAndDerivatives()

template<typename T >
std::vector< Point > Geom::D2< T >::valueAndDerivatives ( double  t,
unsigned  n 
) const
inline

Definition at line 138 of file d2.h.

References Geom::D2< T >::f, Geom::X, and Geom::Y.

Referenced by Geom::intersect_polish_root(), and Geom::unitTangentAt().

◆ valueAt()

template<typename T >
Point Geom::D2< T >::valueAt ( double  t) const
inline

Friends And Related Symbol Documentation

◆ cross()

template<typename T >
T cross ( D2< T > const &  a,
D2< T > const &  b 
)
related

Calculates the 'cross product' or 'outer product' of a and b.

Returns
\(a \times b = a_Y b_X - a_X b_Y\).

Definition at line 386 of file d2.h.

◆ cubics_fitting_curvature()

template<typename T >
std::vector< D2< SBasis > > cubics_fitting_curvature ( Point const &  M0,
Point const &  M1,
Point const &  dM0,
Point const &  dM1,
double  d2M0xdM0,
double  d2M1xdM1,
int  insist_on_speed_signs,
double  epsilon 
)
related

returns the cubics fitting direction and curvature of a given input curve at two points.

The input can be the value, speed, and acceleration or value, speed, and cross(acceleration,speed) of the original curve at the both ends. (the second is often technically useful, as it avoids unnecessary division by |v|^2) Recall that K=1/R=cross(acceleration,speed)/|speed|^3.

Moreover, a 7-th argument 'insist_on_speed_signs' can be supplied to select solutions:
If insist_on_speed_signs == 1, only consider solutions where speeds at both ends are positively proportional to the given ones. If insist_on_speed_signs == 0, allow speeds to point in the opposite direction (both at the same time) If insist_on_speed_signs == -1, allow speeds to point in both direction independently.

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

References c, Geom::cross(), Geom::curvature(), result, solve_lambda0(), and Geom::Piecewise< T >::valueAt().

◆ dot()

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

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

Returns
\(a \bullet b = a_X b_X + a_Y b_Y\).

Definition at line 370 of file d2.h.

◆ find_normals()

template<typename T >
std::vector< double > find_normals ( Point  P,
D2< SBasis > const &  A 
)
related

returns all the parameter values of A whose normal passes through P.

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

References Geom::derivative(), Geom::dot(), and Geom::roots().

◆ find_normals_by_vector()

template<typename T >
std::vector< double > find_normals_by_vector ( Point  V,
D2< SBasis > const &  A 
)
related

returns all the parameter values of A whose normal is parallel to vector V.

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

References Geom::derivative(), Geom::dot(), and Geom::roots().

◆ find_tangents()

template<typename T >
std::vector< double > find_tangents ( Point  P,
D2< SBasis > const &  A 
)
related

returns all the parameter values of A whose tangent passes through P.

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

References Geom::cross(), Geom::derivative(), and Geom::roots().

◆ find_tangents_by_vector()

template<typename T >
std::vector< double > find_tangents_by_vector ( Point  V,
D2< SBasis > const &  A 
)
related

returns all the parameter values of A whose tangent is parallel to vector V.

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

References Geom::derivative(), Geom::dot(), Geom::roots(), and Geom::rot90().

◆ length()

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

Calculates the length of a 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 484 of file sbasis-geometric.cpp.

References Geom::length_integrating(), and result.

◆ length_integrating()

template<typename T >
void length_integrating ( D2< SBasis > const &  B,
double &  result,
double &  abs_error,
double  tol 
)
related

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

Parameters
Bthe Element.
tolthe maximum error allowed.
resultvariable to be incremented with the length of the path
abs_errorvariable to be incremented with the estimated error

If you only want the length, this routine may be faster/more accurate.

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

References Geom::derivative(), Geom::dot(), result, sb_length_integrating(), and w.

◆ tan2()

template<typename T >
D2< Piecewise< SBasis > > tan2 ( 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 , SBasis

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

References order, and Geom::tan2().

Member Data Documentation

◆ f


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