This is to my knowledge the best function to use if you hatch patches need to have 'holes' in them (e.g. a torus-shaped hatch patch). Works on R2014a.
When I plotted complex hatch plots, there would be dotted lines running across different hatch patches. This is fixed by inserting the following code immediately after the "Organize to pairs and separate by NaN's" block:
% Remove point line segments (i.e. segment of the form (a,b) to (a,b)
i_same = find(diff(xi)<eps('single')); % find the first index of each point
i_remove = repmat(i_same,[3 1]) + repmat((0:2)',[1 length(i_same)]);
xi(i_remove) = ;
yi(i_remove) = ;
This amendment removes hatch lines shorter than 1E-7 unit long (essentially what those dotted lines are).