16 for (
int i=0; i<size; i++){
17 Point noiseDraw(noise*(drand48()-.5),noise*(drand48()-.5));
19 pp.first.x=100.*(drand48()-.5)+200;
20 pp.first.y=10.*(drand48()-.5);
21 pp.second.x=
c*pp.first.x-s*pp.first.y;
22 pp.second.y= s*pp.first.x+
c*pp.first.y;
23 pp.second=pp.second+t+noiseDraw;
32 int main(
int argc,
const char ** argv){
36 cerr <<
"Insert size, t.x, t.y, t.theta" << endl;
37 cin >> size >> t.
x >> t.
y >> t.
theta;
44 cerr <<
"iterate?" << endl;
50 else if (buf[0]!=
char(0))
52 cout <<
"plot '-' w l, '-' w p, '-' w p" << endl;
53 for(PointPairList::iterator it=ppl.begin(); it!=ppl.end(); it++){
54 cout << it->first.x <<
" " << it->first.y<< endl;
55 cout << it->second.x <<
" " << it->second.y<< endl;
59 for(PointPairList::iterator it=ppl.begin(); it!=ppl.end(); it++){
60 cout << it->first.x <<
" " << it->first.y<< endl;
63 for(PointPairList::iterator it=ppl.begin(); it!=ppl.end(); it++){
64 cout << it->second.x <<
" " << it->second.y<< endl;
70 cerr <<
"Nonlinear Optimization" << endl;
73 cerr <<
"Linear Optimization" << endl;
76 cerr <<
"ICP err=" << error <<
" t.x=" << tc.
x <<
" t.y=" << tc.
y <<
" t.theta=" << tc.
theta << endl;
77 cerr <<
"\t" << error <<
" ttot.x=" << ttot.
x <<
" ttot.y=" << ttot.
y <<
" ttot.theta=" << ttot.
theta << endl;
79 for(PointPairList::iterator it=ppl.begin(); it!=ppl.end(); it++){
80 Point p1(
c*it->first.x-s*it->first.y+tc.
x,
81 s*it->first.x+
c*it->first.y+tc.
y);