[Pkg-octave-devel] Bug in shapecentroid [was: Status of the Octave-Forge packages in Debian]

Juan Pablo Carbajal carbajal at ifi.uzh.ch
Wed Mar 21 15:01:04 UTC 2012


On Wed, Mar 21, 2012 at 2:43 PM, Rafael Laboissiere
<rafael at laboissiere.net> wrote:
> * Rafael Laboissiere <rafael at laboissiere.net> [2012-03-18 20:16]:
>
>> 3) The test of shapetransform fails:
>>
>>      ==============================================================
>>       ***** test
>>      v = shapecentroid (shape)(:);
>>      nshape = shapetransform (shape, -v);
>>      vn = shapecentroid (nshape)(:);
>>      assert(vn,[0; 0],1e-2);
>>      !!!!! test failed
>>      assert (vn,[0; 0],1e-2) expected
>>        0
>>        0
>>      but got
>>        -682.75
>>        -528.18
>>      maximum absolute error 682.753 exceeds tolerance 0.01
>>      ==============================================================
>
> I tracked down the problem and discovered that it comes from the
> shapecentroid function, which seems to compute the wrong centroid in some
> cases. Here is an example, with the following shape taken from the test
> section of file shapetransform.m:
>
> ############################################################
> shape = {[-93.172   606.368  -476.054   291.429;
>          -431.196   637.253    11.085   163.791];
>         [-75.3626  -253.2337   457.1678   328.5714;
>          438.7659  -653.6278    -7.9953   380.9336];
>         [-89.5841   344.9716  -275.3876   457.1429;
>          -170.3613   237.8858     1.0469   158.0765];...
>         [32.900  -298.704   145.804   437.143;
>         -243.903   369.597   -34.265   226.648];
>         [-99.081   409.127  -352.903   317.143;
>           55.289  -114.223   -26.781   318.076];
>         [-342.231   191.266   168.108   274.286;
>           58.870   -38.083   -89.358   232.362]};
> ############################################################
>
> Using "shapeplot(shape)", I can clearly see that the centroid for this
> shape is situated around x = 340 and y = 260.  However, shapecentroid
> gives the following:
>
> ############################################################
> octave> shapecentroid(shape)
> ans =
>
>  -341.38  -264.10
> ############################################################
>
> The values are negated.
>
> Any clues?
>
> Rafael
>
> _______________________________________________
> Pkg-octave-devel mailing list
> Pkg-octave-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-octave-devel

Hi Rafael,

Thanks, yes this is a known bug. It should be marked in the NEWS
function of the package.
I am working on it.

Cheers,


-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/



More information about the Pkg-octave-devel mailing list