From 05353d79205f1292fe81d26b137a8746dbdc2a3d Mon Sep 17 00:00:00 2001 From: William Pringle Date: Mon, 12 Aug 2019 18:30:20 -0500 Subject: [PATCH] Update dpoly.m putting the in_boubox inside the sum(inside) == 0 directive to avoid error if there is no "inside". --- @meshgen/private/dpoly.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/@meshgen/private/dpoly.m b/@meshgen/private/dpoly.m index f296728b..bb8cb138 100644 --- a/@meshgen/private/dpoly.m +++ b/@meshgen/private/dpoly.m @@ -83,19 +83,20 @@ % in_outer are the points inside the outer meshing domain. % % "in" is defined as the intersection of the in = in_boubox && in_outer - % - % Note: the boubox is pre-pended when forming outer. - firstNaN = find(isnan(outer(:,1)),1,'first') ; - in_boubox = inpoly(p(inside,:),outer(1:firstNaN-1,:)) ; - % Check if the points are inside the meshing domain (omega) - edges = Get_poly_edges( outer ); if sum(inside)~=0 + % Check if the points are inside the meshing domain (omega) + % Note: the boubox is pre-pended when forming outer. + firstNaN = find(isnan(outer(:,1)),1,'first') ; + in_boubox = inpoly(p(inside,:),outer(1:firstNaN-1,:)) ; + % now check if inside the full boundary + edges = Get_poly_edges( outer ); in_outer = inpoly(p(inside,:),outer,edges); if inpoly_flip in_outer = ~in_outer; end else + in_boubox = d_l*0; in_outer = d_l*0; end @@ -106,4 +107,5 @@ d(inside) = d_l; end +% EOF end