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

Detailed Description

template<class T>
class gismo::gsFitting< T >

Class for performing a least squares fit of a parametrized point cloud with a gsGeometry.

+ Inheritance diagram for gsFitting< T >:
+ Collaboration diagram for gsFitting< T >:

Public Member Functions

void applySmoothing (T lambda, gsSparseMatrix< T > &A_mat)
 
void assembleSystem (gsSparseMatrix< T > &A_mat, gsMatrix< T > &B)
 Assembles system for the least square fit.
 
void compute (T lambda=0)
 Computes the least squares fit for a gsBasis.
 
void computeApproxError (T &error, int type=0) const
 Computes the approximation error of the fitted curve to the original point cloud.
 
void computeErrors ()
 Computes the euclidean error for each point.
 
void computeMaxNormErrors ()
 Computes the maximum norm error for each point.
 
void get_Error (std::vector< T > &errors, int type=0) const
 return the errors for each point
 
const gsBasis< T > & getBasis () const
 Returns the basis of the approximation.
 
gsMatrix< T > & getreturnParamValues ()
 returns the parameter values
 
 gsFitting ()
 default constructor
 
 gsFitting (gsMatrix< T > const &param_values, gsMatrix< T > const &points, gsBasis< T > &basis)
 constructor
 
 gsFitting (gsMatrix< T > const &param_values, gsMatrix< T > const &points, gsVector< index_t > offset, gsMappedBasis< 2, T > &mbasis)
 constructor
 
void iterativeCompute (T const &tolerance, unsigned const &num_iters=10)
 Computes the least squares fit for a gsBasis.
 
maxPointError () const
 Returns the maximum point-wise error from the pount cloud (or zero if not fitted)
 
minPointError () const
 Returns the minimum point-wise error from the pount cloud (or zero if not fitted)
 
const gsMappedSpline< 2, T > & mresult () const
 gives back the computed approximation for multipatch geometry
 
size_t numPointsBelow (T threshold) const
 Computes the number of points below the error threshold (or zero if not fitted)
 
const std::vector< T > & pointWiseErrors () const
 Return the errors for each point.
 
gsGeometry< T > * result () const
 gives back the computed approximation
 
gsMatrix< T > returnPoints () const
 returns the points
 
void setConstraints (const gsSparseMatrix< T > &lhs, const gsMatrix< T > &rhs)
 
void setConstraints (const std::vector< index_t > &indices, const std::vector< gsMatrix< T > > &coefs)
 
void setConstraints (const std::vector< boxSide > &fixedSides)
 
void setConstraints (const std::vector< boxSide > &fixedSides, const std::vector< gsBSpline< T > > &fixedCurves)
 
virtual ~gsFitting ()
 Destructor.
 

Protected Attributes

gsFunctionSet< T > * m_basis
 Pointer keeping the basis.
 
gsSparseMatrix< T > m_constraintsLHS
 
gsMatrix< T > m_constraintsRHS
 
m_max_error
 Maximum point-wise error.
 
m_min_error
 Minimum point-wise error.
 
gsMappedSpline< 2, T > m_mresult
 Pointer keeping the resulting multipatch geometry.
 
gsMatrix< T > m_param_values
 the parameter values of the point cloud
 
gsMatrix< T > m_points
 the points of the point cloud
 
gsGeometry< T > * m_result
 Pointer keeping the resulting geometry.
 

Private Member Functions

void extendSystem (gsSparseMatrix< T > &A_mat, gsMatrix< T > &m_B)
 Extends the system of equations by taking constraints into account.
 

Member Function Documentation

void applySmoothing ( lambda,
gsSparseMatrix< T > &  A_mat 
)

Adds to the matrix A_mat terms for minimization of second derivative, weighted with parameter lambda.

void setConstraints ( const gsSparseMatrix< T > &  lhs,
const gsMatrix< T > &  rhs 
)
inline

Sets constraints that the coefficients of the resulting geometry have to conform to. More precisely, denoting the coefficient vector by x, it enforces lhs * x = rhs.

void setConstraints ( const std::vector< index_t > &  indices,
const std::vector< gsMatrix< T > > &  coefs 
)

Sets constraints on that the coefficients of the resulting geometry have to conform to.

Parameters
indicesindices (in the coefficient vector) of the prescribed coefficients.
coefsprescribed coefficients.
void setConstraints ( const std::vector< boxSide > &  fixedSides)

Sets constraints in such a way that the previous values at fixedSides of the geometry remain intact.

void setConstraints ( const std::vector< boxSide > &  fixedSides,
const std::vector< gsBSpline< T > > &  fixedCurves 
)

Set constraints in such a way that the resulting geometry on each of fixedSides will coincide with the corresponding curve in fixedCurves.

Member Data Documentation

gsSparseMatrix<T> m_constraintsLHS
protected

Left hand-side of the constraints that the coefficients of the resulting geometry have to conform to. This corresponds to matrix D in Prautzch, Boehm, Paluszny: Bezier and B-spline techniques, Section 4.7.

gsMatrix<T> m_constraintsRHS
protected

Right hand-side of the constraints that the coefficients of the resulting geometry have to conform to. This corresponds to vector q in Prautzch, Boehm, Paluszny: Bezier and B-spline techniques, Section 4.7.