Inconsistent plotting behavior of polyshapes between R2017b and R2018a
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 25 May 2018
Edited: MathWorks Support Team
on 5 Sep 2018
I am running the code below to plot polyshapes using nsidedpoly in MATLAB R2018a, but I get different behavior when running the program as a whole and executing it section wise.
My reproduction code is as follows:
%%part 1:
figure
pgon = nsidedpoly(6,'radius',1/2);
plot(pgon)
hold on, grid on, axis equal
%%part 2:
ps = pgon.translate(0,1*sqrt(3)/2);
plot(ps)
My findings are:
- Selecting and executing all lines at one time by pressing F9 results in the correct coloring
- Selecting and evaluating the two parts one after another results in wrong coloring (the second polyshape is transparent, the second color is overlaying the first polyshape).
Accepted Answer
MathWorks Support Team
on 5 Sep 2018
Edited: MathWorks Support Team
on 5 Sep 2018
This unexpected behavior occurs due to a bug within the triangulation method of polyshape in MATLAB R2018a. This problem has been fixed in MATLAB R2018b and is also not present in MATLAB R2017b or before.
0 Comments
More Answers (0)
See Also
Categories
Find more on Elementary Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!