diff --git a/README.md b/README.md index 3febf282..2257266c 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Unreleased +## Fixed +- Boundary labeling fix ### [3.3.0] - 2020-12-21 ## Fixed diff --git a/utilities/extract_boundary.m b/utilities/extract_boundary.m index 0b73441a..00820c03 100644 --- a/utilities/extract_boundary.m +++ b/utilities/extract_boundary.m @@ -65,6 +65,12 @@ temp = pts(bnde(r,:)',:); temp2 = bnde(r,:)'; + if v_next ~= temp2(2) + % swap + temp = flipud(temp); + temp2 = flipud(temp2); + end + k = 2; while v_next~=v_end % terminates when we reach v_end rt= (v_next==bnde(:,1) | v_next==bnde(:,2)) & active; @@ -83,6 +89,9 @@ % exhausted all edges and couldn't connect if(~any(active)), cut=false; disp('coudln''t conntect'); break, end end + if length(temp) == 2 + cut = false; + end poly{p} = temp; poly_idx{p} = temp2; [area] = parea(poly{p}(:,1),poly{p}(:,2));