#include <SmoothSurfSet.h>
Public Member Functions | |
SmoothSurfSet () | |
Default constructor. Initializes class variable. | |
SmoothSurfSet (bool copy_coefs) | |
Constructor. | |
virtual | ~SmoothSurfSet () |
Destructor. | |
void | attach (std::vector< boost::shared_ptr< SplineSurface > > &insf, std::vector< std::vector< int > > &coef_known, int num_side_constraints=0, int has_normal_cond=0) |
Initializes data given by an intermediate surface. | |
virtual void | setOptimize (double weight1, double weight2, double weight3) |
Compute the smoothing part of the equation system. | |
void | setLeastSquares (std::vector< std::vector< double > > &pnts, std::vector< std::vector< double > > ¶m_pnts, std::vector< std::vector< double > > &pnt_weights, double weight) |
Compute matrices for least squares approximation. | |
int | setNormalCond (std::vector< std::vector< double > > &pnts, std::vector< std::vector< double > > ¶m_pnts, std::vector< std::vector< double > > &pnt_weights, double weight) |
Compute matrices for approximation of normal directions. | |
void | approxOrig (double weight) |
Compute the contribution to the equation system from the approximation of an original surface, i.e. | |
void | setSideConstraints (std::vector< sideConstraintSet > &constraints) |
Add linear side constraints to the system equation. | |
void | setApproxSideConstraints (std::vector< sideConstraintSet > &constraints, double weight) |
Use least squares to minimize the error given by the constraints. | |
int | equationSolve (std::vector< boost::shared_ptr< SplineSurface > > &surfaces) |
Solve equation system, and produce output surfaces. | |
Protected Member Functions | |
virtual void | getBasis (double *sb1, double *sb2, int kk1, int kk2, int kleft1, int kleft2, int ider, double *sbasis) |
Given the value of non-zero B-spline functions, compute the value of the corresponding surface basis function (i.e. | |
Protected Attributes | |
int | kdim_ |
int | idim_ |
int | idim1_ |
int | ider_ |
int | kncond_ |
int | knconstraint_ |
std::vector< std::vector< int >::iterator > | coef_known_ |
std::vector< std::vector< int > > | pivot_ |
std::vector< boost::shared_ptr< SplineSurface > > | srfs_ |
const int | copy_coefs_ |
std::vector< std::vector< double > > | coef_array_ |
std::vector< double > | gmat_ |
std::vector< double > | gright_ |
Definition at line 66 of file SmoothSurfSet.h.
Go::SmoothSurfSet::SmoothSurfSet | ( | bool | copy_coefs | ) |
Constructor.
Initializes class variable.
copy_coefs | whether to copy coefs in input surface or work directly on them. |
void Go::SmoothSurfSet::attach | ( | std::vector< boost::shared_ptr< SplineSurface > > & | insf, | |
std::vector< std::vector< int > > & | coef_known, | |||
int | num_side_constraints = 0 , |
|||
int | has_normal_cond = 0 | |||
) |
Initializes data given by an intermediate surface.
insf | input set of surfaces to be smoothed. | |
coef_known | whether the coefs are free to be altered. 0: not known, 1: known >= kpointer_ = 3: the coefficients indexed by ki & coef_known[ki] - kpointer_ should be equal. Size of coef_known equal to that of insf, size of coef_known[ki] equals the number of control points in insf[ki]. | |
num_side_constraints | number of side constraints to the minimization problem | |
has_normal_cond | indicates if normal conditions will be given |
virtual void Go::SmoothSurfSet::setOptimize | ( | double | weight1, | |
double | weight2, | |||
double | weight3 | |||
) | [virtual] |
Compute the smoothing part of the equation system.
All weights should be positive, and their sum not exceed 1.0.
weight1 | smoothing weight w.r.t. the 1st derivative. | |
weight2 | smoothing weight w.r.t. the 2nd derivative. | |
weight3 | smoothing weight w.r.t. the 3rd derivative. |
void Go::SmoothSurfSet::setLeastSquares | ( | std::vector< std::vector< double > > & | pnts, | |
std::vector< std::vector< double > > & | param_pnts, | |||
std::vector< std::vector< double > > & | pnt_weights, | |||
double | weight | |||
) |
Compute matrices for least squares approximation.
First index of all vectors corresponds to the indexing of the attached surfaces.
pnts | points on surfaces to be approximated. Stored as (for 3D): (x0, y0, z0, x1, y1, z1, ...) | |
param_pnts | the corresponding 2-dimensional parametric points. Stored as: (u0, v0, u1, v1, ...) | |
pnt_weights | each of the pnts is assigned a weight lying in the unit interval. 1.0 if all pnts are equally important. | |
weight | the contribution of the approximation of the pnts in the system. weight should lie in the unit interval. |
int Go::SmoothSurfSet::setNormalCond | ( | std::vector< std::vector< double > > & | pnts, | |
std::vector< std::vector< double > > & | param_pnts, | |||
std::vector< std::vector< double > > & | pnt_weights, | |||
double | weight | |||
) |
Compute matrices for approximation of normal directions.
pnts | normals in sf to be approximated. Stored as (for 3D): (x0, y0, z0, x1, y1, z1, ...) | |
param_pnts | the corresponding 2-dimensional parametric points. Stored as: (u0, v0, u1, v1, ...) | |
pnt_weights | each of the pnts is assigned a weight lying in the unit interval. 1.0 if all pnts are equally important. | |
weight | the contribution of the approximation of the normals in the system. weight should lie in the unit interval. |
void Go::SmoothSurfSet::approxOrig | ( | double | weight | ) |
Compute the contribution to the equation system from the approximation of an original surface, i.e.
the contribution of the original coefficients.
weight | the relative contribution of the original coefs. Should lie in the unit interval. |
void Go::SmoothSurfSet::setSideConstraints | ( | std::vector< sideConstraintSet > & | constraints | ) |
Add linear side constraints to the system equation.
constraints | the linear side constraints between surface coefficients. |
int Go::SmoothSurfSet::equationSolve | ( | std::vector< boost::shared_ptr< SplineSurface > > & | surfaces | ) |
Solve equation system, and produce output surfaces.
If failing to solve the routine may throw an exception.
surfaces | the output surface. |
virtual void Go::SmoothSurfSet::getBasis | ( | double * | sb1, | |
double * | sb2, | |||
int | kk1, | |||
int | kk2, | |||
int | kleft1, | |||
int | kleft2, | |||
int | ider, | |||
double * | sbasis | |||
) | [protected, virtual] |
Given the value of non-zero B-spline functions, compute the value of the corresponding surface basis function (i.e.
the products of the u and v basis functions).
sb1 | the basis values in the first parameter direction (u). | |
sb2 | the basis values in the second parameter direction (v). | |
kk1 | order in the first (u) direction. | |
kk2 | order in the second (v) direction. | |
kleft1 | index of the first knot interval in u-dir. | |
kleft2 | index of the first knot interval in v-dir. | |
ider | the number of derivatives to compute. | |
sbasis | the computed basis values in sf. size = order_u()*order_v()*(ider + 1)*(ider + 1). The space must be allocated on the outside. |