G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsCurvatureSmoothing< T > Class Template Reference

Detailed Description

template<class T>
class gismo::gsCurvatureSmoothing< T >

Class for computing a closed B-spline curve with a smaller number of curvature extrema compared to a given closed B-spline curve.

i.e. some kind of smoothing the curvature of the curve with the help of two different methods

+ Collaboration diagram for gsCurvatureSmoothing< T >:

Public Member Functions

void computeApproxError (T &error)
 computes approximation error of the smoother curve to the original point cloud
 
void computeApproxErrorCoef (T &error)
 computes the max approximation error between the coeffeicientsof the original and the smoother curve
 
void computeApproxErrorL2 (T &error)
 computes the L^{2}-norm approximation error of the smoother curve
 
void computeApproxErrorLMax (T &error)
 computes the L-max-norm approximation error of the smoother curve
 
void computeCurvatureError (T &error)
 computes the curvature error of the smoother curve
 
const gsBSpline< T > & curveOriginal () const
 gives back the original B-spline curve
 
const gsBSpline< T > & curveSmooth () const
 gives back the smoother B-spline curve
 
 gsCurvatureSmoothing ()
 default constructor
 
 gsCurvatureSmoothing (const gsBSpline< T > &init_curve, const gsMatrix< T > &param_values, const gsMatrix< T > &points)
 constructor
 
void smoothAllHadenfeld (const unsigned smooth_degree=4, const unsigned iter=500)
 
void smoothHadenfeld (const unsigned smooth_degree, const T delta, const index_t iter_step, const index_t iter_total, gsVector< index_t > &iterated, const bool original=true)
 smooth the curve by smoothing only one cofficient in each step using the Hadenfeld algorithm — the usual Hadenfeld algorithm –this method should be used
 
void smoothTotalVariation (const T omega1, const T omega2, const T lamda, const T tau, const unsigned iter=50)
 
void smoothTotalVariationSelectLamda (const T omega1, const T omega2, const gsMatrix< T > listlamdas, const unsigned iter=50)
 
void smoothTotalVariationSelectLamda (const T omega1, const T omega2, const T lamda, const unsigned iter=50)
 
void write (std::ostream &os)
 writes the smooth curve to a file, which can be visualized in Mathematica (Name of Mathematica File VisualizationCurvatureSmoothing)
 
 ~gsCurvatureSmoothing ()
 Destructor.
 

Private Member Functions

void compute_AllValues (gsBSplineBasis< T > *basis, gsMatrix< T > u, gsMatrix< T > *coefs, gsMatrix< T > &values0, gsMatrix< T > &values1, gsMatrix< T > &values2, gsMatrix< T > &values3)
 computes all values and derivatives (up to three) at the parameter values u for the given coefs
 
void compute_ObjectiveFunction (gsBSplineBasis< T > *basis, gsMatrix< T > *coefs, const T omega1, const T omega2, T &value)
 computes the objective function for given coefs and omega1 and omega2 – objective function = omega1*ApproximationFunction + omega2*CurvatureFunction
 
void reset (gsBSpline< T > *newCurve)
 set the smooth curve to the the original curve
 

Private Attributes

const gsBSpline< T > * m_curve_original
 the original B-spline curve
 
gsBSpline< T > * m_curve_smooth
 the smoother B-spline curve
 
gsMatrix< T > m_param_values
 the parameter values of the original point cloud
 
gsMatrix< T > m_points
 the points of the original point cloud
 

Member Function Documentation

void smoothAllHadenfeld ( const unsigned  smooth_degree = 4,
const unsigned  iter = 500 
)

smooth the curve in one step for all coefficients using the Hadenfeld algorithm. Be aware of the fact that it is not ensured that we get a nice result — can work but do not have to work (not sure that it will converge!!) if possible use method void smoothHadenfeld

void smoothTotalVariation ( const T  omega1,
const T  omega2,
const T  lamda,
const T  tau,
const unsigned  iter = 50 
)

smooth the curve by total variation – computes the stepsize by itsself (with the help of a backtracking line search method) this method should be used instead of the two methods void smoothTotalVariationSelectLamda

void smoothTotalVariationSelectLamda ( const T  omega1,
const T  omega2,
const gsMatrix< T >  listlamdas,
const unsigned  iter = 50 
)

smooth the curve by total variation – uses different stepsizes (in listlamdas) in the gradient descent method (look for the best from the list!) if possible use the method void smoothTotalVariation

void smoothTotalVariationSelectLamda ( const T  omega1,
const T  omega2,
const T  lamda,
const unsigned  iter = 50 
)

smooth the curve by total variation – uses always the same stepsize lamda - but which has to be chosen!! if possible use the method void smoothTotalVariation