MATLAB Answers

Union() operation adds hole to polyshape

5 views (last 30 days)
Matt J
Matt J on 17 Apr 2020
Answered: Matt J on 1 Jun 2020
I have attached a file containing a vector of 11 polyshape objects
>> load('polyshape_vector.mat')
>> whos pgon
Name Size Bytes Class Attributes
pgon 1x11 3080 polyshape
When these polyshapes are plotted, they form an agglomeration of triangles which, to the eye at least, has 2 holes
>> plot(pgon)
However, when I plot the union of this polyshape vector, a 3rd hole forms (this is in R2018a). It defies my intuition that taking the union of a collection of polygons could introduce more holes. Can anyone think why this might occur?
>> plot(union(pgon))

  5 Comments

Show 2 older comments
Matt J
Matt J on 17 Apr 2020
@Walter,
I was also wondering about whether ordering of the vertices mattered in some way, but no, all the vertices are in clockwise order for all the polygons.
Jyotsna Talluri
Jyotsna Talluri on 24 Apr 2020
Seems to be a bug.I have brought this to the notice of our developers.They will look into it and investigate further

Sign in to comment.

More Answers (0)


Translated by