#include <AngleLinearMinimizer.h>
Protected Member Functions |
virtual void | oneStep (unsigned int i1, unsigned int i2) |
Detailed Description
Aim: Used to minimize the angle variation between different angles while taking into accounts min and max constraints. Example (.
Description of class 'AngleLinearMinimizer'
- See also:
- math/testAngleLinearMinimizer.cpp)
Definition at line 68 of file AngleLinearMinimizer.h.
Constructor & Destructor Documentation
DGtal::AngleLinearMinimizer::~AngleLinearMinimizer |
( |
| ) |
|
|
virtual |
DGtal::AngleLinearMinimizer::AngleLinearMinimizer |
( |
| ) |
|
Copy constructor.
- Parameters:
-
other | the object to clone. Forbidden by default. |
Member Function Documentation
std::string DGtal::AngleLinearMinimizer::className |
( |
| ) |
const |
|
inline |
Default drawing style object.
- Returns:
- the dyn. alloc. default style for this object.
-
the style name used for drawing this object.
Definition at line 200 of file AngleLinearMinimizer.ih.
{
return "AngleLinearMinimizer";
}
double DGtal::AngleLinearMinimizer::getEnergy |
( |
unsigned int |
i1, |
|
|
unsigned int |
i2 |
|
) |
| const |
double DGtal::AngleLinearMinimizer::getFormerEnergy |
( |
unsigned int |
i1, |
|
|
unsigned int |
i2 |
|
) |
| const |
std::vector< double > DGtal::AngleLinearMinimizer::getFormerGradient |
( |
| ) |
const |
std::vector< double > DGtal::AngleLinearMinimizer::getGradient |
( |
| ) |
const |
void DGtal::AngleLinearMinimizer::init |
( |
unsigned int |
nbMax | ) |
|
(Re-)initializes the linear minimizer.
- Parameters:
-
nbMax | an upper bound for the number of values to optimize. |
Definition at line 71 of file AngleLinearMinimizer.cpp.
bool DGtal::AngleLinearMinimizer::isValid |
( |
| ) |
const |
Checks the validity/consistency of the object.
- Returns:
- 'true' if the object is valid, 'false' otherwise.
Definition at line 515 of file AngleLinearMinimizer.cpp.
double DGtal::AngleLinearMinimizer::lastDelta |
( |
| ) |
const |
|
virtual |
double DGtal::AngleLinearMinimizer::max |
( |
| ) |
const |
|
inline |
unsigned int DGtal::AngleLinearMinimizer::maxSize |
( |
| ) |
const |
|
inline |
void DGtal::AngleLinearMinimizer::oneStep |
( |
unsigned int |
i1, |
|
|
unsigned int |
i2 |
|
) |
| |
|
protectedvirtual |
The method which performs the optimization effectively. The user may override it. The optimization is performed on values [i1] included to [i2] excluded. Afterwards, the field ValueInfo::value should contain the new value.
- Parameters:
-
i1 | the first value to be optimized (between 0 and 'size()-1'). |
i2 | the value after the last to be optimized (between 0 and 'size()-1'). |
Reimplemented in DGtal::AngleLinearMinimizerByAdaptiveStepGradientDescent, DGtal::AngleLinearMinimizerByGradientDescent, and DGtal::AngleLinearMinimizerByRelaxation.
Definition at line 254 of file AngleLinearMinimizer.cpp.
References DGtal::AngleComputer::cast(), DGtal::AngleComputer::deviation(), DGtal::AngleLinearMinimizer::ValueInfo::distToNext, DGtal::AngleComputer::less(), DGtal::AngleLinearMinimizer::ValueInfo::max, DGtal::AngleLinearMinimizer::ValueInfo::min, DGtal::ModuloComputer< TInteger >::next(), DGtal::AngleLinearMinimizer::ValueInfo::oldValue, DGtal::ModuloComputer< TInteger >::previous(), and DGtal::AngleLinearMinimizer::ValueInfo::value.
{
double mid;
unsigned int i = i1;
unsigned int iprev = mc.previous( i );
do
{
unsigned int inext = mc.next( i );
ValueInfo & vi = this->
rw( i );
{
const ValueInfo & viprev = this->
ro( iprev );
mid = viprev.oldValue;
}
{
const ValueInfo & vinext = this->
ro( inext );
mid = vinext.oldValue;
}
else
{
const ValueInfo & viprev = this->
ro( iprev );
const ValueInfo & vinext = this->
ro( inext );
double valp = viprev.oldValue;
double valn = vinext.oldValue;
mid = ( viprev.distToNext * y )
/ ( vi.distToNext + viprev.distToNext );
}
iprev = i;
i = inext;
}
while ( i != i2 );
}
Assignment.
- Parameters:
-
- Returns:
- a reference on 'this'. Forbidden by default.
double DGtal::AngleLinearMinimizer::optimize |
( |
| ) |
|
Move each value on the straight line joining its neighboring values while maintaining the value between its bounds. The optimization is performed on all values. After preparing datas, calls oneStep, which may be overriden.
- Returns:
- the sum of the displacements.
- See also:
- oneStep
Definition at line 204 of file AngleLinearMinimizer.cpp.
double DGtal::AngleLinearMinimizer::optimize |
( |
unsigned int |
i1, |
|
|
unsigned int |
i2 |
|
) |
| |
void DGtal::AngleLinearMinimizer::reset |
( |
| ) |
|
void DGtal::AngleLinearMinimizer::selfDisplay |
( |
std::ostream & |
aStream | ) |
const |
void DGtal::AngleLinearMinimizer::setIsCurveOpen |
( |
bool |
isCurveOpen = false | ) |
|
|
inline |
Specifies if the curve is open or not.
- Parameters:
-
is_curve_open | when 'true' the curve is open and the last value does not depend on the first one, otherwise the curve is closed and the last value is linked to the first one. |
Definition at line 187 of file AngleLinearMinimizer.ih.
void DGtal::AngleLinearMinimizer::setSize |
( |
unsigned int |
nb | ) |
|
|
inline |
unsigned int DGtal::AngleLinearMinimizer::size |
( |
| ) |
const |
|
inline |
double DGtal::AngleLinearMinimizer::sum |
( |
| ) |
const |
|
inline |
Field Documentation
bool DGtal::AngleLinearMinimizer::myIsCurveOpen |
|
protected |
double DGtal::AngleLinearMinimizer::myMax |
|
private |
unsigned int DGtal::AngleLinearMinimizer::myMaxSize |
|
private |
The size of the array myValues, ie the maximal number of valid values.
Definition at line 323 of file AngleLinearMinimizer.h.
unsigned int DGtal::AngleLinearMinimizer::mySize |
|
protected |
The meaningful size of the array [myValues], ie the number of valid entries.
Definition at line 316 of file AngleLinearMinimizer.h.
double DGtal::AngleLinearMinimizer::mySum |
|
private |
ValueInfo* DGtal::AngleLinearMinimizer::myValues |
|
protected |
The dynamically allocated array of values and the associated constraints.
Definition at line 310 of file AngleLinearMinimizer.h.
The documentation for this class was generated from the following files: