I have two lists of points as follow and they're not fixed.
ptlist1 = {{-3, 3}, {-5, 6}, {-5, 0}, {5, 0}, {5, 5}, {1, 3}, {-3, 3}};
ptlist2 = {{5, 0}, {5, 5}, {-5, 5}, {-5, 0}};
Now I want to find the boundary of the intersection of two mesh regions formed by these lists and then plot it using ListLinePlot.
This is what I have so far.
region1 = MeshRegion[#, Polygon[Range@Length@#]] &@ptlist1;
region2 = MeshRegion[#, Polygon[Range@Length@#]] &@ptlist2;
intsec= RegionIntersection[region1, region2];
intpts = MeshCoordinates[intsec] ;
ListLinePlot[intpts, GridLines -> Automatic]
The problem is that MeshCoordinates
does not generate points in a way that ListLinePlot
uses.
The first and last point are not the same so the plot by ListLinePlot
is not closed.
Also these points may not strictly follow one specific direction such clockwise or counterclockwise so the boundary by ListLinePlot
is not same as boundary of intsec
.
{intsec, ListLinePlot[intpts, GridLines -> Automatic]}