Mastodon

MATLAB Does ‘Some Optimization’ When Drawing Line Vertices, Support Says

While working on the 2nd edition of MDRES we noticed that the number of vertices of the coastline polygon of the GSHHG example described in an earlier post did not have the 28033 vertices as expected from the original data set. The number of vertices, as counted by vector graphics software such as Adobe Illustrator CC 2017 was 14398 instead. This was a surprise and important enough to write this note to the readers of both the MRES and MDRES book.

When I worked on the 1st edition of MDRES more than five years ago exporting EPS files from MATLAB created files with the correct number of vertices. Instead polygons at that time were split into smaller segments, which could be connected with Adobe Illustrator. The most recent release of MATLAB does not seem to split the polygons but reduces the  number of vertices, as it can be seen in coastline_script_and_graphics example.

When I contacted the support, I got the message back, “We do some optimization when drawing line vertices, and reduction in vertices count in generated EPS file is result of that.” Whether you like it or not, I find it important enough to let the readers know that MATLAB reduces the number of vertices when saving EPS files. I personally would prefer to be able to export a postscript file with exactly the right number of vertices from MATLAB.