On 12 Dec 2009, at 22:13, Thomas Weber wrote:

> On Sat, Dec 12, 2009 at 05:22:35PM +0100, Carlo de Falco wrote:
>> Hi,
>>
>>
>> Il giorno Dec 11, 2009, alle ore 11:10 PM, Thomas Weber
>> <[email protected]> ha scritto:
>>
>>> Hi,
>>>
>>> the test suite of nrbnumbasisfun.m fails with Octave 3.2:
>>> octave:1> test nrbnumbasisfun
>>> ***** test
>>> p = 2;
>>> q = 3;
>>> mcp = 2; ncp = 3;
>>> knots = {[zeros(1,p), linspace(0,1,mcp-p+2), ones(1,p)],  
>>> [zeros(1,q),
>>> linspace(0,1,ncp-q+2), ones(1,q)]};
>>> Lx  = 1; Ly  = 1;
>>> [cntl(1,:,:), cntl(2,:,:)] = meshgrid(linspace(0, Lx, ncp+1),
>>> linspace(0, Ly, mcp+1) );
>>> cntl(4,:,:) = 1:numel(cntl(1,:,:));
>>> nrb = nrbmak(cntl, knots);
>>> u = rand (1, 30); v = rand (1, 10);
>>> N = nrbnumbasisfun ({u, v}, nrb);
>>> assert (all(all(N>0)), true)
>>> assert (all(all(N<=(ncp+1)*(mcp+1))), true)
>>> assert (max(max(N)),(ncp+1)*(mcp+1))
>>> assert (min(min(N)),1)
>>> !!!!! test failed
>>> A(I,J,...) = X: dimensions mismatchoctave:2>
>>>
>>> The problem is the line
>>>   cntl(4,:,:) = 1:numel(cntl(1,:,:));
>>> The RHS translates to 12, which doesn't match with the definition of
>>> cntl.
>>
>> I cannot check this myself right now but I believe the offending  
>> line in
>> the test should be changed to:
>>
>>> cntl(4,:,:) = reshape(1:numel(cntl(1,:,:)),size(
>>> cntl(4,:,:));
>>
>> does the test succeed if you make this change?
>
> No. I think there's a misunderstanding about the structure of cntl:
> The output of the meshgrad command gives the following for cntl:
> octave:2> cntl
> cntl =
>
> ans(:,:,1) =
>
>   0.00000   0.00000   0.00000
>   0.00000   0.50000   1.00000
>
> ans(:,:,2) =
>
>   0.33333   0.33333   0.33333
>   0.00000   0.50000   1.00000
>
> ans(:,:,3) =
>
>   0.66667   0.66667   0.66667
>   0.00000   0.50000   1.00000
>
> ans(:,:,4) =
>
>   1.00000   1.00000   1.00000
>   0.00000   0.50000   1.00000
>
> So, the variable should be the last part, not the first. With that and
> your suggestion changed to
>       cntl(:,:,4) = reshape(1:numel(cntl(:,:,4)),size(cntl(:,:,4)));
> the test passes.
>
>       Thomas


No, the way you changed the test works but makes no sense
cntl (i,:,:), represents the i-th component of the control points of a  
2D tensor-product nurbs surface.
the correct line in the test would have been:

cntl(4,:,:) = reshape(1:numel(cntl(1,:,:)),size(cntl(1,:,:));

I don't know why the reshape is required  but was previously not, does  
anybody know how this works in matlab?

anyway I currently see quite a few failing tests in other functions in  
the nurbs package so I am looking into it now and I'll check in an  
update soon.
Thanks for your report!
c.



------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to