As others have pointed out, the compute_curvature function results in an index out of bounds error in some cases. So far, my untested and kind of random 'fix' was to comment out the code
%normal = normal'; (line 72) and
insert it again as
normal = normal'; (at line 146, after compute_normal()).
This seems to avoid the out of index error BUT I have no idea if it a right thing to do otherwise.
Some support from Gabriel, would be highly appreciated.
Thanks a lot for your efforts
(on line 75 "dp = sum( normal(:,E(:,1)) .* normal(:,E(:,2)), 1 );")