Inconsistent plotting behavior of polyshapes between R2017b and R2018a

3 vues (au cours des 30 derniers jours)
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:
  1. Selecting and executing all lines at one time by pressing F9 results in the correct coloring
  2. 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).

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 5 Sep 2018
Modifié(e) : MathWorks Support Team le 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.

Plus de réponses (0)

Catégories

En savoir plus sur Elementary Polygons dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by