gibbonCode / GIBBON

The Geometry and Image-Based Bioengineering add-On for MATLAB
http://gibboncode.org/
GNU Affero General Public License v3.0
191 stars 60 forks source link

Fixed variable assignment. #153

Closed a-quinn closed 1 year ago

a-quinn commented 1 year ago

There's a typo, only found it when reviewing my own code.

Only location I found where it may affect a repo example is: https://github.com/gibbonCode/GIBBON/blob/4847c302e621e8b047148832c3b891cde9339224/docs/WIP_DEMO_febio_00XX_fsi_bifurcation.m#L272

The second commit is a fix for using MATLAB contour() in version 2018a and later. Maybe in older versions it did work.

Kevin-Mattheus-Moerman commented 1 year ago

@a-quinn thanks for your contribution. I checked and this all looks good. The function surfacePairIntersect you worked on is quite old and definitely needed updating. It uses the contour command which usually triggers graphics (computes as well as visualises the contours), I then suppress/hide the visualisation and "harvest" the computed contours from it, then close/delete the visualisation. You have now successfully fixed this for the newer MATLAB versions (where the graphics "children" are not there/different), and I think the fix should also still work for older MATLAB version. I'll approve and merge this pull request now but I want to point out that the more efficient way of using contours is what I do in the GIBBON function gcontour. That code uses the "hidden" or undocumented MATLAB function contourc which omits the graphics and just computes the contours only. However it seems, when I tested it just now, that contourc is a bit more sensitive to the data being of the structured meshgrid type (constant spacings in X and Y directions), and the contour command might cope with it better. So I'll accept your implementation for now but in the future a solution that omits the ugly graphics business would be preferred.

Thanks again for your help! Note that I'd be happy to list you as a contributor on the website too if you like. Email me on kevin.moerman@universityofgalway.ie if you'd like this and we can chat about that.