12 template <
typename Po
intPairContainer>
14 typedef typename PointPairContainer::const_iterator ContainerIterator;
17 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
18 mean.first=mean.first+it->first;
19 mean.second=mean.second+it->second;
22 mean.first=mean.first*(1./size);
23 mean.second=mean.second*(1./size);
24 double sxx=0, sxy=0, syx=0, syy=0;
26 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
27 PointPair mf=std::make_pair(it->first-mean.first, it->second-mean.second);
28 sxx+=mf.first.x*mf.second.x;
29 sxy+=mf.first.x*mf.second.y;
30 syx+=mf.first.y*mf.second.x;
31 syy+=mf.first.y*mf.second.y;
33 retval.
theta=atan2(sxy-syx, sxx+sxy);
35 retval.
x=mean.second.x-(
c*mean.first.x-s*mean.first.y);
36 retval.
y=mean.second.y-(s*mean.first.x+
c*mean.first.y);
39 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
41 c*it->first.x-s*it->first.y+retval.
x-it->second.x, s*it->first.x+
c*it->first.y+retval.
y-it->second.y);
47 template <
typename Po
intPairContainer>
49 typedef typename PointPairContainer::const_iterator ContainerIterator;
52 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
53 mean.first=mean.first+it->first;
54 mean.second=mean.second+it->second;
58 mean.first=mean.first*(1./size);
59 mean.second=mean.second*(1./size);
62 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
63 PointPair mf=std::make_pair(it->first-mean.first, it->second-mean.second);
64 double dalpha=atan2(mf.second.y, mf.second.x) - atan2(mf.first.y, mf.first.x);
65 double gain=sqrt(mean.first*mean.first);
69 retval.
theta=atan2(ms, mc);
71 retval.
x=mean.second.x-(
c*mean.first.x-s*mean.first.y);
72 retval.
y=mean.second.y-(s*mean.first.x+
c*mean.first.y);
75 for (ContainerIterator it=container.begin(); it!=container.end(); it++){
77 c*it->first.x-s*it->first.y+retval.
x-it->second.x, s*it->first.x+
c*it->first.y+retval.
y-it->second.y);