Home > matGeom > polygons2d > steinerPolygon.m

steinerPolygon

PURPOSE ^

STEINERPOLYGON Create a Steiner polygon from a set of vectors.

SYNOPSIS ^

function nodes = steinerPolygon(points)

DESCRIPTION ^

STEINERPOLYGON Create a Steiner polygon from a set of vectors.

   NODES = steinerPolygon(VECTORS);
   Builds the (convex) polygon which contains an edge for each one of the
   vectors given by VECTORS.

   Example
   n = steinerPolygon([1 0;0 1;1 1]);
   drawPolygon(n);

   See also
   polygons2d, drawPolygon

 ------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 Created: 2006-04-28
 Copyright 2006 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nodes = steinerPolygon(points)
0002 %STEINERPOLYGON Create a Steiner polygon from a set of vectors.
0003 %
0004 %   NODES = steinerPolygon(VECTORS);
0005 %   Builds the (convex) polygon which contains an edge for each one of the
0006 %   vectors given by VECTORS.
0007 %
0008 %   Example
0009 %   n = steinerPolygon([1 0;0 1;1 1]);
0010 %   drawPolygon(n);
0011 %
0012 %   See also
0013 %   polygons2d, drawPolygon
0014 %
0015 % ------
0016 % Author: David Legland
0017 % e-mail: david.legland@grignon.inra.fr
0018 % Created: 2006-04-28
0019 % Copyright 2006 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas).
0020 
0021 nodes = [0 0];
0022 for i=1:length(points)
0023     nodes = [nodes; nodes+repmat(points(i,:), [size(nodes, 1) 1])]; %#ok<AGROW>
0024 end
0025 
0026 K = convhull(nodes(:,1), nodes(:,2));
0027 nodes = nodes(K, :);
0028

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019