#include <SmoothCurve.h>
Public Member Functions | |
SmoothCurve (int dim=3) | |
Constructor. | |
~SmoothCurve () | |
Destructor. | |
int | attach (const boost::shared_ptr< SplineCurve > &incurve, int coef_known[], int numSideConstraints=0) |
Initializes data given by an intermediate curve. | |
void | setOptim (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, double weight) |
Compute matrices for least squares approximation. | |
void | setPeriodicity (int cont, double weight) |
Set periodicity constraints in one par. | |
void | setSideConstraints (std::vector< sideConstraint > &constraints) |
Set linear side constraints (linear equation involving the free coefficients) to the minimization problem. | |
void | equationSolve (boost::shared_ptr< SplineCurve > &curve) |
Solve equation system, and produce output curve. |
In addition, user can set other conditions on things like curve smoothness or periodicity. To use this object, you must first instanciate it, then run the 'attach()' function, the 'setOptim()' function, the 'setLeastSquares()' function and finally the 'equationSolve()' function. Optionally, the functions 'setPeriodicity()' and 'setSideConstraints()' can be run before 'equationSolve()', if the corresponding conditions should be speficied.
Definition at line 83 of file SmoothCurve.h.
Go::SmoothCurve::SmoothCurve | ( | int | dim = 3 |
) |
Constructor.
Initialises the object with a given spatial dimension (default is 3).
dim | dimension of the geometry space. |
int Go::SmoothCurve::attach | ( | const boost::shared_ptr< SplineCurve > & | incurve, | |
int | coef_known[], | |||
int | numSideConstraints = 0 | |||
) |
Initializes data given by an intermediate curve.
incurve | curve defining the initial spline curve. | |
coef_known | array defining the free coefficients. Size equal to the number of coefficients in incurve. Value 0 = not known, value 1 = known. | |
numSideConstraints | the number of linear side constrains for the approximation. |
void Go::SmoothCurve::setOptim | ( | const double | weight1, | |
const double | weight2, | |||
const double | weight3 | |||
) |
Compute the smoothing part of the equation system.
The sum of the weights should lie in the unit interval.
weight1 | weight for smoothing with respect to the 1st derivative. | |
weight2 | weight for smoothing with respect to the 2nd derivative. | |
weight3 | weight for smoothing with respect to the 3rd derivative. |
void Go::SmoothCurve::setLeastSquares | ( | std::vector< double > & | pnts, | |
std::vector< double > & | param_pnts, | |||
std::vector< double > & | pnt_weights, | |||
double | weight | |||
) |
Compute matrices for least squares approximation.
pnts | the input points (for 3D: (x0, y0, z0, x1, y1, z1, ...)) defining the approximation part of the smoothing problem. | |
param_pnts | the parameters for the input pnts. | |
pnt_weights | weight attached to each point to be approximated. Should lie in the unit interval. Typically they are all 1.0. | |
weight | multiplier of all weights in the pnt_weights vector |
void Go::SmoothCurve::setPeriodicity | ( | int | cont, | |
double | weight | |||
) |
Set periodicity constraints in one par.
dir.
cont | the wanted continuity across the seam. | |
weight | weight given to approximative continuity conditions. Should lie inside the unit interval. |
void Go::SmoothCurve::setSideConstraints | ( | std::vector< sideConstraint > & | constraints | ) |
Set linear side constraints (linear equation involving the free coefficients) to the minimization problem.
The problem is solved using the method of Lagrange multipliers.
constraints | the linear side constraints. |
void Go::SmoothCurve::equationSolve | ( | boost::shared_ptr< SplineCurve > & | curve | ) |
Solve equation system, and produce output curve.
curve | the curve resulting from the smoothing process. |