#include <SmoothSurf.h>
Public Member Functions | |
SmoothSurf () | |
Default constructor. Initializes class variable. | |
SmoothSurf (bool copy_coefs) | |
Constructor. | |
virtual | ~SmoothSurf () |
Destructor. | |
void | attach (boost::shared_ptr< SplineSurface > &insf, int seem[], int coef_known[], int num_side_constraints=0, int has_normal_cond=0) |
Initializes data given by an intermediate surface. | |
virtual void | setOptimize (const double weight1, const double weight2, const double weight3) |
Compute the smoothing part of the equation system. | |
void | setLeastSquares (std::vector< double > &pnts, std::vector< double > ¶m_pnts, std::vector< double > &pnt_weights, const double weight) |
Compute matrices for least squares approximation. | |
int | setNormalCond (std::vector< double > &pnts, std::vector< double > ¶m_pnts, std::vector< double > &pnt_weights, const 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. | |
virtual void | setPeriodicity (int pardir, int cont, double weight1, double weight2) |
Set periodicity constraints in one par. | |
void | setSideConstraints (std::vector< sideConstraint > &constraints) |
Add linear side constraints to the system equation. | |
int | equationSolve (boost::shared_ptr< SplineSurface > &surf) |
Solve equation system, and produce output surface. | |
Protected Member Functions | |
virtual void | releaseScratch () |
Free all memory allocated for class members. | |
virtual void | prepareIntegral () |
Prepare storage for integrals of inner products of basis functions. | |
virtual void | getBasis (const double *sb1, const double *sb2, 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. | |
void | preparePeriodicity (int seem[]) |
Set pointers between identical coefficients at a periodic seem. | |
void | setC1AtSeem (int pardir, double weight) |
Set constraints on C1-continuity across a seem and add these to the equation system. | |
void | setC2AtSeem (int pardir, double weight) |
Set constraints on C2-continuity across a seem and add these to the equation system. | |
virtual int | adjustAtSeem () |
Ensure that the expected C1 or C2 continuity at the seem is satisfied. | |
Protected Attributes | |
int | kdim_ |
int | idim_ |
int | idim1_ |
int | ider_ |
bool | integralset_ |
int | cont_seem_ [2] |
int | kncond_ |
int | knconstraint_ |
const int | kpointer_ |
int * | coefknown_ |
std::vector< int > | pivot_ |
boost::shared_ptr< SplineSurface > | srf_ |
int | kk1_ |
int | kk2_ |
int | kn1_ |
int | kn2_ |
std::vector< double >::const_iterator | st1_ |
std::vector< double >::const_iterator | st2_ |
const bool | copy_coefs_ |
std::vector< double > | coef_array_ |
Parameters used to define the specific input spline surface. | |
std::vector< double >::iterator | scoef_ |
std::vector< double > | gmat_ |
Storage of the equation system. | |
std::vector< double > | gright_ |
Definition at line 70 of file SmoothSurf.h.
Go::SmoothSurf::SmoothSurf | ( | bool | copy_coefs | ) |
Constructor.
Initializes class variable.
copy_coefs | true if coefficients on attached surface are not to be modified. |
void Go::SmoothSurf::attach | ( | boost::shared_ptr< SplineSurface > & | insf, | |
int | seem[], | |||
int | coef_known[], | |||
int | num_side_constraints = 0 , |
|||
int | has_normal_cond = 0 | |||
) |
Initializes data given by an intermediate surface.
insf | the initial surface. | |
seem | continuity across opposite edges. 0 not specified, 1 = C0, 2 = C1, 3 = C2. | |
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. | |
num_side_constraints | the number of linear side constraints in the system. | |
has_normal_cond | whether the system must fulfill normal conditions. |
virtual void Go::SmoothSurf::setOptimize | ( | const double | weight1, | |
const double | weight2, | |||
const double | weight3 | |||
) | [virtual] |
Compute the smoothing part of the equation system.
weight1 | contribution weight with respect to the 1st derivative. | |
weight2 | contribution weight with respect to the 2nd derivative. | |
weight3 | contribution weight with respect to the 3rd derivative. |
void Go::SmoothSurf::setLeastSquares | ( | std::vector< double > & | pnts, | |
std::vector< double > & | param_pnts, | |||
std::vector< double > & | pnt_weights, | |||
const double | weight | |||
) |
Compute matrices for least squares approximation.
pnts | points on surface 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::SmoothSurf::setNormalCond | ( | std::vector< double > & | pnts, | |
std::vector< double > & | param_pnts, | |||
std::vector< double > & | pnt_weights, | |||
const 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::SmoothSurf::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. |
virtual void Go::SmoothSurf::setPeriodicity | ( | int | pardir, | |
int | cont, | |||
double | weight1, | |||
double | weight2 | |||
) | [virtual] |
Set periodicity constraints in one par.
dir.
pardir | the direction of the periodicity, 1 == udir && 2 == vdir. | |
cont | the continuity across the seem, 0 = C0, 1 = C1, 2 = C2. | |
weight1 | C1 continuity contribution used in approximation. | |
weight2 | C2 continuity contribution used in approximation. |
void Go::SmoothSurf::setSideConstraints | ( | std::vector< sideConstraint > & | constraints | ) |
Add linear side constraints to the system equation.
constraints | the linear side constraints between surface coefficients. |
int Go::SmoothSurf::equationSolve | ( | boost::shared_ptr< SplineSurface > & | surf | ) |
Solve equation system, and produce output surface.
If failing to solve the routine may throw an exception.
surf | the output surface. |
virtual void Go::SmoothSurf::getBasis | ( | const double * | sb1, | |
const double * | sb2, | |||
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). | |
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. |
void Go::SmoothSurf::preparePeriodicity | ( | int | seem[] | ) | [protected] |
Set pointers between identical coefficients at a periodic seem.
If possible, update fixed coefficients at the seem.
seem | continuity across the seem. Array size = 2. |
virtual int Go::SmoothSurf::adjustAtSeem | ( | ) | [protected, virtual] |
Ensure that the expected C1 or C2 continuity at the seem is satisfied.
Only applicable if seem_[0] > 1 || seem_[1] > 1.