REVERSEPOLYGON Reverse a polygon, by iterating vertices from the end. POLY2 = reversePolygon(POLY) POLY2 has same vertices as POLY, but in different order. The first vertex of the polygon is still the same. Example reversePolygon See also polygons2d, reversePolyline ------ Author: David Legland e-mail: david.legland@grignon.inra.fr Created: 2009-06-30, using Matlab 7.7.0.471 (R2008b) Copyright 2009 INRA - Cepia Software Platform.
0001 function rev = reversePolygon(poly) 0002 %REVERSEPOLYGON Reverse a polygon, by iterating vertices from the end. 0003 % 0004 % POLY2 = reversePolygon(POLY) 0005 % POLY2 has same vertices as POLY, but in different order. The first 0006 % vertex of the polygon is still the same. 0007 % 0008 % Example 0009 % reversePolygon 0010 % 0011 % See also 0012 % polygons2d, reversePolyline 0013 % 0014 % ------ 0015 % Author: David Legland 0016 % e-mail: david.legland@grignon.inra.fr 0017 % Created: 2009-06-30, using Matlab 7.7.0.471 (R2008b) 0018 % Copyright 2009 INRA - Cepia Software Platform. 0019 0020 rev = poly([1 end:-1:2], :);