petercorke / spatialmath-matlab

Create, manipulate and convert representations of position and orientation in 2D or 3D using Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`trnorm` performance warnings

serges147 opened this issue · comments

There are two issuses:

  1. No preallocation:
    if ndims(T) == 3
        % recurse for transform sequence
        nd = size(T, 3);
        r = zeros(4,4,nd);
        for i=1:nd
            TR(:,:,i) = trnorm(T(:,:,i));
        end
        return
    end

TR is not preallocated as it intended to be (by previous r = zeros(4,4,nd);).

  1. Value unused (n at line 63):
    n = T(1:3,1); o = T(1:3,2); a = T(1:3,3);
    n = cross(o, a);         % N = O x A

Thanks for pointing this out, now fixed. Sadly, there is a long list of performance warnings that need attending to. Help and pull requests needed.