Institut de Robòtica i Informàtica Industrial

pi2pi

PURPOSE ^

Forces an angular interval to be in [-pi,pi].

SYNOPSIS ^

function Iout=pi2pi(I)

DESCRIPTION ^

 Forces an angular interval to be in [-pi,pi].

 Adjusts an angular interval so that it is included in [-pi,pi].

 We shift the interval by +/-2 pi keeping the result that maximizes the
 intersection with [-pi,pi].

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Iout=pi2pi(I)
0002 % Forces an angular interval to be in [-pi,pi].
0003 %
0004 % Adjusts an angular interval so that it is included in [-pi,pi].
0005 %
0006 % We shift the interval by +/-2 pi keeping the result that maximizes the
0007 % intersection with [-pi,pi].
0008 
0009   dp=2*pi;
0010   
0011   pp=Interval(-pi,pi);
0012   Icn=Intersection(I,pp);
0013   Iup=Intersection(I+dp,pp);
0014   Ilo=Intersection(I-dp,pp);
0015   
0016   if Diameter(Iup)>Diameter(Icn)
0017     Iout=Iup;
0018   else
0019     if Diameter(Ilo)>Diameter(Icn)
0020       Iout=Ilo;
0021     else
0022       Iout=I;
0023     end
0024   end
0025


Institut de Robòtica i Informàtica Industrial

Generated on Fri 24-Jul-2009 12:32:50 by m2html © 2003