MATLAB Answers

0

PDETool Dividing up a polygon created by polyshape with an internal boundary

Asked by Heinrich Villinger on 12 Jul 2018
Latest activity Commented on by Heinrich Villinger on 14 Jul 2018

I have a 2D polygon, created with 'polyshape' and would like to separate it with an internal boundary (an irregular open polygon) in two regions which have different material properties. 'Addboundary' does not do the job. I want to use the result in 'triangulation' and 'geometryFromMesh'.

  2 Comments

Can you provide an example showing the problem?

Here is a little bit of code trying to illustrate the problem. The hope was that addboundary cuts my polygon in half so that in the end I have two regions to which I can assign material properties. But it doesn't work that way. Setting the 'simplify' option to false doesn't change anything. Thanks for your help.

% test of addboundary

% vertices of a polygon

x=[0,1,1,0]; y=[0,0,1,1];

%create polygon with polyshape

polygon=polyshape(x,y)

% plot polygon

figure(1),plot(polygon)

% define boundary

xBoundary=[0,0.25,0.5,0.75,1];yBoundary=[0.5,0.25,0.5,0.75,0.5];

% add boundary

polygonWithBoundary=addboundary(polygon,xBoundary,yBoundary)

% plot result of addboundary

% addboundary obviously adds a closed polgon and not a boundary (open polygon)

plot(polygonWithBoundary)

Sign in to comment.

0 Answers