Skip to content

Commit

Permalink
Changes to dpoly.m in meshgen
Browse files Browse the repository at this point in the history
Enabling nests to have an arbitrary polygonal extent (instead of a 2x2 bounding box).
  • Loading branch information
keith roberts authored Feb 8, 2019
1 parent bec4881 commit 5f84472
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions @meshgen/private/dpoly.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,24 @@
inpoly_flip = obj.inpoly_flip{box_num};
bbox = obj.bbox{box_num};
if box_num > 1
inside = (p(:,1) >= bbox(1,1) & p(:,1) <= bbox(1,2) & ...
p(:,2) >= bbox(2,1) & p(:,2) <= bbox(2,2) );
pt=obj.boubox{box_num};
ee=Get_poly_edges(pt);
inside = inpoly(p,pt,ee) ;
clearvars pt ee
%inside = (p(:,1) >= bbox(1,1) & p(:,1) <= bbox(1,2) & ...
% p(:,2) >= bbox(2,1) & p(:,2) <= bbox(2,2) );
else
inside = true(size(d));
end
for bn = box_num+1:length(obj.bbox)
% Get all points inside inner boxes
inside2 = (p(:,1) >= obj.bbox{bn}(1,1) & ...
p(:,1) <= obj.bbox{bn}(1,2) & ...
p(:,2) >= obj.bbox{bn}(2,1) & ...
p(:,2) <= obj.bbox{bn}(2,2) );
pt=obj.boubox{bn};
ee=Get_poly_edges(pt);
inside2 = inpoly(p,pt,ee) ;
% inside2 = (p(:,1) >= obj.bbox{bn}(1,1) & ...
% p(:,1) <= obj.bbox{bn}(1,2) & ...
% p(:,2) >= obj.bbox{bn}(2,1) & ...
% p(:,2) <= obj.bbox{bn}(2,2) );
inside(inside2) = false;
end
end
Expand Down

0 comments on commit 5f84472

Please sign in to comment.