32#include "DGtal/base/Common.h"
33#include "DGtal/math/AngleLinearMinimizer.h"
34#include "DGtal/io/boards/Board2D.h"
49 unsigned int nbok = 0;
57 double valDec [10] = {0.8, 0.3, -0.2, -0.2, -0.1, -0.3, -3.0, -6.0, -7.0, -8.0};
58 double valDecMin [10] = {-0.5, -0.2, -0.5, -0.2, -0.1, -1.0, -1.2, -0.5, -0.3, -0.2};
59 double valDecMax [10] = {0.9, 0.3, 0.2, 1.2, 0.4, 1.0, 0.5, 0.2, 0.1, 0.3};
61 for(
unsigned int i=0; i<10; i++){
63 double val = i + valDec[i];
66 vi.
min = val + valDecMin[i];
67 vi.
max = val + valDecMax[i];
73 double aPrecision=0.00001;
74 while(delta >aPrecision){
76 cerr <<
"sum of displacements " << delta << endl;
79 cout <<
"# index distPos valInit valOpt valMin valMax " << endl;
80 double currentPos=0.0;
81 cout << -1 <<
" "<< -4 <<
" " << 9+valDec[9] <<
" " << alm.
ro(9).
value
82 <<
" " << alm.
ro(9).
min <<
" " << alm.
ro(9).
max << endl ;
84 for(
unsigned int i=0; i<10; i++){
86 cout << i <<
" "<< currentPos <<
" " << i+ valDec[i] <<
" " << vi.
value
87 <<
" " << vi.
min <<
" " << vi.
max << endl ;
90 nbok += (abs(1.59999-alm.
ro(0).
value)<0.00001) && (abs(1.6-alm.
ro(1).
value)<0.00001) ? 1 : 0;
92 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
93 <<
"true == true" << std::endl;
108int main(
int argc,
char** argv )
112 for (
int i = 0; i < argc; ++i )
117 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Used to minimize the angle variation between different angles while taking into accounts min and...
ValueInfo & rw(unsigned int i)
void setIsCurveOpen(bool is_curve_open=false)
void init(unsigned int nbMax)
const ValueInfo & ro(unsigned int i) const
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
void beginBlock(const std::string &keyword="")
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
bool testAngleLinearMinimizer()